From: avl Date: Mon, 22 Sep 2008 10:50:41 +0000 (+0300) Subject: dropshadow & swfobject added X-Git-Tag: 0.5~479^2 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=7afbffe3fcb290a3680c8d37a41c883a76cc4176;p=ipf.git dropshadow & swfobject added --- diff --git a/ipf/admin/media/js/jquery.dropshadow.js b/ipf/admin/media/js/jquery.dropshadow.js new file mode 100644 index 0000000..6063b86 --- /dev/null +++ b/ipf/admin/media/js/jquery.dropshadow.js @@ -0,0 +1,187 @@ +(function($){ + + var dropShadowZindex = 1; //z-index counter + + $.fn.dropShadow = function(options) + { + // Default options + var opt = $.extend({ + left: 4, + top: 4, + blur: 2, + opacity: .5, + color: "black", + swap: false + }, options); + var jShadows = $([]); //empty jQuery collection + + // Loop through original elements + this.not(".dropShadow").each(function() + { + var jthis = $(this); + var shadows = []; + var blur = (opt.blur <= 0) ? 0 : opt.blur; + var opacity = (blur == 0) ? opt.opacity : opt.opacity / (blur * 8); + var zOriginal = (opt.swap) ? dropShadowZindex : dropShadowZindex + 1; + var zShadow = (opt.swap) ? dropShadowZindex + 1 : dropShadowZindex; + + // Create ID for shadow + var shadowId; + if (this.id) { + shadowId = this.id + "_dropShadow"; + } + else { + shadowId = "ds" + (1 + Math.floor(9999 * Math.random())); + } + + // Modify original element + $.data(this, "shadowId", shadowId); //store id in expando + $.data(this, "shadowOptions", options); //store options in expando + jthis + .attr("shadowId", shadowId) + .css("zIndex", zOriginal); + if (jthis.css("position") != "absolute") { + jthis.css({ + position: "relative", + zoom: 1 //for IE layout + }); + } + + // Create first shadow layer + bgColor = jthis.css("backgroundColor"); + if (bgColor == "rgba(0, 0, 0, 0)") bgColor = "transparent"; //Safari + if (bgColor != "transparent" || jthis.css("backgroundImage") != "none" + || this.nodeName == "SELECT" + || this.nodeName == "INPUT" + || this.nodeName == "TEXTAREA") { + shadows[0] = $("
") + .css("background", opt.color); + } + else { + shadows[0] = jthis + .clone() + .removeAttr("id") + .removeAttr("name") + .removeAttr("shadowId") + .css("color", opt.color); + } + shadows[0] + .addClass("dropShadow") + .css({ + height: jthis.outerHeight(), + left: blur, + opacity: opacity, + position: "absolute", + top: blur, + width: jthis.outerWidth(), + zIndex: zShadow + }); + + // Create other shadow layers + var layers = (8 * blur) + 1; + for (i = 1; i < layers; i++) { + shadows[i] = shadows[0].clone(); + } + + // Position layers + var i = 1; + var j = blur; + while (j > 0) { + shadows[i].css({left: j * 2, top: 0}); //top + shadows[i + 1].css({left: j * 4, top: j * 2}); //right + shadows[i + 2].css({left: j * 2, top: j * 4}); //bottom + shadows[i + 3].css({left: 0, top: j * 2}); //left + shadows[i + 4].css({left: j * 3, top: j}); //top-right + shadows[i + 5].css({left: j * 3, top: j * 3}); //bottom-right + shadows[i + 6].css({left: j, top: j * 3}); //bottom-left + shadows[i + 7].css({left: j, top: j}); //top-left + i += 8; + j--; + } + + // Create container + var divShadow = $("
") + .attr("id", shadowId) + .addClass("dropShadow") + .css({ + left: jthis.position().left + opt.left - blur, + marginTop: jthis.css("marginTop"), + marginRight: jthis.css("marginRight"), + marginBottom: jthis.css("marginBottom"), + marginLeft: jthis.css("marginLeft"), + position: "absolute", + top: jthis.position().top + opt.top - blur, + zIndex: zShadow + }); + + // Add layers to container + for (i = 0; i < layers; i++) { + divShadow.append(shadows[i]); + } + + // Add container to DOM + jthis.after(divShadow); + + // Add shadow to return set + jShadows = jShadows.add(divShadow); + + // Re-align shadow on window resize + $(window).resize(function() + { + try { + divShadow.css({ + left: jthis.position().left + opt.left - blur, + top: jthis.position().top + opt.top - blur + }); + } + catch(e){} + }); + + // Increment z-index counter + dropShadowZindex += 2; + + }); //end each + + return this.pushStack(jShadows); + }; + + + $.fn.redrawShadow = function() + { + // Remove existing shadows + this.removeShadow(); + + // Draw new shadows + return this.each(function() + { + var shadowOptions = $.data(this, "shadowOptions"); + $(this).dropShadow(shadowOptions); + }); + }; + + + $.fn.removeShadow = function() + { + return this.each(function() + { + var shadowId = $(this).shadowId(); + $("div#" + shadowId).remove(); + }); + }; + + + $.fn.shadowId = function() + { + return $.data(this[0], "shadowId"); + }; + + + $(function() + { + // Suppress printing of shadows + var noPrint = ""; + $("head").append(noPrint); + }); + +})(jQuery); \ No newline at end of file diff --git a/ipf/admin/media/js/swfobject.js b/ipf/admin/media/js/swfobject.js new file mode 100644 index 0000000..8cfa934 --- /dev/null +++ b/ipf/admin/media/js/swfobject.js @@ -0,0 +1,128 @@ +/** + * SWFObject v1.4.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/ + * + * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for + * legal reasons. + */ +if(typeof deconcept=="undefined"){var deconcept=new Object();} +if(typeof deconcept.util=="undefined"){deconcept.util=new Object();} +if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();} +deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){ +if(!document.createElement||!document.getElementById){return;} +this.DETECT_KEY=_b?_b:"detectflash"; +this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY); +this.params=new Object(); +this.variables=new Object(); +this.attributes=new Array(); +if(_1){this.setAttribute("swf",_1);} +if(id){this.setAttribute("id",id);} +if(w){this.setAttribute("width",w);} +if(h){this.setAttribute("height",h);} +if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));} +this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7); +if(c){this.addParam("bgcolor",c);} +var q=_8?_8:"high"; +this.addParam("quality",q); +this.setAttribute("useExpressInstall",_7); +this.setAttribute("doExpressInstall",false); +var _d=(_9)?_9:window.location; +this.setAttribute("xiRedirectUrl",_d); +this.setAttribute("redirectUrl",""); +if(_a){this.setAttribute("redirectUrl",_a);}}; +deconcept.SWFObject.prototype={setAttribute:function(_e,_f){ +this.attributes[_e]=_f; +},getAttribute:function(_10){ +return this.attributes[_10]; +},addParam:function(_11,_12){ +this.params[_11]=_12; +},getParams:function(){ +return this.params; +},addVariable:function(_13,_14){ +this.variables[_13]=_14; +},getVariable:function(_15){ +return this.variables[_15]; +},getVariables:function(){ +return this.variables; +},getVariablePairs:function(){ +var _16=new Array(); +var key; +var _18=this.getVariables(); +for(key in _18){_16.push(key+"="+_18[key]);} +return _16; +},getSWFHTML:function(){ +var _19=""; +if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){ +if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");} +_19="0){_19+="flashvars=\""+_1c+"\"";} +_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");} +_19=""; +_19+=""; +var _1d=this.getParams(); +for(var key in _1d){_19+="";} +var _1f=this.getVariablePairs().join("&"); +if(_1f.length>0){_19+="";}_19+="";} +return _19;},write:function(_20){ +if(this.getAttribute("useExpressInstall")){ +var _21=new deconcept.PlayerVersion([6,0,65]); +if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){ +this.setAttribute("doExpressInstall",true); +this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl"))); +document.title=document.title.slice(0,47)+" - Flash Player Installation"; +this.addVariable("MMdoctitle",document.title);}} +if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){ +var n=(typeof _20=="string")?document.getElementById(_20):_20; +n.innerHTML=this.getSWFHTML();return true; +}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}}; +deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){ +var _25=new deconcept.PlayerVersion([0,0,0]); +if(navigator.plugins&&navigator.mimeTypes.length){ +var x=navigator.plugins["Shockwave Flash"]; +if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));} +}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); +for(var i=3;axo!=null;i++){axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);_25=new deconcept.PlayerVersion([i,0,0]);}} +catch(e){} +if(_23&&_25.major>_23.major){return _25;} +if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){ +try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));} +catch(e){}}}return _25;}; +deconcept.PlayerVersion=function(_29){ +this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0; +this.minor=parseInt(_29[1])||0; +this.rev=parseInt(_29[2])||0;}; +deconcept.PlayerVersion.prototype.versionIsValid=function(fv){ +if(this.majorfv.major){return true;} +if(this.minorfv.minor){return true;} +if(this.rev-1)?q.indexOf("&",_2d):q.length; +if(q.length>1&&_2d>-1){return q.substring(q.indexOf("=",_2d)+1,_2e);}} +return "";}}; +deconcept.SWFObjectUtil.cleanupSWFs=function(){ +var _2f=document.getElementsByTagName("OBJECT"); +for(var i=0;i<_2f.length;i++){ +for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=null;}}}}; +if(typeof window.onunload=="function"){ +var oldunload=window.onunload; +window.onunload=function(){deconcept.SWFObjectUtil.cleanupSWFs();oldunload();}; +}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;} +if(Array.prototype.push==null){ +Array.prototype.push=function(_32){ +this[this.length]=_32; +return this.length;};} + +var getQueryParamValue = deconcept.util.getRequestParameter; +var FlashObject = deconcept.SWFObject; // for backwards compatibility +var SWFObject = deconcept.SWFObject; +