BB/HTML Code Inventory List Generator

Generates a bbcode of list your inventory excluding frozen, soulbound, equiped items. This make it easer to sell a ton of stuff in the Gaia Exchange. Also generates HTML code for http://www.tektek.org/gaia/worth.php (excludes frozen and soulbound items)

  1. // ==UserScript==
  2. // @name BB/HTML Code Inventory List Generator
  3. // @description Generates a bbcode of list your inventory excluding frozen, soulbound, equiped items. This make it easer to sell a ton of stuff in the Gaia Exchange. Also generates HTML code for http://www.tektek.org/gaia/worth.php (excludes frozen and soulbound items)
  4. // @include http://www.gaiaonline.com/inventory/view/*
  5. // @include http://www.gaiaonline.com/inventory/
  6. // @include http://www.gaiaonline.com/inventory
  7. // @include http://gaiaonline.com/inventory/view/*
  8. // @include http://gaiaonline.com/inventory/
  9. // @include http://gaiaonline.com/inventory
  10. // @version 0.0.1.20140525024110
  11. // @namespace https://greatest.deepsurf.us/users/2178
  12. // ==/UserScript==
  13. function getId(id){
  14. return document.getElementById(id);
  15. }
  16. function genBbList(){
  17. var ele=getId('all').parentNode.getElementsByClassName('item-list');
  18. for (var i=0;i<ele.length;i++){
  19. if (ele[i].getAttribute('class')=='item-list'){
  20. var img=ele[i].getElementsByTagName('li');
  21. break;
  22. }
  23. }
  24. var text='';
  25. var text2='';
  26. var quantity='';
  27. var arr=new Array;
  28. for (var i=0;i<img.length;i++){
  29. var t=img[i].getElementsByTagName('img')[0];
  30. if(t.parentNode.getElementsByClassName('soulbound').length==1 || t.parentNode.getElementsByClassName('frozen').length==1 || t.className=='equipped'){
  31. continue;
  32. }
  33. if(t.parentNode.getElementsByClassName('quantity').length==1){
  34. quantity='|quantity='+img[i].parentNode.getElementsByClassName('quantity')[0].textContent+'| ';
  35. }
  36. else{
  37. quantity='';
  38. }
  39. arr[arr.length]=t.title+' '+quantity+'[url=http://www.gaiaonline.com/marketplace/itemdetail/'+t.id.slice(t.id.indexOf('.')+1,t.id.lastIndexOf('.'))+'][imgleft]'+t.src+'[/imgleft][/url]\n\n\n';
  40. }
  41. arr=arr.sort();
  42. var conCount=0;
  43. for(var i=0;i<arr.length;i++){
  44. if(!arr[i]){
  45. conCount++;
  46. continue;
  47. }
  48. if(text.length+(i*3-conCount)<48800){
  49. text+=arr[i];
  50. }
  51. else{
  52. text2+=arr[i];
  53. }
  54. }
  55. var box=getId('genlist');
  56. box.value=text;
  57. if (text2!=''){
  58. var tall=getId('all').parentNode.offsetHeight/2-14+'px';
  59. var box2=getId('genlist2');
  60. getId('genlist2').style.display='block';
  61. getId('GM_Note').style.display='block';
  62. box2.value=text2;
  63. box2.style.height=tall;
  64. }
  65. else{
  66. var tall=getId('all').parentNode.offsetHeight-9+'px';
  67. getId('genlist2').style.display='none';
  68. getId('GM_Note').style.display='none';
  69. }
  70. box.style.height=tall;
  71. text=null;
  72. text2=null;
  73. }
  74. function genHtmList(){
  75. var ele=getId('all').parentNode.getElementsByClassName('item-list');
  76. for (var i=0;i<ele.length;i++){
  77. if (ele[i].getAttribute('class')=='item-list'){
  78. var img=ele[i].getElementsByTagName('li');
  79. break;
  80. }
  81. }
  82. var text='';
  83. for (var i=0;i<img.length;i++){
  84. var t=img[i].getElementsByTagName('img')[0];
  85. if(t.parentNode.getElementsByClassName('soulbound').length==1 || t.parentNode.getElementsByClassName('frozen').length==1){
  86. continue;
  87. }
  88. /*var s=t.parentNode.getElementsByTagName('span');
  89. for(var x=0;x<s.length;x++){
  90. if(s[x].className='quantity stacked'){
  91. s='<span class="quantity stacked">'+s[x].textContent+'</span>';
  92. break;
  93. }
  94. }
  95. text+='<img width="30" height="30" alt="'+t.alt+'" title="'+t.title+'" src="'+t.src+'" id="'+t.id+'" rel="'+t.rel+'"/>'+s+''+'\n';*/
  96. text+='<li>'+t.parentNode.innerHTML+'</li>';
  97. s='';
  98. }
  99. var box=getId('genlist');
  100. box.value=text;
  101. box.style.height=getId('all').parentNode.offsetHeight-9+'px';
  102. getId('genlist2').style.display='none';
  103. getId('GM_Note').style.display='none';
  104. text=null;
  105. }
  106. getId('right').innerHTML='<center><span style="font-size: 11px;">Code for posting your invintory<br/><a style="float: left;" id="GM_Reload_Blnk" title="Good for selling a stuff in the Exchange." onclick="return false;" href="#">BB Code</a><a id="GM_Reload_Hlnk" title="Good for http://www.tektek.org/gaia/worth.php" onclick="return false;" href="#" style="float: right;">HTML Code</a><-Refresh-></span></center><textarea id="genlist" wrap="off" onclick="this.focus();this.select();"></textarea><br/><span id="GM_Note" style="font-size:12px;text-align:center;">Part 2 (will not fit in 1 post)</span><textarea id="genlist2" wrap="off" onclick="this.focus();this.select();"></textarea>';
  107. getId('GM_Reload_Blnk').addEventListener("click", genBbList, false);
  108. getId('GM_Reload_Hlnk').addEventListener("click", genHtmList, false);
  109. //getId('items_tabview').addEventListener('DOMSubtreeModified',genBbList,false);
  110. genBbList();