The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#3
|
|||
|
|||
![]()
This works great... But I am having one issue incorporating this with Ajax...
This is the text field to be edited... Code:
<div class="editUse"><img src="ranking/usage/amy.gif"></div> Code:
function editBox_use(actual) { if(!changing) { actual.innerHTML = fetch_usage(actual.innerHTML).join(','); actual.innerHTML = "<input id=\""+ actual.id +"_field\" type=\"text\" value=\"" + actual.innerHTML + "\" onkeypress=\"return fieldEnter(this,event,'" + actual.id + "')\" onblur=\"return fieldBlur(this,'" + actual.id + "');\" style=\"width:50px; text-align:center; font-size:12px; \" />"; changing = true; } actual.firstChild.focus(); } function fetch_usage(code) { matches = new Array(); while (code.match(/(<img src="\w+\/usage\/(\w+?)\.gif">)/i)) { matches.push(RegExp.$2); code = code.replace(RegExp.$1, '', code); } return matches; } ($input is the new value where "amy" once was, lets say for now it is "cas") Code:
function update_score($input) { global $thumbdir; $input = str_replace(' ','',$input); $input = strtolower($input); $uses = explode(',',$input); foreach ($uses as $use) { $usage .= '<img src="'.$thumbdir.'/usage/'.$use.'.gif">'; } echo $usage; } Code:
<div class="editUse"><img src="ranking/usage/cas.gif"></div> However, now a new issue comes up... THEORETICALLY, if I click on the div AGAIN (without refresshing the page), it should return the text box filled out with the word "cas". It doesn't instead it gives me a blank text box. If I refresh the page, it works fine, but if I don't (which is the purpose of AJAX), the regex script fails. Is there something wrong with the way the new HTML is echoed out that makes it fail the matching? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|