Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.75 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Freak OW Helper
  3. // @namespace You
  4. // @version 2f
  5. // @date 24 May 10
  6. // @match *.outwar.com/*
  7. // @exclude *.outwar.com/myaccount*
  8.  
  9. // @require http://code.jquery.com/jquery-latest.js
  10. // @grant GM_setClipboard
  11. // @grant GM_openInTab
  12. // ==/UserScript==
  13.  
  14.  
  15. var owServer = oServer(document.URL);
  16. var button = document.createElement('button');
  17. var doc = document;
  18.  
  19. if (doc.URL.indexOf("raidattack.php") > -1) {
  20. var autoRaidDamage = true;
  21. var bHandler = true;
  22. var aHit = new Array();
  23. RaidDamage();
  24. } else if (doc.URL.indexOf("world") > -1) {
  25. // display room number in tab
  26. setInterval(function() { doc.title = "OW | Room: " + curRoom }, 100);
  27. }
  28.  
  29. //var x = document.cookie.length-1;
  30. //window.alert(x);
  31.  
  32.  
  33.  
  34. // page-switch memory
  35. $('#toolbar_uid').attr('onchange', '');
  36. $('#toolbar_uid').change(function() {
  37. var uid = $('#toolbar_uid').val();
  38. //var uid = document.getElementById('toolbar_uid').value;
  39. //var uid2 = document.cookie.split('ow_userid=')[1].split('')[0];
  40. if (uid > 0) {
  41. //$.cookie("ow_userid=", uid);
  42. //document.cookie = 'ow_userid=' + uid;
  43. if (window.location.search.length != 0) {
  44. if (window.location.search.indexOf('suid=') != -1) {
  45. window.location = window.location.href.replace(/suid=\d+/i, ('suid='+uid))
  46. } else {
  47. window.location = window.location.href + '&suid='+uid;
  48. };
  49. } else {
  50. window.location = window.location.pathname + '?suid='+uid;
  51. };
  52. // } else if (uid < 1) {
  53. } else {
  54. window.location = '/myaccount';
  55. };
  56. });
  57.  
  58.  
  59. function getCrewName (number) {
  60. var links = document.links;
  61. var tlink = 'http://' + oServer(doc.URL) + '.outwar.com/crew_raidsults';
  62. for(var l = 0; l < links.length; l++) {
  63. if(links[l].href.startsWith(tlink)) {
  64. var crewnameParts = links[l].textContent.split('\'')[0].split(' ');
  65. var crewname = '';
  66. for(var i = 1; i < crewnameParts.length; i++) {
  67. crewname += crewnameParts[i] + ' ';
  68. }
  69. return crewname;
  70. }
  71. }
  72. }
  73.  
  74. if ( document.URL.indexOf("crew_profile") != -1 ) {
  75. if (doc && doc != null) {
  76. var crewname = getCrewName();
  77. var tables = doc.getElementsByTagName('table'); //fetching all the tabels
  78. for (var t = 0; t < tables.length; t++){ //running through all the tables
  79. if(tables[t].border >= '1' && crewname != 'Results ') { //getting the one that contains the crew members
  80. var rows = tables[t].getElementsByTagName('tr');
  81. for (var r = 0; r < rows.length; r++){ //running through all the rows
  82. var cells = rows[r].getElementsByTagName('td'); //fetching the cells of the current row
  83. if(cells[0].innerHTML == '<b>Rank</b>') {
  84. rows[r].innerHTML = rows[r].innerHTML + '<td><b>&nbsp;</b></td>'
  85. } else {
  86. var link = rows[r].getElementsByTagName('a')[0].href;
  87. //rows[r].innerHTML = rows[r].innerHTML + '<td><a href="' + link + '" target="_blank"><img alt="Attack!" src="images/atk_player_icon.jpg" valign="center" border="0"></a></td><td><form method="POST" action="crew_hitlist" TARGET="_blank"><input type="hidden" name="hitname" value="' + cells[1].textContent + '"><input type="hidden" name="hitreason" value="' + crewname + '"><input NAME="addToHitlist" type="image" src="http://torax.outwar.com/images/rareicon.jpg" ></form></td>'
  88. rows[r].innerHTML = rows[r].innerHTML + '<td><a href="' + link + '" target="_blank" valign="center" border="0">Attack</a></td><td><form method="POST" action="crew_hitlist" TARGET="_blank"><input type="hidden" name="hitname" value="' + cells[1].textContent + '"><input type="hidden" name="hitreason" value="' + crewname + '"><input NAME="addToHitlist" type="image" src="http://torax.outwar.com/images/rareicon.jpg" ></form></td>'
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }
  95.  
  96. //if (doc.URL.indexOf("outwar") != -1) {
  97. var sessid = document.cookie.split('rg_sess_id=')[1].split(';')[0];
  98. var btn1 = document.createElement("button");
  99. btn1.appendChild(document.createTextNode("COPY RG_SESS_ID"));
  100. btn1.setAttribute('title', sessid);
  101. btn1.setAttribute('style', 'font-family: "Verdana" !important; background-color: inherit; width:160px; padding:4px; margin-bottom: 1px; color: #FFF !important; font-weight:bold !important; border:1px; cursor: pointer;');
  102. //btn1.addEventListener("click", function() { alert("RG_SESS_ID Copied to Clipboard")}, false);
  103. btn1.addEventListener('mouseover', function() {
  104. this.title = sessid
  105. }, false);
  106. btn1.addEventListener("click", function() {
  107. GM_setClipboard(sessid)
  108. }, false);
  109. $("div#accordian ul li").last().append("<li><hr color=#C50202></li>");
  110. $("div#accordian ul li").last().append(btn1);
  111. $("div#accordian ul li").last().append("<h3><a href='expchart'><font color=white><center>EXP CHART</center></font></a></h3>");
  112. $("div#accordian ul li").last().append("<h3><a href='crew_vault'><font color=white><center>CREW VAULT</center></font></a></h3>");
  113. $("div#accordian ul li").last().append("<h3><a href='crew_bossspawns'><font color=white><center>BOSS SPAWNS</center></font></a></h3>");
  114. $("div#accordian ul li").last().append("<li><hr color=#C50202></li>");
  115.  
  116. //console.log(thediv.childNodes);
  117.  
  118.  
  119. if (doc.URL.indexOf("world") != -1) {
  120. //var thediv = doc.getElementById('accordian');
  121. var box = doc.createElement('LI');
  122. var linkme = doc.createElement('a');
  123. linkme.addEventListener("click", attackmobs, false);
  124. //linkme.setAttribute('title', "Attack all the mobs in this room");
  125. linkme.appendChild(doc.createTextNode('ATTACK ALL MOBS'));
  126. linkme.setAttribute('href', '#');
  127. linkme.setAttribute('style', 'font-family: "Verdana" !important; color: white !important; font-weight:bold !important; border:1px; cursor: pointer;');
  128. box.setAttribute('style', 'text-align: center; width: 160px; padding:4px;');
  129. box.appendChild(linkme);
  130. //thediv.insertBefore(box, thediv.childNodes[2]);
  131. $("div#accordian ul li").last().append(box);
  132. }
  133.  
  134. if (window.location.href.indexOf("/world") > -1) {
  135. var searchForm = document.createElement('div');
  136. searchForm.setAttribute('id', 'search_form');
  137. searchForm.setAttribute('style', 'border: 1px solid #990000; font-family: "Verdana" !important; background-color: #990000 !important; width: 154px; padding: 2px !important; color: #FFF !important; font-weight:bold !important; cursor: pointer;');
  138. box.appendChild(searchForm);
  139. var searchInput = document.createElement('input');
  140. searchInput.setAttribute('size', '14');
  141. searchInput.setAttribute('type', 'text');
  142. searchInput.setAttribute('id', 'sPlayer');
  143. searchInput.setAttribute('style', 'font-family: "Verdana" !important; background-color: black; width: 99px; padding: 0px !important; margin: 1px !important; color: #FFF !important; font-weight:bold !important; cursor: default;');
  144. searchInput.addEventListener('click', killHandler, false);
  145. searchInput.addEventListener('blur', reviveHandler, false);
  146. searchInput.addEventListener('keypress', function(e) {
  147. if (e.keyCode == 13) {
  148. document.getElementById('search_button').click();
  149. }
  150. }, false);
  151. var searchSubmit = document.createElement('input');
  152. searchSubmit.setAttribute('type', 'button');
  153. searchSubmit.setAttribute('value', 'Search');
  154. searchSubmit.setAttribute('id', 'search_button');
  155. searchSubmit.setAttribute('style', 'color: #000 !important; background-color: gray; width: 50px; padding-top: 2px !important; cursor: pointer;');
  156. searchSubmit.addEventListener('click', goSearch, false);
  157. searchForm.appendChild(searchInput);
  158. //searchForm.appendChild(document.createElement('br'));
  159. searchForm.appendChild(searchSubmit);
  160. masterdiv.insertBefore(searchForm, masterdiv.lastChild);
  161.  
  162. function goSearch() {
  163. var sPlayer = trim(document.getElementById('sPlayer').value);
  164. var owServer = oServer(document.URL);
  165. location.href = 'http://' + owServer + '.outwar.com/profile?transnick=' + sPlayer;
  166. }
  167. }
  168.  
  169.  
  170.  
  171. // will probably trigger rate limit error now
  172. if ( document.URL.indexOf("crew_profile") > -1 ) {
  173. var link2 = document.createElement('a');
  174. link.addEventListener("click", crewprofileTabs, false);
  175. link.setAttribute('title',"Clicking this will open everyone's profile in tabs. It may take several minutes to load.");
  176. link.appendChild(document.createTextNode(' @'));
  177. link.setAttribute('href','#');
  178. link.setAttribute('style','color: orange; font-weight: bold; font-size: 10px;');
  179. var doc2 = document;
  180. if (doc2 && doc2 != null) {
  181. var maindiv = doc2.getElementsByTagName("td");
  182. var i2 = 0;
  183. for (i2; i2 < maindiv.length; i2++){
  184. if ( maindiv[i2].innerHTML.indexOf("Name") > -1 ) {
  185. maindiv[i2].appendChild(link2);
  186. }
  187. }
  188. }
  189. }
  190.  
  191.  
  192. function crewprofileTabs() {
  193. var doc = document;
  194. if (doc != null){
  195. var aLinks = doc.links;
  196. if (aLinks && aLinks != null && aLinks.length > 0 ){
  197. var i = 0;
  198. for (i; i < aLinks.length; i++){
  199. if ( oPage(aLinks[i].href, 'profile.php') == true ){
  200. GM_openInTab(aLinks[i].href, true);
  201. }
  202. }
  203. }
  204. }
  205. }
  206.  
  207. // need to add time interval every 4ish tabs to avoid rate limit error
  208. function attackmobs() {
  209. // check we have document object
  210. if (doc != null){
  211. // get all links
  212. var aLinks = doc.links;
  213. // check
  214. if (aLinks && aLinks != null && aLinks.length > 0 ){
  215. // loop
  216. var i = 0
  217. for (i; i < aLinks.length; i++){
  218. // check
  219. if ( oPage(aLinks[i].href, 'somethingelse.php') == true ){
  220. // open new tab
  221. GM_openInTab(aLinks[i].href);
  222. }
  223. }
  224. }
  225. }
  226. }
  227. // error handling, return to earth
  228. //var owsrc = '/images/errorz.jpg',
  229. //imgs = doc.evaluate("//img[contains(@src, '"+owsrc+"')]",doc,null,6,null);
  230. //var e = imgs.snapshotLength-1
  231. //for(e; e >= 0; e--) {
  232. // location.href = 'http://' + owServer + '.outwar.com/world';
  233. //}
  234.  
  235. // quest help - doesn't work right now
  236. //if (document.body.innerHTML.indexOf("They are in a lost section of the Foundry") > -1) {
  237. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=14264&stepid=758&finish=1&userspawn=';
  238. //} else if (document.body.innerHTML.indexOf("5 Dark Essences") > -1) {
  239. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4045&stepid=438&finish=1&userspawn=';
  240. //} else if (document.body.innerHTML.indexOf("Shadow Potion!") > -1) {
  241. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4045&stepid=437&finish=1&userspawn=';
  242. //} else if (document.body.innerHTML.indexOf("5 Holy Essences") > -1) {
  243. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4043&stepid=442&finish=1&userspawn=';
  244. //} else if (document.body.innerHTML.indexOf("Holy Potion!") > -1) {
  245. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4043&stepid=441&finish=1&userspawn=';
  246. //} else if (document.body.innerHTML.indexOf("5 Fiery Essence") > -1) {
  247. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4042&stepid=448&finish=1&userspawn=';
  248. //} else if (document.body.innerHTML.indexOf("Fire Potion!") > -1) {
  249. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4042&stepid=447&finish=1&userspawn=';
  250. //} else if (document.body.innerHTML.indexOf("5 Arcane Essences") > -1) {
  251. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4044&stepid=440&finish=1&userspawn=';
  252. //} else if (document.body.innerHTML.indexOf("Arcane Potion!") > -1) {
  253. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4044&stepid=439&finish=1&userspawn=';
  254. //} else if (document.body.innerHTML.indexOf("1 Flame-Scarred Ruby") > -1) {
  255. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4041&stepid=444&finish=1&userspawn=';
  256. //} else if (document.body.innerHTML.indexOf("Kinetic Potion!") > -1) {
  257. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=4041&stepid=443&finish=1&userspawn=';
  258. //} else if (document.body.innerHTML.indexOf("purchase a potion") > -1) {
  259. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=2160075&stepid=1512&userspawn=1';
  260. //} else {
  261. // if (document.body.innerHTML.indexOf("Kix Potion!") > -1) {
  262. // location.href = 'http://' + owServer + '.outwar.com/mob_talk.php?id=2160075&stepid=1509&finish=1&userspawn=1';
  263. // }
  264. //}
  265.  
  266. //display passwords and security words on mouseover
  267. (function () {
  268. var inputs, input;
  269. inputs = document.evaluate('//input[@type="password"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  270. if (!inputs.snapshotLength) return;
  271. for (var i = 0; i < inputs.snapshotLength; i++) {
  272. input = inputs.snapshotItem(i);
  273. input.addEventListener('mouseover', function (event) {
  274. this.type = 'text';
  275. }, false);
  276. input.addEventListener('mouseout', function (event) {
  277. this.type = 'password';
  278. }, false);
  279. }
  280. })();
  281.  
  282. // logout confirmation
  283. var links = document.getElementsByTagName('a');
  284. for (var x = 0; x < links.length; x++) {
  285. if (links[x].getAttribute('href') == '/?cmd=logout') {
  286. links[x].setAttribute('onclick', 'return confirm(\'Are you sure you want to Logout?\')')
  287. }
  288. }
  289.  
  290. if (document.URL.indexOf("crew_invites") != -1) {
  291. document.forms[0].elements[0].focus();
  292. } else if (document.URL.indexOf("homepost") != -1) {
  293. document.forms[0].elements[0].focus();
  294. } else if (document.URL.indexOf("security_prompt") != -1) {
  295. document.forms[0].elements[1].focus();
  296. } else if (document.URL.indexOf("formraid") != -1) {
  297. document.forms[0].elements[0].value = 3;
  298. } else if (document.URL.indexOf("cast_skills") != -1) {
  299. if (document.forms.length > 0) {
  300. document.forms[0].elements[1].focus();
  301. }
  302. }
  303.  
  304.  
  305.  
  306. // need to fix this
  307. // Shows Results Faster (exp gained and item)
  308. if (unsafeWindow.location.href.indexOf("/attack") != -1 ) {
  309. //var result_text = setTimeout("result_text.innerHTML='<b>"+unsafeWindow['battle_result']+"</b>'",0);
  310. //var result_text = setTimeout("result_text.innerHTML='<b>"+unsafeWindow.battle_result+"</b>'",0);
  311. var result_text = unsafeWindow.result_text;
  312. var battle_result = unsafeWindow.battle_result;
  313. if ( ( battle_result == null ) || ( battle_result == '' ) ) {
  314. battle_result = '';
  315. }
  316. battle_result = battle_result.replace(/\'/g,'\\\'');
  317. result_text.innerHTML="<b>"+battle_result+"</b>";
  318. }
  319. //if ( ( document.URL.indexOf("attack") != -1 ) && ( document.URL.indexOf("raidattack.php") == -1 ) ) {
  320. //setTimeout("result_text.innerHTML='<b>"+unsafeWindow['battle_result']+"</b>'",0);
  321. //result_text.innerHTML="<b>"+battle_result+"</b>";
  322. //result_text.innerHTML="<b>"+result_notice_window+"</b>";
  323.  
  324. //}
  325.  
  326.  
  327.  
  328.  
  329. function killHandler () {
  330. bHandler = false;
  331. }
  332.  
  333. function reviveHandler() {
  334. bHandler = true;
  335. }
  336.  
  337. var oHandler = unsafeWindow.handler;
  338.  
  339.  
  340. function myHandler (e) {
  341. if ( ( bHandler ) && ( oHandler != null ) ) {
  342. oHandler(e);
  343. }
  344. }
  345.  
  346. unsafeWindow.onkeypress = myHandler;
  347.  
  348. function oProfileId(doc) {
  349. var myregexp = /allies.php.uid=(\w+)/;
  350. var links = doc.links;
  351. var i = 0;
  352. for (i; i < links.length; i++) {
  353. var match = myregexp.exec(links[i]);
  354. if (match != null) {
  355. var id = match[1];
  356. return id;
  357. }
  358. }
  359. }
  360.  
  361. function numberWithCommas(x) {
  362. return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  363. }
  364. function roundUp(num, precision) {
  365. precision = Math.pow(10, precision)
  366. return Math.ceil(num * precision) / precision
  367. }
  368.  
  369. function RaidDamage() {
  370. var damage = 0;
  371. var newDamage = 0;
  372. var firstSpan = null;
  373. var lastSpan = null;
  374. if (doc) {
  375. var spans = doc.getElementsByTagName('span');
  376. if (spans && spans.length > 0) {
  377. var firstwithout = -1;
  378. for (var i = 0; i < spans.length; i++) {
  379. if (spans[i].hasAttribute('id')) {
  380. if (left(spans[i].getAttribute('id'), 8) == 'message_') {
  381. spans[i].setAttribute('style', 'visibility: visible');
  382. if (autoRaidDamage == true) {
  383. if (spans[i].parentNode.hasAttribute('rowspan') && spans[i].parentNode.hasAttribute('align')) {
  384. if (firstSpan == null) {
  385. firstSpan = spans[i];
  386. }
  387. lastSpan = spans[i];
  388. }
  389. var b = spans[i].getElementsByTagName('b');
  390. if (b && b.length == 1) {
  391. var fonts = b[0].getElementsByTagName('font');
  392. if (fonts && fonts.length >= 1) {
  393. newDamage = trim(fonts[fonts.length - 1].innerHTML);
  394. newDamage = newDamage.replace(/,/g, "");
  395. if (isNumeric(newDamage) == true) {
  396. damage += parseInt(newDamage);
  397. }
  398. }
  399. } else if (firstwithout == -1) {
  400. firstwithout = spans[i + 1];
  401.  
  402. }
  403. }
  404. }
  405. }
  406. }
  407. if (autoRaidDamage == true && damage > 0 && lastSpan != null && firstSpan != null) {
  408. var newImage = doc.createElement('img');
  409. var newTable = doc.createElement('table');
  410. var newTr = doc.createElement('tr');
  411. var newTd = doc.createElement('td');
  412. var newLink = doc.createElement('a');
  413. var resultTd = doc.createElement('td');
  414. var resultTr = doc.createElement('tr');
  415. //newImage.setAttribute('src', 'images/spacer.gif');
  416. //newImage.setAttribute('height', '20');
  417. //newImage.setAttribute('width', '1');
  418. //lastSpan.parentNode.appendChild(newImage);
  419. //find last percentage on page
  420. var percentage = $('td:contains("%"):last').map(function(){return $.trim($(this).text());}).get();
  421. var integer = parseInt(percentage, 10);
  422. var result1 = (integer / 100) * damage;
  423. var result = roundUp(result1, 1)
  424. //window.alert(numberWithCommas(result));
  425. if (document.getElementsByTagName('center')[1].innerHTML.indexOf(' has won!') != -1) {
  426. resultTd.innerHTML = '<b><font color="#00FF00">WIN</font></b>';
  427. } else {
  428. resultTd.innerHTML = '<b><font color="#C50202">LOST&nbsp;</font></b><font color="#ffffff">('+percentage+') | '+numberWithCommas(result)+'</font>';
  429. };
  430. resultTd.setAttribute('style', 'font-family: "Verdana";text-align:center;font-size:13px;');
  431. newTd.innerHTML = 'Total Damage: ' + numberWithCommas(damage);
  432. resultTr.appendChild(resultTd);
  433. //newTd.setAttribute('style', 'padding-left:10px;color:orange;');
  434. newTd.setAttribute('style', 'font-family: "Verdana"; text-align: center; color: #FFFFFF; font-weight:normal; font-size: 13px;');
  435. newTr.appendChild(newTd);
  436. newTable.setAttribute('width', '268');
  437. newTable.setAttribute('height', '10');
  438. newTable.setAttribute('style', 'border: 2px solid black; background: #2b2b2b; border-radius: 10px;');
  439. newTable.appendChild(resultTr);
  440. newTable.appendChild(newTr);
  441. newLink.setAttribute('href', '#');
  442. newLink.innerHTML = 'Back to Top';
  443. lastSpan.parentNode.appendChild(newTable);
  444. lastSpan.parentNode.appendChild(newImage.cloneNode(true));
  445. lastSpan.parentNode.appendChild(newLink);
  446. firstSpan.parentNode.insertBefore(newTable.cloneNode(true), firstSpan);
  447. firstSpan.parentNode.insertBefore(newImage.cloneNode(true), firstSpan);
  448. var sTable = doc.createElement('table');
  449. var sTr = doc.createElement('tr');
  450. var sTd = doc.createElement('td');
  451. sTd.innerHtml = ' ';
  452. sTd.setAttribute('style', 'border:0px;');
  453. sTr.appendChild(sTd);
  454. sTable.setAttribute('style', 'border:0px;');
  455. sTable.setAttribute('height', '28');
  456. sTable.appendChild(sTr);
  457. firstwithout.parentNode.insertBefore(sTable.cloneNode(true), firstwithout);
  458. firstwithout.parentNode.insertBefore(newImage.cloneNode(true), firstwithout);
  459.  
  460. /*// create a box for raid results
  461. var box = document.createElement('div');
  462. box.id = 'center_div';
  463. box.textContent = 'Total Damage: ' + damage;
  464. box.setAttribute('style', 'position:fixed; top:'+window.innerHeight/2+'px; left:'+window.innerWidth/2+'px; height: 50px; width: 200px; border:2px solid #990000; background:#000000; color:#ffffff; padding:20px; -moz-border-radius:4px; -moz-appearance:none;');
  465. document.body.appendChild(box);
  466. alignCenter('center_div');
  467. window.addEventListener('resize', function(e){alignCenter('center_div')}, false);*/
  468.  
  469. }
  470. }
  471. }
  472. }
  473.  
  474.  
  475. //$('table td:contains("%"):last').css('color','red');
  476.  
  477. //document.body.innerHTML= document.body.innerHTML.replace(/RAGE/g, function(m){
  478. // return '<span style="color:red">'+m+'</span>'
  479. //});
  480.  
  481. //var elmDeleted = document.getElementById("questhelper");
  482. //elmDeleted.parentNode.removeChild(elmDeleted);
  483. //var elmDeleted2 = document.getElementById("foot_right");
  484. //elmDeleted2.parentNode.removeChild(elmDeleted2);
  485.  
  486. function left(str, n) {
  487. if (n <= 0) {
  488. return "";
  489. }
  490. if (n > String(str).length) {
  491. return str;
  492. } else {
  493. return String(str).substring(0, n);
  494. }
  495. }
  496.  
  497. function trim(str) {
  498. return str.replace(/^\s*|\s*$/g, "");
  499. }
  500.  
  501. function isNumeric(sText) {
  502. var ValidChars = "0123456789";
  503. var Char;
  504. var i = 0;
  505. for (i; i < sText.length; i++) {
  506. Char = sText.charAt(i);
  507. if (ValidChars.indexOf(Char) == -1) {
  508. return false;
  509. }
  510. }
  511. return true;
  512. }
  513.  
  514.  
  515. function oPage(vURL, vPage) {
  516. var regex = new RegExp("^https?://(torax|sigil|www)\.outwar\.com/(" + vPage + ")");
  517. var result = regex.exec(vURL);
  518. if (result != null) {
  519. if (result.length == 3) {
  520. if (result[2] == vPage) {
  521. return true;
  522. } else {
  523. return false;
  524. }
  525. } else {
  526. return false;
  527. }
  528. } else {
  529. return false;
  530. }
  531. }
  532.  
  533. function oServer(vURL) {
  534. var regex = new RegExp("^https?://(torax|sigil|www)\.outwar\.com/");
  535. var result = regex.exec(vURL);
  536. if (result != null) {
  537. if (result.length == 2) {
  538. return result[1];
  539. } else {
  540. return false;
  541. }
  542. } else {
  543. return false;
  544. }
  545. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement