⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client_master.js

📁 一种.net实现ajax方法的类库
💻 JS
📖 第 1 页 / 共 4 页
字号:
    {        if( str.charAt(0) == "/" )        {            str = this.frameAbsoluteBaseUrl + str;        }        else        {            str = this.frameBaseUrl + str;        }    }    else if( str && str.indexOf(this.hostBaseUrl) > -1 )    {        str = str.replace(this.hostBaseUrl,this.frameBaseUrl) ;    }    else if( str && str.indexOf(this.hostAbsoluteBaseUrl) > -1 )    {        str = str.replace(this.hostAbsoluteBaseUrl,this.frameAbsoluteBaseUrl) ;    }    return str;}Browser.prototype.GoTo = function( url ){    this.source = new dojo.uri.Uri(url);    this.OnChanged();}Browser.prototype.SetAttribute = function(attribute, value){    if( attribute == "source" )    {        this.source = new dojo.uri.Uri( value );    }    else    {        this.uber("SetAttribute", attribute, value );    }}function DocumentOnClick(evt){	Send( "root", "OnClick", evt.clientX + "," + evt.clientY );}svgSelectableElements = [];SvgCircle.inherits(Widget);function SvgCircle( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }	this.elemNS = SVG_NS;	this.elemType = "circle";	//this.className = 'defaultCircle';	this.onDelayedMouseOver = true;	this.Widget(args);	this.elem.setAttribute("cx", this.x );	this.elem.setAttribute("cy", this.y );	this.elem.setAttribute("r", this.r );	//this.elem.setAttribute("fill", this.fill );	this.elem.setAttribute("stroke", this.stroke );	dojo.event.connect( this.elem, "onclick", this, "Click" );	svgSelectableElements[svgSelectableElements.length] = this;}SvgLine.inherits(Widget);function SvgLine( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }	this.elemNS = SVG_NS;	this.elemType = "line";	this.Widget(args);	this.elem.setAttribute("x1", this.x1 );	this.elem.setAttribute("y1", this.y1 );	this.elem.setAttribute("x2", this.x2 );	this.elem.setAttribute("y2", this.y2 );	this.elem.setAttribute("stroke", this.color );	this.elem.onclick = this.Click;	//this.elem.style.zIndex = -1;}SvgRect.inherits(Widget);function SvgRect( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }    this.elemNS = SVG_NS;	this.elemType = "rect";	this.Widget(args);	this.elem.setAttribute("x", this.x );	this.elem.setAttribute("y", this.y );	this.elem.setAttribute("width", this.width );	this.elem.setAttribute("height", this.height );	this.elem.setAttribute("fill", this.color );	this.elem.setAttribute("stroke", 'black' );	this.elem.onclick = this.Click;}SvgPath.inherits(Widget);function SvgPath( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }    this.elemNS = SVG_NS;	this.elemType = "path";	this.Widget(args);}/*function(evt){	var str = "Events:\r\n";	for( var k in evt )	{		if( typeof( k ) != "function" )			str += k + ": " + evt[k] + "\t\t";	}	alert(str);}*/SvgImage.inherits(Widget);function SvgImage( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }	this.elemNS = SVG_NS;	this.elemType = "circle";	this.className = 'image';	this.Widget(args);	this.elem.setAttribute("x", this.x );	this.elem.setAttribute("y", this.y );	this.elem.setAttribute("width", this.width );	this.elem.setAttribute("height", this.height );	this.elem.setAttributeNS(XLINK_NS, "href", this.url );	//this.elem.setAttribute("stroke", 'black' );	this.elem.onclick = this.Click;}SvgGroup.inherits(Widget);function SvgGroup( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }	this.elemNS = SVG_NS;	this.elemType = "g";	this.Widget(args);	if( this.transform) this.elem.setAttribute("transform", this.transform );	this.elem.onclick = this.Click;}SvgText.inherits(Widget);function SvgText( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }	this.elemNS = SVG_NS;	this.elemType = "text";	this.Widget(args);	this.elem.setAttribute("x", this.x );	this.elem.setAttribute("y", this.y );	this.elem.appendChild( document.createTextNode( this.text ) );	this.elem.setAttribute("text-anchor", this.align );	this.elem.setAttribute("font-size", this.fontSize );	//this.elem.setAttribute("dominant-baseline", "mathematical");		//this.elem.setAttribute("height", this.height );	//this.elem.setAttribute("fill", this.color );	//this.elem.setAttribute("stroke", 'black' );}SvgText.prototype.SetText = function (newText){    this.elem.removeChild(this.elem.firstChild);    this.elem.appendChild(document.createTextNode(newText));}SvgHost.inherits(Widget);function SvgHost( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }    this.elemNS = SVG_NS;	this.elemType = "svg";	this.Widget(args);	this.elem.setAttribute("top", this.top );	this.elem.setAttribute("left", this.left );    this.elem.setAttribute("height", this.height );	this.elem.setAttribute("width", this.width);	this.elem.setAttributeNS(SVG_NS, "preserveAspectRatio", "none" );	if( this.vb != '' )	{		this.elem.setAttribute("viewBox", this.vb );	}		if( this.pannableElement != null)	{		this.elem.pannableElement = this.pannableElement; 		document.addEventListener( "keydown", zoom_keydown_handler, false );		this.elem.addEventListener( "mousedown", pan_mousedown_handler, false );	}}SvgGradient.inherits(Widget);function SvgGradient( args ){    if( dojo.render.html.ie ){ return new PlaceHolder(args); }    this.elemNS = SVG_NS;    this.elemType = args.gradientType || "radialGradient";	this.Widget(args);	this.elem.id = args.gradientId;	var defs = this.baseElem.getElementsByTagName("defs")	if( defs.length == 0 )	{		defs = document.createElementNS( SVG_NS, "defs" );		this.baseElem.appendChild( defs );	}	else	{	    defs = defs[0];	}	if( this.elemType == "radialGradient" ) 	{	    this.elem.setAttribute( "cx", this.cx );	    this.elem.setAttribute("cy", this.cy );	}	else	{	    this.elem.setAttribute("x1", this.x1 );	    this.elem.setAttribute("y1", this.y1 );	    this.elem.setAttribute("x2", this.x2 );	    this.elem.setAttribute("y2", this.y2 );	}	 	var stopArray = this.stops.split(" ");	for( var i = 0; i < stopArray.length; i+=2 )	{		var stop = document.createElementNS( SVG_NS, "stop" );		stop.setAttribute( "offset", stopArray[i] );		stop.setAttribute("stop-color", stopArray[i+1] );		this.elem.appendChild( stop );	}	defs.appendChild( this.elem );}SvgGradient.prototype.Render = function(){};var gdx = 0,gdy = 0;var tx = 0, ty = 0;var otx = 0, oty = 0;var pannableElement;var panHost;var sy = 1, scaleDeltaY = 0;var mode = "panning";function zoom_keydown_handler( evt ){	if( evt.keyCode == 17 )	{		mode = "zooming"		document.addEventListener( "keyup", zoom_keyup_handler, false );	}	}function zoom_keyup_handler( evt ){	if( evt.keyCode == 17 )	{		mode = "panning";		document.removeEventListener( "keyup", zoom_keyup_handler, true );		//alert( sy );	}}function pan_mousedown_handler( evt ){	pannableElement = $( this.pannableElement );//this.pannableElement;	panHost = this;	if( mode == "panning" )	{		gdx = evt.clientX - tx;		gdy = evt.clientY - ty;	}	else	{		scaleDeltaY = evt.clientY;	}	document.addEventListener( "mousemove", pan_move_handler, true );	document.addEventListener( "mouseup", pan_up_handler, true );}var translate = "", scale = "";var lastTransX = 0, lastTransY = 0;function pan_move_handler(evt){    if( mode == "panning" )    {		tx = evt.clientX - gdx;		ty = evt.clientY - gdy;		if( abs( tx - lastTransX ) > 15 || abs( ty - lastTransY ) > 15 )		{			lastTransX = tx;			lastTransY = ty;			translate = "translate( " + tx + "," + ty + ")";		}				if( abs( otx - tx ) > 200 || abs( oty - ty > 200 ) )		{			otx = tx;			oty = ty;			sendPan();		}	}    else	{		sy += (evt.clientY - scaleDeltaY)/1000;		if( sy < 0.1 )			sy = 0.1		scale = " scale( " + sy + ")";	}	pannableElement.setAttribute("transform", translate + scale );}function sendPan(){	Send( panHost.id, "OnPan", tx + "," + ty );}function pan_up_handler(evt){    document.removeEventListener( "mousemove", pan_move_handler, true );    document.removeEventListener( "mouseup",  pan_up_handler, true );    if( otx != tx || oty != ty )    {		otx = tx;		oty = ty;		sendPan();	}}function abs( x ){	if( x < 0 ) x *= -1;	return x;}function attachMouseDrag(elem){    elem.onmousedown = mouseDragDown;}var dragging = false;function mouseDragDown(evt){    if( document.onmousemove != null )        document.onmousemove_ = document.onmousemove;    if( document.onmouseup != null )        document.onmouseup_ = document.onmouseup;    this.mouseDragMove = mouseDragMove;    this.mouseDragUp = mouseDragUp;    dojo.event.connect( document, "onmousemove", this, "mouseDragMove" );    dojo.event.connect( document, "onmouseup", this, "mouseDragUp" );/* Unfortunately, this is not working for some reason.    dojo.event.connect(document, "onmouseup", elem, "mouseDragUp");    dojo.event.connect(document, "onmousemove", elem, "mouseDragMove"); */    this.startX = evt.clientX;    this.startY = evt.clientY;    this.box = new Box( this.startX, this.startY, 1,1);     this.mask = createMask(this.box);    dragging = true;    return false;    }function mouseDragMove(evt){    if( ! dragging ) return;    var width = evt.clientX - this.startX;    var height = evt.clientY - this.startY;    if( width < 0 )    {        this.box.p1.x = this.startX + width;        this.mask.style.left = this.box.p1.x;        width *= -1;    }    if( height < 0 )    {        this.box.p1.y = this.startY + height;        this.mask.style.top = this.box.p1.y;        height *= -1;    }    this.box.width = width;    this.box.height = height;    this.box.p2.x = this.box.p1.x + width;    this.box.p2.y = this.box.p1.y + height;    this.mask.style.width = this.box.width;    this.mask.style.height = this.box.height;    //evt.preventBubble();    //return false;}function mouseDragUp(evt){    if( ! dragging ) return;    dragging = false;    document.onmousemove = document.onmousemove_;    document.onmouseup = document.onmouseup_;    this.mask.style.display = 'none';    dojo.event.disconnect(document, "mouseup", this, "mouseDragUp");    dojo.event.disconnect(document, "mousemove", this, "mouseDragMove");    var newBox = Svg.translateBox( this.box, this.getScreenCTM().inverse() )    findContainedElements(newBox);    document.onselectstart=null;    //evt.preventBubble();    //return false;}function findContainedElements(box){    var foundElems = "found:";    for( var i = 0; i < svgSelectableElements.length; i++ )    {        if( Svg.elemInsideBox( svgSelectableElements[i].elem, box ) )        {            svgSelectableElements[i].elem.style.setProperty("fill", "yellow","important" );        }    }}function Svg(){}//all boxes are assumed that p1 is the top left corner, and p2 is the bottom right.Svg.elemInsideBox = function(elem, box){    var eBox = Svg.extractBox(elem);    if( Svg.pointInsideBox( eBox.p1, box ) )        return true;    if( Svg.pointInsideBox( eBox.p2, box ) )        return true;    if( Svg.pointInsideBox( new Svg.Point(eBox.p1.x, eBox.p2.y), box ) )        return true;    if( Svg.pointInsideBox( new Svg.Point(eBox.p2.x, eBox.p1.y), box ) )        return true;}Svg.pointInsideBox = function ( p, box ){    return p.x > box.p1.x &			p.x < box.p2.x &			p.y > box.p1.y &			p.y < box.p2.y;}Svg.applyMatrix = function ( point, matrix ){    return new Svg.Point(        matrix.a*point.x + matrix.c*point.y + matrix.e,        matrix.b*point.x + matrix.d*point.y + matrix.f );}Svg.Point = function(x,y){    this.x = x;    this.y = y;}Svg.extractBox = function( elem ){    var box = elem.getBBox();    box.p1 = new Svg.Point(box.x, box.y);    box.p2 = new Svg.Point( box.p1.x + box.width, box.p1.y + box.height);    return box;}Svg.translateBox = function( box, matrix ){    var box2 = {};    box2.p1 = Svg.applyMatrix( box.p1, matrix );    box2.p2 = Svg.applyMatrix( box.p2, matrix );    box2.height = box2.p2.y - box2.p1.y;    if( box2.height < 0 )     {        box2.height *= -1;        box2.p1.y -= box2.height;        box2.p2.y = box2.p1.y + box2.height;        //box2.p1.y -= box2.height;        //box2.p1.y -= window.scrollY;    }    box2.width = box2.p2.x - box2.p1.x;    if( box2.width < 0 ) box2.width *= -1;    return box2;}function animate(){    var anim = new dojo.animation.Animation( new dojo.math.curves.Line([0.2,45],[1.0,0]),1000);        dojo.event.connect(anim, "onAnimate", function(e) {        left_c_Group0.elem.transform.baseVal.getItem(0).setScale( e.x, -1*e.x );	    //left_c_Group0.elem.transform.baseVal.getItem(0).setScale( e.x, -1*e.x );	    //left_c_Group0.elem.transform.baseVal.getItem(2).setSkewY( e.y, -1*e.y );    });        anim.play();}var mask;function maskElem(elem){    var box = extractBox(elem);    var matrix = elem.getScreenCTM();    var newBox = translateBox( box, matrix );    createMask(newBox)}function Box(x,y,width,height){    this.x = x;    this.y = y;    this.width = width;    this.height = height;    this.p1 = new Svg.Point( x,y);    this.p2 = new Svg.Point( x+width, y+height);}function createMask(box){    var div = document.createElement("DIV");    div.className = "popUp";    div.style.top = box.p1.y - window.scrollY;    div.style.left = box.p1.x;    div.style.width = box.width;    div.style.height = box.height;    document.body.appendChild(div);    return div;}function checkForBookmark(){    if( document.location.hash.length > 0 )    {	Send("root","Bookmark",document.location.hash);    }}dojo.addOnLoad(checkForBookmark);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -