spFunctions

This is a library with code to be used with Joe's SpeedCalling for Popmundo online roleplaying game

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greatest.deepsurf.us/scripts/10151/54520/spFunctions.js

  1. var _gwCalling = null;
  2. var _gwAuthor = null;
  3.  
  4. //Updates the localStorage with the new values
  5. function spStoreValue( mainId, charId, cbbId )
  6. {
  7. //Gets the value for the given cbbId
  8. var tmpValue = 24;
  9. if( typeof document.getElementById( cbbId ) != 'undefined' ) {
  10. tmpValue = document.getElementById( cbbId ).value;
  11. }
  12.  
  13. storedValues = JSON.parse( window.localStorage.getItem( mainId ) );
  14. storedValues[charId] = tmpValue;
  15. window.localStorage.setItem( mainId, JSON.stringify( storedValues ) );
  16. }
  17.  
  18. // Calls everyone in the contact list
  19. function spCallEveryone( mainId )
  20. {
  21. itemListId = 1;
  22. _gwCalling = window.open( '', 'gexWindow', '' );
  23. var toCall = JSON.parse( window.localStorage.getItem( mainId ) );
  24. var doit = function( key )
  25. {
  26. var tmpitemListId = itemListId;
  27. if( tmpitemListId <= 9 ) {
  28. tmpitemListId = 'ctl00_cphLeftColumn_ctl00_repAddressBook_ctl0' + tmpitemListId + '_lnkCharacter';
  29. } else {
  30. tmpitemListId = 'ctl00_cphLeftColumn_ctl00_repAddressBook_ctl' + tmpitemListId + '_lnkCharacter';
  31. }
  32. var callObject = document.getElementById( tmpitemListId );
  33. var callUrl = 'http://' + window.location.hostname + callObject.getAttribute( "href" );
  34. _gwCalling.location = callUrl;
  35. itemListId++;
  36. };
  37. var i = 0;
  38. for( var key in toCall ) {
  39. ( function()
  40. {
  41. var k = key;
  42. setTimeout(
  43. function()
  44. {
  45. doit( key );
  46. }, 8000 * i );
  47. } )();
  48. i += 1;
  49. }
  50. }
  51.  
  52. // Create a contact Private Message to the author of the script
  53. function contactAuthor()
  54. {
  55. _gwAuthor = window.open( '', 'gexAuthor', '' );
  56. _gwAuthor.location = 'http://' + window.location.hostname + '/World/Popmundo.aspx/Conversations/Conversation/3248185';
  57. }