Tanabata, single How I received 12 bunches of roses after I knocked out the code

Source: Internet
Author: User
Tags sendmsg

You are sure to say:
No picture u say a JB!!!

---, let's go.

In summary, this article is to introduce a blogger's brush star (inside the Flash) script, used to hang the machine to brush the stars. In the Tanabata is the brush of roses, so is not the title party, let me take everyone together to brush the stars!

One Send MessageLook at the request and simulate the send yourself
$.post ("Http://ing.cnblogs.com/ajax/ing/Publish",            //Address    json.stringify ({"Content": Content, "Publicflag": 1}),//parameters, JSON format string    function (Result) {                                      ///callback        Console.log ("... Sent successfully, next to determine whether there are stars ");        Result && result. Issuccess && Judgestar (content)    }, "json");                                              The returned content is turned into a JS object
Two Judging if there's a lucky flash in the news just now ,Still looking at the picture and talking, doing it

The requested address is:http://ing.cnblogs.com/ajax/ing/GetIngList?IngListType=all&PageIndex=1&PageSize=30&Tag=&_=1440087133884

Known by the name (and indeed so), you can choose the type (my, I respond, the new response, mention me, reply me, the whole station), the first few pages, the number of pages per page. The last one is a timestamp.

Our mock request:
$.ajax ({            URL: "Http://ing.cnblogs.com/ajax/ing/GetIngList? inglisttype=all&pageindex=1&pagesize=3&tag=&_= "+ (+new Date),            type:" Get ",            dataType:" Text ",            success:function (Result) {                //processed logic
window.doc=$ (result); What ghosts can be seen in the console );

The reason for using dataType: "Text" is because:

Returned is a piece of HTML code, using $ (result) can be seen in the console is divided into 3 parts, we need to find the part just sent, and determine whether there is a lucky flash. I only choose to get the first 3 to judge, if there are 3 people above just with me to brush the flash, then I can not find it ... So you can make a little more of each page.

This is the code that I find and judge whether there are stars:
var Feeddiv = $ (Result). EQ (2);                var Msgspan = Feeddiv.find ("Span:contains ('" + msg + "')");                This is actually not rigorous, especially in the big night to find all their own                ... if (Msgspan.length > 0) {                    console.log ("..."). Find sent Flash, start judging ");                } else {                    Console.log ("....."). Failed to find the sent Flash, possibly script error ")                ;                var id = msgspan.attr ("id"). Match (/body_ (\d+) $/) [1];                if (Msgspan.next ("Img.ing_icon_lucky"). Length > 0) {                    console.log ("..."). Lucky Flash +1 "Stars" ");                } else {                    //did not find the stars, it seems bad luck. Then just delete that one!!!                }
Three Delete the "scrap" flash that just didn't have a starFor the Stars (roses) people, useless will throw it ... This I do not send a diagram, directly on the code:
    Remove    The Flash function delmsg (ID) {        console.log ("...). No stars, delete the Flash, id "+ ID");        Return $.post ("Http://ing.cnblogs.com/ajax/ing/del", Json.stringify ({ingid:id}));    }
Four Summary

Can get "star", really with the face, I 6 minutes brush once, brush one afternoon one night only more than 10.
It's 12 o ' 43, I'm disturbed. My company computer hanging this script has been brushed, I looked at home no way, do not know tomorrow will be small black house ... Let's go to the park early tomorrow morning.
And do not know whether it is the browser card master, and occasionally a few no stars, it did not delete ...

The following is the complete code:
function Memeda (input) {var times = 0;    Shuaxingxing (input);        function shuaxingxing (content) {sendmsg (content);        SetInterval (function () {sendmsg (content);    }, 1000 * 60 * 6 + 100); }//Send Flash message function sendmsg (content) {Console.log ("..... ... ...) ... ..... ... ..... ... ..... ... ..... ....." ..... ..... ...........        ...........");        times++;        Console.log ("Current time:" + new Date (). tolocaletimestring () + "first" + Times + "Send Flash"); Console.log ("......")        Send Flash "); Return $.post ("Http://ing.cnblogs.com/ajax/ing/Publish", Json.stringify ({"Content": Content, "Publicflag": 1}), function () {}, "JSON"). Done (function (result) {Console.log ("...").                Judging whether there are stars "); Result && result.    Issuccess && Judgestar (content)}); }//Determine if there is a Star function Judgestar (msg) {$.ajax ({url: "Http://ing.cnblogs.com/ajax/ing/GetIngList? inglisttype=all&pageindex=1&Amp pagesize=3&tag=&_= "+ (+new Date), type:" Get ", DataType:" Text ", Success:functi                On (Result) {var feeddiv = $ (Result). EQ (2);                var Msgspan = Feeddiv.find ("Span:contains ('" + msg + "')"); if (Msgspan.length > 0) {console.log ("...").                Find sent Flash, start to judge "); } else {Console.log (".....").                Failed to find the sent Flash, possibly script error ");                var id = msgspan.attr ("id"). Match (/body_ (\d+) $/) [1]; if (Msgspan.next ("Img.ing_icon_lucky"). Length > 0) {console.log ("...").                Lucky Flash +1 "Stars" ");                } else {delmsg (ID);    }            }        }); }//Remove Flash function delmsg (ID) {Console.log ("...)".        No stars, delete the Flash, id "+ ID");    Return $.post ("Http://ing.cnblogs.com/ajax/ing/del", Json.stringify ({ingid:id})); }}
xClose Here's the brazen time.

Do you have any interest in this article?

It's okay. WQNMLGBD










.

Tanabata, single How I received 12 bunches of roses after I knocked out the code

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.