JavaScript writes: Russia

zhaozj2021-02-16  46

dwin.net - Web Application - TETRIS </ Title> <body> Written by David Ng @ <a href="http://dwin.net"> http://dwin.net </> <br > CopyRight (C) 1998-2007 Dwin.Net All Rights Reserved <br></p> <p><br> <font color = red> Press "S" Button to Star or Stop <br> Press "Space Bar" Button to Change Quadrel Into Another Shape <br> Press "Page Up" To Speed ​​Up <br> Press "Page Down" to Speed ​​Down </ font> <div id = 'base' style = 'position: absolute; overflow: visible;'> <div id = 'growdiv' style = 'position: absolute; left: 0; TOP: 0; Filter: Glow (color = # fff00, stregth = 5); '> <div id =' droppedblockdiv 'style =' Position: absolute; left: 0; Top: 0 '> </ div> </ div > <Div id = 'droppingblockdiv' style = 'Position: absolute;'> </ div> <div id = 'readyblockdiv' style = 'position: absolute; top: 0;'> </ div> <div id = ' Scorediv 'Style =' Position: Absolute; '> 0 </ div> </ div></p> <p><Script> // firefoxif (! Typeof HTMLElement = "undefined" && HTMLElement.prototype.insertAdjacentElement!) {HTMLElement.prototype.insertAdjacentElement = function (where, parsedNode) {switch (where) {case 'beforeBegin': this.parentNode. insertBefore (parsedNode, this) break; case 'afterBegin': this.insertBefore (parsedNode, this.firstChild); break; case 'beforeEnd': this.appendChild (parsedNode); break; case 'afterEnd': if (this.nextSibling ) this.parentNode.insertBefore (parsedNode, this.nextSibling); else this.parentNode.appendChild (parsedNode); break;}} HTMLElement.prototype.insertAdjacentHTML = function (where, htmlStr) {var r = this.ownerDocument.createRange ( ); R.setStartBefore (this); var parsedhtml = r.createContextualfragment (htmlstr); this.insertadjacentelement (where, pasedhtml)}</p> <p>Htmlelement.prototype.insertadjacenttext = function (where, txtstr) {var parsedtext = document.createtextNode (txtstr) this.insertadjacentelement (where, pasedtext)}}</p> <p>/ * Written by David Ng @ http: //dwin.netcopyright (c) 1998-2004 Dwin.Net All Rights Reserved</p> <p>Start: 2002-09-20 14: 45FINISH: 2002-10-31 23:50</p> <p>2003-08-14 01: 25Add Block [7] = ['1'] function</p> <p>2007-08-09 02: 06firefox support: as firefox do not support filter: flipv, so relate function has been modify to achive the same result.Found a unfix bug: Change the shape of Block = [ '1111'] at the Top Right Corner. (Slow the Ospeed to Test this bug)</p> <p>* / var rows = 17; var cells = 10; var objw = Objh = 20;</p> <p>Var scores = 0; var marks = [100, 400, 900, 1600];</p> <p>VAR BaseBW = 5; var Basebgcolor = 'White';</p> <p>Var blockbw = '1px'; var blockbs = 'INSET'; var blockbc = 'orange'; var osp = 300;</p> <p>Block = []; block [0] = ['', '1', '111'] block [0] .change = 4; block [0] .color = 'red';</p> <p>Block [1] = ['', '1', '111'] Block [1] .change = 4; Block [1] .COLOR = 'Green';</p> <p>Block [2] = ['', '1', '111'] Block [2] .change = 4; Block [2] .color = 'blueviolet';</p> <p>Block [3] = ['11', '11'] Block [3] .change = 2; Block [3] .color = 'fuchsia';</p> <p>Block [4] = ['11', '11'] Block [4] .change = 2; Block [4] .color = 'Yellow';</p> <p>Block [5] = ['1111'] Block [5] .change = 2; Block [5] .COLOR = 'Lime';</p> <p>Block [6] = ['11', '11'] Block [6] .change = 1; Block [6] .color = 'blue';</p> <p>Block [7] = ['1'] Block [7] .change = 1; Block [7] .COLOR = 'Gold';</p> <p>Block [8] = ['', '1 1', '111'] Block [8] .change = 4; Block [8] .COLOR = 'Pink';</p> <p>Block [9] = ['111', '1', '1'] Block [9] .change = 4; Block [9] .COLOR = 'Black';</p> <p>Block [10] = ['1', '1', '1'] Block [10] .change = 2; Block [10] .COLOR = 'CornflowerBlue';</p> <p>Block [11] = ['', '1', '1 1'] Block [11] .change = 4; block [11] .color = 'greenylellow';</p> <p>Function ReadyFordown (Obj1, Obj2) {Obj1.k = (Math.random () * block.Length) | 0; if (! newblock [obj1.k] .length) {switch (block [obj1.k] .change {Case 1: Change0 (Obj1.k); Break; Case 2: Change0 (Obj1.k); Change1 (Obj1.k); Break; Case 4: Change0 (Obj1.k); Change1 (Obj1.k); Change2 (Obj1.k); Break;}} Obj1.change = (Math.random () * block [obj1.k] .change | 0; obj2.innerhtml = newblock [obj1.k] [obj1.change] .ihtml Obj1.gapx = (newblock [obj1.k] [obj1.change] [0] .length / 2) | 0; checkobjgapy (obj1, newblock [obj1.k] [obj1.change] .length); Obj1.x = (Cells / 2) | 0; Obj1.y = 0;} Function Checkobjgapy (Obj, K) {if (! Newblock [obj.k] [obj.change] [k-1] .join (''). Match (// d /)) {obj.gapy = 1-k; Checkobjgapy (Obj, k-1);} else obj.gapy = -k;}</p> <p>Function changeblock () {if (block [obj1.k] .change> 1) {obj1.testchange = ((obj1.change | 0) 1> = block [obj1.k] .change)? 0: (Obj1. Change | 0) 1; Obj1.testgapx = (newblock [obj1.k] [obj1.testchange] [0] .length / 2) | 0; obj1.testgapy = -newblock [obj1.k] [obj1.testchange] .length; obj1.testl = (obj1.x | 0) - (Obj1.testgapx | 0); Obj1.testt = (obj1.y | 0) (Obj1.testgapy | 0);</p> <p>VAR K1 = K2 = Areas; for (var i = Obj1.testl | 0; i> = 0 && i> (obj1.testl | 0) -newblock [obj1.k] [obj1.testchange] .lg; i - ) {IF ((k1 = checkchangeblock (i))! = Allas) Break} for (var i = (obj1.testl | 0) 1; i <cells && i <(obj1.testl | 0) newblock [Obj1 [obj1.testchange] .lg; i ) {IF ((k2 = checkchangeblock (i))! = areas) Break} if (k1 == k2) return;</p> <p>Obj1.l = (Math.abs ((Obj1.testl | 0) -k1)> Math.abs ((Obj1.testl | 0) -k2))))? K2: K1; Obj1.t = Obj1.testt; Obj1. Gapx = obj1.testgapx; obj1.gapy = obj1.testgapy; obj1.x = (obj1.l | 0) (OBJ1.GAPX | 0); obj1.y = (Obj1.t | 0) - (Obj1.gapy | 0); obj1.change = obj1.testchange; document.getlementByid ('DroppingBlockdiv'). Style.left = ((Obj1.l | 0) * Objw) 'PX'; Document.getElementByid ('DroppingBlockdiv'). Style.top = ((Obj1.t | 0) * Objh) 'PX'; Document.GtelementByid ('DroppingBlockdiv'). InnerHtml = Newblock [Obj1.k] [Obj1.change] .ihtml;}} Function CheckchangeBlock Lefts {for (var y = 0; y <newblock [obj1.k] [obj1.testchange] .length; y ) {for (var x = 0; x <newblock [obj1.k] [obj1.testchange] [ 0] .length; x ) {ion (newblock [obj1.k] [obj1.testchange] [y] [x] == 1) {Try {if (map [(obj1.testt | 0) y] [Lefts x]! = ') Return Areas;} catch (e) {}}}}</p> <p>Return Lefts;</p> <p>Function Dir (xx, yy) {var special = false if (newblock [obj1.k] [obj1.change] .length == 1 && newblock [obj1.k] [obj1.change] [0] == 1) { For (var y = (obj1.t | 0) 1; y <rows-1; y ) {IF (MAP [Y YY] [OBJ1.L] == "") {special = true; Break;} }}} For (var y = newblock [obj1.k] [obj1.change] .length-1; y> = 0; y -) {for (var x = newblock [obj1.k] [obj1.change] [ 0] .length-1; x> = 0; x--) {IF (newblock [obj1.k] [obj1.change] [y] [x] == 1) {Try {if (yy == 0 && (((Obj1.l | 0) x xx) <0 || ((Obj1.L | 0) x xx)> = Cells || MAP [(Obj1.t | 0) Y] [( Obj1.l | 0) x xx] == 1)) Return; // Horizontal IF ((Obj1.t | 0) Y YY> = ROWS || (! Special && Map [(Obj1. T | 0) y yy] [(OBJ1.L | 0) x xx] == 1)) {Return CreateBlockInMap (); // vertical}}}}}}}}} Document.GtelementByid ('DroppingBlockdiv'). Style.Left = ((Obj1.l = (Obj1.x = xx) - (OBJ1.GAPX | 0)) * OBJW) 'PX'; Document.getElementById ('DroppingBlockdiv'). Style .top = ((obj1.t = (obj1.y = yy) (obj1.gapy | 0)) * OBJH) 'PX';</p> <p>Function creteblockinmap () {for (var y = 0; y <newblock [obj1.k] [obj1.change] .length; y ) {for (var x = 0; x <newblock [obj1.k] [obj1.change ] [0] .length; x ) {try {if (newblock [obj1.k] [obj1.change] [y] [x] == 1) {MAP [(Obj1.t | 0) Y] [( Obj1.l | 0) x] = newblock [obj1.k] [obj1.change] [y]; Document.getlementByid ('DroppedBlockdiv'). ChildNodes [((Obj1.t | 0) Y) * Cells (Obj1.l | 0) x] .style.Background = block [obj1.k] .color; document.getlementByid ('DroppedBlockdiv'). ChildNodes [(Obj1.t y) * Cells Obj1.l x] .style.visibility = 'visible';}} catch (e) {return GameOver ()}}} CheckBlockAppear (); ReadyForDown (Obj2, document.getElementById ( 'ReadyBlockDiv'));} function CheckBlockAppear () { ClearInterval (Gotime2); Gotime2 = 0 var newmap = []; var html = ''; var kk = rows-1; var kk = -1; var TMPOBJ;</p> <p>For (var y = rows-1; y> = 0; y -) {if (Map [Y] .join ('')! = fullstring) {newMap [k -] = map [y];} else {KK ; for (var x = 0; x <cells; x ) {tmp/ = document.getlementByid ('DroppedBlockdiv'). ChildNodes [(Y) * Cells]; tmpobj.parentnode.removeChild (tmpobj);</p> <p>IHTML = "<span style = 'width:" ObjW "PX; Height:" Objh "PX; Border:" BlockbW "" blockbs " blockbc "; - Moz-Box-Sining: Border-Box Overflow: hidden; display: -moz-inline-box; visibility: hidden '> </ span> ";}}} for (; k> = 0; k -) {newMap [k] = []; for (var x = 0; x <cells; x ) newMap [k] [x] = '';} if (kk! = -1) Document.getElementByid ('scorediv'). Innerhtml = (Score = Marks [kk] ); // Cal the scores for (VAR i = 0; i <rows; i ) map [i] = newMap [i]; document.getElementByid ('DroppedBlockdiv'). INSERTADJACENTHTML ("insterbegin", html); for I in obj2) OBJ1 [i] = Obj2 [i]; // Obj2 => OBJ1</p> <p>. Document.getElementById ( 'DroppingBlockDiv') innerHTML = NewBlock [Obj1.k] [Obj1.Change] .iHtml; document.getElementById ( 'DroppingBlockDiv') style.left = ((Obj1.L = (Obj1.X | 0. ) - (OBJ1.GAPX | 0)) * OBJW) 'PX'; Document.GtelementByid ('DroppingBlockdiv'). Style.top = ((Obj1.t = (Obj1.gapy | 0)) * Objh) ' PX ';}</p> <p>Function GameOver () {ix (confirm ('Game over, restart?') "); Else Window.close ();}</p> <p>Function change0 (k) {newblock [k] = []; newblock [k] [0] = []; newblock [k] [0] .ihtml = ';</p> <p>For (var y = 0; y <block [k] .length; y ) {newblock [k] [0] [y] = []; for (var x = 0; x <block [k] [0]. Length; x ) newblock [k] [0] .ihtml = (NEWBLOCK [K] [0] [y] [x] = block [k] [y] .Charat (x)) == 1)? Blockhtml (x, y, k): "";} checkblocklong (k, 0);</p> <p>Function change1 (k) {newblock [k] [1] = []; newblock [k] [1] .ihtml = '; for (var y = 0; y <block [k] [0] .length; y ) {Newblock [k] [1] [y] = []; for (var x = 0; x <block [k] .length; x ) newblock [k] [1] .ihtml = ((NEWBLOCK [K ] [1] [Y] [x] = Block [K] [Block [K] .length-x-1] .Charat (y)) == 1)? BlockHTML (X, Y, K): "" Checkblocklong (k, 1);}</p> <p>Function change2 (k) {newblock [k] [2] = []; newblock [k] [3] = []; newblock [k] [2] .ihtml = '; newblock [k] [3] .ihtml = '';</p> <p>For (var y = 0; y <block [k] .length; y ) {newblock [k] [2] [y] = []; for (var x = 0; x <block [k] [0]. Length; x ) newblock [k] [2] .ihtml = (NEWBLOCK [K] [2] [y] [x] = block [k] [block [k] .length-y-1] .Charat ( Block [K] [0] .length-x-1)) == 1)? BlockHTML (X, Y, K): "";} for (var y = 0; y <block [k] [0]. Length; y ) {newblock [k] [3] [y] = []; for (var x = 0; x <block [k] .length; x ) newblock [k] [3] .ihtml = (( Newblock [K] [3] [Y] [x] = Block [K] [x] .Charat (Block [K] [0] .length-y-1)) == 1)? Blockhtml (x, y, K): "";} Checkblocklong (K, 2); Checkblocklong (k, 3);}</p> <p>Function Blockhtml (X, Y, K) {Return "<span style = 'POSITION: ABSOLUTE; Left:" (x * Objw) "PX; TOP:" (Y * Objh) "PX; Width:" ObjW "PX; Height:" Objh "PX; Background-Color:" Block [K] .COLOR "; Border:" BlockbW "" blockbs " blockbc "; - Moz-Box-Sining: Border -box; overflow: hidden; '> </ span>}</p> <p>Function checkblocklong (k, i) {for (var y = 0; y <newblock [k] [i] .length; y ) newblock [k] [i] [y] .lg = (newblock [k] [i] [y] .tostring (). match (// d /) == NULL)? 0: Newblock [k] [i] [y] .join (''). match (// d /). Tostring () .length; newblock [k] [i] .LG = 1; for (var y = 0; y <newblock [k] [i] .length; y ) newblock [k] [i] .lg = Math.max ( Newblock [k] [i] [y] .lg, newblock [k] [i] .lg);</p> <p>}</p> <p>Document.onkeyDown = function (evt) {if (TypeOf (evt) == 'undefined') evt = window.event || WINDOW.EVENT; var keycode = 0; if (est.keycode) Keycode = evt.keycode; Else IF (TypeOf (Evt.Which)! = 'undefined') Keycode = evt.which;</p> <p>Switch (keycode) {copy 34: ClearInterval (Gotime); ospeed = 20; if (Gotime> 0) {DIR (0, 1); Gotime = setInterval ('DIR (0, 1)', OSPEED;}; Break; // page Down Case 33: IF (OSPEED-30> 0) {ClearInterval (Gotime); Ospeed - = 20} if (Gotime> 0) {DIR (0, 1); Gotime = setInterval ('DIR (0 , 1) ', OSPEED;}; Break; // Page Up Case 38: IF (Gotime> 0) Gotime2 = setInterval ("DIR (0, 1)", 1); Break; // Up Case 37: CheckKeyDown (-1, 0, 150, 20); Break; // Left Case 39: CheckKeyDown (1,0,150,20); Break; // Right Case 40: CheckKeyDown (0, 1, 150, 20); Break; // Down // Case 96: IF (Gotime> 0) ChangeBlock (); Break; // 0 Case 32: IF (Gotime> 0) ChangeBlock (); Break; // Space Case 83: Checkstart (); Break; // s}}</p> <p>Document.onkeyup = function () {dokeydown = false;}</p> <p>Function CheckKeyDown (X, Y, T1, T2) {IF (Gotime> 0 &&! dokeydown) {DIR (x, y); dokeydown = true; settimeout ("f", " " Y "," T2 ");", t1);}} function keydownagain (x, y, t2) {if (gotime> 0 && dokeydown) {dir (x, y); settimeout ("KeyDownagain" , " Y ", " T2 ") ", T2);}}</p> <p>Function checkstart () {if (gotime == -1) {checkblockappear (); gotime = 0; ReadyFordown (Obj2, Document.getElementByid ('ReadyBlockdiv'));} if (! gotime) {DIR (0, 1); Gotime = setInterval ('DIR (0, 1)', OSPEED);} else {cleaninterval (gotime); gotime = 0;}}</p> <p>Var map = []; var newblock = []; var aas = 0; var gotime = -1, gotime2; var fullstring = '; var obj1 = new object (); var obj2 = new object (); var dokeydown = False;</p> <p>Window.onLoad = function () {WINDOW.FOCUS (); var obj var html = ''; var basewidth = cells * objw; var baseheight = rows * objh; var mainmapwidth = document.all? 2 * basebw cells * Objw : Cells * Objw; var mainmapheight = Document.all? 2 * basebw rows * objh: rows * objh;</p> <p>obj = document.getElementById ( 'Base'); obj.style.left = (document.body.clientWidth-MainMapWidth) / 2; obj.style.top = (document.body.clientHeight-MainMapHeight) / 2; obj.style .width = MainMapWidth; obj.style.height = MainMapHeight; obj.style.borderWidth = BaseBW 'px'; obj.style.borderStyle = 'inset'; obj.style.borderColor = '# 0000CC'; obj = document.getElementById ( 'GrowDiv'); obj.style.width = BaseWidth 'px'; obj.style.height = BaseHeight 'px'; obj = document.getElementById ( 'DroppedBlockDiv'); obj.style.width = BaseWidth 'px'; Obj.style.height = baseheight 'px';</p> <p>Obj = document.getlementByid ('readyblockdiv'); obj.style.left = (MainmapWidth 2 * Basebw) 'PX';</p> <p>Obj = document.getlementByid ('scorediv'); obj.style.Left = (mainmapwidth 50) 'px'; obj.style.top = (mainmapHeight-20) 'PX'; obj.innerhtml = "0" ;</p> <p>For (var i = 0, k = cells * rows; i <k; i ) html = "<span style = 'width:" objW "PX; Height:" Objh "PX; Border:" blockbw " " Blockbs " " blockbc "; - Moz-Box-Siting: Border-Box; overflow: hidden; display: -moz-inline-box; Visibility: hidden; '> </ span> ";</p> <p>For (var i = 0; i <block.length; i ) newblock [i] = [];</p> <p>Fullstring = New Array (Cells 1) .join ("1");</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-25959.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="25959" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.045</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'c6bsKynLeKZ_2FlU3XLxmGs1UUV5COgDtz0wARFMOV1m1PTGTFyrOSW0Y36vlckQiDf8_2FHLQoRG7_2Bo_2FBhawJ1jSQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>