1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
;var ns={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console){window.console=new function(){this.log=function(a){};this.dir=function(a){}}}$.jGraduate={Paint:function(b){var a=b||{};this.alpha=a.alpha||100;if(a.copy){this.type=a.copy.type;this.alpha=a.copy.alpha;switch(this.type){case"none":this.solidColor=null;this.linearGradient=null;break;case"solidColor":this.solidColor=a.copy.solidColor;this.linearGradient=null;break;case"linearGradient":this.solidColor=null;this.linearGradient=a.copy.linearGradient.cloneNode(true);break}}else{if(a.linearGradient){this.type="linearGradient";this.solidColor=null;this.linearGradient=a.linearGradient.cloneNode(true)}else{if(a.solidColor){this.type="solidColor";this.solidColor=a.solidColor}else{this.type="none";this.solidColor=null;this.linearGradient=null}}}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint(),window:{pickerTitle:"Drag markers to pick a paint",},images:{clientPath:"images/",},};jQuery.fn.jGraduate=function(b){var a=arguments;return this.each(function(){var l=$(this),m=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),H=l.attr("id"),e="#"+l.attr("id")+" ";if(!e){alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");return}var c=function(){$.isFunction(l.okCallback)&&l.okCallback(l.paint);l.hide()},i=function(){$.isFunction(l.cancelCallback)&&l.cancelCallback();l.hide()};$.extend(true,l,{paint:new $.jGraduate.Paint({copy:m.paint}),okCallback:$.isFunction(a[1])&&a[1]||null,cancelCallback:$.isFunction(a[2])&&a[2]||null,});var F=l.position(),B=null;if(l.paint.type=="none"){l.paint=$.jGraduate.Paint({solidColor:"ffffff"})}l.addClass("jGraduate_Picker");l.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current">Solid Color</li><li class="jGraduate_tab_lingrad">Linear Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_lgPick"></div>');var K=$(e+"> .jGraduate_colPick");var s=$(e+"> .jGraduate_lgPick");s.html('<div id="'+H+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+m.window.pickerTitle+'</h2><div id="'+H+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+H+'_jGraduate_Opacity" class="jGraduate_Opacity" title="Click to set overall opacity of the gradient paint"><img id="'+H+'_jGraduate_AlphaArrows" class="jGraduate_AlphaArrows" src="'+m.images.clientPath+'rangearrows2.gif"></img></div></div><div class="jGraduate_Form"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Stop</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+H+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+H+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/><div id="'+H+'_jGraduate_colorBoxBegin" class="colorBox"></div><label id="'+H+'_jGraduate_beginOpacity"> 100%</label></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Stop</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+H+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+H+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/><div id="'+H+'_jGraduate_colorBoxEnd" class="colorBox"></div><label id="'+H+'_jGraduate_endOpacity">100%</label></div></div><div class="jGraduate_OpacityField"><label class="jGraduate_OpacityLabel">A: </label><input type="text" id="'+H+'_jGraduate_OpacityInput" class="jGraduate_OpacityInput" size="3" value="100"/>%</div></div><div class="jGraduate_OkCancel"><input type="button" id="'+H+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+H+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div><div class="jGraduate_LightBox"></div><div id="'+H+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var N=256,E=0,D=0,j=15/2,w=N-2*E,u=N-2*D;var G=document.getElementById(H+"_jGr
|