Multi Auction - Bid Logger

Multi auction site bid count tracker. beezid.com,dealdash.com,happybidday.com,quibids.com

  1. // ==UserScript==
  2. // @name Multi Auction - Bid Logger
  3. // @fullname Multi Auction - Bid Logger
  4. // @licence GPL version 3 or any later version
  5. // @namespace MultiAuctionLogger
  6. // @include http://www.beezid.com/*
  7. // @include http://www.happybidday.com/*
  8. // @include http://www.quibids.com/*
  9. // @include http://www.dealdash.com/*
  10. // @include https://www.dealdash.com/*
  11. // @homepage https://greasyfork.org/en/scripts/5214-multi-auction-bid-logger
  12. // @require http://code.jquery.com/jquery-1.8.3.js
  13. // @require http://code.jquery.com/ui/1.9.2/jquery-ui.js
  14. // @run-at document-end
  15. // @author hugo pi
  16. // @grant none
  17. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFaElEQVR4Xr2XaUxUVxvH//fOvbMAAwOCBLXACAKvIgioIC6v0LSoLGXikrQ1dk2FRgWq9lWMtrFbGq3VfmhMWmttTBc3Yq12EWtBBNFI60Jto1TU4a2ogA7MdmfufXrGXkPkg5EB/E9+cz9Nfud5znNO7mAQIhyunHPol3X5hwAIeMQRvnk1t+rc1hK6sK2EqtfMOdDfRfDwP5pti6bvik9JKTaGD0egKRQcoQCA4VEsQPPh/OzdoxPNluBQE0gMggIRLpcHB5bnbQegGcoFCOvzJ++JM4dbjIEC7J23IDnsuNNph9EUDJ5o7pHKfO/RtflVAITBXoDwv5z078ZEBxSHGDWsYgcklx0dbVa0X72CkKjHMDYrA/FpyYiMHlV8uHL2LgCawVyA3ikpOpckQXLbIUtuOFn1Vy63IfyxGASGRUGBAR4P+w4OxkhztIUNptqJQdqCj47/trT+nK3u9Nk7OH2mHc3N1zE6nondTjhtXZB9Lk0QZBlsME3giCt80GBq0L8oDLmp7cYxu1M+q+UFgyLBbI4JhqwoUGQF4JhfGwCeF0GQcb31Gp7OHpPwVUPLXgCEPuH8GUJGICOUEblqZvqJvJxY8BqRifXQ6gNgMAYzwuDuuYWOqy3ovt0NvV4Er+H257x1cB4Ar38d6O2CxHAwMDEqolynBWcMEtVqCKQQZNmD63+1IixqFKKT4hE+IgI6vTZpbkpk5o7ai18DUAZyD5CPFTPSGgqLpnN3erS4Zr0NRfGAZAlQXLjw6zkEsEE0hJhAQhAUEuHxELpdXh0AfW87/Yu4Ynpa66y8zBEBBhGxIw2oOdFOf7bYOFHUYMRwAxISI6EVCc7bHeB4DrZOG041nD9W+sXxpQM6BYVJsSFrHp94Oc8nD9Dh/60tqD3ZenNz/Zn86kvW0g676+e/bzghcl5Ibie8bgesl1pwtLqhlsnLAbQzXPAj3HPpSXFvzsqi+k3ljGW0t7yQKqal3gSQzRjNMDMyV+dkUPXaJ6nmLQt9u7KI3sjPqAGQzgj3t+vcwgmJ8ffkxz9YRgdXW+j1mek++RRGFEOrMqoka3zt5y9l05elM2l5blptrxwav+TPpibEvZGXyeRlVOeTr7LQuicmUZhBl6vKRfTGyEhli2hcMnV844DlJZPHFWyY+19W9f3ypIjQeb5qVXnfeyKCkawS4W/b+cWTxr2waUEOnfxoOdVt9MmL78oTI0IXAIhh6B5wWQWpDFT+Gh3buJR+XGOh94oyacww0zxVrmdwGILwr0wa93xf+fvFWVT4H/M7AMxDKReWZCXv2/7yHGrcwuQbeuUFSbE+eQIjcKjkmiWZyft2lhbRiXvyyvvkieqE80Mjz1Llmyuolsl/YPKPn5lK+Ymxbw+lnGMIy6akVGWmmwviEuIgSR44uqy4Zr2Jhuau2s9ON5cAsDLsDAVDEGNFdio1fbzSd9TuVv7Jomn0YsbYGgATGKGDXXnf86oDh66Ll6yh4UEeWNt8lXeyyn+vUCvvZigP8e9oj8BxTxEpICL4wnEcAAZ73v2wp0dR9j/xbu9LCccwMcaUZaf8pOF4k03y1H16qrkMwFVGF0PGg6PZuTh3twBYJs1IA3EChKAwkKJA6umE7O6BIrsZLpDiwh/nu+EhpWrh1iPzAci8urdtW+rP5jX9fatsR9OF/siFzQumHbB1eywTslLgcjOpVwPZy8Pd44TLITG8cDm9cNoVOByEmNFadHd7Lb7fARA4VSCqU65jOBk9DO/DzM/62Zk2IoIsK1AUAsAg6m09hz7bAPD8v8913zcGc31OBK/uN+HhEqJey8P6M6iqo4NxhcPAolVvRhH9j4dh/wfgmWNrtN0tjAAAAABJRU5ErkJggg==
  18. // @version 1.2.8.004
  19. // @description Multi auction site bid count tracker. beezid.com,dealdash.com,happybidday.com,quibids.com
  20. // ==/UserScript==
  21.  
  22. var pageLoad={
  23. main:true,
  24. }
  25. function GM_log(s){
  26. console.log(s)
  27. }
  28. function GM_addStyle(s){
  29. $('head').append('<style type="text/css">' + s + '</style>');
  30. }
  31. var inactiveTime=2; //in minutes
  32.  
  33. var styletext='\
  34. .maltabs{\
  35. position:relative;\
  36. min-height:360px;\
  37. clear:both;\
  38. margin:25px 0;\
  39. max-height:400px;\
  40. width:445px;\
  41. left:0px;\
  42. height:10px;}\
  43. .odd {\
  44. background-color:#f8f8f8;}\
  45. .even {\
  46. background-color:#d8d8d8;}\
  47. .maltabwrap{\
  48. line-height:normal;\
  49. ccursor:pointer;\
  50. font-family:Arial,sans-serif;\
  51. position:absolute;\
  52. left:44px;\
  53. top:180px;\
  54. z-index:100000;\
  55. border:3px solid rgb(191, 191, 191);\
  56. box-shadow: 0px 1px 6px 0px rgb(215, 215, 215);\
  57. border-radius:10px;\
  58. color:black;\
  59. background-color:#e8e8e8;}\
  60. .tdpadding{\
  61. padding-left:2px;}\
  62. .loalinks{\
  63. font-size:12px;\
  64. line-height:normal;\
  65. padding:4px;\
  66. background-color:#E8E8E8;\
  67. position:fixed;\
  68. left:10px;\
  69. top:10px;\
  70. z-index:100!Important;\
  71. border-radius:5px;\
  72. border:2px solid rgb(191,191,191);\
  73. font-weight:400;\
  74. font-family:Arial,sans-serif!important;\
  75. text-align:left!important;}\
  76. .loalinks a{\
  77. margin-top:2px;\
  78. color:blue!important;\
  79. font-size:12px;\
  80. font-family:Arial,sans-serif!important;\
  81. font-weight:800!important;}\
  82. .loalinks a:hover{\
  83. font-size:12px;\
  84. font-family:Arial,sans-serif!important;\
  85. color:#A000C0!important;\
  86. text-decoration:underline;!important;\
  87. cursor:pointer;}\
  88. .loalinks span{\
  89. font-size:12px;\
  90. color:white!important;\
  91. background-color:green;\
  92. padding:1px 3px 1px 3px;\
  93. font-weight:bold;}\
  94. #tab-wrap tr td {\
  95. text-align:left!important;\
  96. padding:0px 0px 0px 5px!important;\
  97. }\
  98. #tab-wrap{\
  99. font-family:Arial,sans-serif;\
  100. line-height:default;}\
  101. .debug{\
  102. cursor:default;\
  103. display:block;\
  104. width:424px;\
  105. height:327px;\
  106. overflow:auto;\
  107. font-size:12px;\
  108. line-height:14px;}\
  109. .btimer{\
  110. padding-left:0px;\
  111. font-size:28px;\
  112. font-weight:bold;\
  113. text-align:center;}\
  114. .btimer p {\
  115. background-color:white!important}\
  116. .trheader{\
  117. font-weight:bold;\
  118. background-color:green;\
  119. color:white;}\
  120. .maltab {\
  121. float:left}\
  122. .maltab label {\
  123. border-top-left-radius:5px;\
  124. border-top-right-radius:5px;\
  125. background:#eee;\
  126. padding:10px!important;\
  127. border:1px solid #ccc;\
  128. margin-left:1px;\
  129. margin-right:1px;\
  130. left:1px;\
  131. cursor:pointer;\
  132. line-height:normal!important;\
  133. font-weight:bold;\
  134. float:none;\
  135. font-weight:400;}\
  136. .maltab [type=radio] {\
  137. display:none;}\
  138. .maltab div{\
  139. top:27px;}\
  140. .ncontent {\
  141. position:absolute;\
  142. text-align:left;\
  143. top:27px;\
  144. left:0;\
  145. background:white;\
  146. right:0;\
  147. bottom:0;\
  148. padding:5px;\
  149. border-bottom:1px solid black;\
  150. border-top:0px!important;\
  151. z-index:1px;\
  152. overflow:auto;}\
  153. [type=radio]:checked ~ label {\
  154. background:white;\
  155. border-bottom:1px solid white;\
  156. z-index:2}\
  157. [type=radio]:checked ~ label ~.ncontent {\
  158. z-index:1}\
  159. [type=radio]:checked ~ label ~.ncontent >* {\
  160. opacity:1;\
  161. -webkit-transform:translateX(0);\
  162. -moz-transform:translateX(0);\
  163. -ms-transform:translateX(0);\
  164. -o-transform:translateX(0);}\
  165. .moredata {\
  166. font-size:13px!important;\
  167. line-height:normal!important;\
  168. }\
  169. .moredata table a {\
  170. color:blue;\
  171. font-weight:bold;\
  172. padding:0 5px;}\
  173. .moredata table a:hover{\
  174. text-decoration:underline;\
  175. padding:0 5px;}\
  176. .inactive{\
  177. color:rgba(138,138,138,.95);}\
  178. .trstyle{\
  179. font-size:14px;}\
  180. .cl{\
  181. display:none!important;}\
  182. .nstuff{\
  183. width:439px;\
  184. min-height:25px;\
  185. max-height:130px;\
  186. font-size:12px;\
  187. padding:2px;\
  188. border:0px solid black;\
  189. position:relative;\
  190. top:-24px;\
  191. clear:both;}\
  192. #nstuff span {\
  193. color:green;\
  194. padding:2px;\
  195. font-weight:bold;}\
  196. .histlabel{\
  197. margin-left:5px!important;}\
  198. .dshadow{\
  199. -moz-transform:scale(1.0075);\
  200. zoom:1.0075; \
  201. box-shadow:0 0 14px rgb(0,0,0);\
  202. -moz-box-shadow:0 0 4px rgb(0,0,0);}\
  203. div#nabout{\
  204. text-align:left!important}\
  205. div#tmpDebug , div#nstuff{\
  206. text-align:left!important}\
  207. .ndumpta{\
  208. width:432px!important;\
  209. white-space:nowrap!important;\
  210. overflow:auto!important;\
  211. height:322px!important;\
  212. border:0;}\
  213. #ndump textarea {\
  214. padding:0px;\
  215. resize:none!important;\
  216. font-family:Arial,sans-serif!important;\
  217. font-weight:400!important;\
  218. font-size:13px!important;\
  219. color:black!important;\
  220. border:1px solid black!important;\
  221. border-radius:0px!important;\
  222. background-color:white!important;\
  223. white-space:pre!important;\
  224. overflow:hidden!important;}\
  225. #nabout a{\
  226. color:blue!important;\
  227. text-decoration:none!important;\
  228. font-weight:bold!important;\
  229. }\
  230. #nabout a:link{\
  231. color:blue!important;\
  232. text-decoration:none!important;\
  233. font-weight:bold!important;\
  234. }\
  235. #nabout a:hover{\
  236. color:blue!important;\
  237. text-decoration:underline!important;\
  238. font-weight:bold!important;}';
  239. GM_addStyle(styletext);
  240.  
  241. var hold=0;
  242.  
  243. var happybidday={
  244. moddedJSON:'',
  245. previousJSON:'',
  246. curl:document.location.href.toString(),
  247. saveData:3,
  248. offsetDelay:1,
  249. auction_ID:-1,
  250. delay:250,
  251. historyElement1:'div#product-information > div.product-box.auction-item > div.product-content',
  252. historyElement:'div#tab_history.tab-content',
  253. offsetLeft:790,
  254. timer:'p.currentvalue',
  255. url:'http://www.happybidday.com/viewproduct.php?aid=',
  256. notsoldpriceElement:'div.product-content > ul > li:eq(1) > em',
  257. soldpriceElement:'p.bidprice > strong > span:gt(0)',
  258. popUp:function(){
  259. if(this.curl.toString().indexOf('we-miss-you.php')!=-1){
  260. var urlParms=this.curl.toString().split('=');
  261. document.location=(decodeURIComponent(urlParms[1]));
  262. return(true);
  263. }
  264. return(false);
  265. },
  266. issold:function(){
  267. var elem=$('div.auction-detail > p.currentvalue >');
  268. if(elem.length!=0){
  269. if($('div.auction-detail > p.currentvalue > strong').html().toLowerCase().indexOf('sold')!=-1) return(true);
  270. }
  271. return(false)
  272. },
  273. isready:function(){
  274. var elem=$(auction.notsoldpriceElement).html().replace('$','').replace('.','');
  275.  
  276. try{
  277. if(!$.isNumeric(elem)) return(false);
  278. }catch(e){}
  279.  
  280. var isactive=$('div.product-content');
  281. var issold=$('div.product-content');
  282. if(issold.length==0 && isactive.length==0){
  283. return(false)
  284. }else{
  285. return(true);
  286. }
  287. },
  288. getAID:function(){
  289.  
  290. if(this.auction_ID!=-1) return(this.auction_ID);
  291. var elem=$('span#history_auctionid')
  292. if(elem.length!=0) this.auction_ID=elem[0].innerHTML;
  293. if(!$.isNumeric(this.auction_ID)) this.auction_ID=-1;
  294. return(this.auction_ID);
  295. },
  296. getAuctionTitle:function(){
  297. if($('div#product-details > h1').length!=0){
  298. return($('div#product-details > h1').html());
  299. }else{
  300. return(document.title);
  301. }
  302. },
  303. getCurrentBidders:function(){
  304. HistoryDetail=[];
  305. $('div#tab_history.tab-content > table > tbody > tr').each(function(){
  306. var h=new Object();
  307. h.id=0;
  308. h.amount=this.children[0].innerHTML.replace('$','');
  309. h.name=this.children[1].innerHTML.replace(/ /gm,'').replace(/(\r\n|\n|\r)/gm,'');
  310. if($.isNumeric(h.amount)) HistoryDetail.push(h)
  311. });
  312. procFreeze();
  313. }
  314. }
  315.  
  316. var beezid={
  317. bid_id:0,
  318. moddedJSON:'',
  319. previousJSON:'',
  320. previousHTML:'',
  321. curl:document.location.href.toString(),
  322. saveData:3,
  323. offsetDelay:1,
  324. auction_ID:-1,
  325. delay:100,
  326. historyElement:'div.adetails_center',
  327. offsetLeft:450,
  328. offsetTop:0,
  329. timer:'div.adetails_tmr',
  330. url:'http://www.beezid.com/auctions/',
  331. notsoldpriceElement:'div.adetails_cprice',
  332. soldpriceElement:'div.adetails_cprice',
  333. popUp:function(){
  334. var obj=$('div.beezid-idle-popup');
  335. try{
  336. if(obj.length!=0) return(true);
  337. }catch(e){}
  338. return(false);
  339. },
  340. issold:function(){
  341. var btn=$('button#btn_bid_' + auction.getAID());
  342. if (btn.length!=0) {
  343. if ($(btn[0]).html().toLowerCase()=="sold") {
  344. return(true);
  345. }else{
  346. return(false);
  347. }
  348. }
  349. },
  350. isready:function(){
  351. var btn=$('button#btn_bid_' + auction.getAID());
  352. if (btn.length!=0) {
  353. if ($(btn[0]).html().toLowerCase()=="bid") return(true);
  354. if ($(btn[0]).html().toLowerCase()=="sold") return(true);
  355. if ($(btn[0]).html().toLowerCase()=="super bid") return(true);
  356. if ($(btn[0]).html().toLowerCase().indexOf("bids")) return(true);
  357. }
  358. return(false);
  359. },
  360. getAID:function(){
  361. if (this.auction_ID!=-1) return (this.auction_ID);
  362.  
  363. try {
  364. var aid=$("p:contains('Auction ID')")[0].innerHTML;
  365. aid=aid.substring(aid.indexOf(':')+1).toString().trim();
  366. this.auction_ID=aid;
  367. if(!$.isNumeric(this.auction_ID)) this.auction_ID=-1;
  368. if(this.auction_ID<=0) return(0);
  369. if(auction.curl.indexOf(aid)==-1) {
  370. document.location.href=document.location.href+'#auction-'+this.auction_ID;
  371. setTimeout(function(){
  372. window.location.reload(true);
  373. },250)
  374. return(false)
  375. }
  376. this.timer='div#timer_'+this.auction_ID.toString()+'.adetails_tmr';
  377. return (this.auction_ID)
  378. }catch(e) {
  379. return (-1)
  380. }
  381. },
  382. getAuctionTitle:function(){
  383. if($('div.auction_details_big_title > h1').length!=0){
  384. return($('div.auction_details_big_title > h1').html());
  385. }else{
  386. return(document.title);
  387. }
  388. },
  389. getCurrentBidders:function() {
  390. HistoryDetail=[];
  391. $('div.bidding_history_column_holder').each(function(){
  392. var h=new Object();
  393. h.id=0;
  394. h.id=this.children[0].id.replace('bidder_','');
  395. h.amount=this.children[0].innerHTML.replace('$','');
  396. h.name=this.children[1].outerHTML.replace(/<[^>]+>/igm,'');
  397. if($.isNumeric(h.amount)) HistoryDetail.push(h);
  398. })
  399. procFreeze();
  400. }
  401. }
  402.  
  403. var quibids={
  404. moddedJSON:'',
  405. previousJSON:'',
  406. curl:document.location.href.toString(),
  407. saveData:3,
  408. offsetDelay:1.25,
  409. auction_ID:-1,
  410. delay:250,
  411. historyElement:'div.module.auction-right',
  412. hhistoryElement:'div.module.ap-bidding-section',
  413. offsetLeft:460,
  414. timer:'p.time.large-timer2',
  415. url:'http://www.quibids.com/en/auction-',
  416. notsoldpriceElement:'div.content > p.large-price > span.price',
  417. soldpriceElement:'p.won_price.large-price',
  418. popUp:function(){
  419. var elem=$('div#popupModal')
  420. if(elem.length!=0){
  421. if(elem[0].style.display!='none'){
  422. return(true)
  423. }else{
  424. return(false);
  425. }
  426. }else{
  427. return(false);
  428. }
  429. },
  430. issold:function(){
  431. var elem=$('#end-time-disclaim')[0];
  432. if(elem){return(true);}else{return(false);}
  433. },
  434. isready:function(){
  435. if(this.issold()){
  436. var isold=$(this.soldpriceElement);
  437. if(isold.html()=='--.--') return(false);
  438. return(true);
  439. }else{
  440. var isactive=$(this.notsoldpriceElement);
  441. if(isactive.html()=='--.--') return(false)
  442. return(true);
  443. }
  444. return(false)
  445. },
  446. getAID:function(){
  447. if(this.auction_ID!=-1) return(this.auction_ID);
  448. try{
  449. var aid=$('span:contains("Auction #A")')[0].innerHTML
  450. aid=aid.replace('Auction #A','');
  451. this.auction_ID=aid;
  452. if(!$.isNumeric(this.auction_ID)) this.auction_ID=-1;
  453. return(this.auction_ID);
  454. }catch(e){return(-1)}
  455. },
  456. getAuctionTitle:function(){
  457. if($('div#auction-title > h1#product_title').length!=0){
  458. return($('div#auction-title > h1#product_title').html());
  459. }else{
  460. return(document.title);
  461. }
  462. },
  463. getCurrentBidders:function() {
  464. HistoryDetail=[];
  465. $('#bid-history > tbody > tr').each(function(){
  466. var h=new Object();
  467. h.id=0;
  468. h.amount=this.children[2].innerHTML.replace('$','');
  469. h.name=this.children[1].innerHTML.replace(/ /gm,'').replace(/(\r\n|\n|\r)/gm,'');
  470. if($.isNumeric(h.amount)) HistoryDetail.push(h);
  471. });
  472. procFreeze();
  473. }
  474. }
  475.  
  476. var dealdash={
  477. auctionTime:10,
  478. moddedJSON:'',
  479. previousJSON:'',
  480. curl:document.location.href.toString(),
  481. saveData:3,
  482. offsetDelay:1,
  483. auction_ID:-1,
  484. delay:250,
  485. historyElement:'ul#previousBids',
  486. offsetLeft:-450,
  487. offsetTop:0,
  488. timer:'p#time',
  489. url:'http://www.dealdash.com/battle.php?auction_id=',
  490. notsoldpriceElement:'span#productPage_bidInfo_current_price',
  491. soldpriceElement:'span#productPage_bidInfo_current_price',
  492. popUp:function(){
  493. if($('div#colorbox').length!=0){
  494. if($('div#colorbox')[0].style.display!='none') return true;
  495. }
  496. return false;
  497. },
  498. issold:function(){
  499. if($('#time').html().indexOf('Congrat')!=-1) return(true);
  500. if($('img#itemSold').length==0) return(false);
  501. },
  502. isready:function(){
  503. var isactive=$('span#productPage_bidInfo_current_price');
  504. var issold=$('span#productPage_bidInfo_current_price');
  505. if(issold.length==0 && isactive.length==0){
  506. return(false);
  507. }else{
  508. return(true);
  509. }
  510. },
  511. getAID:function(){
  512. if(this.auction_ID!=-1) return(this.auction_ID);
  513. var elem=$('div#auctionid')
  514. if(elem.length!=0){
  515. this.auction_ID=elem[0].getAttribute('data-id');
  516. }else{
  517. this.auction_ID=-1;
  518. }
  519. if(!$.isNumeric(this.auction_ID)) this.auction_ID=-1;
  520. return(this.auction_ID);
  521. },
  522. getAuctionTitle:function(){
  523. console.log('AucTitle called ' + $('h1.auctionTitle').text())
  524. if($('h1.auctionTitle').length!=0){
  525. return($('h1.auctionTitle').text());
  526. }else{
  527. return(document.title);
  528. }
  529. },
  530. getCurrentBidders:function() {
  531. HistoryDetail=[];
  532. var element=$('ul#previousBids')[0]
  533. if(element){
  534. var echild=element.getElementsByTagName('li');
  535. if(echild){
  536. for(var i=0;i<echild.length-1;i++){//=4){
  537. var h=new Object();
  538. h.id=0;
  539. h.amount=parseFloat(echild[i].innerHTML.replace('$',''));
  540. h.name=$(echild[i]).children(0).html()
  541. if($.isNumeric(h.amount)) HistoryDetail.push(h);
  542. }
  543. }
  544. }
  545. procFreeze();
  546. }
  547. }
  548.  
  549. var auction=null;
  550.  
  551. if(document.location.href.toString().indexOf('happybidday.com')!=-1) {
  552. GM_addStyle('.maltab div{top:26px;}');
  553. auction=happybidday;
  554. auction.popUp();
  555. }
  556.  
  557. if(document.location.href.toString().indexOf('beezid.com')!=-1) {
  558. GM_addStyle('.maltab div{top:26px;}');
  559. auction=beezid;
  560. }
  561.  
  562. if(document.location.href.toString().indexOf('quibids.com')!=-1) {
  563. auction=quibids;
  564. }
  565.  
  566. if(document.location.href.toString().indexOf('dealdash.com')!=-1) {
  567. GM_addStyle('.maltab label {margin-top:-11px!important}');
  568. auction=dealdash;
  569. }
  570. if(auction==null) return;
  571. console.log('hi there dude' + Math.random());
  572.  
  573. //below is the GLOBAL code for all sites as long as its defined above.
  574. function procFreeze(){
  575.  
  576. var tmpJSON=JSON.stringify(HistoryDetail);
  577. if(tmpJSON!=auction.previousJSON) {
  578. auction.previousJSON=tmpJSON;
  579. if(HistoryDetail.length!=0){
  580. if(HistoryDetail[0].id!=0) auction.moddedJSON=tmpJSON;
  581. }
  582. }
  583.  
  584.  
  585. if(FullAuctionDetail.length<2) {
  586. auction.moddedJSON=auction.previousJSON;
  587. return;
  588. }
  589.  
  590. if(FullAuctionDetail[0].amt!=FullAuctionDetail[1].amt){
  591. auction.moddedJSON=auction.previousJSON;
  592. return;
  593. }
  594. if(HistoryDetail[0].id!=0) return;
  595.  
  596. var found=false;
  597.  
  598. var lbh=JSON.stringify(LastBidHistory);
  599. var hd=JSON.stringify(HistoryDetail)
  600.  
  601. var lastName=LastBidHistory[0].name;
  602. for(var i=1;i<HistoryDetail.length;i++){
  603. if(lastName==HistoryDetail[i].name){
  604. HistoryDetail=HistoryDetail.splice(0,i);
  605. tmpBids=JSON.stringify(HistoryDetail);
  606. LastBidHistory=JSON.parse(tmpBids);
  607. auction.moddedJSON=tmpBids;
  608. found=true;
  609. break;
  610. }
  611. }
  612.  
  613. if(found==false){
  614. var hd=JSON.stringify(HistoryDetail);
  615. LastBidHistory=JSON.parse(hd);
  616. auction.moddedJSON=hd;
  617. }
  618. }
  619.  
  620. var debug={
  621. append: function (data) {
  622. try{
  623. var cd=$('div[name*=debug]').html();
  624. $('div[name*=debug]').html(data+'<br><br>'+cd);
  625. }catch(e){}
  626. },
  627. log: function (data) {
  628. try{
  629. $('div[name*=debug]').html(data);
  630. }catch(e){}
  631. },
  632. gmlog:function(s){
  633. GM_log(s);
  634. }
  635. }
  636.  
  637. var localVersions={
  638. cv:'1.2.8',
  639. lsv:'1.0.2'
  640. }
  641.  
  642. var siteBidCounts=0;
  643. var FullAuctionDetail=[];
  644. var FullBidStats=[];
  645. var HistoryDetail=[];
  646. var LastBidHistory=[];
  647. var h=new Object();
  648. h.name='none';h.amount=0;h.id=0;LastBidHistory.push(h);
  649.  
  650. var ls='';
  651. var CHKSITE_Timeout=0;
  652. var MAINLOOP_Timeout=0;
  653. var LOA_Timeout=0;
  654. var STLS_Timeout=0;
  655. var previous_result='none';
  656. var T_Timeout=0;
  657. var IGNORE_SAVE=false;
  658. var gcount=0;
  659. var BID_PRICE_COUNT_DIFFERANCE=0;
  660.  
  661. function reload(){
  662. clearInterval(MAINLOOP_Timeout);
  663. clearInterval(LOA_Timeout);
  664. clearInterval(STLS_Timeout);
  665. saveToLocalStorage(true);
  666. document.location.reload();
  667. }
  668.  
  669.  
  670. $(window).unload(function() {
  671. clearInterval(MAINLOOP_Timeout);
  672. clearInterval(LOA_Timeout);
  673. clearInterval(STLS_Timeout);
  674. saveToLocalStorage();
  675. });
  676.  
  677. $(document).ready(function () {
  678. doodls();
  679. listOfAuctions();
  680. CHKSITE_Timeout=setInterval(checkSite,200)
  681. })
  682. function checkSite(){
  683. if(auction.isready()){
  684. clearInterval(CHKSITE_Timeout);
  685. initCode();
  686. }
  687. hold++;
  688. if(hold>=30){
  689. clearInterval(CHKSITE_Timeout);
  690. }
  691. }
  692. function initCode(){
  693.  
  694. ls=lzw_decode(localStorage.getItem('bid_grabber_'+auction.getAID()));
  695.  
  696. if(ls=='null'){
  697. ls=localStorage.getItem('bid_grabber_'+auction.getAID())
  698. }
  699.  
  700. if (ls!=null) {
  701.  
  702. try{
  703.  
  704. FullAuctionDetail=JSON.parse(ls);
  705. BID_PRICE_COUNT_DIFFERANCE=FullAuctionDetail.bpcd;
  706. FullAuctionDetail=FullAuctionDetail.bids;
  707. LastBidHistory=[];
  708. var h=new Object();
  709. h.name=FullAuctionDetail[0].user;
  710. h.amount=FullAuctionDetail[0].amt;
  711. h.id=FullAuctionDetail[0].id;
  712. LastBidHistory.push(h);
  713.  
  714. }catch(e){
  715. debug.append(e.lineNumber+' '+e);
  716. }
  717. }
  718.  
  719. if ((auction.getAID()!=-1) && (auction.getAID()!=undefined)) {
  720. setTimeout(saveit,5000);
  721. STLS_Timeout=setInterval(saveit,auction.saveData*60000)
  722. T_Timeout=setInterval(timerLoop,50);
  723. add_display();
  724. MAINLOOP_Timeout=setInterval(mainLoop, auction.delay);
  725. //$('#ndump').parent().removeClass('cl').addClass('maltab')
  726.  
  727. $("#tab-wrap").draggable({
  728. cursor: 'move',
  729. cancel: 'div div,table',
  730. opacity: 1,
  731. drag: function () {
  732. $(this).addClass('dshadow')
  733. },
  734. stop: function () {
  735. $(this).removeClass('dshadow');
  736. }
  737. })
  738.  
  739.  
  740. $(auction.timer).on('DOMSubtreeModified DOMNodeInserted DOMNodeRemoved', function(event){
  741. $('div[name*=btimer]').html($(this).outerHTML());
  742. clearInterval(T_Timeout);
  743. });
  744.  
  745. }
  746.  
  747. if(auction.issold()==false) if ($("#tab-wrap").is(':hidden')) $("#tab-wrap").show();
  748. listOfAuctions();
  749.  
  750. LOA_Timeout=setInterval(listOfAuctions,30000);
  751. }
  752.  
  753. function timerLoop(){
  754. $('div[name*=btimer]').html($(auction.timer).outerHTML());
  755. }
  756.  
  757. function saveit(){
  758. if(auction.getAID()==-1) {
  759. return;
  760. }
  761. saveToLocalStorage();
  762. }
  763.  
  764. function mainLoop() {
  765. var u='';
  766. var outPut='';
  767.  
  768. if(auction.popUp()==true){
  769. reload();
  770. return;
  771. }
  772.  
  773. if(!auction.isready()){
  774. return;
  775. }
  776.  
  777. if(!auction.issold()){
  778.  
  779. auction.getCurrentBidders();
  780. if(previous_result==auction.previousJSON){
  781. return;
  782. }
  783. }else{
  784.  
  785. }
  786.  
  787. previous_result=auction.previousJSON;
  788. if(auction.moddedJSON.length<4) auction.moddedJSON=auction.previousJSON;
  789. try {
  790. BidDataDetail=null;
  791. BidDataDetail=JSON.parse(auction.moddedJSON);
  792. siteBidCounts=$(auction.notsoldpriceElement).html();
  793.  
  794. if(siteBidCounts==undefined) {
  795. siteBidCounts=0;
  796. }else{
  797. if(siteBidCounts=='---') {
  798. siteBidCounts=0;
  799. }else{
  800. siteBidCounts=siteBidCounts.replace('$','').replace('.','');
  801. }
  802. }
  803. for (var i=BidDataDetail.length-1;i>-1;i--) {
  804. u ='$'+parseFloat(BidDataDetail[i].amount).toFixed(2)+' - '+BidDataDetail[i].name+' - '+BidDataDetail[i].id+'<br>'+u;
  805. }
  806.  
  807. for (var i=BidDataDetail.length-1;i>-1;i--) {
  808. var itemIndex=UserExists(FullAuctionDetail, BidDataDetail[i].name);
  809.  
  810. if (itemIndex==-1) {
  811. var BidDetail=new Object();
  812. BidDetail.amt=parseFloat(BidDataDetail[i].amount).toFixed(2);
  813. BidDetail.user=BidDataDetail[i].name;
  814. BidDetail.time=clock();
  815. BidDetail.bid_count=1;
  816. BidDetail.bid_id=BidDataDetail[i].id;
  817. FullAuctionDetail.splice(0,0,BidDetail);
  818. outPut+='<b>Added: $'+parseFloat(BidDetail.amt).toFixed(2)+' '+BidDetail.user+' '+BidDetail.bid_count+' - '+BidDetail.bid_id+'</b><br>'
  819.  
  820. } else {
  821.  
  822. itemIndex=itemIndex-1;
  823. if((BidDataDetail[i].id!=0)){
  824. if (parseFloat(BidDataDetail[i].id) > parseFloat(FullAuctionDetail[itemIndex].bid_id)) {
  825. var tBidDetail=FullAuctionDetail[itemIndex];
  826. FullAuctionDetail.splice(itemIndex,1);
  827. tBidDetail.bid_count=tBidDetail.bid_count+1;
  828. tBidDetail.amt=BidDataDetail[i].amount;
  829. tBidDetail.bid_id=BidDataDetail[i].id;
  830. tBidDetail.time=clock();
  831. FullAuctionDetail.splice(0,0,tBidDetail)
  832. outPut=' <b>Updated: $'+parseFloat(tBidDetail.amt).toFixed(2)+' - '+tBidDetail.user+' - '+tBidDetail.bid_count+' - '+tBidDetail.bid_id+'</b><br>'+outPut;
  833. }
  834. }else{
  835.  
  836. if(FullAuctionDetail.length>1){
  837. if (parseFloat(FullAuctionDetail[0].amt)==parseFloat(FullAuctionDetail[1].amt)) {
  838. var tBidDetail=FullAuctionDetail[itemIndex];
  839. FullAuctionDetail.splice(itemIndex,1);
  840. tBidDetail.bid_count=tBidDetail.bid_count+1;
  841. tBidDetail.amt=BidDataDetail[i].amount;
  842. tBidDetail.bid_id=BidDataDetail[i].id;
  843. tBidDetail.time=clock();
  844. FullAuctionDetail.splice(0,0,tBidDetail)
  845. outPut='<b>Updated: $'+parseFloat(tBidDetail.amt).toFixed(2)+' - '+tBidDetail.user+' - '+tBidDetail.bid_count+' - '+tBidDetail.bid_id+'</b><br>'+outPut;
  846. }else{
  847. if (parseFloat(BidDataDetail[i].amount) > parseFloat(FullAuctionDetail[itemIndex].amt)) {
  848. var tBidDetail=FullAuctionDetail[itemIndex];
  849. FullAuctionDetail.splice(itemIndex,1);
  850. tBidDetail.bid_count=tBidDetail.bid_count+1;
  851. tBidDetail.amt=BidDataDetail[i].amount;
  852. tBidDetail.bid_id=BidDataDetail[i].id;
  853. tBidDetail.time=clock();
  854. FullAuctionDetail.splice(0,0,tBidDetail)
  855. outPut='<b>Updated: $'+parseFloat(tBidDetail.amt).toFixed(2)+' - '+tBidDetail.user+' - '+tBidDetail.bid_count+'</b><br>'+outPut;
  856. }
  857. }
  858. }
  859. }
  860. }
  861. }
  862.  
  863. showList();
  864.  
  865. if (outPut.length>0) {
  866. debug.log('<b>Bidding History:</b><br>'+u + '<br><br>'+outPut);
  867. }
  868. outPut='';u='';
  869.  
  870. }catch(e) {
  871. debug.append(e.lineNumber+' '+e)
  872. }
  873. if (auction.issold()) {
  874. clearInterval(MAINLOOP_Timeout);
  875. clearInterval(T_Timeout);
  876. clearInterval(LOA_Timeout);
  877. clearInterval(STLS_Timeout);
  878.  
  879. $(auction.timer).off();
  880.  
  881. if(FullAuctionDetail.length!=0) {
  882. ls=JSON.stringify(FullAuctionDetail);
  883. }else{
  884. $('div#tab-wrap').remove();
  885. return;
  886. }
  887. $('#ndump').parent().removeClass('cl').addClass('maltab')
  888. CSVDump();
  889. showList();
  890. listOfAuctions();
  891. FullAuctionDetail=[];
  892. $('div[name*="btimer"]').html('<strong><span style="color:#E80000;">SOLD</span></strong>');
  893.  
  894. if ((ls==null) || (ls=='[]')) {
  895. $("#tab-wrap").hide();
  896. }else{
  897. if ($("#tab-wrap").is(':hidden')) $("#tab-wrap").show();
  898. }
  899. debug.log('Auction Ended');
  900. return;
  901.  
  902. }
  903. }
  904.  
  905. function showList() {
  906. if(FullAuctionDetail.length==0) return;
  907. var leader='';
  908. var bid_total=0;
  909. var outPut='';
  910. var sold=auction.issold();
  911. var table=document.createElement('table');
  912. table.width='100%';
  913. table.cellPadding=0;
  914. table.cellSpacing=0;
  915. table.id='moredata_table';
  916. table.style.cssText='cursor:default';
  917. var tr=document.createElement('tr');
  918. var lpcnt=0;
  919.  
  920. tr.className='trheader';
  921.  
  922. cTC(tr,'Amount');
  923. cTC(tr,'User');
  924. cTC(tr,'Bids','tdpadding');
  925. cTC(tr,'Time');
  926. table.appendChild(tr);
  927. var curr_time=clock();
  928. for (var iStart=0;iStart<FullAuctionDetail.length;iStart++) {
  929. var BidItem=FullAuctionDetail[iStart];
  930.  
  931. if(FullAuctionDetail.length>18){
  932. if(!auction.issold()){
  933. if (curr_time > (parseFloat(BidItem.time)+parseFloat(inactiveTime*60000))) {
  934. break;
  935. }
  936. }
  937. }
  938.  
  939. var tr=document.createElement('tr');
  940. tr.setAttribute('rel',BidItem.user);
  941. tr.className='trstyle';
  942.  
  943. cTC(tr,'$'+parseFloat(BidItem.amt).toFixed(2));
  944. cTC(tr,BidItem.user);
  945. cTC(tr,BidItem.bid_count,'tdpadding');
  946. cTC(tr,ctime(BidItem.time));
  947. cTC(tr,BidItem.time,'cl');
  948.  
  949. tr.className='trstyle';
  950. if(pageLoad.main==true){
  951. table.appendChild(tr);
  952. }else{
  953. $($('#current_leader')[0]).id='';
  954. $('tr[rel*="'+BidItem.user+'"]').remove();
  955. $($('#moredata_table tr')[iStart]).after(tr)
  956. }
  957. }
  958.  
  959. siteBidCounts=FullAuctionDetail[0].amt.toString().replace('$','').replace('.','');
  960. bid_total=0;
  961.  
  962. for(var ii=0;ii<FullAuctionDetail.length;ii++){
  963. var BidItem=FullAuctionDetail[ii];
  964. bid_total=parseInt(bid_total)+parseInt(BidItem.bid_count);
  965. }
  966.  
  967. if(auction.issold()){
  968. siteBidCounts=$(auction.soldpriceElement).html()
  969. siteBidCounts=siteBidCounts.replace('$','').replace('.','');
  970. if(!$.isNumeric(siteBidCounts)) siteBidCounts=0;
  971. }
  972.  
  973. if(auction==happybidday){
  974. siteBidCounts=siteBidCounts-100;
  975. }
  976.  
  977. if(bid_total>siteBidCounts) siteBidCounts=bid_total;
  978.  
  979. if(pageLoad.main==true){
  980. $('div[name*="moredata"]').empty();
  981. $('div[name*="moredata"]').append([table]);
  982. }
  983.  
  984. colorRows('#moredata_table');
  985. inactiveCount=inactiveRows('#moredata_table');
  986.  
  987. var inactiveCount=0;
  988.  
  989. if(FullAuctionDetail.length>18){
  990. inactiveCount=FullAuctionDetail.length- parseInt($('#moredata_table > tr:gt(0)').length)
  991. $('.delete_me').remove();
  992. }else{
  993. inactiveCount=inactiveRows('#moredata_table');
  994. }
  995.  
  996. if((BID_PRICE_COUNT_DIFFERANCE==0) || (!$.isNumeric(BID_PRICE_COUNT_DIFFERANCE))){
  997. BID_PRICE_COUNT_DIFFERANCE=siteBidCounts-bid_total;
  998. }
  999.  
  1000. if(FullAuctionDetail.length>1){
  1001. if(FullAuctionDetail[0].amt==FullAuctionDetail[1].amt){
  1002. siteBidCounts=parseInt(bid_total)+parseInt(BID_PRICE_COUNT_DIFFERANCE);
  1003. }
  1004. }
  1005.  
  1006. var at10c=parseFloat(siteBidCounts*.10).toFixed(2);
  1007. var bidcount=FullAuctionDetail[0].bid_count
  1008. var ucost=parseFloat(bidcount*.10).toFixed(2);
  1009. var cprice=FullAuctionDetail[0].amt;
  1010.  
  1011. outPut='<table cellPadding="0" cellSpacing="0" id="tguess">\
  1012. <tr><td colspan=3>Bid counts tracked - '+bid_total+' of&nbsp;&nbsp;'+parseFloat(siteBidCounts)+'</td></tr>\
  1013. <tr>\
  1014. <td><b>Site earnings:</b></td>\
  1015. <td></td>\
  1016. <td><b>Highest Bidder&#39;s (<span>'+FullAuctionDetail[0].user+'</span>) cost.</b></td>\
  1017. </tr>\
  1018. <tr>\
  1019. <td><span>'+formatCurrency(at10c)+'</span> @ 0.10&#162; per bid.</td><td></td><td>'+bidcount+' x .10 = $'+parseFloat(ucost).toFixed(2)+' + $'+cprice+' = '+formatCurrency((parseFloat(ucost)+parseFloat(cprice)).toFixed(2))+'</td>\
  1020. </tr>\
  1021. <tr>\
  1022. <td><span>'+formatCurrency(at10c*2)+'</span> @ 0.20&#162; per bid.</td><td></td><td>'+bidcount+' x .20 = $'+parseFloat(ucost*2).toFixed(2)+' + $'+cprice+' = '+formatCurrency((parseFloat(ucost*2)+parseFloat(cprice)).toFixed(2))+'</td>\
  1023. </tr>\
  1024. <tr>\
  1025. <td><span>'+formatCurrency(at10c*4)+'</span> @ 0.40&#162; per bid.</td><td></td><td>'+bidcount+' x .40 = $'+parseFloat(ucost*4).toFixed(2)+' + $'+cprice+' = '+formatCurrency((parseFloat(ucost*4)+parseFloat(cprice)).toFixed(2))+'</td>\
  1026. </tr>\
  1027. <tr>\
  1028. <td><span>'+formatCurrency(at10c*6)+'</span> @ 0.60&#162; per bid.</td><td></td><td>'+bidcount+' x .60 = $'+parseFloat(ucost*6).toFixed(2)+' + $'+cprice+' = '+formatCurrency((parseFloat(ucost*6)+parseFloat(cprice)).toFixed(2))+'</td>\
  1029. </tr>\
  1030. </table>'
  1031.  
  1032. $('#nstuff').html(outPut);
  1033.  
  1034. if(!auction.issold()){
  1035. $('#tguess').append('<tr><td colspan=2><br><b>Active:'+(FullAuctionDetail.length-inactiveCount)+'<br>InActive: '+inactiveCount+'</b></td>')
  1036. }else{
  1037. $('#tguess').append('<tr><td colspan=2><br><b>Logged Bidder\'s: '+(FullAuctionDetail.length)+'</b></td>')
  1038. }
  1039.  
  1040. $('#moredata_table > tr:eq(1) > td:lt(4)').effect("highlight", {color: '#FF0000'}, 150);
  1041.  
  1042. if(FullAuctionDetail.length!=0) $('div#tab-wrap').removeClass('cl');
  1043.  
  1044. pageLoad.main=false;
  1045. a=null;td=null;tr=null;table=null;
  1046. }
  1047.  
  1048. function add_display() {
  1049. $('body').append('<div id="tab-wrap" class="maltabwrap cl">\
  1050. <div class="maltabs">\
  1051. <div class="maltab">\
  1052. <input checked="checked" id="tab-1" name="tab-group-1" type="radio">\
  1053. <label for="tab-1" class="histlabel">History</label>\
  1054. <div class="ncontent moredata" name="mdparent">\
  1055. <div class="btimer" name="btimer"></div>\
  1056. <div name="moredata">\
  1057. <table width="100%" cellspacing="0" cellpadding="0" id="moredata_table" style="cursor: default;">\
  1058. <tr class="trheader"><td>Amount</td><td>User</td><td class="tdpadding">Bids</td><td>Time</td></tr>\
  1059. </table>\
  1060. </div>\
  1061. </div>\
  1062. </div>\
  1063. <div class="maltab">\
  1064. <input id="tab-2" name="tab-group-1" type="radio">\
  1065. <label for="tab-2">Log</label>\
  1066. <div class="ncontent" name="debug">\
  1067. Started ...\
  1068. </div>\
  1069. </div>\
  1070. <div class="cl">\
  1071. <input id="tab-4" name="tab-group-1" type="radio">\
  1072. <label for="tab-4">CSV Dump</label>\
  1073. <div class="ncontent" name="ndump" id="ndump">\
  1074. <textarea id="ndumpta" class="ndumpta" wrap="off">Clicking in here will toggle viewing and refreshing.</textarea>\
  1075. </div>\
  1076. </div>\
  1077. <div class="maltab">\
  1078. <input id="tab-3" name="tab-group-1" type="radio">\
  1079. <label for="tab-3">About</label>\
  1080. <div class="ncontent" name="nabout" id="nabout">\
  1081. <p>About</p>\
  1082. </div>\
  1083. </div>\
  1084. </div>\
  1085. <div id="nstuff" class="nstuff"></div>\
  1086. </div>')
  1087.  
  1088. $('#tab-wrap').hide();
  1089.  
  1090. $('#nabout').html('<a target="_blank" href="https://openuserjs.org/scripts/hugopi/Multi_Auction_-_Bid_Logger">Home</a>\
  1091. <br>\
  1092. <b>Version:</b><span id="lv"></span>\
  1093. <br><br>\
  1094. In order to count as correctly as possible, you need to watch the auction, leaving the page will result in missed bid counts.\
  1095. <br><br>\
  1096. This can not catch all of the bids!<br>\
  1097. There are instances where more that 10 bids are placed and only the last 10 make it back to your browser.<br><br>\
  1098. <b>Page refreshes</b> can also cause loss of bids not being counted if the amount of bids placed durring the refresh are greater than the amount shown in the history of the site.\
  1099. <br><br>\
  1100. <p><b>All calculations are a \'guess!\'</b></p>\
  1101. The option to delete the locally saved data will become avaliable when the auction is over.\
  1102. <br>');
  1103.  
  1104. $('#nabout > span#lv').html('&nbsp;'+localVersions.cv);
  1105. setTimeout(function(){
  1106. try{
  1107. var offset = $(auction.historyElement).offset()
  1108. $("#tab-wrap").css({'left':offset.left-auction.offsetLeft,'top':offset.top})
  1109. }catch(e){}
  1110. },auction.offsetDelay*500)
  1111.  
  1112. }
  1113.  
  1114. function UserExists(Auction, bUser) {
  1115. var uExists=-1;
  1116. try{
  1117. if (Auction.length > 0) {
  1118. for (var aucCount=Auction.length-1;aucCount>-1;aucCount--) {
  1119. if (Auction[aucCount].user.toString().toLowerCase()==bUser.toLowerCase()) {
  1120. uExists=(aucCount+1);
  1121. break;
  1122. }
  1123. }
  1124. }
  1125. }catch(e){return(uExists)};
  1126. return (uExists)
  1127. }
  1128.  
  1129. function clock() {
  1130. return (Date.now())
  1131. }
  1132.  
  1133. function saveToLocalStorage(){
  1134. if(IGNORE_SAVE==true) return;
  1135. var aid=auction.getAID().toString().trim();
  1136. if(!$.isNumeric(aid)) return;
  1137. if(aid.toString().length<5) return;
  1138. var bids='"bids":'+JSON.stringify(FullAuctionDetail);
  1139. var stats='"stats":'+JSON.stringify(FullBidStats);
  1140. var title=auction.getAuctionTitle();
  1141. var href=document.location.href.toString();
  1142. title=title.replace(/'/g,'').replace(/"/g,'').replace(/\<br\>/g,' : ').replace(/<(?:.|\n)*?>/gm, '').replace('&amp;','&');
  1143. console.log('The Title ' + title)
  1144. var jstring=lzw_encode('{'+bids+','+stats+',"bpcd":"'+BID_PRICE_COUNT_DIFFERANCE+'","version":"'+localVersions.lsv+'","url":"'+href+'","date":"'+clock()+'","auc_title":"'+ title +'"}');
  1145. if(arguments[0]==true) localStorage.setItem('bid_grabber_'+aid,jstring);
  1146. if(auction.issold()==false) localStorage.setItem('bid_grabber_'+aid,jstring);
  1147. }
  1148.  
  1149. function colorRows(elemid){
  1150. var bgcolor=0;
  1151. $(elemid+' > tr:gt(0)').each(function() {
  1152. var x=bgcolor%2;
  1153. bgcolor++;
  1154. if (x==1) {
  1155. $(this).addClass('odd').removeClass('even');
  1156. } else {
  1157. $(this).addClass('even').removeClass('odd');
  1158. }
  1159. });
  1160. }
  1161.  
  1162. function cTC(){
  1163. var td=document.createElement('td')
  1164. td.innerHTML=arguments[1];
  1165. if(arguments[2]!=undefined) td.className=arguments[2];
  1166. arguments[0].appendChild(td);
  1167. }
  1168.  
  1169. function inactiveRows(elemid){
  1170. var curr_time=clock();
  1171. var inactiveCount=0;
  1172. $(elemid+' > tr:gt(0)').each(function() {
  1173. var bt=this.children[4].innerHTML;
  1174. if (curr_time > (parseFloat(bt)+parseFloat(inactiveTime*60000))) {
  1175. $(this).removeClass('inactive').addClass('inactive').removeClass('delete_me').addClass('delete_me');
  1176. inactiveCount++;
  1177. }
  1178. });
  1179.  
  1180. if(auction.issold()){
  1181. $(elemid+' > tr:gt(0)').each(function() {
  1182. $(this).removeClass('inactive').removeClass('delete_me');
  1183. inactiveCount=0;
  1184. });
  1185. }
  1186.  
  1187. return(inactiveCount)
  1188. }
  1189. function ctime(d) {
  1190. if (d==0) return ('Not Set');
  1191. var time=new Date(d);
  1192. var hr=time.getHours();
  1193. var min=time.getMinutes();
  1194. var sec=time.getSeconds();
  1195. var mon=time.getMonth()+1;
  1196. var day=time.getDate();
  1197. var msec=time.getMilliseconds();
  1198. var ampm=' PM ';
  1199. if (hr < 12) {
  1200. ampm=' AM ';
  1201. }
  1202. if (hr > 12) {
  1203. hr -=12;
  1204. }
  1205. if (hr==0) {
  1206. hr=12;
  1207. }
  1208. if (hr < 10) {
  1209. hr=' '+hr;
  1210. }
  1211. if (min < 10) {
  1212. min='0'+min;
  1213. }
  1214. if (sec < 10) {
  1215. sec='0'+sec;
  1216. }
  1217. var ct=mon+'/'+day+' '+hr+':'+min+':'+sec+ampm;
  1218. if (ct.indexOf('NaN')!=-1) ct=d;
  1219. return (ct)
  1220. }
  1221.  
  1222. function idebug(d) {
  1223. var e=document.getElementById('ddebug');
  1224.  
  1225. if(!e){
  1226. e=document.createElement('textarea');
  1227. e.id='ddebug';
  1228. e.style.cssText='position:fixed;top:5px;right:5px;border:1px solid black;';
  1229. document.body.appendChild(e);
  1230. }
  1231. $('#ddebug').html(d).css('display', 'block')
  1232. }
  1233.  
  1234. function outerHTML(node){
  1235. return node.outerHTML || (
  1236. function(n){
  1237. var div=document.createElement('div'), h;
  1238. div.appendChild(n.cloneNode(true));
  1239. h=div.innerHTML;
  1240. div=null;
  1241. return h;
  1242. })(node);
  1243. }
  1244.  
  1245. (function ($) {
  1246. $.fn.outerHTML=function () {
  1247. return $(this).clone().wrap('<div></div>').parent().html();
  1248. }
  1249. })(jQuery);
  1250.  
  1251. function doodls(){
  1252. console.log(Math.random());
  1253. var dc_time=Date.now();
  1254. var ll=localStorage.length;
  1255.  
  1256. var t=[];
  1257. for (var i=ll;i>-1;i--){
  1258. var id=localStorage.key(i);
  1259. if(id!==null){
  1260. if(id.indexOf('bid_grabber_')==0){
  1261.  
  1262. var lls=lzw_decode(localStorage.getItem(id));
  1263. if(lls==null){
  1264. lls=(localStorage.getItem(id));
  1265. }
  1266.  
  1267. try{
  1268. t=JSON.parse(lls);
  1269. if(t.url==document.location.href.toString()){
  1270. if(t.version.toString()!=lsv.toString()) {
  1271. if(id.indexOf('bid_grabber_')==0) {
  1272. ls=null;
  1273. localStorage.removeItem(id);
  1274. }
  1275. }
  1276. }
  1277. }catch(e){};
  1278.  
  1279. try{
  1280. if(parseFloat(dc_time)>(parseFloat(t.date)+432000000)) {
  1281. if(id.indexOf('bid_grabber_')==0) {
  1282. ls=null;
  1283. localStorage.removeItem(id);
  1284. }
  1285. }
  1286. }catch(e){};
  1287.  
  1288. }
  1289. }
  1290. }
  1291. }
  1292. function listOfAuctions() {
  1293.  
  1294. var aucExists=false;
  1295. var br=document.createElement('br');
  1296. var div=document.createElement('div');
  1297. var ll=localStorage.length;
  1298. var l_id=0;
  1299. var sold=auction.issold();
  1300. console.log('Is it Sold ' + sold);
  1301. div.className='loalinks';
  1302. div.id='a_links';
  1303. var s=document.createElement('span');
  1304. s.innerHTML='List of Auctions';
  1305. s.id='s_links';
  1306.  
  1307. div.appendChild(s);
  1308. div.appendChild(document.createElement('br'));
  1309. for (var i=0; i < ll; i++) {
  1310. var id=localStorage.key(i);
  1311.  
  1312. if(id.indexOf('bid_grabber_')==0){
  1313. l_id++;
  1314. id=id.replace('bid_grabber_','');
  1315.  
  1316. if(id==auction.getAID()) aucExists=true;
  1317.  
  1318. var title='';
  1319.  
  1320. var id=localStorage.key(i).replace('bid_grabber_','');
  1321. try{
  1322. var ls=lzw_decode(localStorage.getItem(localStorage.key(i)));
  1323. if(ls==null){
  1324. ls=localStorage.getItem(localStorage.key(i));
  1325. }
  1326. ls=JSON.parse(ls);
  1327. GM_log('Saved Title is ' + ls.auc_title)
  1328. title=ls.auc_title;
  1329. }catch(e){}
  1330.  
  1331. var a=document.createElement('a');
  1332.  
  1333. if(ls.url==undefined){
  1334. a.href=auction.url+id;
  1335. }else{
  1336. a.href=ls.url;
  1337. }
  1338.  
  1339. a.className='context-menu';
  1340. a.id=id;
  1341.  
  1342. if (parseInt(id)==parseInt(auction.getAID())) {
  1343. a.innerHTML='Viewing';
  1344. a.title=title;
  1345. if (sold==true) {
  1346. a.className='';
  1347. a.innerHTML='Has&nbsp;Ended,&nbsp;Delete?';
  1348. a.addEventListener('click', function (e) {
  1349. e.preventDefault();
  1350. e.stopPropagation();
  1351. localStorage.removeItem('bid_grabber_'+auction.getAID());
  1352.  
  1353. $('div#tab-wrap').fadeOut('slow',function(){
  1354. $(this).remove();
  1355. });
  1356. listOfAuctions();
  1357. return(false);
  1358. }, false);
  1359.  
  1360. a.title='Click to delete localStorage data!'
  1361. }
  1362. a.target='_self'
  1363. } else {
  1364. a.title=title+'\nHold CTRL to open in new tab';
  1365. a.target='_self';
  1366. a.innerHTML=id;
  1367. }
  1368.  
  1369. a.id=auction.getAID();
  1370. div.appendChild(a)
  1371. div.appendChild(document.createElement('br'));
  1372. }
  1373. }
  1374.  
  1375. if (document.getElementById('a_links')) {
  1376. document.getElementById('a_links').parentNode.removeChild(document.getElementById('a_links'))
  1377. }
  1378. if (l_id!=0) {
  1379. $('body').append(div);
  1380. }
  1381. }
  1382.  
  1383. function detailprice(a, b) {
  1384. if (parseFloat(a.amount) > parseFloat(b.amount)) {
  1385. return (-1);
  1386. }
  1387. if (parseFloat(a.amount) < parseFloat(b.amount)) {
  1388. return (1);
  1389. }
  1390. return 0;
  1391. }
  1392.  
  1393. function price(a, b) {
  1394. if (parseFloat(a.amt) > parseFloat(b.amt)) {
  1395. return (-1);
  1396. }
  1397. if (parseFloat(a.amt) < parseFloat(b.amt)) {
  1398. return (1);
  1399. }
  1400. return 0;
  1401. }
  1402.  
  1403. function usersort(a, b) {
  1404. if ((a.user) < (b.user)) {
  1405. return (-1);
  1406. }
  1407. if ((a.user) > (b.user)) {
  1408. return (1);
  1409. }
  1410. return 0;
  1411. }
  1412.  
  1413. function lzw_encode(s) {
  1414. return(s);
  1415. }
  1416.  
  1417.  
  1418. function lzw_decode(s) {
  1419. return(s);
  1420. }
  1421.  
  1422. function formatCurrency(num) {
  1423. num = num.toString().replace(/\$|\,/g, '');
  1424. if (isNaN(num)) num = "0";
  1425. sign = (num == (num = Math.abs(num)));
  1426. num = Math.floor(num * 100 + 0.50000000001);
  1427. cents = num % 100;
  1428. num = Math.floor(num / 100).toString();
  1429. if (cents < 10) cents = "0" + cents;
  1430. for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
  1431. num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
  1432. return (((sign) ? '' : '-') + '$' + num + '.' + cents);
  1433. }
  1434.  
  1435. function rm(s){
  1436. localStorage.removeItem('bid_grabber_'+s)
  1437. }
  1438.  
  1439. function CSVDump(){
  1440.  
  1441. $('#ndumpta').empty();
  1442. var dumpStr='';
  1443. dumpStr+='"Amount","User","Bids","Time","Auction Url"\r\n'
  1444. for(var i=0;i<FullAuctionDetail.length;i++){
  1445. dumpStr+=parseFloat(FullAuctionDetail[i].amt).toFixed(2)+',';
  1446. dumpStr+=FullAuctionDetail[i].user+',';
  1447. dumpStr+=FullAuctionDetail[i].bid_count+',';
  1448. dumpStr+='"'+ctime(FullAuctionDetail[i].time).replace(/ /gm,' ')+'",';
  1449. dumpStr+='"'+document.location.href.toString()+'"\r\n</br>';
  1450. }
  1451. $('#ndumpta').append(dumpStr);dumpStr='';
  1452.  
  1453. }