Advertisement
Yunga

CastleVille Bookmarklets

May 8th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // --------------------------[ CastlevilleBonuses.201204132000.js ]-----
  2. //
  3. //             ,-.         .   .           . .
  4. //            /            |   |         o | |
  5. //            |    ,-: ,-. |-  | ,-. . , . | | ,-.
  6. //            \    | | `-. |   | |-' |/  | | | |-'
  7. //             `-' `-` `-' `-' | `-' '   ' ' ' `-'
  8. //                             |-. ,-. ,-. . . ,-. ,-. ,-.
  9. //                             | | | | | | | | `-. |-' `-.
  10. //                             `-' `-' ' ' `-` `-' `-' `-'
  11. //
  12. // --------------------------------------------------------[ Info ]-----
  13. //
  14. // Hello!
  15. //
  16. // This bookmarklet searches the links in the current page that start
  17. // with 'http://apps.facebook.com/playcastleville/receive.php?'. If some
  18. // are found, and depending of what the user chooses, it opens every url
  19. // sequentially in a new window (every 20 seconds) to get the bonuses,
  20. // or - if cancel is pressed - produces a list of all the bonuses found
  21. // (this might be useful for copy/pasting or saving the urls for
  22. // friends).
  23. //
  24. // I tested this on Chromium and Firefox. I don't know if it works for
  25. // other browsers, feel free to modify and redistribute this.
  26. //
  27. // How to use?
  28. // Simply create a new bookmark, possibly in your address bar, give it
  29. // any name you like, and for the address field, copy/paste one of the
  30. // "javascript:" line below. (Triple click to select the whole line)
  31. //
  32. // Attention: Don't close the windows while it's running, else you will
  33. // have to restart and fatally you will request the same bonuses.
  34. //
  35. // It is NOT advised to play while collecting bonuses. It works, sadly
  36. // your connection to the game may be reset while you play. But you can
  37. // harvest several pages of bonuses at the same time...
  38. //
  39. // Included are two other versions with prompts for the delay and the
  40. // search string. The three are nearly identical, basically, set d(elay)
  41. // and/or s(earch) to 0 near column 282. I also leave the unminified
  42. // script if you want to play with it.
  43. //
  44. // I also added a bookmarklet for The Sims Social and CityVille, for
  45. // other games, just change the s(earch) string at columns 225.
  46. //
  47. // As usual, if this thing destroy your computer, your town, or the
  48. // entire fabric of space-time, it's your business. Don't play with
  49. // something you don't understand, use with extreme caution and at your
  50. // own risks.
  51. //
  52. //                                                        Have Fun!
  53. //                                                     Yunga Palatino.
  54. //
  55. //
  56. // ------------------------------------------------[ Bookmarklets ]-----
  57.  
  58. // CastleVille: http://apps.facebook.com/playcastleville/receive.php?
  59. javascript:(function(){function g(){if(i--){m.innerHTML="<br /><br /><br />"+i+" bonus pages to get...";w.location=b[i];setTimeout(g,d*1e3)}else{document.body.removeChild(m);alert("That's all folks!")}}var l,b,d,s,c,i,m,w;c='http://apps.facebook.com/playcastleville/receive.php?';d=20;s=c;s=s?c:prompt("What's the BEGINNING of the url?",c);if(!s)return;b=[];l=document.links;i=l.length;while(i--){if(!l[i].href.indexOf(s))b.push(l[i].href)}c=i=b.length;if(i>0){if(confirm('Get the '+i+' bonus(es) found?')){d=d?d:prompt('Delay in second between each bonus?',20);if(!d)return;m=document.createElement('div');m.setAttribute('style','position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');document.body.appendChild(m);w=window.open('about:blank');g()}else{w=window.open().document;w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="'+location.href+'">'+document.title+'</a>:</h3><hr />');while(i--){w.writeln('\n<a href="'+b[i]+'">'+b[i]+'</a><br />')}w.writeln('</body></html>')}}else{alert('No Bonus Found!')}})()
  60.  
  61. // CastleVille + Delay:
  62. javascript:(function(){function g(){if(i--){m.innerHTML="<br /><br /><br />"+i+" bonus pages to get...";w.location=b[i];setTimeout(g,d*1e3)}else{document.body.removeChild(m);alert("That's all folks!")}}var l,b,d,s,c,i,m,w;c='http://apps.facebook.com/playcastleville/receive.php?';d=0;s=c;s=s?c:prompt("What's the BEGINNING of the url?",c);if(!s)return;b=[];l=document.links;i=l.length;while(i--){if(!l[i].href.indexOf(s))b.push(l[i].href)}c=i=b.length;if(i>0){if(confirm('Get the '+i+' bonus(es) found?')){d=d?d:prompt('Delay in second between each bonus?',20);if(!d)return;m=document.createElement('div');m.setAttribute('style','position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');document.body.appendChild(m);w=window.open('about:blank');g()}else{w=window.open().document;w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="'+location.href+'">'+document.title+'</a>:</h3><hr />');while(i--){w.writeln('\n<a href="'+b[i]+'">'+b[i]+'</a><br />')}w.writeln('</body></html>')}}else{alert('No Bonus Found!')}})()
  63.  
  64. // SearchString + Delay:
  65. javascript:(function(){function g(){if(i--){m.innerHTML="<br /><br /><br />"+i+" bonus pages to get...";w.location=b[i];setTimeout(g,d*1e3)}else{document.body.removeChild(m);alert("That's all folks!")}}var l,b,d,s,c,i,m,w;c='http://apps.facebook.com/playcastleville/receive.php?';d=0;s=0;s=s?c:prompt("What's the BEGINNING of the url?",c);if(!s)return;b=[];l=document.links;i=l.length;while(i--){if(!l[i].href.indexOf(s))b.push(l[i].href)}c=i=b.length;if(i>0){if(confirm('Get the '+i+' bonus(es) found?')){d=d?d:prompt('Delay in second between each bonus?',20);if(!d)return;m=document.createElement('div');m.setAttribute('style','position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');document.body.appendChild(m);w=window.open('about:blank');g()}else{w=window.open().document;w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="'+location.href+'">'+document.title+'</a>:</h3><hr />');while(i--){w.writeln('\n<a href="'+b[i]+'">'+b[i]+'</a><br />')}w.writeln('</body></html>')}}else{alert('No Bonus Found!')}})()
  66.  
  67. // CityVille: https://apps.facebook.com/cityville/Reward.php?
  68. javascript:(function(){function g(){if(i--){m.innerHTML="<br /><br /><br />"+i+" bonus pages to get...";w.location=b[i];setTimeout(g,d*1e3)}else{document.body.removeChild(m);alert("That's all folks!")}}var l,b,d,s,c,i,m,w;c='https://apps.facebook.com/cityville/Reward.php?';d=20;s=c;s=s?c:prompt("What's the BEGINNING of the url?",c);if(!s)return;b=[];l=document.links;i=l.length;while(i--){if(!l[i].href.indexOf(s))b.push(l[i].href)}c=i=b.length;if(i>0){if(confirm('Get the '+i+' bonus(es) found?')){d=d?d:prompt('Delay in second between each bonus?',20);if(!d)return;m=document.createElement('div');m.setAttribute('style','position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');document.body.appendChild(m);w=window.open('about:blank');g()}else{w=window.open().document;w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="'+location.href+'">'+document.title+'</a>:</h3><hr />');while(i--){w.writeln('\n<a href="'+b[i]+'">'+b[i]+'</a><br />')}w.writeln('</body></html>')}}else{alert('No Bonus Found!')}})()
  69.  
  70. // The Sims Social: https://apps.facebook.com/thesimssocial/feed?
  71. javascript:(function(){function g(){if(i--){m.innerHTML="<br /><br /><br />"+i+" bonus pages to get...";w.location=b[i];setTimeout(g,d*1e3)}else{document.body.removeChild(m);alert("That's all folks!")}}var l,b,d,s,c,i,m,w;c='https://apps.facebook.com/thesimssocial/feed?';d=20;s=c;s=s?c:prompt("What's the BEGINNING of the url?",c);if(!s)return;b=[];l=document.links;i=l.length;while(i--){if(!l[i].href.indexOf(s))b.push(l[i].href)}c=i=b.length;if(i>0){if(confirm('Get the '+i+' bonus(es) found?')){d=d?d:prompt('Delay in second between each bonus?',20);if(!d)return;m=document.createElement('div');m.setAttribute('style','position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');document.body.appendChild(m);w=window.open('about:blank');g()}else{w=window.open().document;w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="'+location.href+'">'+document.title+'</a>:</h3><hr />');while(i--){w.writeln('\n<a href="'+b[i]+'">'+b[i]+'</a><br />')}w.writeln('</body></html>')}}else{alert('No Bonus Found!')}})()
  72.  
  73. // --------------------------------------------------[ JavaScript ]-----
  74.  
  75. javascript:(function () {
  76.  
  77.     function g() {              // get the bonuses
  78.         if (i--) {
  79.             m.innerHTML = "<br /><br /><br />" + i + " bonus pages to get...";
  80.             w.location = b[i];
  81.             setTimeout(g, d * 1000)
  82.         } else {
  83.             document.body.removeChild(m);
  84.             alert("That's all folks!");
  85.         }
  86.     }
  87.  
  88.     var l, b, d, s, c, i, m, w;   // links, bonuses, delay, search, castleville string/counter, iterations, message element, window
  89.     c = 'http://apps.facebook.com/playcastleville/receive.php?';
  90.     d = 20; // d = 0;          // set to 0 if you want to be prompted for delay
  91.     s = c;  // s = 0;          // set to 0 if you want to be prompted for another search string
  92.  
  93.     s = s ? c : prompt("What's the BEGINNING of the url?", c);
  94.     if (!s) return;
  95.  
  96.     b = [];
  97.     l = document.links;
  98.     i = l.length;
  99.     while (i--) {
  100.         if (!l[i].href.indexOf(s)) b.push(l[i].href)
  101.     }
  102.  
  103.     c = i = b.length;
  104.     if (i > 0) {
  105.  
  106.         if (confirm('Get the ' + i + ' bonus(es) found?')) {  // Get the bonuses
  107.             d = d ? d : prompt('Delay in second between each bonus?', 20);
  108.             if (!d) return;
  109.  
  110.             m = document.createElement('div');
  111.             m.setAttribute('style', 'position: fixed; top: 0px; left: 0px; bottom: 0px; right: 0px; background: #369; color: #fff; cursor: wait; text-align: center; vertical-align: middle; opacity: 0.9; z-index: 10000;');
  112.             document.body.appendChild(m);
  113.             w = window.open('about:blank');
  114.             g()
  115.         } else {                // List found bonuses
  116.             w = window.open().document;
  117.             w.writeln('<html><head><title>CastleVilleBonuses '+new Date().getTime()+'</title></head><body><h3>Bonus(es) from <a href="' + location.href + '">' + document.title + '</a>:</h3><hr />');
  118.             while (i--) {
  119.                 w.writeln('\n<a href="'+ b[i] +'">'+ b[i] +'</a><br />')
  120.             }
  121.             w.writeln('</body></html>')
  122.         }
  123.  
  124.     } else {
  125.         alert('No Bonus Found!')
  126.     }
  127.  
  128. })()
  129.  
  130. // -----------------------------------------------------[ The End ]-----
  131. // QlpoOTFBWSZTWe7KfUUAAaxYAGAAQABgADABUaKhmgEnqkgKmpRvr5Y022RJu7oD3XvXH
  132. // de93bodXad3l6cvXsL3aD0wvXWN113j3c70tVzSZjCINYJlFIFmz5NS7crNRQwkRACRNm
  133. // jWFAGxptJVSiBzk6XDobilu6XTuyZjQkxUkb9sscLYstbRutnW6yMat0GjSiyy7aktNLt
  134. // 2OxFQrCzdm4axHhdyRThQkO7KfUU=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement