// Copyright (c) 2008, Chewy Byte Solutions. All rights reserved. This is a Greasemonkey user script. You will need to install Greasemonkey from [https://addons.mozilla.org/en-US/firefox/addon/748] or [http://greasemonkey.mozdev.org/] before using this script. // DEVELOPMENT ('TESTED WORKING') ENVIRONMENT: OS: Windows XP SP3 32-bit (http://www.microsoft.com) Internet Browser: Firefox 3.0 (http://www.mozilla.com/en-US/) Required Internet Browser Addon: Greasemonkey version 0.8.20080609.0 (https://addons.mozilla.org/en-US/firefox/addon/748) // LICENSE: - Free for non-profit personal usage upon total agreement and acceptance of this license. - Author reserves all exclusive rights for distribution of this script. (DO NOT link directly to script download URL. Link to the download page.) - Author reserves all rights to seek and take legal actions for any usage/distribution/modification deems unappropriate by the author and solely by the author. - Author will have the final say in all other usage/distribution/modification circumstances not covered by this short, simple license agreement. - Author reserves all rights to amend terms and conditions in this license as deems appropriate by the author and solely by the author. - Use this script at your own risk(s). Author will not be held liable for any loss from usage or this script. - Do not expect the author to give your 'after sales' services. Use the script as is or don't use it at all. However, constructive feedbacks will be greatly appreciated. - There is no guarantee this script will work, especially in other versions of OS, browsers and/or Greasemonkey. - The only guarantee author gives is that this script DOES NOT contain any intentionally included malicious codes. - In general terms, this script DOES NOT contain/download/generate/produce any kind virus/malware/security exploits/adware. The only 'ad' is the credit to author as stated here. - Author is reachable at admin [at|@] chewybyte [dot|.] com OR admin [at|@] chewybyte [dot|.] net // Compacted at http://www.meanfreepath.com/tools/jscompactor.html // ==UserScript== // @name Lelong Utilities // @author Yen of Chewy Byte Solution (http://www.chewybyte.com) // @namespace yen@cbs // @description Utility script(s) for lelong.com.my // @include http://*.lelong.com.my/* // @version 2008.07.18 // ==/UserScript== function listingPage_Main(){AddJavascript((0){tbls[i].removeAttribute(tbls[i].attributes[0].nodeName);}tbls[i].id='pageTbl';tbls[i].className='pageTbl';for(j=0;j0){tbls[i].rows[0].cells[j].removeAttribute(tbls[i].rows[0].cells[j].attributes[0].nodeName);}tbls[i].rows[0].cells[j].className='pageTblCell'+j.toString();}}if(tbls[i].getAttribute('width')== '80%'&&tbls[i]&&tbls[i].rows&&tbls[i].rows[0].cells&&tbls[i].rows[0].cells.length==6){if(tbls[i].rows[0].cells[2].innerHTML.match(/Price /)){tbls[i].id='lstTbl0';}else if(tbls[i].rows[1]&&tbls[i].rows[1].cells[2].innerHTML.match(/RM /)){tblIdCount++;tbls[i].id='lstTbl'+tblIdCount.toString();}}if(tbls[i].className=='bt bl br bb'){ tbls[i].id='advertTbl_RCol';}}if(document.getElementById('advertTbl_RCol')!= null){ document.getElementById('advertTbl_RCol').parentNode.removeChild(document.getElementById('advertTbl_RCol'));}while(document.getElementsByTagName('iframe')[0]!=null){document.getElementsByTagName('iframe')[0].parentNode.removeChild(document.getElementsByTagName('iframe')[0]);}if(document.getElementById('lstTbl0')!= null){return true;}else{return false;}}function ReadTables(data){var c0,c1,c2,c3,c4,c5;var tbl,i=0;while(document.getElementById('lstTbl'+i.toString())!= null){tbl=document.getElementById('lstTbl'+i.toString());for(j=0;j1){data[0][2]=''+aD+''+aU+''+data[0][2];data[0][5]=''+aD+''+aU+''+data[0][5];for(i=1;iRM /,'">RM ');data[i][2] += '
RM '+FormatPrice(data[i][6])+ '
';if(data[i][4].match(/ Bids/)){data[i][4]=''+data[i][4]+'';}else if(data[i][4].match(/\d{3,}Views/)){data[i][4]=''+data[i][4]+'';}}}return;}function ShowTable(data,sorter){var titleRow,tbl,newRow,newCell;var closedItemExists=false;var i=0;if(sorter==null){sorter=GetSortCommand();}AppendSortCommandToLinks(sorter);if(document.getElementById('qcksrch')&& document.getElementById('qcksrch_sort')== null){var newInput=document.createElement('input');newInput.id='qcksrch_sort';newInput.type='hidden';newInput.name='SortBy';newInput.value=sorter;document.getElementById('qcksrch').appendChild(newInput);}else if(document.getElementById('qcksrch_sort')){document.getElementById('qcksrch_sort').value=sorter;}tbl=document.getElementById('lstTbl0');if(tbl==null){ return;}while(tbl.rows[0]!=null){tbl.deleteRow(0);}titleRow=data.shift();data=data.sort(eval(sorter));data.unshift(titleRow);for(i=0;iHide
Closed';document.getElementById('pageTbl').rows[0].appendChild(newTd);}if(document.getElementById('pageTblTop')== null&&document.getElementById('pageTbl')!= null){var newPageTbl=document.getElementById('pageTbl').cloneNode(true);newPageTbl.id='pageTblTop';document.getElementById('lstTbl0').parentNode.insertBefore(newPageTbl,document.getElementById('lstTbl0'));}return;}function HideClosedItems(){while(document.getElementsByClassName('pageTblCell3 hideClosedItemCell')[0]){document.getElementsByClassName('pageTblCell3 hideClosedItemCell')[0].parentNode.removeChild(document.getElementsByClassName('pageTblCell3 hideClosedItemCell')[0]);}hideClosed=true;ShowTable(tblData,null);return;}function GetSortCommand(){if(document.URL.match(/SortBy=priceAsc|SortBy=priceDesc|SortBy=timeAsc|SortBy=timeDesc/)){return document.URL.match(/priceAsc|priceDesc|timeAsc|timeDesc/)[0];}else{return 'priceAsc';}}function AppendSortCommandToLinks(command){var i;var links=document.getElementsByTagName('a');for(i=0;i6){formattedPrice=formattedPrice.toString().substr(0,formattedPrice.toString().length-6)+ ','+formattedPrice.toString().substr(-6);}return formattedPrice;}function priceAsc(a,b){var x=a[6];var y=b[6];return x-y;}function priceDesc(a,b){var x=a[6];var y=b[6];return y-x;}function timeAsc(a,b){var x=a[7];var y=b[7];return x-y;}function timeDesc(a,b){var x=a[7];var y=b[7];return y-x;}]]>
).toString());AddCSS(().toString());}function itemPage_Main(){AddJavascript(('+ItemPage_CalcSale(saleCell.innerHTML,shippingCell.innerHTML)+ '';}else if(startCell!=undefined&&highBidCell!=undefined&&shippingCell!=undefined){if(highBidCell.innerHTML.match(/Below Reserve/)){highBidCell.innerHTML += ''+ItemPage_CalcBid(startCell.innerHTML,highBidCell.innerHTML,shippingCell.innerHTML)+ '';}else{highBidCell.innerHTML += ''+ItemPage_CalcBid(startCell.innerHTML,highBidCell.innerHTML,shippingCell.innerHTML)+ '';}}function ItemPage_CalcSale(sale,ship){var totalPrice;var salePrice=sale.match(/RM [\d,]{1,}\.\d\d/);var shipPrice=ship.match(/RM [\d,]{1,}/);if(salePrice!=null){salePrice=parseFloat(salePrice[0].replace(/RM/,'').replace(/,/,''));if(shipPrice==null){totalPrice=salePrice;}else{shipPrice=parseFloat(shipPrice[0].replace(/RM/,'').replace(/,/,''));totalPrice=salePrice+shipPrice;}}if(totalPrice==undefined||totalPrice==null){return '?.??';}else{totalPrice=totalPrice.toString();}if(!totalPrice.match(/\./)){totalPrice += '.00';}else if(totalPrice.length-totalPrice.search(/\./)== 2){totalPrice += '0';}if(totalPrice.length>6){totalPrice=totalPrice.substr(0,totalPrice.length-6)+ ','+totalPrice.substr(-6);}return 'RM '+totalPrice;}function ItemPage_CalcBid(start,bid,ship){var totalPrice;var startPrice=start.match(/RM [\d,]{1,}\.\d\d/);var bidPrice=bid.match(/RM [\d,]{1,}\.\d\d/);var shipPrice=ship.match(/RM [\d,]{1,}/);if(startPrice!=null&&bidPrice!=null){startPrice=parseFloat(startPrice[0].replace(/RM/,'').replace(/,/,''));bidPrice=parseFloat(bidPrice[0].replace(/RM/,'').replace(/,/,''));if(startPrice>bidPrice){totalPrice=startPrice;}else{totalPrice=bidPrice;}if(shipPrice!=null){shipPrice=parseFloat(shipPrice[0].replace(/RM/,'').replace(/,/,''));totalPrice += shipPrice;}}if(totalPrice==undefined||totalPrice==null){return '?.??';}else{totalPrice=totalPrice.toString();}if(!totalPrice.match(/\./)){totalPrice += '.00';}else if(totalPrice.length-totalPrice.search(/\./)== 2){totalPrice += '0';}if(totalPrice.length>6){totalPrice=totalPrice.substr(0,totalPrice.length-6)+ ','+totalPrice.substr(-6);}return 'RM '+totalPrice;}]]>).toString());AddCSS(().toString());}function AddJavascript(content){var newElement=document.createElement('script');newElement.setAttribute('type','text/javascript');newElement.innerHTML=content;document.body.appendChild(newElement);return;}function AddCSS(content){var newElement=document.createElement('style');newElement.setAttribute('type','text/css');newElement.innerHTML=content;document.getElementsByTagName('head')[0].appendChild(newElement);return;}if(document.URL.match(/Auc\/List\/List.asp/)){GM_log('Lelong Utilities Script:Listing page.');listingPage_Main();}else if(document.URL.match(/\/Auc\/List\/[^\/]+\.htm/)|| document.URL.match(/\/Auc\/List\/DetailStd\.asp/)){GM_log('Lelong Utilities Script:Item page.');itemPage_Main();}else{GM_log('Lelong Utilities Script:No matching utilities for page '+document.URL.toString());}