CSDN _ vote _ JS _ Analysis script

Source: Internet
Author: User

Author: Tie

Date: January 1, December 31, 2013

The usage instructions are as follows:

1. Original book http://special.csdn.net/book2013/yc.html2. Introduced book http://special.csdn.net/book2013/yj.html//// opened by chrome, right click on the page, select review elements // then switch to the console // copy all the code of the js file, the console can be executed
The script is as follows:

! (Function () {// create the script element var SC = document. createElement ("script"); // sets the SC attribute. src = "http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"; // set the loading Event Callback SC. onload = pickVote; // Add to body document. body. appendChild (SC); // function Vote (id, name, ding_num) {this. id = id; this. name = name; this. ding_num = ding_num;}; Vote. prototype = {toString: function () {return this. ding_num + "\ t" + this. name ;}}; // Function pickVote (e) {if (! $) {Alert ("sorry, the Sina server has a nap. "); return false;} // var allbook = $ (". container. list "); var len = allbook. length; // var allVote = []; //! Allbook. each (function (I, v) {var $ this = $ (this); // var $ name = $ ("p. black strong ", $ this); var $ ding_num = $ (". ding_num ", $ this); // name of the book var name = $ name. text (); var ding_num = $ ding_num.text (); // ding_num = parseInt (ding_num); // var vote = new Vote (++ I, name, ding_num); allVote. push (vote) ;}); function desc (x, y) {if (x. ding_num> y. ding_num) {return-1;} else if (x. ding_num <y. ding_num) {return 1 ;}else {return 0 ;}; // sort allVote = Array. prototype. sort. call (allVote, desc); // output information var title = document. title; console.info (title + ": ranking:"); console.info (allVote. join ("\ n "));};}());


Resource:

A new example of anti-DDOS test for ITEYE is added:

Instructions for use:

1. chrome first opens a page of iteye, so that cross-origin is not displayed. 2. Open console3. paste and execute the refreshed JS, and then keep the page open. If you want the auto-refresh function, you can use the proud web browser. Of course, it seems that sogou also supports it. Right-click the tab and refresh it automatically.

The Code is as follows:

(function(){var iframe = document.createElement("iframe");iframe.src = "http://damoqiongqiu.iteye.com/blog/1998022";window.document.body.appendChild(iframe);iframe.src= "";var tms = 0;var itv = window.setInterval(function(){iframe.src= "";iframe.src = "http://damoqiongqiu.iteye.com/blog/1998022";tms += 1;if(tms % 500 < 1){console.info("tms="+tms);}}, 0.2 * 1000);}());

An nonstandard code that tests the concurrency of mobile app api interfaces in a browser:

(Function () {// var $ this = $ ('# apitestform'); // password encryption var password_clear = $ ("# password_clear "). val () | ""; $ ("# password_md5 "). val (hex_md5 (password_clear); // the new password is encrypted var newpassword_clear =$ ("# newpassword_clear "). val () | ""; $ ("# newpassword_md5 "). val (hex_md5 (newpassword_clear); var data =$ ('# apitestform '). serialize (); // window. all_time = 0; window. all_num = 0; window. success_num = 0; window. failure_num = 0; // var config = {url: $ this. attr ("action"), data: data, type: "POST", dataType: "json", beforeSend: function () {}, complete: function (xhr, result) {var text = xhr. responseText; var js = JSON. parse (text); if (js & (1 = js. success) {success_num + = 1;} else {failure_num + = 1;} var pref = window. time | 0; var current = new Date (); var time = current. getTime ()-pref. getTime (); window. all_time + = time; // current. getTime ()-window. start_time.getTime (); var avg_time = Math. round (all_time/all_num ); // var log = "all_num =" + all_num + "\ n" + "success_num =" + success_num + "\ n" + "failure_num =" + failure_num + "\ n" + "time =" + time + "ms \ n" + "all_time =" + all_time + "ms \ n" + "avg_time =" + avg_time + "ms \ n "; $ ("# apitestresult "). text (log); // window. setTimeout (loop, 0.01*1000) ;}; // function loop () {// window. all_num + = 1; window. time = new Date (); jQuery. ajax (config);} // window. startTime = 0; window. setTimeout (loop, 0.01*1000 );}());

Take a pat.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.