Slupik98

[PLEMIONA] Basic Tools

Nov 29th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. $.ajax({
  2. url: 'https://raw.githubusercontent.com/Slupik/TribalWars/master/SlupioScriptSettings/maincode.js',
  3. success: function (response) {
  4. eval(response);
  5. }
  6. });
  7.  
  8. if (!('contains' in String.prototype)) {
  9. String.prototype.contains = function (str, startIndex) {
  10. return -1 !== String.prototype.indexOf.call(this, str, startIndex);
  11. };
  12. };
  13. if (!('getHexEncode' in String.prototype)) {
  14. String.prototype.getHexEncode = function () {
  15. var hex, i;
  16.  
  17. var result = "";
  18. for (i = 0; i < this.length; i++) {
  19. hex = this.charCodeAt(i).toString(16);
  20. result += ("000" + hex).slice(-4);
  21. }
  22.  
  23. return result;
  24. }
  25. };
  26. if (!('getHexDecode' in String.prototype)) {
  27. String.prototype.getHexDecode = function () {
  28. var j;
  29. var hexes = this.match(/.{1,4}/g) || [];
  30. var back = "";
  31. for (j = 0; j < hexes.length; j++) {
  32. back += String.fromCharCode(parseInt(hexes[j], 16));
  33. }
  34.  
  35. return back;
  36. }
  37. };
  38. if (!('replaceAll' in String.prototype)) {
  39. String.prototype.replaceAll = function (token, newToken, ignoreCase) {
  40. var _token;
  41. var str = this + "";
  42. var i = -1;
  43.  
  44. if (typeof token === "string") {
  45. if (ignoreCase) {
  46. _token = token.toLowerCase();
  47.  
  48. while ((
  49. i = str.toLowerCase().indexOf(
  50. _token, i >= 0 ? i + newToken.length : 0
  51. )
  52. ) !== -1
  53. ) {
  54. str = str.substring(0, i) +
  55. newToken +
  56. str.substring(i + token.length);
  57. }
  58. } else {
  59. return this.split(token).join(newToken);
  60. }
  61. }
  62. return str;
  63. };
  64. }
Advertisement
Add Comment
Please, Sign In to add comment