lib_SpeedCalling

Library for SpeedCalling script

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greatest.deepsurf.us/scripts/9993/53096/lib_SpeedCalling.js

  1. // Used to hold the callings page
  2. var _gwCalling = null;
  3.  
  4. //Updates the localStorage with the new values
  5. function storeValue(mainId, charId, cbbId)
  6. {
  7. //Gets the value for the given cbbId
  8. var tmpValue = 24;
  9. if (typeof document.getElementById(cbbId) != 'undefined') { tmpValue = document.getElementById(cbbId).value; }
  10.  
  11. storedValues = JSON.parse(window.localStorage.getItem(mainId));
  12. storedValues[charId] = tmpValue;
  13. window.localStorage.setItem(mainId, JSON.stringify(storedValues));
  14. }
  15.  
  16. function CallEveryone(mainId)
  17. {
  18. itemListId = 1;
  19. _gwCalling = window.open('', 'gexWindow', '');
  20. var toCall = JSON.parse(window.localStorage.getItem(mainId));
  21. var doit = function (key)
  22. {
  23. var tmpitemListId = itemListId;
  24. if (tmpitemListId <= 9) { tmpitemListId = 'ctl00_cphLeftColumn_ctl00_repAddressBook_ctl0' + tmpitemListId + '_lnkCharacter'; }
  25. else { tmpitemListId = 'ctl00_cphLeftColumn_ctl00_repAddressBook_ctl' + tmpitemListId + '_lnkCharacter'; }
  26. var callObject = document.getElementById(tmpitemListId);
  27. var callUrl = 'http://' + window.location.hostname + callObject.getAttribute("href");
  28. _gwCalling.location = callUrl;
  29. itemListId++;
  30. };
  31. var i = 0;
  32. for (var key in toCall)
  33. {
  34. (function ()
  35. {
  36. var k = key;
  37. setTimeout(function () { doit(key); }, 8000 * i);
  38. })();
  39. i += 1;
  40. }
  41. }