欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

CSDN轮换广告图片轮换效果

程序员文章站 2023-12-05 21:30:58
/*---------------------------------------------------------------------------*\ | ...
/*---------------------------------------------------------------------------*\
|  subject: javascript framework
|  author:  meizz
|  created: 2005-02-27
|  version: 2006-08-31
|-----------------------------------
|  msn: huangfr@msn.com qq:112889082 copyright (c) meizz
|  http://www.meizz.com/jsframework/ mit-style license
|  the above copyright notice and this permission notice shall be
|  included in all copies or substantial portions of the software
\*---------------------------------------------------------------------------*/

window.system = function(){this.sethashcode();}

system.debug=false; //false
system._codebase={};
try
{
  if (window!=parent && parent.system && parent.system._codebase)
    system._codebase = parent.system._codebase;
  else if ("undefined"!=typeof opener&&opener.system&&opener.system._codebase)
    system._codebase = opener.system._codebase;
  else if ("undefined"!=typeof dialogarguments && dialogarguments.system)
    system._codebase = dialogarguments.system._codebase;
}
catch(ex){}

system.missing_argument="missing argument";
system.argument_parse_error="the argument cannot be parsed";
system.not_supported_xmlhttp="your browser do not support xmlhttp";
system.file_not_found="file not found";
system.miscoding="maybe file encoding is not ansi or utf-8";
system.namespace_error=" nonstandard namespace";

system.hashcounter=0;
system.currentversion="20060831";
var t=document.getelementsbytagname("script");
t=(system.scriptelement=t[t.length-1]).src.replace(/\\/g, "/");
system.extend=function(d,s){for(var i in s)d[i]=s[i];return d;};
system.path=(t.lastindexof("/")<0)?".":t.substring(0, t.lastindexof("/"));
system.getuniqueid=function(){return "mz_"+(system.hashcounter++).tostring(36);};
system.tohashcode=function(e)
{
  if("undefined"!=typeof e.hashcode) return e.hashcode;
  return e.hashcode=system.getuniqueid();
};
system.supportsxmlhttp=function()
{
  return "object"==typeof(system._xmlhttp||(system._xmlhttp=new xmlhttprequest()));
};
system._getprototype=function(namespace, argu)
{
  if("undefined"==typeof system._prototypes[namespace])return new system();
  for(var a=[], i=0; i<argu.length; i++) a[i]="argu["+ i +"]";
  return eval("new (system._prototypes['"+namespace+"'])("+a.join(",")+")");
};
system.ie=navigator.useragent.indexof("msie")>0 && !window.opera;
system.ns=navigator.vendor=="netscape";
system.alert=function(msg){if(system.debug)alert(msg);};
system._parseresponsetext=function(s)
{
    if (null==s||"\ufffd"==s.charat(0)){system.alert(system.miscoding);return "";}
    if ("\xef"==s.charat(0))s=s.substr(3); //for firefox
    return s.replace(/(^|\n)\s*\/\/+\s*((using|import|include)\((\"|\'))/g,"$1$2");
};

if(window.activexobject && (system.ie || !window.xmlhttprequest))
{
  window.xmlhttprequest = function()
  {
    var msxmls=['msxml3','msxml2','microsoft'];
    for(var i=0;i<msxmls.length;i++)
      try{return new activexobject(msxmls[i]+'.xmlhttp')} catch(ex){}
    system._xmlhttp="mz"; throw new error(system.not_supported_xmlhttp);
  }
}
system.load = function(namespace, path)
{
  try
  {
    if(system.supportsxmlhttp()){path=system._mappath(namespace, path);
    var x=system._xmlhttp; x.open("get",path,false); x.send(null);
    if (x.readystate==4)
    {
      if(x.status==0||/^file\:/i.test(path))
        return system._parseresponsetext(x.responsetext);
      else if(x.status==200)return system._parseresponsetext(x.responsetext);
      else if(x.status==404)system.alert(namespace+"\n"+system.file_not_found);
      else throw new error(x.status +": "+ x.statustext);}
    } else system.alert(system.not_supported_xmlhttp);
  }
  catch(ex){system.alert(namespace+"\n"+ex.message);}return "";
};
system._eval = function(namespace, path)
{
  //alert("system._eval(\""+namespace+"\")=\r\n"+system._codebase[namespace]);
  try{if(window.execscript)window.execscript(system._codebase[namespace]);else
  {
    var script=document.createelement("script");script.type="text/javascript";
    script.innerhtml="eval(system._codebase['"+ namespace +"']);";
    document.getelementsbytagname("head")[0].appendchild(script);
    settimeout(function(){script.parentnode.removechild(script)},99);
  }}catch(ex){system.alert("syntax error on load "+ namespace);}
  system._existences[namespace]=system._mappath(namespace, path);
};
system._exist = function(namespace, path)
{
  if("undefined"==typeof system._existences[namespace]) return false;
  return system._existences[namespace]==system._mappath(namespace,path);
};
system._mappath = function(namespace, path)
{
  if("string"==typeof path && path.length>3) return path;
  var p=system.path +"/"+ namespace.replace(/\./g,"/") +".js";
  return p +(("undefined"==typeof path||path) ? "" : "?t="+ math.random());
};

window.using = function(namespace, path, rename)
{
  if(system._exist(namespace, path)){
  var s=window[namespace.substr(namespace.lastindexof(".")+1)];
  if(s!=system._prototypes[namespace])s=system._prototypes[namespace];return}
  var code=namespace +"."; if(!/((^|\.)[\w\$]+)+$/.test(namespace))
  throw new error(namespace+system.namespace_error);
  for(var i=code.indexof("."); i>-1; i=code.indexof(".", i+1)){
  var e= code.substring(0,i), s=(e.indexof(".")==-1) ? "window[\""+e+"\"]":e;
  if(e&&"undefined"==typeof(s)){
  eval(s+"=function(){return system._getprototype(\""+e+"\", arguments)}");}}
  if("undefined"==typeof path &&"string"==typeof system._codebase[namespace])
  {
    system._eval(namespace, path);}else{if(code=system.load(namespace,path)){
    e = "$"+ system.getuniqueid() +"__id"+ new date().gettime() +"$";
    s = "function "+e+"(){\r\n"+code+";\r\nsystem._prototypes['";
    code=namespace.substr(namespace.lastindexof(".")+1);
    s += namespace+"']=window['"+(rename||code)+"']="+code+";\r\n}"+e+"();";
    system._codebase[namespace]=s;s="";system._eval(namespace, path);}
  }
};
window.import=function(namespace,path,rename){using(namespace,path,rename)};
window.instance=function(hashcode){return system._instances[hashcode]};
window.include=function(namespace, path)
{
  if(system._exist(namespace, path)) return;
  var code;if(!/((^|\.)[\w\$]+)+$/.test(namespace))
  throw new error(namespace + system.namespace_error);
  if("undefined"==typeof path&&"string"==typeof(system._codebase[namespace]))
  {
    system._eval(namespace, path);}else if(system.supportsxmlhttp()){
    if(code=system.load(namespace, path)){system._codebase[namespace]=code;
    system._eval(namespace, path);}}else{
    var script=document.createelement("script");script.type="text/javascript";
    script.src=system._existences[namespace]=system._mappath(namespace,path);
    document.getelementsbytagname("head")[0].appendchild(script);
    settimeout(function(){script.parentnode.removechild(script)},99);
  }
};

function.read=1;function.write=2;function.read_write=3;
function.prototype.addproperty=function(name,initvalue,r_w)
{
  var capital=name.charat(0).touppercase()+name.substr(1);
  r_w=r_w||function.read_write; name="_"+name; var p=this.prototype;
  if("undefined"!=typeof initvalue) p[name]=initvalue;
  if(r_w&function.read) p["get"+ capital]=function(){return this[name];};
  if(r_w&function.write) p["set"+ capital]=function(v){this[name]=v;};
};
function.prototype.extends=function(superclass,classname)
{
  var op=this.prototype, i, p=this.prototype=new superclass();
  if(classname)p._classname=classname; for(i in op)p[i]=op[i];
  if(p.hashcode)delete system._instances[p.hashcode];return p;
};
system._instances={};
system._prototypes=
{
  "system":system,
  "system.object":system,
  "system.event":system.event
};
system._existences=
{
  "system":system._mappath("system"),
  "system.event":system._mappath("system.event"),
  "system.object":system._mappath("system.object")
};
t=system.extends(object, "system"); system.object = system;
t.decontrol=function(){var t;if(t=this.hashcode)delete system._instances[t]};
t.addeventlisteners=function(type, handle)
{
  if("function"!=typeof handle)
    throw new error(this+" addeventlistener: "+handle+" is not a function");
  if(!this._listeners) this._listeners={};
  var id=system.tohashcode(handle), t=this._listeners; 
  if("object"!=typeof t[type]) t[type]={}; t[type][id]=handle;
};
t.removeeventlistener=function(type, handle)
{
  if(!this._listeners)this._listeners={}; var t=this._listeners;
  if(!t[type]) return; var id=system.tohashcode(handle);
  if( t[type][id])delete t[type][id];if(t[type])delete t[type];
};
t.dispatchevent=function(evt)
{
  if(!this._listeners)this._listeners={};
  var i, t =this._listeners, p =evt.type;
  evt.target=evt.srcelement=evt.target||evt.srcelement||this;
  evt.currenttarget=this; if(this[p])this[p](evt);
  if("object"==typeof t[p]) for(i in t[p]) t[p][i].call(null, evt);
  delete evt.target;delete evt.currenttarget;delete evt.srcelement;
  return evt.returnvalue;
};
t.sethashcode=function()
{
  system._instances[(this.hashcode=system.getuniqueid())]=this;
};
t.gethashcode=function()
{
  if(!this.hashcode)this.sethashcode(); return this.hashcode;
};
t.tostring=function(){return "[object "+(this._classname||"object")+"]";};
system.event=function(type){this.type=type;};
t=system.event.extends(system, "system.event");
t.returnvalue=true; t.cancelbubble=false;
t.target=t.currenttarget=t.srcelement=null;
t.stoppropagation=function(){this.cancelbubble=true;};
t.preventdefault =function(){this.returnvalue=false;};

if(system.ie && !system.debug) include("system.plugins.ie"); //ie userdata
if(window.opera) include("system.plugins.opera"); //opera support
include("system.global");