Best JavaScript code snippet using webdriverio-monorepo
exportfilms.js
Source:exportfilms.js
1/*2Copyright (c) 2012 John King3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:4The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.5THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.6*/7function writeFilm()8{9 var nfls=0;10 for(var name in FILMS)11 {12 nfls++;13 }14 if(nfls==0)15 {16 alert("No films to export");17 return;18 }19 var flen=100;20 var filmhtml = "<p style='font-weight:bold'>Select the Films you want to Export.</p>";21 for (var name in FILMS)22 {23 flen+=25;24 film=FILMS[name];25 filmhtml+="<p class='check_input'> <input type='checkbox' id='"+film.name+"'><label for='"+film.name+"'>"+film.title+"</label></p>"26 }27 filmhtml+="<input type='button' value=' Export ' onclick='exportFilms()' /> <input type='button' value=' Cancel ' onclick='closedialogue(this)' />"28 29 $("filmexportcontent").innerHTML=filmhtml;30 $("filmexportcontent").style.height=flen+"px";31 $("filmexportbox").style.height=(flen+25)+"px";32 $("filmexportbox").style.visibility="visible";33}34function exportFilms()35{36 var filmwrit=false;37 for (var name in FILMS)38 {39 if($(name).checked)40 {41 filmwrit=true;42 writeFilmHTML(FILMS[name]);43 }44 }45 if(!filmwrit)46 {47 alert("No films were selected!")48 }49}50function writeFilmHTML(film)51{ 52 var flel;53 var shape,sprite;54 var dl=parseInt($("stagearea").style.left);55 var dt=parseInt($("stagearea").style.top);56 newwindow=window.open(film.name,film.name);57 newwindow.document.writeln('<!DOCTYPE HTML>');58 newwindow.document.writeln('<html>');59 newwindow.document.writeln(SPACES.substr(0,3)+'<head>');60 newwindow.document.writeln(SPACES.substr(0,6)+'<style>');61 newwindow.document.writeln(SPACES.substr(0,9)+'div {');62 newwindow.document.writeln(SPACES.substr(0,12)+'position:absolute;');63 newwindow.document.writeln (SPACES.substr(0,9)+'}');64 newwindow.document.writeln ('');65 newwindow.document.writeln(SPACES.substr(0,9)+'#screen {');66 newwindow.document.writeln(SPACES.substr(0,12)+'height:'+parseInt($("stagearea").style.height)+'px;');67 newwindow.document.writeln(SPACES.substr(0,12)+'width:'+parseInt($("stagearea").style.width)+'px;');68 newwindow.document.writeln(SPACES.substr(0,12)+'clip:rect(0px,'+(parseInt($("stagearea").style.width))+'px,'+(parseInt($("stagearea").style.height))+'px,0px);');69 newwindow.document.writeln (SPACES.substr(0,9)+'}');70 newwindow.document.writeln(SPACES.substr(0,9)+'#frame {');71 newwindow.document.writeln(SPACES.substr(0,12)+'height:'+parseInt($("stagearea").style.height)+'px;');72 newwindow.document.writeln(SPACES.substr(0,12)+'width:'+parseInt($("stagearea").style.width)+'px;');73 newwindow.document.writeln(SPACES.substr(0,12)+'border:black 1px solid;');74 newwindow.document.writeln (SPACES.substr(0,9)+'}');75 newwindow.document.writeln(SPACES.substr(0,6)+'</style>'); 76 newwindow.document.writeln ('');77 newwindow.document.writeln(SPACES.substr(0,6)+'<script type="text/javascript" src = "canvimation_script.js" ></script>');78 newwindow.document.writeln(SPACES.substr(0,6)+'<!--[IF LT IE 9]><script type="text/javascript" src = "excanvas.js" ></script><![endif]-->');79 newwindow.document.writeln(SPACES.substr(0,6)+'<script type="text/javascript">');80 newwindow.document.writeln(SPACES.substr(0,9)+'var SCRW='+(2*SCRW)+';');81 newwindow.document.writeln(SPACES.substr(0,9)+'var SCRH='+(2*SCRH)+';');82 newwindow.document.writeln(SPACES.substr(0,9)+'var flel;');83 newwindow.document.writeln(SPACES.substr(0,9)+'var scene;');84 newwindow.document.writeln(SPACES.substr(0,9)+'var shape;');85 newwindow.document.writeln(SPACES.substr(0,9)+'var tween;');86 newwindow.document.writeln(SPACES.substr(0,9)+'var sprite;');87 newwindow.document.writeln(SPACES.substr(0,9)+'var film;');88 newwindow.document.writeln(SPACES.substr(0,9)+'var TRAINS={};');89 newwindow.document.writeln(SPACES.substr(0,9)+'var LOCUS=false;');90 newwindow.document.writeln ('');91 newwindow.document.writeln(SPACES.substr(0,9)+'function main() {');92 newwindow.document.writeln(SPACES.substr(0,12)+'film = new Film("'+film.name+'");');93 94 for(var el in film.elements)95 {96 flel=film.elements[el];97 newwindow.document.writeln ('');98 newwindow.document.writeln(SPACES.substr(0,0)+'//---------- Film Element----------------------------');99 newwindow.document.writeln(SPACES.substr(0,12)+'film.elements["'+el+'"]={};');100 newwindow.document.writeln(SPACES.substr(0,12)+'flel=film.elements["'+el+'"];');101 newwindow.document.writeln(SPACES.substr(0,12)+'flel.name="'+flel.name+'",');102 newwindow.document.writeln(SPACES.substr(0,12)+'flel.id="'+flel.id+'",');103 newwindow.document.writeln(SPACES.substr(0,12)+'flel.title="'+flel.title+'",');104 newwindow.document.writeln(SPACES.substr(0,12)+'flel.source="'+flel.source+'",');105 newwindow.document.writeln(SPACES.substr(0,12)+'flel.A="'+flel.A+'",');106 newwindow.document.writeln(SPACES.substr(0,12)+'flel.D="'+flel.D+'",');107 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv=document.createElement("div");');108 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.id="'+flel.id+'";');109 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.top="'+(flel.yOffset-dt)+'px";');110 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.left="'+(flel.xOffset-dl)+'px";');111 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.width="'+SCRW+'px";');112 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.height="'+SCRH+'px";');113 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.zIndex='+flel.layer+';');114 newwindow.document.writeln(SPACES.substr(0,12)+'eldiv.style.visibility="hidden";');115 newwindow.document.writeln(SPACES.substr(0,12)+'$("screen").appendChild(eldiv);');116 switch(flel.source)117 {118 case 'scene':119 newwindow.document.writeln ('');120 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Scene---Base is '+flel.title+'-------------------------');121 for (var name in flel.elm.shapes)122 {123 shape=flel.elm.shapes[name];124 shape.shapeHTML(flel.id);125 newwindow.document.writeln(SPACES.substr(0,12)+'shape.draw();');126 newwindow.document.writeln ('');127 }128 newwindow.document.writeln(SPACES.substr(0,12)+'scene=new Scene("'+flel.id+'");');129 newwindow.document.writeln(SPACES.substr(0,12)+'flel.elm=scene;');130 newwindow.document.writeln (''); 131 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Scene---Base is '+flel.title+'-------------------------');132 break133 case "tween":134 newwindow.document.writeln(SPACES.substr(0,12)+'flel.R="'+flel.R+'",');135 newwindow.document.writeln(SPACES.substr(0,12)+'flel.S="'+flel.S+'",');136 tween=flel.elm;137 tween.tweenHTML(flel.id);138 newwindow.document.writeln(SPACES.substr(0,12)+'flel.elm=tween;');139 newwindow.document.writeln(SPACES.substr(0,12)+'flel.elm.prepareTweens();');140 break141 case 'sprite':142 newwindow.document.writeln(SPACES.substr(0,12)+'flel.R="'+flel.R+'",');143 newwindow.document.writeln(SPACES.substr(0,12)+'flel.S="'+flel.S+'",');144 sprite=flel.elm;145 sprite.spriteHTML(flel.id)146 newwindow.document.writeln(SPACES.substr(0,12)+'flel.elm=sprite;');147 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.setPoints();');148 break149 }150 newwindow.document.writeln ('');151 newwindow.document.writeln(SPACES.substr(0,0)+'//---------- End Of Film Element -- Type '+flel.source+'--Base is '+flel.title+'--------------------------');152 }153 newwindow.document.writeln ('');154 newwindow.document.writeln(SPACES.substr(0,12)+'film.setUp();');155 newwindow.document.writeln(SPACES.substr(0,9)+'}');156 newwindow.document.writeln(SPACES.substr(0,6)+'</script>'); 157 newwindow.document.writeln(SPACES.substr(0,3)+'</head>');158 newwindow.document.writeln(SPACES.substr(0,3)+'<body onload="main()">');159 newwindow.document.writeln(SPACES.substr(0,6)+'<div id="screen"></div>'); 160 newwindow.document.writeln(SPACES.substr(0,6)+'<div id="frame"></div>'); 161 newwindow.document.writeln(SPACES.substr(0,3)+'</body>');162 newwindow.document.writeln('</html>');163 newwindow.document.close(); 164}165function shapeHTML(fleldiv)166{167 var node;168 var nc1x,nc1y,nc2x,nc2y;169 newwindow.document.writeln ('');170 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- Type Shape---Base is '+this.title+'-------------------------'); 171 newwindow.document.writeln(SPACES.substr(0,12)+'shape=new Shape("'+this.name+'");');172 newwindow.document.writeln(SPACES.substr(0,12)+'shape.title="'+this.title +'";');173 newwindow.document.writeln(SPACES.substr(0,12)+'shape.open='+this.open +';');174 newwindow.document.writeln(SPACES.substr(0,12)+'shape.editable='+this.editable +';');175 newwindow.document.writeln(SPACES.substr(0,12)+'shape.type="'+this.type +'";');176 newwindow.document.writeln(SPACES.substr(0,12)+'shape.lineWidth ="'+this.lineWidth +'";');177 newwindow.document.writeln(SPACES.substr(0,12)+'shape.lineCap="'+this.lineCap +'";');178 newwindow.document.writeln(SPACES.substr(0,12)+'shape.lineJoin="'+ this.lineJoin +'";'); 179 newwindow.document.writeln(SPACES.substr(0,12)+'shape.justfill='+ this.justfill +';'); 180 newwindow.document.writeln(SPACES.substr(0,12)+'shape.linearfill='+ this.linearfill +';'); 181 newwindow.document.writeln(SPACES.substr(0,12)+'shape.stopn="'+ this.stopn +'";'); 182 newwindow.document.writeln(SPACES.substr(0,12)+'shape.shadow='+this.shadow +';');183 newwindow.document.writeln(SPACES.substr(0,12)+'shape.shadowOffsetX="'+ this.shadowOffsetX +'";'); 184 newwindow.document.writeln(SPACES.substr(0,12)+'shape.shadowOffsetY ="'+ this.shadowOffsetY +'";'); 185 newwindow.document.writeln(SPACES.substr(0,12)+'shape.shadowBlur="'+ this.shadowBlur +'";'); 186 newwindow.document.writeln(SPACES.substr(0,12)+'shape.zIndex="'+this.zIndex +'";');187 newwindow.document.writeln(SPACES.substr(0,12)+'shape.crnradius="'+this.crnradius +'";');188 newwindow.document.writeln(SPACES.substr(0,12)+'shape.strokeStyle=['+this.strokeStyle+'];');189 newwindow.document.writeln(SPACES.substr(0,12)+'shape.fillStyle=['+this.fillStyle+'];');190 newwindow.document.writeln(SPACES.substr(0,12)+'shape.lineGrad=['+this.lineGrad+'];');191 newwindow.document.writeln(SPACES.substr(0,12)+'shape.radGrad=['+this.radGrad+'];');192 newwindow.document.writeln(SPACES.substr(0,12)+'shape.shadowColor=['+ this.shadowColor +'];'); 193 newwindow.document.writeln(SPACES.substr(0,12)+'shape.colorStops=[');194 for(var i=0;i<this.colorStops.length-1;i++)195 {196 newwindow.document.writeln(SPACES.substr(0,15)+'['+this.colorStops[i]+'],'); 197 }198 newwindow.document.writeln(SPACES.substr(0,15)+'['+this.colorStops[i]+']'); 199 newwindow.document.writeln(SPACES.substr(0,12)+'];');200 node=this.path.next;201 while(node.point.x!="end")202 {203 204 newwindow.document.writeln(SPACES.substr(0,12)+'p=new Point('+node.point.x+','+node.point.y+');');205 if(node.ctrl1.x=="non")206 {207 nc1x='"non"';208 nc1y='"non"';209 nc2x='"non"';210 nc2y='"non"';211 }212 else213 {214 nc1x=node.ctrl1.x;215 nc1y=node.ctrl1.y;216 nc2x=node.ctrl2.x;217 nc2y=node.ctrl2.y;218 }219 newwindow.document.writeln(SPACES.substr(0,12)+'c1=new Point('+nc1x+','+nc1y+');');220 newwindow.document.writeln(SPACES.substr(0,12)+'c2=new Point('+nc2x+','+nc2y+');');221 newwindow.document.writeln(SPACES.substr(0,12)+'node=new Node(p,c1,c2);');222 newwindow.document.writeln(SPACES.substr(0,12)+'node.corner="'+node.corner+'";');223 newwindow.document.writeln(SPACES.substr(0,12)+'node.vertex="'+node.vertex+'";');224 newwindow.document.writeln(SPACES.substr(0,12)+'shape.addNode(node);');225 node=node.next;226 }227 newwindow.document.writeln(SPACES.substr(0,12)+'shape.addTo($("'+fleldiv+'"));');228 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- End Of Shape---Base is '+this.title+'-------------------------');229}230function pathshapeHTML(type) //type is string 'node', 'ctrl1' 'ctrl2'231{232 var node;233 var nc1x,nc1y,nc2x,nc2y;234 newwindow.document.writeln ('');235 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- Type Path Shape--- '+this.name+' '+type+' -------------------------'); 236 newwindow.document.writeln(SPACES.substr(0,12)+'pathshape=new PathShape("'+this.name+'");');237 node=this.path.next;238 while(node.point.x!="end")239 {240 241 newwindow.document.writeln(SPACES.substr(0,12)+'p=new Point('+node.point.x+','+node.point.y+');');242 if(node.ctrl1.x=="non")243 {244 nc1x='"non"';245 nc1y='"non"';246 nc2x='"non"';247 nc2y='"non"';248 }249 else250 {251 nc1x=node.ctrl1.x;252 nc1y=node.ctrl1.y;253 nc2x=node.ctrl2.x;254 nc2y=node.ctrl2.y;255 }256 newwindow.document.writeln(SPACES.substr(0,12)+'c1=new Point('+nc1x+','+nc1y+');');257 newwindow.document.writeln(SPACES.substr(0,12)+'c2=new Point('+nc2x+','+nc2y+');');258 newwindow.document.writeln(SPACES.substr(0,12)+'pathnode=new Node(p,c1,c2);');259 newwindow.document.writeln(SPACES.substr(0,12)+'pathnode.corner="'+node.corner+'";');260 newwindow.document.writeln(SPACES.substr(0,12)+'pathnode.vertex="'+node.vertex+'";');261 newwindow.document.writeln(SPACES.substr(0,12)+'pathshape.addNode(pathnode);');262 node=node.next;263 }264 newwindow.document.writeln(SPACES.substr(0,12)+'node.'+type+'path=pathshape');265 if(type=="node")266 {267 newwindow.document.writeln(SPACES.substr(0,12)+'node.nodepath.nodeTweening={');268 newwindow.document.writeln(SPACES.substr(0,42)+'active:'+this.nodeTweening.active+',');269 if(isNaN(this.nodeTweening.repeat))270 {271 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');272 }273 else274 {275 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.nodeTweening.repeat+',');276 }277 newwindow.document.writeln(SPACES.substr(0,42)+'yoyo:'+this.nodeTweening.yoyo+',');278 newwindow.document.writeln(SPACES.substr(0,42)+'twtime:'+this.nodeTweening.twtime+','); 279 newwindow.document.writeln(SPACES.substr(0,12)+'}'); 280 newwindow.document.writeln(SPACES.substr(0,12)+'copynode.nodepath=node.nodepath');281 }282 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- End Of Path Shape--- '+this.name+' '+type+' -------------------------');283}284function tweenHTML(fleldiv)285{286 var shape, copy, tweenshape;287 if(this.nodeTweening.active || this.pointTweening)288 {289 var npths=0;290 for(var name in this.nodePaths)291 {292 npths++293 }294 if(npths==0)295 {296 this.startNodePaths();297 }298 else299 {300 this.setNodePaths();301 }302 }303 this.prepareTweens();304 newwindow.document.writeln ('');305 newwindow.document.writeln(SPACES.substr(0,3)+'//--- Type Tween---Base is '+this.title+'-----------------------------');306 newwindow.document.writeln(SPACES.substr(0,12)+'tween=new Tween("'+this.name+'");');307 shape=this.getShape();308 newwindow.document.writeln ('');309 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Tween Shape---Base is '+shape.title+'-------------------------');310 shape.shapeHTML(fleldiv);311 newwindow.document.writeln(SPACES.substr(0,12)+'shape.centreOfRotation={');312 newwindow.document.writeln(SPACES.substr(0,40)+'x:'+shape.group.centreOfRotation.x+',');313 newwindow.document.writeln(SPACES.substr(0,40)+'y:'+shape.group.centreOfRotation.y+',');314 newwindow.document.writeln(SPACES.substr(0,12)+'}');315 newwindow.document.writeln(SPACES.substr(0,12)+'tween.shape=shape;');316 copy=this.copy.getShape();317 newwindow.document.writeln ('');318 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Tween Copy---Base is '+copy.title+'-------------------------');319 copy.shapeHTML(fleldiv);320 newwindow.document.writeln(SPACES.substr(0,12)+'shape.centreOfRotation={');321 newwindow.document.writeln(SPACES.substr(0,40)+'x:'+copy.group.centreOfRotation.x+',');322 newwindow.document.writeln(SPACES.substr(0,40)+'y:'+copy.group.centreOfRotation.y+',');323 newwindow.document.writeln(SPACES.substr(0,12)+'}');324 newwindow.document.writeln(SPACES.substr(0,12)+'tween.copy=shape;');325 newwindow.document.writeln ('');326 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Tween Tweenshape---Base is '+this.tweenshape.title+'-------------------------');327 this.tweenshape.shapeHTML(fleldiv);328 newwindow.document.writeln(SPACES.substr(0,12)+'tween.tweenshape=shape;');329 newwindow.document.writeln(SPACES.substr(0,12)+'tween.translate = {');330 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.translate.active+',');331 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.translate.twtime+',');332 if(isNaN(this.translate.repeat))333 {334 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');335 }336 else337 {338 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.translate.repeat+',');339 }340 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.translate.yoyo+',');341 newwindow.document.writeln(SPACES.substr(0,12)+'};');342 newwindow.document.writeln(SPACES.substr(0,12)+'tween.rotate = {');343 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.rotate.active+',');344 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.rotate.twtime+',');345 if(isNaN(this.rotate.repeat))346 {347 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');348 }349 else350 {351 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.rotate.repeat+',');352 }353 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.rotate.yoyo+',');354 newwindow.document.writeln(SPACES.substr(0,12)+'};');355 newwindow.document.writeln(SPACES.substr(0,12)+'tween.linestyles = {');356 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.linestyles.active+',');357 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.linestyles.twtime+',');358 if(isNaN(this.linestyles.repeat))359 {360 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');361 }362 else363 {364 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.linestyles.repeat+',');365 }366 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.linestyles.yoyo+',');367 newwindow.document.writeln(SPACES.substr(0,12)+'};');368 newwindow.document.writeln(SPACES.substr(0,12)+'tween.linecolour = {');369 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.linecolour.active+',');370 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.linecolour.twtime+',');371 if(isNaN(this.linecolour.repeat))372 {373 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');374 }375 else376 {377 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.linecolour.repeat+',');378 }379 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.linecolour.yoyo+',');380 newwindow.document.writeln(SPACES.substr(0,12)+'};');381 newwindow.document.writeln(SPACES.substr(0,12)+'tween.fillcolour = {');382 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.fillcolour.active+',');383 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.fillcolour.twtime+',');384 if(isNaN(this.fillcolour.repeat))385 {386 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');387 }388 else389 {390 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.fillcolour.repeat+',');391 }392 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.fillcolour.yoyo+',');393 newwindow.document.writeln(SPACES.substr(0,12)+'};');394 newwindow.document.writeln(SPACES.substr(0,12)+'tween.gradfill = {');395 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.gradfill.active+',');396 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.gradfill.twtime+',');397 if(isNaN(this.gradfill.repeat))398 {399 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');400 }401 else402 {403 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.gradfill.repeat+',');404 }405 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.gradfill.yoyo+',');406 newwindow.document.writeln(SPACES.substr(0,12)+'};');407 newwindow.document.writeln(SPACES.substr(0,12)+'tween.shadow = {');408 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.shadow.active+',');409 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.shadow.twtime+',');410 if(isNaN(this.shadow.repeat))411 {412 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');413 }414 else415 {416 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.shadow.repeat+',');417 }418 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.shadow.yoyo+',');419 newwindow.document.writeln(SPACES.substr(0,12)+'};');420 newwindow.document.writeln(SPACES.substr(0,12)+'tween.edit = {');421 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.edit.active+',');422 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.edit.twtime+',');423 if(isNaN(this.edit.repeat))424 {425 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');426 }427 else428 {429 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.edit.repeat+',');430 }431 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.edit.yoyo+',');432 newwindow.document.writeln(SPACES.substr(0,12)+'};');433 newwindow.document.writeln(SPACES.substr(0,12)+'tween.nodeTweening = {');434 newwindow.document.writeln(SPACES.substr(0,35)+'active:'+this.nodeTweening.active+',');435 newwindow.document.writeln(SPACES.substr(0,35)+'twtime:'+this.nodeTweening.twtime+',');436 if(isNaN(this.nodeTweening.repeat))437 {438 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:"c",');439 }440 else441 {442 newwindow.document.writeln(SPACES.substr(0,35)+'repeat:'+this.nodeTweening.repeat+',');443 }444 newwindow.document.writeln(SPACES.substr(0,35)+'yoyo:'+this.nodeTweening.yoyo+',');445 newwindow.document.writeln(SPACES.substr(0,12)+'};');446 newwindow.document.writeln(SPACES.substr(0,12)+'tween.pointTweening='+this.pointTweening+';');447 newwindow.document.writeln(SPACES.substr(0,12)+'tween.reverse='+this.reverse+';');448 if(isNaN(this.maxruntime))449 {450 newwindow.document.writeln(SPACES.substr(0,12)+'tween.maxruntime="always";');451 }452 else453 {454 newwindow.document.writeln(SPACES.substr(0,12)+'tween.maxruntime='+this.maxruntime+';');455 }456 if(this.nodeTweening.active || this.pointTweening)457 {458 var node=this.getShape().path.next;459 newwindow.document.writeln(SPACES.substr(0,12)+'node=tween.shape.path.next;');460 newwindow.document.writeln(SPACES.substr(0,12)+'copynode=tween.copy.path.next;');461 while(node.point.x!="end")462 {463 node.nodepath.pathshapeHTML('node');464 if(node.vertex=="B") 465 {466 node.ctrl1path.pathshapeHTML('ctrl1');467 node.ctrl2path.pathshapeHTML('ctrl2');468 }469 newwindow.document.writeln(SPACES.substr(0,12)+'node=node.next;');470 newwindow.document.writeln(SPACES.substr(0,12)+'copynode=copynode.next;');471 node=node.next;472 }473 }474 newwindow.document.writeln ('');475 newwindow.document.writeln(SPACES.substr(0,3)+'//--- Type Tween---Base is '+this.title+'-----------------------------');476}477function spriteHTML(fleldiv)478{479 var shape,shapes;480 var train;481 switch (this.engine)482 {483 case "scene":484 newwindow.document.writeln ('');485 newwindow.document.writeln(SPACES.substr(0,3)+'//--- Type Sprite---Base is '+this.title+'-----------------------------');486 newwindow.document.writeln ('');487 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Train Scene---Base is '+this.train.title+'-------------------------');488 newwindow.document.writeln(SPACES.substr(0,12)+'scene=new Scene("'+this.train.name+'");');489 shapes=this.train.shapes;490 for (var name in shapes)491 {492 shape=shapes[name];493 shape.shapeHTML(fleldiv);494 newwindow.document.writeln(SPACES.substr(0,12)+'scene.shapes[shape.name]=shape;');495 }496 newwindow.document.writeln ('');497 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- End of Train Scene---Base is '+this.train.title+'-------------------------');498 break499 case "tween":500 newwindow.document.writeln ('');501 newwindow.document.writeln(SPACES.substr(0,3)+'//--- Type Sprite---Base is '+this.title+'-----------------------------');502 newwindow.document.writeln ('');503 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- Type Train Tween---Base is '+this.train.title+'-------------------------');504 this.train.tweenHTML(fleldiv);505 newwindow.document.writeln ('');506 newwindow.document.writeln(SPACES.substr(0,3)+'//---------- End of Train Tween---Base is '+this.train.title+'-------------------------');507 break508 default:509 this.train.spriteHTML(fleldiv);510 break511 }512 newwindow.document.writeln ('');513 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- Track ---Base is '+this.track.title+'-------------------------');514 shape=this.track.getShape();515 shape.shapeHTML(fleldiv);516 newwindow.document.writeln(SPACES.substr(0,12)+'track=new Track("'+this.track.name+'");');517 newwindow.document.writeln(SPACES.substr(0,12)+'track.shape=shape;');518 if(isNaN(this.track.repeats))519 {520 newwindow.document.writeln(SPACES.substr(0,12)+'track.repeats="'+this.track.repeats+'";');521 }522 else523 {524 newwindow.document.writeln(SPACES.substr(0,12)+'track.repeats='+this.track.repeats+';');525 }526 newwindow.document.writeln(SPACES.substr(0,12)+'track.visible='+this.track.visible+';');527 newwindow.document.writeln(SPACES.substr(0,12)+'track.yoyo='+this.track.yoyo+';');528 newwindow.document.writeln(SPACES.substr(0,12)+'track.shape.addTo($("'+fleldiv+'"));');529 newwindow.document.writeln ('');530 newwindow.document.writeln(SPACES.substr(0,6)+'//---------- End Of Track ---Base is '+this.track.title+'-------------------------');531 newwindow.document.writeln ('');532 newwindow.document.writeln(SPACES.substr(0,12)+'sprite=new Sprite("'+this.name+'");');533 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.train='+this.engine+';');534 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.engine="'+this.engine+'";');535 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.track=track;');536 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.ptime='+this.ptime+';');537 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.pointer='+this.pointer+';');538 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.usevec='+this.usevec+';');539 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.expanded='+this.expanded+';');540 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.finishmove='+this.finishmove+';');541 newwindow.document.writeln(SPACES.substr(0,12)+'sprite.vector={xs:'+this.vector.xs+',xe:'+this.vector.xe+',ys:'+this.vector.ys+',ye:'+this.vector.ye+',psi:'+this.vector.psi+'};');542 newwindow.document.writeln ('');543 newwindow.document.writeln(SPACES.substr(0,3)+'//--- End Of Sprite---Base is '+this.title+'-----------------------------');544 545 newwindow.document.writeln(SPACES.substr(0,12)+'TRAINS["'+this.name+'"]=sprite;');546 return 'TRAINS["'+this.name+'"];';...
newWin.js
Source:newWin.js
1<!--2/*3// ë´ ìëì° - ì¬ì§4function viewImage(name,url,width,height,caption)5{6 if (caption == null) {7 caption = " ";8 }9 width_str = width + 40;10 height_str = height + 100;11 newWindow = window.open('',name,'left=0,top=0,width='+width_str+',height='+height_str+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');12 if (newWindow != null && newWindow.opener == null)13 newWindow.opener = window;14 newWindow.document.write("<html><head><title>Image View</title>\n");15 //newWindow.document.write("</head><body>\n");16 newWindow.document.write("</head><body background='/kr/imgs/popup_bg_2.gif' onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);moveTo((screen.width - (document.images[0].width + 40)) / 2, (screen.height - (document.images[0].height + 130)) / 2)'>\n");17 //newWindow.document.write("</head><body onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);'>\n");18 newWindow.document.write("<div align=center><Table border=0 cellpadding=0 cellspacing=0>\n");19 newWindow.document.write("<tr height='40' style='color:#6E684C;font-size:15px;font-weight:bold;' align='center'><td>â "+caption+"</td></tr>\n");20 newWindow.document.write("<tr><td height='2' bgcolor='#6B6549'></td></tr><tr><td height='2'></td></tr>");21 newWindow.document.write("<tr><td align=center>");22 newWindow.document.write("<img src='/kr/L_image/"+url+"' border=0 style='border:1px solid #948D6C;' onfocus='blur();' onClick='javascript:self.close()'>");23 newWindow.document.write("</td></tr><tr><td align=right style=padding-right:5px;'><a href='#' onfocus='blur();'onClick='javascript:self.close()'><img src='/kr/imgs/popup_close2.gif' border='0'></a>");24 newWindow.document.write("</td></tr><tr><td height=3></td></tr>");25 newWindow.document.write("<tr><td align=center><img src='/kr/imgs/popup_copyright1_2.gif' border='0'></td></tr>");26 newWindow.document.write("</table></div></body></html>");27 //newWindow.document.close();28}29*/30// ë´ ìëì° - ì¬ì§31function viewImage(name,url,width,height,caption)32{33 if (caption == null) {34 caption = " ";35 }36 width_str = width + 40;37 height_str = height + 100;38 newWindow = window.open('',name,'left=0,top=0,width='+width_str+',height='+height_str+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');39 if (newWindow != null && newWindow.opener == null)40 newWindow.opener = window;41 newWindow.document.write("<html><head><title>Image View</title>\n");42 newWindow.document.write("<BODY bgcolor='#EEECEA' onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);moveTo((screen.width - (document.images[0].width + 40)) / 2, (screen.height - (document.images[0].height + 130)) / 2)'>\n");43 newWindow.document.write("<TABLE width='100%' border='0'>");44 newWindow.document.write("<TR><TD height='20' align='center'><font style='font-family:굴림;font-size:12px;color:#666666;font-weight:bold;'>"+caption+"</font></TD></TR>");45 newWindow.document.write("<TR><TD><TABLE width='100%'>");46 newWindow.document.write("<TR><TD width='20'></TD>");47 newWindow.document.write("<TD align='center'><img src='/kr/L_image/"+url+"' border=0 style='border:1px solid #C6C2BD;' onfocus='blur();' onClick='javascript:self.close()'></TD>");48 newWindow.document.write("<TD width='20'></TD></TR></TABLE></TD></TR>");49 newWindow.document.write("<TR><TD><TABLE width='100%' border='0'><TR>");50 newWindow.document.write("<TD width='57'></TD><TD align='center'><img src='/kr/preserv/tools/img/copyright2.gif' border='0'></TD>");51 newWindow.document.write("<TD align='right' width='57'><a href='#' onClick='javascript:self.close()'><img src='/kr/preserv/tools/img/btn_close.gif' border='0'></a></TD>");52 newWindow.document.write("</TR></TABLE></TD></TR></TABLE>");53 newWindow.document.write("</BODY></HTML>");54 //newWindow.document.close();55}56// ë´ ìëì°57function viewImage2(name,url,width,height,caption)58{59 if (caption == null) {60 caption = " ";61 }62 //newWindow = window.open(str,"ViewImage","status=yes,resialble=no,menubar=no,scrollbars=yes,width=1010,height=720");63 width_str = width + 40;64 height_str = height + 110;65 newWindow = window.open("/kr/newWin/image_view.jsp?caption="+caption+"&url="+url,"ViewImage","left=0,top=0,width="+width_str+",height="+height_str+",toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no");66}67// ë´ ìëì° - ê³ ê³ íì¬ì 68function viewImage3(name,url,width,height,caption)69{70 if (caption == null) {71 caption = " ";72 }73 width_str = width + 40;74 height_str = height + 100;75 newWindow = window.open('',name,'left=0,top=0,width='+width_str+',height='+height_str+',toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no');76 if (newWindow != null && newWindow.opener == null)77 newWindow.opener = window;78 newWindow.document.write("<html><head><title>Image View</title>\n");79 //newWindow.document.write("</head><body>\n");80 newWindow.document.write("</head><body background='/kr/imgs/popup_bg_2.gif' onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);moveTo((screen.width - (document.images[0].width + 40)) / 2, (screen.height - (document.images[0].height + 130)) / 2)'>\n");81 //newWindow.document.write("</head><body onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);'>\n");82 newWindow.document.write("<div align='center'><Table border='0' cellpadding='0' cellspacing='0'>\n");83 newWindow.document.write("<tr height='40' style='color:#6E684C;font-size:15px;font-weight:bold;' align='center'><td>â "+caption+"</td></tr>\n");84 newWindow.document.write("<tr><td height='2' bgcolor='#6B6549'></td></tr><tr><td height='2'></td></tr>");85 newWindow.document.write("<tr><td align='left'>");86 newWindow.document.write("<img src='./pic/"+url+"' border=0 style='border:1px solid #948D6C;' onfocus='blur();' onClick='javascript:self.close()'>");87 newWindow.document.write("</td></tr><tr><td align=right style=padding-right:55px;'><a href='#' onfocus='blur();' onClick='javascript:self.close()'><img src='/kr/imgs/popup_close2.gif' border='0'></a>");88 newWindow.document.write("</td></tr><tr><td height=3></td></tr>");89 newWindow.document.write("<tr><td align=center><img src='/kr/imgs/popup_copyright1_2.gif' border='0'></td></tr>");90 newWindow.document.write("</table></div></body></html>");91 //newWindow.document.close();92}93// í리ë¡ë94function MM_preloadImages() { //v3.095 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();96 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)97 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}98}99// ì íë©ë´100function MM_jumpMenu(targ,selObj,restore){ //v3.0101 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");102 if (restore) selObj.selectedIndex=0;103}104function resize_iframe(ifrmName, ifrmHeight){105 document.all(""+ifrmName).style.height = ifrmHeight;106//ëì´ë ì¤í¬ë¡¤ ë±ì ë´ì ì ë¹í ì¡°ì 107}108// ë´ ìëì° - ë´ì©109/*110function viewPopup(name,url,width,height,caption)111{112 if (caption == null) {113 caption = " ";114 }115 width_str = width + 40;116 height_str = height + 100;117 newWindow = window.open('',name,'left=0,top=0,width='+width_str+',height=600,toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes');118 if (newWindow != null && newWindow.opener == null)119 newWindow.opener = window;120 newWindow.document.write("<html><head><title>"+caption+"</title>\n");121 newWindow.document.write("</head><body background='/kr/imgs/popup_bg2_2.gif' onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);moveTo((screen.width - (document.images[0].width + 40)) / 2, (screen.height - (document.images[0].height + 130)) / 2)'>\n");122 newWindow.document.write("<div align=center><Table border=0 cellpadding=0 cellspacing=0>\n");123 newWindow.document.write("<tr height='40' style='color:#3B3B3B;font-size:15px;font-weight:bold;' align='center'><td><a name='top'>â "+caption+"</td></tr>\n");124 newWindow.document.write("<tr><td height='2' bgcolor='#333333'></td></tr><tr><td height='2'></td></tr>");125 newWindow.document.write("<tr><td valign=top><TABLE Border=0 Cellpadding=0 cellspacing=1 width=100% bgcolor=#333333><TR bgcolor='#FFFFFF'><TD align=center>");126 newWindow.document.write("<iframe src='/kr/"+url+"' style='border:0;' frameborder='0' width='"+width+"' height='"+height+ "' scrolling='no' id='popFrame' name='popFrame'></iframe>");127 newWindow.document.write("</TD></TR></TABLE></td></tr><tr><td align=right style='padding-right:5px;'><a href='#top' onfocus='blur();'><img src='/kr/imgs/popup_top2.gif' border='0'></a>");128 newWindow.document.write("</td></tr><tr><td height=3></td></tr>");129 newWindow.document.write("<tr><td align=center><img src='/kr/imgs/popup_copyright2_2.gif' border='0'></td></tr>");130 newWindow.document.write("</table></div></body></html>");131 //newWindow.document.close();132}133*/134// ë´ ìëì° - ë´ì©135function viewPopup(name,url,width,height,caption)136{137 if (caption == null) {138 caption = " ";139 }140 width_str = width + 60;141 height_str = height + 100;142 newWindow = window.open('',name,'left=0,top=0,width='+width_str+',height=600,toolbar=no,menubar=no,status=yes,scrollbars=yes,resizable=yes');143 if (newWindow != null && newWindow.opener == null)144 newWindow.opener = window;145 newWindow.document.write("<HTML><HEAD><title>"+caption+"</title></HEAD>\n");146 newWindow.document.write("<BODY bgcolor='#DDDAD6' onload='resizeTo(document.images[0].width + 40,document.images[0].height + 130);moveTo((screen.width - (document.images[0].width + 40)) / 2, (screen.height - (document.images[0].height + 130)) / 2)'>\n");147 newWindow.document.write("<TABLE width='100%' cellspacing='0' cellpadding='0' border='0'>\n");148 newWindow.document.write("<TR><TD width='10' height='10'><img src='/kr/preserv/tools/img/bg_top_left.gif' border='0'></TD>\n");149 newWindow.document.write("<TD background='/kr/preserv/tools/img/bg_top_middle.gif'></TD>\n");150 newWindow.document.write("<TD width='10'><img src='/kr/preserv/tools/img/bg_top_right.gif' border='0'></TD></TR><TR>\n");151 newWindow.document.write("<TD background='/kr/preserv/tools/img/bg_left.gif'></TD>\n");152 newWindow.document.write("<TD bgcolor='#ffffff' align='center'>\n");153 newWindow.document.write("<TABLE width='100%' height='40' cellspacing='0' cellpadding='0' border='0'>\n");154 newWindow.document.write("<TR><TD width='14'><img src='/kr/preserv/tools/img/bigtitle_left.gif' border='0'></TD>\n");155 newWindow.document.write("<TD width='15' bgcolor='#A69D8C'><img src='/kr/preserv/tools/img/icon_bigtitle.gif' border='0'></TD>\n");156 newWindow.document.write("<TD bgcolor='#A69D8C'><font style='font-family:굴림;font-size:14px;color:#ffffff;font-weight:bold;'>"+caption+"</font></TD>\n");157 newWindow.document.write("<TD width='14'><img src='/kr/preserv/tools/img/bigtitle_right.gif' border='0'></TD></TR></TABLE>\n");158 newWindow.document.write("<TABLE width='100%' cellspacing='0' cellpadding='0' border='0'>\n");159 newWindow.document.write("<TR><TD height='10'></TD></TR></TABLE>\n");160 newWindow.document.write("<iframe src='/kr/"+url+"' style='border:0;' frameborder='0' width='"+width+"' height='"+height+"' scrolling='no' id='popFrame' name='popFrame'></iframe>\n");161 newWindow.document.write("</TD><TD background='/kr/preserv/tools/img/bg_right.gif'></TD></TR>\n");162 newWindow.document.write("<TR><TD height='10'><img src='/kr/preserv/tools/img/bg_bottom_left.gif' border='0'></TD>\n");163 newWindow.document.write("<TD background='/kr/preserv/tools/img/bg_bottom_middle.gif'></TD>\n");164 newWindow.document.write("<TD height='10'><img src='/kr/preserv/tools/img/bg_bottom_right.gif' border='0'></TD></TR></TABLE>\n");165 newWindow.document.write("<TABLE width='100%' height='40' cellspacing='0' cellpadding='0' border='0'>\n");166 newWindow.document.write("<TR><TD align='center'><img src='/kr/preserv/tools/img/copyright.gif' border='0'></TD>\n");167 newWindow.document.write("<TD width='40'><a href='javascript:self.close();'><img src='/kr/imgs/btn_close.gif' border='0'></a></TD></TR>\n");168 newWindow.document.write("</TABLE></BODY></HTML>\n");169 //newWindow.document.close();170}171//ë³´ì 기기 ì¤í172function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)173{174 toolbar_str = toolbar ? 'yes' : 'no';175 menubar_str = menubar ? 'yes' : 'no';176 statusbar_str = statusbar ? 'yes' : 'no';177 scrollbar_str = scrollbar ? 'yes' : 'no';178 resizable_str = resizable ? 'yes' : 'no';179 window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);180}181function keywordCheck()182{183 if(document.frmFind.keyword.value=="")184 {185 alert("ê²ìì´ë¥¼ ì
ë ¥í´ì£¼ì¸ì");186 document.frmFind.keyword.focus();187 return false;188 }189 return true;190}191function goFind()192{193 if (keywordCheck())194 document.frmFind.submit()195}196//ëìì보기197function showMovie(media_url) {198 var left = (screen.width - 526) / 2199 var top = (screen.height - 473) / 2200 var url= "/kr/vod/wm.jsp?media_url=" + media_url201 open(url, '', "left=" + left + ",top=" + top +",width=350,height=348,toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no")202}203//ì°¸ì¬ë§ë¹-ê³¼ì ì ì204function OpenWin_0218(){205 window.open('http://www.nrich.go.kr/culture_web/','web','width=1024,height=768,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=150,top=100');206}207//êµë¯¼ì°¸ì¬ë§ë¹208function OpenWin_1119(){209 window.open('http://221.145.178.209/ppc/','ppc','width=1070,height=668,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=150,top=100');210}211//íë³´ì°½-íê°ì 민ìëì´212function OpenWin_0911(){213 window.open('http://www.nrich.go.kr/kr/hanga/','hanga','width=716,height=770,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=150,top=100');214}...
popup.js
Source:popup.js
1//popup2function zipcodeShowPopup(e, name) {3 var value = $(e).val().trim();4 if (value === '') {5 value = '*';6 }7 var newwindow = window.open('../popup/zipcode/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');8 if (window.focus) {9 newwindow.focus()10 }11 return false;12}13function centerShowPopup($eId, $eName, name) {14 setIdBeforeSearch($eId, $eName);15 var value = $eId.val().trim();16 if (value === '') {17 value = '*';18 19 var newwindow = window.open('../popup/center/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');20 if (window.focus) {21 newwindow.focus()22 }23 } else {24 $.ajax({25 url: '/popup/center/search/' + value, 26 type: "GET",27 data: 28 {29 page : 0,30 len : 20031 },32 success: function(data){ 33 if(data){34 if(data.length == 1){ 35 setDataCenter(data[0]); 36 } else { 37 localStorage.setItem("dataCenter", JSON.stringify(data));38 var newwindow = window.open('../popup/center/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');39 if (window.focus) {40 newwindow.focus()41 }42 }43 } 44 }45 46 });47 }48 49 return false;50}51function bankShowPopup($eId, $eName, name) {52 setIdBeforeSearch($eId, $eName);53 var value = $eId.val().trim();54 if (value === '') {55 value = '*';56 57 var newwindow = window.open('../popup/bank/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resize=no, width=900, height=520, left=500,top=200');58 if (window.focus) {59 newwindow.focus()60 }61 } else {62 $.ajax({63 url: '/popup/bank/search/' + value, 64 type: "GET",65 data: 66 {67 page : 0,68 len : 20069 },70 success: function(data){ 71 if(data){72 if(data.length == 1){73 setDataBank(data[0]); 74 } else { 75 localStorage.setItem("dataBank", JSON.stringify(data));76 var newwindow = window.open('../popup/bank/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resize=no, width=900, height=520, left=500,top=200');77 if (window.focus) {78 newwindow.focus()79 }80 }81 } 82 }83 84 });85 }86 87 return false;88}89function memberShowPopup($eId, $eName, name, prgid) {90 setIdBeforeSearch($eId, $eName);91 92 var value = $eId.val().trim();93 if (value === '') {94 value = '*';95 96 var urlpopup = '../popup/member/showpopup/' + value97 if(prgid) {98 urlpopup += '?prgid=' + prgid;99 }100 101 var newwindow = window.open(urlpopup, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');102 if (window.focus) {103 newwindow.focus()104 }105 } else {106 var urlsearch = '../popup/member/search/' + value;107 if(prgid) {108 urlsearch += '?prgid=' + prgid;109 }110 111 $.ajax({112 url: urlsearch, 113 type: "GET",114 data: 115 {116 page : 0,117 len : 100118 },119 success: function(data){ 120 if(data){121 if(data.length == 1){122 setDataMember(data[0]); 123 } else { 124 localStorage.setItem("dataMember", JSON.stringify(data));125 126 var urlpopup = '../popup/member/showpopup/' + value127 if(prgid) {128 urlpopup += '?prgid=' + prgid;129 }130 var newwindow = window.open(urlpopup, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');131 if (window.focus) {132 newwindow.focus()133 }134 }135 }136 137 }138 139 });140 }141 142 return false;143}144function orderShowPopup(e, name) {145 var value = $(e).val().trim();146 if (value === '') {147 value = '*';148 149 150 } 151 var newwindow = window.open('../popup/order/showpopup/' + value + '/*', name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');152 if (window.focus) {153 newwindow.focus()154 }155 156 return false;157}158function productShowPopup($eId, $eName, name) {159 setIdBeforeSearch($eId, $eName);160 var value = $eId.val().trim();161 if (value === '') {162 value = '*';163 164 var newwindow = window.open('../popup/product/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');165 if (window.focus) {166 newwindow.focus()167 }168 } else {169 $.ajax({170 url: '/popup/product/search/' + encodeURIComponent(value), 171 type: "GET",172 data: 173 {174 page : 0,175 len : 200176 },177 success: function(data){178 179 if(data){180 if(data.length == 1){ 181 setDataProduct(data[0]); 182 } else {183 184 localStorage.setItem("dataProduct", JSON.stringify(data));185 var newwindow = window.open('../popup/product/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');186 if (window.focus) {187 newwindow.focus()188 }189 }190 }191 192 }193 194 });195 }196 197 198 return false;199}200function pdtCateShowPopup($eId, $eName, name) {201 202 203 var value = $eId.val().trim();204 205 if (value === '') {206 value = '*';207 208 var newwindow = window.open('../popup/pdtCate/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=900, height=520, left=500,top=200');209 if (window.focus) {210 newwindow.focus()211 }212 } else {213 $.ajax({214 url: '/popup/pdtCate/search/' + encodeURIComponent(value), 215 type: "GET",216 data: 217 {218 page : 0,219 len : 200220 },221 success: function(data){222 223 if(data){224 if(data.length == 1){ 225 setDataPdtCate(data[0]); 226 } else {227 228 localStorage.setItem("dataCate", JSON.stringify(data));229 var newwindow = window.open('../popup/pdtCate/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=900, height=520, left=500,top=200');230 if (window.focus) {231 newwindow.focus()232 }233 }234 }235 }236 237 });238 }239 return false;240}241function relproductShowPopup($eId, $eName, name) {242 /*var value = $(e).val().trim();243 if (value === '') {244 value = '*';245 }246 var newwindow = window.open('../popup/relproduct/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');247 if (window.focus) {248 newwindow.focus()249 }250 return false;*/251 252 setIdBeforeSearch($eId, $eName);253 var value = $eId.val().trim();254 255 if (value === '') {256 value = '*';257 258 var newwindow = window.open('../popup/relproduct/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');259 if (window.focus) {260 newwindow.focus()261 }262 } else {263 $.ajax({264 url: '/popup/product/relsearch/' + encodeURIComponent(value), 265 type: "GET",266 data: 267 {268 page : 0,269 len : 200270 },271 success: function(data){272 273 if(data){274 if(data.length == 1){ 275 setDataProduct(data[0]); 276 } else {277 278 localStorage.setItem("dataRelProduct", JSON.stringify(data));279 var newwindow = window.open('../popup/relproduct/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');280 if (window.focus) {281 newwindow.focus()282 }283 }284 }285 286 }287 288 });289 }290 return false;291}292function adoAdoShowPopup(e, name) {293 var value = $(e).val().trim();294 if (value === '') {295 value = '*';296 }297 var newwindow = window.open('../popup/adoNo/showpopup/' + value + '/*', name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');298 if (window.focus) {299 newwindow.focus()300 }301 return false;302 303}304function adoAdoPdtPopup(name) {305 var value = '*';306 var newwindow = window.open('../popup/adoPdt/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');307 if (window.focus) {308 newwindow.focus()309 }310 return false;311}312function adoAdoPdtShowPopup($eId, $eName, name) {313 setIdBeforeSearch($eId, $eName);314 315 var value = $eId.val().trim();316 var pathKind = "PC";317 318 if (value === '') {319 value = '*';320 321 var newwindow = window.open('../popup/adoPdt/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');322 if (window.focus) {323 newwindow.focus()324 }325 326 }else{327 $.ajax({328 url: '/popup/autoship/adoPdtList/' + encodeURIComponent(value) + "/" + pathKind,329 type: "GET",330 data: 331 {332 page : 0,333 len : 200334 },335 success: function(data){336 if(data){337 if(data.length == 1){ 338 setDataAdoPdt(data[0]); 339 } else {340 341 localStorage.setItem("dataAdoPdt", JSON.stringify(data));342 var newwindow = window.open('../popup/adoPdt/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');343 if (window.focus) {344 newwindow.focus()345 }346 }347 }348 349 }350 351 });352 353 }354 355 356 return false;357}358function adoAdoPdtPopup(name) {359 var value = '*';360 var newwindow = window.open('../popup/adoPdt/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');361 if (window.focus) {362 newwindow.focus()363 }364 return false;365}366function ordProductPopup(name) {367 var value = '*';368 369 var newwindow = window.open('../popup/ordProduct/showpopup/' + value, name, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=900, height=520, left=500,top=200');370 if (window.focus) {371 newwindow.focus()372 }373 return false;374}...
order2.js
Source:order2.js
1var subtotal=0;2var total=0;3function finalCheckout()4{5 var s1cc=document.getElementsByClassName("select1Color");6 s1c=s1cc;7 var s2cc=document.getElementsByClassName("select2Color");8 s2c=s2cc;9 var s3cc=document.getElementsByClassName("select3Color");10 s3c=s3cc;11 var s4cc=document.getElementsByClassName("select4Color");12 s4c=s4cc;13 window.close();14 var newWindow = window.open();15 newWindow.document.write('<!DOCTYPE html>');16 newWindow.document.write('<html lang="en">');17 newWindow.document.write('<head>');18 newWindow.document.write('<meta charset="utf-8">');19 newWindow.document.write('<title>How The Turntables Furniture Store</title>');20 newWindow.document.write('<meta name="viewport" content="width=device-width, initial-scale=1.0">');21 newWindow.document.write('<link rel="stylesheet" href="style.css">');22 newWindow.document.write('<script src="order2.js"></script>');23 newWindow.document.write('</head>');24 newWindow.document.write('<body>');25 newWindow.document.write('<div class="header">');26 newWindow.document.write('<img src="images/banner.jpg" class="hp" alt="collage of all the characters from the office">');27 newWindow.document.write('<div class="banner-title">');28 newWindow.document.write('<h1>How The Turntables Furniture Store</h1>');29 newWindow.document.write('</div>');30 newWindow.document.write('</div>');31 newWindow.document.write('<div id="nav">');32 newWindow.document.write('<ul>');33 newWindow.document.write('<li><a href="furniture.html">Home</a><li>');34 newWindow.document.write('<li><a href="contact.html">Contact Us</a><li>');35 newWindow.document.write('<li><a href="order.html">Order</a><li>');36 newWindow.document.write('</ul>');37 newWindow.document.write('</div>');38 newWindow.document.write('<div class="row">');39 newWindow.document.write('<div class="leftcolumn">');40 newWindow.document.write('<br>');41 newWindow.document.write('</div>');42 newWindow.document.write('<div class="centercolumn">');43 newWindow.document.write('<h2>Order Summary</h2>');44 if(s1c.length==0)45 {46 }47 else48 {49 for(var i=0;i<s1c.length;i++)50 {51 newWindow.document.write('<p>Round Stool: '+s1c[i].value+', $20</p>');52 subtotal=subtotal+20;53 }54 }55 if(s2c.length==0)56 {57 }58 else59 {60 for(var i=0;i<s2c.length;i++)61 {62 newWindow.document.write('<p>Piano Table: '+s2c[i].value+', $30</p>');63 subtotal=subtotal+30;64 }65 }66 if(s3c.length==0)67 {68 }69 else70 {71 for(var i=0;i<s3c.length;i++)72 {73 newWindow.document.write('<p>Bench Table: '+s3c[i].value+' $40</p>');74 subtotal=subtotal+40;75 }76 }77 if(s4c.length==0)78 {79 }80 else81 {82 for(var i=0;i<s4c.length;i++)83 {84 newWindow.document.write('<p>Stool Table: '+s4c[i].value+', $10</p>');85 subtotal=subtotal+10;86 }87 }88newWindow.document.write('<p>subtotal: $'+subtotal +'</p>');89newWindow.document.write('<p>shipping options (shipping is $10 in 92647 area code, $50 outside of 92647 area code. Pickup is free)</p>')90newWindow.document.write('<form>');91newWindow.document.write('<select name="travel_arriveVia" id="travel_arriveVia" onchange="showfield(this.options[this.selectedIndex].value,'+subtotal+')">');92//newWindow.document.write('<option selected="selected">Please select ...</option>');93newWindow.document.write('<option selected="selected" value="Standard1">Standard in 92647</option>');94newWindow.document.write('<option value="Standard2">Standard outside 92647</option>');95newWindow.document.write('<option value="Pickup">Pickup</option>');96newWindow.document.write('</select>');97newWindow.document.write('<div id="div1"></div>');98newWindow.document.write('<div id="div2"></div>');99newWindow.document.write("<p>We won't use your address for anything but shipping</p>");100newWindow.document.write('<button class="submitButton">Confirm Order</button>');101newWindow.document.write('</form>');102 newWindow.document.write('</div>');103 newWindow.document.write('<div class="rightcolumn">');104 newWindow.document.write('<br>');105 newWindow.document.write('</div>');106 newWindow.document.write('</div>');107 newWindow.document.write('<div id="footer">');108 newWindow.document.write('Latest Update: <!--#echo var="LAST_MODIFIED"-->');109 newWindow.document.write('<br>');110 newWindow.document.write('<a href=mailto:andrew.myer@student.csulb.edu >andrew.myer@student.csulb.edu</a>');111 newWindow.document.write('</div>');112 newWindow.document.write('</body>');113 newWindow.document.write('</html>');114}115function showfield(name,subtotal)116{117 if(name=='Standard1')118 {119 document.getElementById('div1').innerHTML='<p>Shipping Address: </p><input type="text" name="other" />';120 total=subtotal+20;121 document.getElementById('div2').innerHTML='<p>Total: $'+total+'</p>';122 }123 else if (name=='Standard2')124 {125 document.getElementById('div1').innerHTML='<p>Shipping Address: </p><input type="text" name="other" />';126 total=subtotal+50;127 document.getElementById('div2').innerHTML='<p>Total: $'+total+'</p>';128 }129 else130 {131 document.getElementById('div1').innerHTML='';132 total=subtotal;133 document.getElementById('div2').innerHTML='<p>Total: $'+total+'</p>';134 }...
application.js
Source:application.js
1// Place your application-specific JavaScript functions and classes here2// This file is automatically included by javascript_include_tag :defaults3// Place your application-specific JavaScript functions and classes here4// This file is automatically included by javascript_include_tag :defaults5function open_frame_window(artpiece_id)6{7 var newwindow;8 newwindow=window.open("/page/view_in_frame/?artpiece_id=" + artpiece_id,'frames','height=675,width=900,toolbar=no,menubar=yes,scrollbars=yes');9 if (window.focus) {newwindow.focus()}10}11function open_zoom_window(artpiece_id)12{13 var newwindow;14 if (artpiece_id == 353)15 newwindow=window.open("/artwork/view_zoom/" + artpiece_id,'zoom','height=800,width=1024,toolbar=no,menubar=no,scrollbars=yes');16 else17 newwindow=window.open("/artwork/view_zoom/" + artpiece_id,'zoom','height=800,width=1024,toolbar=no,menubar=no,scrollbars=yes');18 if (window.focus) {newwindow.focus()}19}20function open_request_info_window(artpiece_id)21{22 var newwindow;23 if (artpiece_id == 353)24 newwindow=window.open("/artwork/request_pdfs?artpiece_id=" + artpiece_id,'zoom','height=800,width=1024,toolbar=no,menubar=no,scrollbars=yes');25 else26 newwindow=window.open("/artwork/request_pdfs?artpiece_id=" + artpiece_id,'zoom','height=800,width=1024,toolbar=no,menubar=no,scrollbars=yes');27 if (window.focus) {newwindow.focus()}28}29function open_artist_comment_window(artpiece_id)30{31 var newwindow;32 newwindow=window.open("/artwork/artist_comments/?artpiece_id=" + artpiece_id,'zoom','height=340,width=520,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');33 if (window.focus) {newwindow.focus()}34}35function open_list_of_symbolism(artwork_title) {36 var newwindow;37 newwindow=window.open("/artwork/list_of_symbolism/"+artwork_title,'symbolism','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');38 if (window.focus) {newwindow.focus()}39}40function open_interview_with_the_artist() {41 var newwindow;42 newwindow=window.open("/artwork/interview_with_the_artist",'interview','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');43 if (window.focus) {newwindow.focus()}44}45function open_what_has_obama_done() {46 var newwindow;47 newwindow=window.open("/artwork/what_has_obama_done",'obama','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');48 if (window.focus) {newwindow.focus()}49}50function open_collapse_of_the_dollar() {51 var newwindow;52 newwindow=window.open("/artwork/collapse_of_the_dollar",'obama','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');53 if (window.focus) {newwindow.focus()}54}55function open_what_is_a_true_christian() {56 var newwindow;57 newwindow=window.open("/artwork/what_is_a_true_christian",'truechristian','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');58 if (window.focus) {newwindow.focus()}59}60function open_promotional_code_window() {61 var newwindow;62 newwindow=window.open("/shopping_cart/promotional_code_description",'promotional_code_description','height=800,width=950,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');63 if (window.focus) {newwindow.focus()}64}65function open_product_tab_help() {66 var newwindow;67 newwindow=window.open("/artwork/product_tab_help",'product_tab_help','height=500,width=500,toolbar=no,menubar=no,scrollbars=yes,resizable=yes');68 if (window.focus) {newwindow.focus()}69}70function close_window_if_opener_exists(redirect_url) {71 if (window.opener) {72 window.opener.location = redirect_url;73 window.opener.focus();74 window.close();75 }76}77/*78var image;79var width;80function refresh_zoom_image() {81 image = document.getElementById('image_zoom');82 width = image.width;83 //image.width = 100;84 85 //setTimeout("image.width = width;", 2000);86}87*/88// returns the character count of param string excluding html tags89function get_char_count(string) {90 var html_stripped = string.replace(/(<([^>]+)>)/ig,"");91 return html_stripped.length;92}93// source: http://javascript.internet.com/forms/currency-format.html94function formatCurrency(num) {95 num = num.toString().replace(/\$|\,/g,'');96 if(isNaN(num))97 num = "0";98 sign = (num == (num = Math.abs(num)));99 num = Math.floor(num*100+0.50000000001);100 cents = num%100;101 num = Math.floor(num/100).toString();102 if(cents<10)103 cents = "0" + cents;104 for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)105 num = num.substring(0,num.length-(4*i+3))+','+106 num.substring(num.length-(4*i+3));107 return (((sign)?'':'-') + '$' + num + '.' + cents);108}109function fetch_right_cart() {110 url = '/get_right_shopping_cart';111 new Ajax.Request(url, {112 method: 'get',113 onSuccess: function(transport) {114 $('ajax_shopping_list').insert( { 'top' : transport.responseText } );115 }116 });117}...
canvashtml.js
Source:canvashtml.js
1/*2Copyright (c) 2012 John King3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:4The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.5THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.6*/7function exportshape(name)8{9 var shape=SHAPES[name];10 var dl=parseInt($("stagearea").style.left);11 var dt=parseInt($("stagearea").style.top);12 newwindow.document.writeln(' ');13 newwindow.document.writeln(SPACES.substr(0,15)+'//'+shape.name+';');14 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.shadowColor ="rgba(0,0,0,0)";');15 var rule='rgba('16 for (var j=0;j<3;j++)17 {18 rule += shape.strokeStyle[j]+',';19 } 20 rule +=shape.strokeStyle[j]+')';21 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.strokeStyle ="'+rule+'";');22 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.lineWidth = '+shape.lineWidth+';');23 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.lineCap = "'+shape.lineCap+'";');24 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.lineJoin = "'+shape.lineJoin+'";');25 26 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.beginPath();');27 var node=shape.path.next;28 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.moveTo('+(Math.round(node.point.x)-dl)+','+(Math.round(node.point.y)-dt)+');');29 node=node.next;30 while(node.point.x!="end")31 {32 if (node.vertex=="L")33 {34 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.lineTo('+(Math.round(node.point.x)-dl)+','+(Math.round(node.point.y)-dt)+');')35 }36 else37 {38 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.bezierCurveTo('+(Math.round(node.ctrl1.x)-dl)+','+(Math.round(node.ctrl1.y)-dt)+','+(Math.round(node.ctrl2.x)-dl)+','+(Math.round(node.ctrl2.y)-dt)+','+(Math.round(node.point.x)-dl)+','+(Math.round(node.point.y)-dt)+');');39 }40 node=node.next;41 } 42 if (!shape.open) {newwindow.document.writeln(SPACES.substr(0,15)+'ctx.closePath();')}43 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.stroke();'); 44 if (!shape.open)45 {46 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.shadowOffsetX = '+shape.shadowOffsetX+';'); 47 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.shadowOffsetY = '+shape.shadowOffsetY+';'); 48 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.shadowBlur = '+shape.shadowBlur+';'); 49 var rule='rgba('50 for (var j=0;j<3;j++)51 {52 rule += shape.shadowColor[j]+',';53 } 54 rule +=shape.shadowColor[j]+')';55 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.shadowColor = "'+rule+'";');56 if (shape.justfill)57 {58 var rule='rgba('59 for (var j=0;j<3;j++)60 {61 rule += shape.fillStyle[j]+',';62 }63 rule +=shape.fillStyle[j]+')';64 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.fillStyle = "'+rule+'";');65 66 }67 else68 {69 if (shape.linearfill)70 {71 newwindow.document.writeln(SPACES.substr(0,15)+'grad = ctx.createLinearGradient('+(Math.round(shape.lineGrad[0])-dl)+','+(Math.round(shape.lineGrad[1])-dt)+','+(Math.round(shape.lineGrad[2])-dl)+','+(Math.round(shape.lineGrad[3])-dt)+');');72 }73 else74 {75 newwindow.document.writeln(SPACES.substr(0,15)+'grad = ctx.createRadialGradient('+(Math.round(shape.radGrad[0])-dl)+','+(Math.round(shape.radGrad[1])-dt)+','+Math.round(shape.radGrad[2])+','+(Math.round(shape.radGrad[3])-dl)+','+(Math.round(shape.radGrad[4])-dt)+','+Math.round(shape.radGrad[5])+');');76 }77 var rule;78 for (var k=0; k<shape.colorStops.length;k++)79 {80 rule='rgba('81 for (var j=1;j<4;j++)82 {83 rule += shape.colorStops[k][j]+',';84 }85 rule +=shape.colorStops[k][j]+')';86 newwindow.document.writeln(SPACES.substr(0,15)+'grad.addColorStop('+shape.colorStops[k][0]+',"'+rule+'");');87 }88 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.fillStyle = grad;');89 }90 newwindow.document.writeln(SPACES.substr(0,15)+'ctx.fill();');91 }...
export.js
Source:export.js
1/*2Copyright (c) 2012 John King3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:4The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.5THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.6*/7function exportShapes()8{ 9 var shapelist=[];10 var nameZ=[];11 for (var name in SHAPES)12 {13 nameZ=[];14 nameZ.push(name);15 nameZ.push(SHAPES[name].zIndex);16 shapelist.push(nameZ);17 }18 shapelist.sort(compareZ);19 20 newwindow=window.open('','_blank');21 newwindow.document.writeln('<!DOCTYPE HTML>');22 newwindow.document.writeln('<html>');23 newwindow.document.writeln(SPACES.substr(0,3)+'<head>');24 newwindow.document.writeln(SPACES.substr(0,6)+'<style>');25 newwindow.document.writeln(SPACES.substr(0,9)+'#canvasarea');26 newwindow.document.writeln(SPACES.substr(0,9)+'{');27 newwindow.document.writeln(SPACES.substr(0,12)+'border:black 1px solid;');28 newwindow.document.writeln (SPACES.substr(0,9)+'}');29 newwindow.document.writeln(SPACES.substr(0,6)+'</style>');30 newwindow.document.writeln(SPACES.substr(0,6)+'<!--[IF LT IE 9]><script type="text/javascript" src = "excanvas.js" ></script><![endif]-->');31 newwindow.document.writeln(SPACES.substr(0,6)+'<script type="text/javascript">');32 newwindow.document.writeln(SPACES.substr(0,9)+'function setcanvas()');33 newwindow.document.writeln(SPACES.substr(0,9)+'{');34 newwindow.document.writeln(SPACES.substr(0,12)+'var canvas = document.getElementById("canvasarea");'); 35 newwindow.document.writeln(SPACES.substr(0,12)+'if (canvas.getContext)');36 newwindow.document.writeln(SPACES.substr(0,12)+'{'); 37 newwindow.document.writeln(SPACES.substr(0,15)+'var ctx = canvas.getContext("2d");');38 newwindow.document.writeln(SPACES.substr(0,15)+'drawcanvas(ctx);');39 newwindow.document.writeln (SPACES.substr(0,12)+'}'); 40 newwindow.document.writeln(SPACES.substr(0,12)+'else');41 newwindow.document.writeln(SPACES.substr(0,12)+'{'); 42 newwindow.document.writeln(SPACES.substr(0,15)+'alert("Canvas NOT supported");'); 43 newwindow.document.writeln (SPACES.substr(0,12)+'}'); 44 newwindow.document.writeln (SPACES.substr(0,9)+'}');45 newwindow.document.writeln (SPACES.substr(0,9));46 newwindow.document.writeln (SPACES.substr(0,9)+'function drawcanvas(ctx)');47 newwindow.document.writeln(SPACES.substr(0,9)+'{');48 for(var i=0;i<shapelist.length;i++)49 {50 exportshape(shapelist[i][0]);51 } 52 newwindow.document.writeln (SPACES.substr(0,9)+'}');53 newwindow.document.writeln(SPACES.substr(0,6)+'</script>');54 newwindow.document.writeln(SPACES.substr(0,3)+'</head>');55 newwindow.document.writeln(SPACES.substr(0,3)+'<body onload="setcanvas()">');56 newwindow.document.writeln(SPACES.substr(0,6)+'<canvas id="canvasarea" width="'+parseInt($("stagearea").style.width)+'" height="'+parseInt($("stagearea").style.height)+'"></canvas>'); 57 newwindow.document.writeln(SPACES.substr(0,3)+'</body>');58 newwindow.document.writeln('</html>');59 newwindow.document.close();60}61function compareZ(a,b)62{63 return a[1]-b[1];...
saver.js
Source:saver.js
1javascript:(function(){2 newWindow = window.open("", null, "height=600,width=600,status=yes,toolbar=no,menubar=no,location=no");3 newWindow.download = function(data, filename, type) {4 var file = new Blob([data], {type: type});5 if (window.navigator.msSaveOrOpenBlob)6 window.navigator.msSaveOrOpenBlob(file, filename);7 else {8 var a = document.createElement("a"),9 url = URL.createObjectURL(file);10 a.href = url;11 a.download = filename;12 document.body.appendChild(a);13 a.click();14 setTimeout(function() {15 document.body.removeChild(a);16 window.URL.revokeObjectURL(url);17 }, 0);18 }19 };20 newWindow.title = document.getElementsByClassName("challenge-title")[0].textContent;21 newWindow.save = function() {22 let str = newWindow.document.getElementsByTagName('textarea')[0].value;23 newWindow.download(str, newWindow.title + ".html", "text");24 newWindow.close();25 };26 newWindow.document.write("<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css' integrity='sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu' crossorigin='anonymous'>");27 newWindow.document.write("<h1 class = 'display-4' style='width:600px;text-align:center;'>Input your code here!</h1>");28 newWindow.document.write("<textarea class = 'form-control' style='width:560px;height:400px;margin:10px 20px;font-size:20px;'></textarea>");29 newWindow.document.write("<br>");30 newWindow.document.write("<button class='btn btn-success' onclick='save();' type='button' style='font-size:20px;width:200px;margin-left:200px;margin-right:200px;'>Download Code</button>");...
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should have the right title', () => {3 const title = browser.getTitle();4 expect(title).to.equal('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');5 });6 it('should open new window', () => {7 const title = browser.getTitle();8 expect(title).to.equal('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');9 });10});
Using AI Code Generation
1var webdriverio = require('webdriverio');2var options = { desiredCapabilities: { browserName: 'chrome' } };3var client = webdriverio.remote(options);4 .init()5 .getTitle().then(function(title) {6 console.log('Title was: ' + title);7 })8 .end();
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should open a new window', () => {3 browser.pause(3000)4 })5})6describe('webdriver.io page', () => {7 it('should open a new window', () => {8 browser.pause(3000)9 })10})11describe('webdriver.io page', () => {12 it('should open a new window', () => {13 browser.pause(3000)14 })15})16describe('webdriver.io page', () => {17 it('should open a new window', () => {18 browser.pause(3000)19 })20})21describe('webdriver.io page', () => {22 it('should open a new window', () => {23 browser.pause(3000)24 })25})26describe('webdriver.io page', () => {27 it('should open a new window', () => {28 browser.pause(3000)29 })30})
Using AI Code Generation
1describe('test window', function() {2 it('should open new window', function () {3 browser.pause(2000);4 browser.pause(2000);5 browser.pause(2000);6 });7});8describe('test window', function() {9 it('should open new window', function () {10 browser.pause(2000);11 browser.pause(2000);12 browser.pause(2000);13 });14});15describe('test window', function() {16 it('should open new window', function () {17 browser.pause(2000);18 browser.pause(2000);19 browser.pause(2000);20 });21});22describe('test window', function() {23 it('should open new window', function () {24 browser.pause(2000);25 browser.pause(2000);26 browser.pause(2000);27 });28});29describe('test window', function() {30 it('should open new window', function () {31 browser.pause(2000);32 browser.pause(2000);33 browser.pause(2000);34 });35});36describe('test window', function() {
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should open a new window', async () => {3 const tabs = await browser.getWindowHandles()4 await browser.switchToWindow(tabs[1])5 })6})7describe('webdriver.io page', () => {8 it('should open a new window', async () => {9 const tabs = await browser.getWindowHandles()10 await browser.switchToWindow(tabs[1])11 })12})
Using AI Code Generation
1describe('newWindow method', function() {2 it('should open a new window', function () {3 });4});5describe('newWindow method', function() {6 it('should open a new window and switch to it', function () {7 });8});9describe('newWindow method', function() {10 it('should open a new window, switch to it and close it', function () {11 browser.closeWindow();12 });13});14describe('new15describe('webdriver.io page', () => {16 it('should open a new window', () => {17 browser.pause(3000)18 })19})20describe('webdriver.io page', () => {21 it('should open a new window', () => {22 browser.pause(3000)23 })24})25describe('webdriver.io page', () => {26 it('should open a new window', () => {27 browser.pause(3000)28 })29})30 })31})
Using AI Code Generation
1describe('test window', function() {2 it('should open new window', function () {3 browser.pause(2000);4 browser.pause(2000);5 browser.pause(2000);6 });7});8describe('test window', function() {9 it('should open new window', function () {10 browser.pause(2000);11 browser.pause(2000);12 browser.pause(2000);13 });14});15describe('test window', function() {16 it('should open new window', function () {17 browser.pause(2000);18 browser.pause(2000);19 browser.pause(2000);20 });21});22describe('testvwindow', function() erio23descit('shouldropeninewbwindow',efunction () {24 browser.pause(2000);25 browser.aause(2000);26 browger.switchWindow('httpe', ww.w() => {;27 it('should opause(2000);28 });29});30describe('test window', function() {31 it('should open new window', function () {32 browwer.newWindow('http', ww(.github.com');33 brows)r.pause(2000);34 browse>.pause(2000);35 browspause(2000);36 });37});38describe('test window', function() {
Using AI Code Generation
1describe('webdriver.io page', () => {2 it('should open a new window', async () => {3 await browser.newWindow('https:/webdriver.io')4 const tabs = await browser.getWindowHadles()5 await browsr.sitchToow(tabs[1])6 })7})8describe('webdriver.io page', () => {9 it('should open a new window', async () => {10 const tabs = await browser.getWindowHandles()11 await browser.switchToWindow(tabs[1]12 browser.pause(3000)13 })14})15describe('webdriver.io page', () => {16 it('should open a new window', () => {17 browser.pause(3000)18 })19})20describe('webdriver.io page', () => {21 it('should open a new window', () => {22 browser.pause(3000)23 })24})
Using AI Code Generation
1describe('test window', function() {2 it('should open new window', function () {3 browser.pause(2000);4 browser.pause(2000);5 browser.pause(2000);6 });7});8describe('test window', function() {9 it('should open new window', function () {10 browser.pause(2000);11 browser.pause(2000);12 browser.pause(2000);13 });14});15describe('test window', function() {16 it('should open new window', function () {17 browser.pause(2000);18 browser.pause(2000);19 browser.pause(2000);20 });21});22describe('test window', function() {23 it('should open new window', function () {24 browser.pause(2000);25 browser.pause(2000);26 browser.pause(2000);27 });28});29describe('test window', function() {30 it('should open new window', function () {31 browser.pause(2000);32 browser.pause(2000);33 browser.pause(2000);34 });35});36describe('test window', function() {
Wondering what could be a next-gen browser and mobile test automation framework that is also simple and concise? Yes, that’s right, it's WebdriverIO. Since the setup is very easy to follow compared to Selenium testing configuration, you can configure the features manually thereby being the center of attraction for automation testing. Therefore the testers adopt WedriverIO to fulfill their needs of browser testing.
Learn to run automation testing with WebdriverIO tutorial. Go from a beginner to a professional automation test expert with LambdaTest WebdriverIO tutorial.
Running Your First Automation Script - Learn the steps involved to execute your first Test Automation Script using WebdriverIO since the setup is very easy to follow and the features can be configured manually.
Selenium Automation With WebdriverIO - Read more about automation testing with WebdriverIO and how it supports both browsers and mobile devices.
Browser Commands For Selenium Testing - Understand more about the barriers faced while working on your Selenium Automation Scripts in WebdriverIO, the ‘browser’ object and how to use them?
Handling Alerts & Overlay In Selenium - Learn different types of alerts faced during automation, how to handle these alerts and pops and also overlay modal in WebdriverIO.
How To Use Selenium Locators? - Understand how Webdriver uses selenium locators in a most unique way since having to choose web elements very carefully for script execution is very important to get stable test results.
Deep Selectors In Selenium WebdriverIO - The most popular automation testing framework that is extensively adopted by all the testers at a global level is WebdriverIO. Learn how you can use Deep Selectors in Selenium WebdriverIO.
Handling Dropdown In Selenium - Learn more about handling dropdowns and how it's important while performing automated browser testing.
Automated Monkey Testing with Selenium & WebdriverIO - Understand how you can leverage the amazing quality of WebdriverIO along with selenium framework to automate monkey testing of your website or web applications.
JavaScript Testing with Selenium and WebdriverIO - Speed up your Javascript testing with Selenium and WebdriverIO.
Cross Browser Testing With WebdriverIO - Learn more with this step-by-step tutorial about WebdriverIO framework and how cross-browser testing is done with WebdriverIO.
Get 100 minutes of automation test minutes FREE!!