Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    please help with javascript function

    Im using this script for greasemonkey but its not working could somebody please help me


    // ==UserScript==
    // @name tweepi
    // @namespace tweepi
    // @description tweepi
    // @include http://tweepi.com/tools/follow_by_followers#0
    // @version 1
    // @grant none
    // ==/UserScript==

    var input=document.createElement("input");
    input.type="button";
    input.value="GreaseMonkey Button";
    input.onclick = showAlert;
    document.body.appendChild(input);

    function showAlert()
    {
    javascriptfunction(){var%20a=function(b,c,d){return%20a=document.getElementsByClassName?function(a,b,c){c=c||d ocument;for(var%20g,d=c.getElementsByClassName(a),e=b?new%20RegExp('\\b'+b+'\\b','i'):null,f=[],h=0,i=d.length;i>h;h+=1)g=d[h],(!e||e.test(g.nodeName))&&f.push(g);return%20f}:document.evaluate?function(a,b,c){b=b||'*',c=c||doc ument;for(var%20i,j,d=a.split('%20'),e='',f='http://www.w3.org/1999/xhtml',g=document.documentElement.namespaceURI===f?f:null,h=[],k=0,l=d.length;l>k;k+=1)e+='[contains(concat(\'%20\',%20@class,%20\'%20\'),%20\'%20'+d[k]+'%20\')]';try{i=document.evaluate('.//'+b+e,c,g,0,null)}catch(m){i=document.evaluate('.//'+b+e,c,null,0,null)}for(;j=i.iterateNext()h.push(j);return%20h}:function(a,b,c){b=b||'*',c=c||document;for(var%20g,i,d=a.split('%20'),e=[],f='*'===b&&c.all?c.all:c.getElementsByTagName(b),h=[],j=0,k=d.length;k>j;j+=1)e.push(new%20RegExp('(^|\\s)'+d[j]+'(\\s|$)'));for(var%20l=0,m=f.length;m>l;l+=1){g=f[l],i=!1;for(var%20n=0,o=e.length;o>n&&(i=e[n].test(g.className),i);n+=1);i&&h.push(g)}return%20h},a(b,c,d)},b=function(a,b){if(-1==a.className.indexOf('x-grid3-row-selected')){var%20c=document.createEvent('MouseEvents');c.initMouseEvent('mousedown',!0,!0,window,0, 0,0,0,0,b,b,b,b,0,null),a.dispatchEvent(c);var%20d=document.createEvent('MouseEvents');d.initMouseEv ent('click',!0,!0,window,0,0,0,0,0,b,b,b,b,0,null),a.dispatchEvent(d)}};try{if(-1==window.location.href.indexOf('tweepi.com'))throw'';var%20c=document.createElement('script');c.tex tContent='window.fua();',(document.head||document.documentElement).appendChild(c),c.parentNode.remov eChild(c);var%20d=a('x-grid3-rows','div',document.getElementById('tweepiGridDiv'));if(d.length<=0)return;b(d[0],!1),b(d[d.length-1],!0)}catch(e){alert('Something%20went%20wrong.%20Please%20make%20sure%20you%20are%20on%20a%20Tweepi. com%20page!%20'+e)}})();
    }

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,969
    Thanks
    56
    Thanked 557 Times in 554 Posts
    I'm hoping that all those %20 and % aren't in the actual script, because that would be problem number one...

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,982
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    When posting here please help us to help you by making it easier to view, copy, modify, test and debug your scripts by following the posting guidelines and wrapping your code in CODE tags. This means use the octothorpe or # button on the toolbar. It should be very obvious why this is necessary. And you cannot expect people to disentangle scripts without any line breaks.


    Peter the Great's achievements was the acryllic alphabet. - Presenter BBC1

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    New Coder
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    When posting here please help us to help you by making it easier to view, copy, modify, test and debug your scripts by following the posting guidelines and wrapping your code in CODE tags. This means use the octothorpe or # button on the toolbar. It should be very obvious why this is necessary. And you cannot expect people to disentangle scripts without any line breaks.


    Peter the Great's achievements was the acryllic alphabet. - Presenter BBC1
    Ok,

    I know 100% sure the code bellow works:

    javascriptfunction(){var%20a=function(b,c,d){return%20a=document.getElementsByClassName?function(a,b,c){c=c||d ocument;for(var%20g,d=c.getElementsByClassName(a),e=b?new%20RegExp('\\b'+b+'\\b','i'):null,f=[],h=0,i=d.length;i>h;h+=1)g=d[h],(!e||e.test(g.nodeName))&&f.push(g);return%20f}:document.evaluate?function(a,b,c){b=b||'*',c=c||doc ument;for(var%20i,j,d=a.split('%20'),e='',f='http://www.w3.org/1999/xhtml',g=document.documentElement.namespaceURI===f?f:null,h=[],k=0,l=d.length;l>k;k+=1)e+='[contains(concat(\'%20\',%20@class,%20\'%20\'),%20\'%20'+d[k]+'%20\')]';try{i=document.evaluate('.//'+b+e,c,g,0,null)}catch(m){i=document.evaluate('.//'+b+e,c,null,0,null)}for(;j=i.iterateNext()h.push(j);return%20h}:function(a,b,c){b=b||'*',c=c||document;for(var%20g,i,d=a.split('%20'),e=[],f='*'===b&&c.all?c.all:c.getElementsByTagName(b),h=[],j=0,k=d.length;k>j;j+=1)e.push(new%20RegExp('(^|\\s)'+d[j]+'(\\s|$)'));for(var%20l=0,m=f.length;m>l;l+=1){g=f[l],i=!1;for(var%20n=0,o=e.length;o>n&&(i=e[n].test(g.className),i);n+=1);i&&h.push(g)}return%20h},a(b,c,d)},b=function(a,b){if(-1==a.className.indexOf('x-grid3-row-selected')){var%20c=document.createEvent('MouseEvents');c.initMouseEvent('mousedown',!0,!0,window,0, 0,0,0,0,b,b,b,b,0,null),a.dispatchEvent(c);var%20d=document.createEvent('MouseEvents');d.initMouseEv ent('click',!0,!0,window,0,0,0,0,0,b,b,b,b,0,null),a.dispatchEvent(d)}};try{if(-1==window.location.href.indexOf('tweepi.com'))throw'';var%20c=document.createElement('script');c.tex tContent='window.fua();',(document.head||document.documentElement).appendChild(c),c.parentNode.remov eChild(c);var%20d=a('x-grid3-rows','div',document.getElementById('tweepiGridDiv'));if(d.length<=0)return;b(d[0],!1),b(d[d.length-1],!0)}catch(e){alert('Something%20went%20wrong.%20Please%20make%20sure%20you%20are%20on%20a%20Tweepi. com%20page!%20'+e)}})();
    I used it as a bookmark so when i click on the bookmark the code will activate, but because didn't wrote it myself if have no idea how it works so thats why I asked you guys for help
    the function will automaticly click a few buttons button code:

    <div class="x-button-litebutton-wrapper x-btn action_button inline_block x-component x-btn-text-icon " aria-describedby="x-auto-82" id="x-auto-293" tabindex="0" style="width: 40px;">Follow<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="http://tweepi.com/js/tweepigxt/clear.cache.gif" style="width: 16px; height: 16px; background-image: url(http://tweepi.com/js/tweepigxt/67791...52.cache.png); position: absolute; left: -1px; top: 3px; background-position: -162px 0px; background-repeat: no-repeat no-repeat;" border="0" role="presentation" class=" x-btn-image"></div>
    and:

    <div class="x-button-litebutton-wrapper x-btn action_button inline_block x-component x-btn-text-icon " aria-describedby="x-auto-107" id="x-auto-303" tabindex="0" style="width: 40px;">Follow<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="http://tweepi.com/js/tweepigxt/clear.cache.gif" style="width: 16px; height: 16px; background-image: url(http://tweepi.com/js/tweepigxt/67791...52.cache.png); position: absolute; left: -1px; top: 3px; background-position: -162px 0px; background-repeat: no-repeat no-repeat;" border="0" role="presentation" class=" x-btn-image"></div>

    as you can see the code's are almost the same
    the "id" always starts with: id="x-auto-(and than a number bellow 1000)
    so if you could write a similar javascript that picks up the the id="x-auto-(and than a number bellow 1000)
    I would get the same result

    if somebody please could help me with writing this script, I would be very thankfull

  • #5
    New Coder
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can anybody help me with this please

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,982
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Quote Originally Posted by arclite886 View Post
    if somebody please could help me with writing this script, I would be very thankfull
    See my comments in post #3. We don't have the time to disentangle code with no line breaks and containing smilies. Nor does it help to say "it does not work" without further information. Have you tried using your error console? What error messages do you receive? I suggest you read the posting guidelines and MUST READ- How to post a JavaScript question! before you post again.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #7
    New Coder
    Join Date
    Feb 2014
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, i didn't wrote the code so i have no idea how it woeks or how to line break so i have we have to forget about that,

    could somebody please help me how to get this object:

    <div class="x-button-litebutton-wrapper x-btn action_button inline_block x-component x-btn-text-icon " aria-describedby="x-auto-82" id="x-auto-293" tabindex="0" style="width: 40px;">Follow<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="http://tweepi.com/js/tweepigxt/clear.cache.gif" style="width: 16px; height: 16px; background-image: url(http://tweepi.com/js/tweepigxt/67791...52.cache.png); position: absolute; left: -1px; top: 3px; background-position: -162px 0px; background-repeat: no-repeat no-repeat;" border="0" role="presentation" class=" x-btn-image"></div>
    and this one

    <div class="x-button-litebutton-wrapper x-btn action_button inline_block x-component x-btn-text-icon " aria-describedby="x-auto-107" id="x-auto-303" tabindex="0" style="width: 40px;">Follow<img onload="this.__gwtLastUnhandledEvent=&quot;load&quot;;" src="http://tweepi.com/js/tweepigxt/clear.cache.gif" style="width: 16px; height: 16px; background-image: url(http://tweepi.com/js/tweepigxt/67791...52.cache.png); position: absolute; left: -1px; top: 3px; background-position: -162px 0px; background-repeat: no-repeat no-repeat;" border="0" role="presentation" class=" x-btn-image"></div>
    how to get them at the same time, the only difference between those two is the the "id" for example "id="x-auto-(number above 0)"
    can somebody please help me with this one


  •  

    LinkBacks (?)

    1. 02-28-2014, 02:34 PM

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •