ファイルからこのコード行を削除するだけで、ロードを無効にすることができます。
この js ファイルを問題なくロードできます。これがコードです。
/** Bind for this object Function **/
if( typeof Function.prototype.bind != 'function' ){
Function.prototype.bind = function (bind) {
var self = this;
return function () {
var args = Array.prototype.slice.call(arguments);
return self.apply(bind || null, args);
};
};
}
/******************************** ver. 0.1F8.731 Cortica Default Object ********************************************************/
var CorticaDO = {
version : 073,
height : 210,
width : 190,
bannerType : 15,
publisherId : 10048,
dataUrl : "http://srv.overlay-ad.com:8080/adserver/Server",
dotClickUrl : "http://srv.overlay-ad.com:8080/adserver/inimageclick",
requestId : '',
fontfamily : "arial,helvetica,sans-serif",
textsize : 10,
opacity : 9,// from 1 to 10
floaters : [],
scanedImages : [],
fzindex : 999998, // 999998
rescanParamExt : "",
rescan : 0,
REC : 0,
debugMode : true,
doRescan : false,
onReload : false,
/** Object Common Functions *********************************************************/
/** Detect Parameters **/
getParameterByName : function(identifier,name) {
var scripts = document.getElementsByTagName('script') ,i , curScript;
for (i = 0; i < scripts.length; ++i)
{
curScript = scripts[i];
if (curScript.src.match(identifier))
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec((curScript.src.match(/\?.*/) || [undefined])[0]);
if(results == null)
{return "";}
else{return decodeURIComponent(results[1].replace(/\+/g, " "));}
}
}
return ;
},
/** Decode URL ***/
urlDecode : function(psEncodeString){
var lsRegExp = /\+/g; /* Create a regular expression to search all +s in the string */
return unescape(String(psEncodeString).replace(lsRegExp, " ")); /* Return the decoded string */
},
/** Count Object Properties **///////
countProperties : function(obj){
var count = 0;
for(var prop in obj){if(obj.hasOwnProperty(prop)){++count;}}
return count;
},
/** Debug Mode ***/
consoleOut : function(msg){if(this.debugMode && typeof console != 'undefined' && typeof console.log === 'function'){console.log(msg);}},
/******************************** Images Detection ************************************************************************************/
/** Check Image ***/
checkImageParam : function(obj){
if(obj.height > this.height && obj.width > this.width)
{return true;}
else{return false;}
},
/** Get Visible Images ***/
getAllVisibleImages : function(){
var images = document.getElementsByTagName('img'),
i,
tmpFloater = null,
newImages = [];
/* Preset Floaters */
for(i=0; i < CorticaDO.floaters.length; i++)
{CorticaDO.floaters[i].visible = false;}
/* Over Images */
if(typeof images != 'undefined')
{
for( var s in images)
{
if(CorticaDO.checkImageParam(images[s]) && CorticaDO.isVisible( images[s]))
{
var found = false;
/* Detect Object exist */
if( CorticaDO.floaters.length > 0)
{
for(i = 0; i < CorticaDO.floaters.length; i++){
if( CorticaDO.floaters[i].isObj(images[s]))
{
CorticaDO.floaters[i].visible = true; /* Object detected and must be visible */
found = true;
break;
}
}
}
/* New Object Add */
if( !found)
{
tmpFloater = new corticaFDOC();
tmpFloater.src = images[s].src;
tmpFloater.obj = images[s];
tmpFloater.visible = true;
tmpFloater.index = CorticaDO.floaters.length;
CorticaDO.floaters.push( tmpFloater );
/* New Images Array for Request to AdServer */
this.scanedImages.push({src:images[s].src,obj:images[s],index:tmpFloater.index});
newImages.push( tmpFloater );
}
}
}
if(newImages.length > 0)
{
this.getImageList(newImages);
this.sendScanedData();
}
/* Show/Hide Floaters */
if( CorticaDO.floaters.length > 0)
{
for(i=0;i< CorticaDO.floaters.length;i++)
{CorticaDO.floaters[i].setVisibility();}
}
}
},
/** Check Image Visibility ***/
isVisible : function(element){
if( element.offsetWidth === 0 || element.offsetHeight === 0)
{return false;}
// Resolution for IE 9/8 quirk/compatible mode
var rects = element.getClientRects(),height,r,in_viewport;
if('innerWidth' in window)
{height = document.documentElement.clientHeight}
else{height = document.body.clientHeight;}
for( var i = 0, l = rects.length; i < l; i++)
{
r = rects[i];
in_viewport = parseInt( r.top) > 0 ? parseInt( r.top) <= height : ( parseInt( r.bottom) > 0 && parseInt( r.bottom) <= height );
if( in_viewport && CorticaDO.isElementOnTop( r, element))
{return true;}
}
return false;
},
/** Is view Point on Element **/
isElementOnTop : function( r, element){
var x = parseInt(( r.left + r.right)/2),
y = parseInt(( r.bottom + r.top)/2);
var el = document.elementFromPoint( x, y);
if( typeof el == 'undefined' || el == null)
{return false}
return (el === element);
},
/** Preset Image and Data Image Functions **/ /** tu - tag url,ts - tag size, ta - tag alt, tt - tag title **/
getImageList : function(list){
var lsRegExp = /\+/g,
tu = "",ts = "&sizes=",ta = "&alts=",tt = "&titles=";
for(var img=0;img<list.length;img++)
{
var tiUrl = escape(list[img].src);
tiUrl = tiUrl.replace(lsRegExp, encodeURIComponent('+'));
tu += tiUrl + "|";
ts += list[img].obj.width + "x" + list[img].obj.height + "|";
var alt = list[img].obj.getAttribute('alt');
var title = list[img].obj.getAttribute('title');
if(typeof alt == 'string')
{ta += escape(alt.replace (/\|/g, " ")) + "|";}
else{ta += "|";}
if(typeof title == 'string')
{tt += escape(title.replace (/\|/g, " ")) + "|";}
else{tt += "|";}
}
this.rescanParamExt = tu+ts+ta+tt+"&rescan="+this.rescan+"&requesId="+this.requestId;
},
/******************************************************************************************************************************/
/** Start Main Flow **/
corticaScan : function(){
if(CorticaDO.onRescan || CorticaDO.onReload){return;}
CorticaDO.onRescan = true;
CorticaDO.getAllVisibleImages();
CorticaDO.onRescan = false;
},
/** Common Start Flows Function **/
applyCortica : function(data,reqID){
CorticaDO.onReload = true;
this.requestId = reqID;
var dataCount = this.countProperties(data),found,i;
if(dataCount > 0)
{
for(var img = 0;img < dataCount;img++)
{
var src = unescape(data[img].imageUrl);
for( var p in this.scanedImages)
{
found = false;
for(i=0;i < CorticaDO.floaters.length;i++)
{
if( CorticaDO.floaters[i].src == src && CorticaDO.floaters[i].floater == null && this.scanedImages[p].index == CorticaDO.floaters[i].index)
{
CorticaDO.floaters[i].parseData(data[img]);
CorticaDO.floaters[i].createOFloater();
CorticaDO.floaters[i].viewFloater();
found = true;
break;
}
}
if(found){break;}
}
}
}
CorticaDO.onReload = false;
},
/** Send Images to AdServer **/
sendScanedData : function(){
try{
this.consoleOut('\nReload');// Debug Only
this.requestId = '';
if(typeof this.REC.removeScriptTag == 'function')
{
this.REC.removeScriptTag(); // Delete from Header corticaData
this.REC = 0;
}
//
CorticaDO.REC = new CorticaJSONscriptRequest(CorticaDO.dataUrl,'btype='+CorticaDO.bannerType+'&rid='+CorticaDO.publisherId+'&ref='+escape(document.location.href)+'&imgs='+CorticaDO.rescanParamExt);
CorticaDO.REC.buildScriptTag();
CorticaDO.REC.addScriptTag();
CorticaDO.onReload = false;
CorticaDO.refUrl = "";
CorticaDO.rescanParamExt = '';
CorticaDO.rescan++;
}
catch(err)
{
this.REC = 0;
this.consoleOut(err); // Debug Only
}
},
/** Event Close Floater ***/
closeFloater : function(p){
if(document.getElementById('corticaOF'+ p))
{
document.getElementById('corticaOF'+ p).style.display = 'none';
CorticaDO.floaters[p].disable = true;
}
else{this.consoleOut('Can\'t find floater for close action with ID: corticaOF'+p);}
},
};
/** Floater Default Object Clone *********************************************************************************************************************/
function corticaFDOC(){
this.obj = null;
this.src = '';
this.visible = true;
this.index = null;
this.data = {styleID:1,behaviour:2,advertiserId:10,campaignId:0,siteId:1,html:null,banW:null,banH:null,nonloc:1,isFullWidth:0,content:3};
this.floater = null;
this.onOFView = false;
this.disable = false;
};
corticaFDOC.prototype = {
/** Create Overlay Floater ***/
createOFloater : function (){
var self = this;
var f = document.createElement('DIV');
if(this.data.isFullWidth == 0)
{f.style.width = this.data.banW + "px";}
else{f.style.width = this.obj.width + "px";}
f.style.height = this.data.banH + "px";
f.invoker = this.obj;
f.style.position = 'absolute';
f.style.display = 'none';
f.style.cursor = 'pointer';
f.style.overflow = 'hidden';
f.style.fontFamily = CorticaDO.fontfamily;
f.style.padding = f.style.margin = 0;
f.innerHTML = this.data.html;
f.setAttribute('id','corticaOF'+this.index);
document.body.appendChild(f);
/** Set Close Button **/
if(document.getElementById('corticaFcl'))
{
var fclb = document.getElementById('corticaFcl');
fclb.id = "corticaFcl"+this.index;
fclb.onclick = function()
{CorticaDO.closeFloater(self.index);};//this.closeFloater(self.index).bind(this);
}
this.floater = f;
},
/** Parse Data from AdServer ***/
parseData : function (data){
if(typeof data['behaviorId'] != 'undefined') {this.data.behaviour = data['behaviorId'];}
if(typeof data['loc'] != 'undefined') {this.data.nonloc = data['loc'];} // Non Locationable
if(typeof data['siteId'] != 'undefined') {this.data.siteId = data['siteId'];}
if(typeof data['isFullWidth'] != 'undefined') {this.data.isFullWidth= data['isFullWidth'];} // isFullWidth
if(typeof data['content'] != 'undefined') {this.data.content = data['content'];} // content
// Set data to object
if(typeof data['ads'][0].html != 'undefined'){
this.data.html = CorticaDO.urlDecode(data['ads'][0].html);
if(typeof data['ads'][0].bannerWidth != 'undefined') // banW
{this.data.banW = data['ads'][0].bannerWidth;}
if(typeof data['ads'][0].bannerHeight != 'undefined') // banH
{this.data.banH = data['ads'][0].bannerHeight;}
if(typeof data['ads'][0].styleId != 'undefined' && data['ads'][0].styleId)
{this.data.styleID = data['ads'][0].styleId;}
if(data['ads'][0].advertiserId)
{this.data.advertiserId = data['ads'][0].advertiserId;}
if(data['ads'][0].campaignId)
{this.data.campaignId = data['ads'][0].campaignId;}
}
},
/** Show Floater ***/
viewFloater: function (){
try{
if(typeof this.data != 'undefined')
{
var allOffset = this.getOffsetElement(this.obj);
var strH = this.floater.style.height;
var strW = this.floater.style.width;
if(this.floater.style.display != "block" && !this.disable){
if(this.data.nonloc == 3)
{this.floater.style.top = (allOffset.top + this.obj.height) + 'px';}
else{this.floater.style.top = (allOffset.top + this.obj.height - parseInt(strH.replace(/px/i, ""),10)) + 'px';}
var left = 0;
if(this.data.isFullWidth == 0)
{left = parseInt((this.obj.width - parseInt(strW.replace(/px/i, ""),10))/2);}
this.floater.style.left = allOffset.left + left + 'px';
this.floater.style.zIndex = CorticaDO.fzindex;
this.floater.style.display = 'block';
if(!this.onOFView)
{
this.onOFView = true;
this.doclick(0);
}
}
}
}
catch(err){CorticaDO.consoleOut(err);}
},
/** Position Correction ***/
correctPos : function (){
if(this.floater != null)
{
var allOffset = this.getOffsetElement(this.obj);
var strH = this.floater.style.height;
var strW = this.floater.style.width;
if(this.data.nonloc == 3)
{this.floater.style.top = (allOffset.top + this.obj.height) + 'px';}
else{this.floater.style.top = (allOffset.top + this.obj.height - parseInt(strH.replace(/px/i, ""),10)) + 'px';}
var left = 0;
if(this.data.isFullWidth == 0)
{left = parseInt((this.obj.width - parseInt(strW.replace(/px/i, ""),10))/2);}
this.floater.style.left = allOffset.left + left + 'px';
}
},
/** Close Floater ***/
closeFloater : function(){
if(document.getElementById('corticaOF'+ this.index))
{
document.getElementById('corticaOF'+ this.index).style.display = 'none';
this.disable = true;
}
else{CorticaDO.consoleOut('Can\'t find floater for close action with ID: corticaOF'+this.index);}
},
/** Get Visibility Status ***/
isVisible : function(){return this.visible;},
/** Hide Floater **/
hide : function(){this.toggle(false);},
/** Show Floater **/
display : function(){this.toggle(true);},
/** Show/Hide Floaters [action: true/false] ***/
toggle : function(action){
var status = action ? "block" : "none";
if(!this.disable)
{
if(document.getElementById('corticaOF'+this.index))
{document.getElementById('corticaOF'+this.index).style.display = status;}
if(action)
{this.correctPos();}
}
},
setVisibility : function(){
if(this.floater != null)
{this.visible ? this.display() : this.hide();}
},
/** Check if obj Same **/
isObj : function (obj){return this.src == obj.src && this.obj === obj;},
/** Report ver 0.9 **/
doclick : function(dotIndex){
var requester = new Image();
requester.src = CorticaDO.dotClickUrl + '?picUrl=' + escape(this.src) + '&pageUrl =' + escape(document.location.href) +
'&reqid=' + CorticaDO.requestId + '&pid=' + CorticaDO.publisherId + '&btype=' + CorticaDO.bannerType +
'&campid=' + this.data.campaignId +
'&advid=' + this.data.advertiserId +
"&styleId=" + this.data.styleID +
"&behaviorId=" + this.data.behaviour +
'&siteId=' + this.data.siteId;
},
/******* ______ ************************************************************************************/
/** Get Element Position flow 2***/
getOffsetSum: function(elem) {
var top=0, left=0;
while(elem) {
top = top + parseInt(elem.offsetTop);
left = left + parseInt(elem.offsetLeft);
elem = elem.offsetParent;
}
return {top: top, left: left};
},
/** Get Element Position flow 1***/
getOffsetRect: function(elem) {
var box = elem.getBoundingClientRect(); // (1)
var body = document.body; // (2)
var docElem = document.documentElement;
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop; // (3)
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
var clientTop = docElem.clientTop || body.clientTop || 0; // (4)
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
var top = box.top + scrollTop - clientTop; // (5)
var left = box.left + scrollLeft - clientLeft;
return {top: Math.round(top), left: Math.round(left)};
},
/** Get Element Position Main ***/
getOffsetElement: function(el){
if (el.getBoundingClientRect)
{return this.getOffsetRect(el);}
else{return this.getOffsetSum(el);}
},
/** Get Element Style ***/
getElStyle : function(el,styleProp){
var value, defaultView = el.ownerDocument.defaultView;
if (defaultView && defaultView.getComputedStyle){// W3C standard way:
styleProp = styleProp.replace(/([A-Z])/g, "-$1").toLowerCase();
return defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
}
else{
if (el.currentStyle) { // IE
styleProp = styleProp.replace(/\-(\w)/g,function(str,letter){return letter.toUpperCase();});
value = el.currentStyle[styleProp];
if (/^\d+(em|pt|%|ex)?$/i.test(value)){// convert other units to pixels on IE
return (
function(value){
var oldLeft = el.style.left, oldRsLeft = el.runtimeStyle.left;
el.runtimeStyle.left = el.currentStyle.left;
el.style.left = value || 0;
value = el.style.pixelLeft + "px";
el.style.left = oldLeft;
el.runtimeStyle.left = oldRsLeft;
return value;
}
)(value);
}
return value;
}
}
return null;
}
};
/***** OLD ****************************************************************************************/
function CorticaJSONscriptRequest(fullUrl,data){
this.data = data;
this.fullUrl = fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headLoc = document.getElementsByTagName("head").item(0);
this.scriptId = 'JscriptId' + CorticaJSONscriptRequest.scriptCounter++;
};
CorticaJSONscriptRequest.scriptCounter = 1;
CorticaJSONscriptRequest.prototype.buildScriptTag = function(){
this.scriptObj = document.createElement("script");
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl + '?' + this.data + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
};
CorticaJSONscriptRequest.prototype.removeScriptTag = function(){this.headLoc.removeChild(this.scriptObj);};
CorticaJSONscriptRequest.prototype.addScriptTag = function(){this.headLoc.appendChild(this.scriptObj);};
/****************************************************************************************************/
/** Load / Calculate request string & Create script tag **/
function corticaInit(){
if(arguments.callee.done){return;} /* Preventing DC */
// Make css
corticaMakeCSS('.corticaBS{background-color:transparent;}.corticaAbs{position:absolute;}.corticaIS{image-rendering:optimizeQuality; -ms-interpolation-mode: bicubic;}.corticaRB{width:100%;text-align:center;position:absolute;border:0;background-color:black;opacity:'+CorticaDO.opacity / 10 +';alpha(opacity='+CorticaDO.opacity+'0);}');
// Get Publisher ID identifier:(script name with extention),name(parameter name)
var pubID = CorticaDO.getParameterByName('searchBox.js','pid');
if(typeof pubID != 'undefined' && pubID != '')
{CorticaDO.publisherId = pubID;}
// Start Auto Scanning for Visible Images
setInterval("CorticaDO.corticaScan()", 200);
// Set DC Flags
arguments.callee.done = true;
alreadyrunflag = 1;
};
/** Common Functions *************************************************************************************/
function corticaMakeCSS(css){
var head = document.getElementsByTagName('head')[0],style = document.createElement('style'),rules = document.createTextNode(css);
style.type = 'text/css';
if(style.styleSheet)
{style.styleSheet.cssText = rules.nodeValue;}
else{style.appendChild(rules);}
head.appendChild(style);
};
/** Start Script *****************************************************************************************/
corticaInit();