View Single Post
  #4  
Old 09-22-2012, 10:52 PM
tristantio tristantio is offline
Fire Giant

tristantio's Avatar

Join Date: Nov 2010
Posts: 888
Default

Hi Falkun, thanks for the advice on the item linking. I could probably adjust so hyphens work properly, but I believe the reason I did not initially was that some item names contain them.

Since none (or extremely few) item names contain a comma (,) or slash (/), I was able to assume that was a breaking point in the /auc log.

The regular expressions I'm using for this break apart can be seen in the eqAuction.js file the site uses.

Code:
//Define regexes
var item = new RegExp(/([A-Z][a-z][A-Za-z ':`\-]+?)([^A-Za-z ':`\-])/g);
var add_ = new RegExp(/([a-z])([A-Z])/g);
var sell = new RegExp(/([ ]*?)(Selling|Seller|WTS)([: ]*?)/gi);
var buy = new RegExp(/([ ]*?)(Offering|Buying|WTB)([: ]*?)/gi);
var caps = new RegExp(/( [A-Z][A-Z])/g);
var dash = new RegExp(/[\-\|]+? /g);
var dash2 = new RegExp(/ [\-\|]+?/g);
and applied on the fly as such:
Code:
function findItems(target) {
	target = target ? target : '.aul';
	$(target).each(function() {
		var text = $(this).html();
		text = text.replace(add_, '$1, $2');
		text = text.replace(sell, '$1(WTS)$3');
		text = text.replace(buy, '$1(WTB)$3');
		text = text.replace(caps, ', $1');
		text = text.replace(dash, ', ');
		text = text.replace(dash2, ', ');
		text = text.replace(item, '<a href="http://wiki.project1999.org/index.php/$1" alt="$1" class="ii">$1<pre class="itemTT"></pre></a>$2');
		$(this).html(text);
	});
}
__________________
Realtime auction logger: http://ahungry.com/eqauctions/
Reply With Quote