vForums Support :: Programming & Coding :: Code Requests & Support :: [ROSS] Something Odd - View Topic
| |
| CåñåÐå™ Full Member
Posts: 427 Status: Offline Gender: Male Location: Toronto Ontario Joined:
pmwww | [ROSS] Something Odd (12th Jul 09 at 4:42am UTC) | | Code: - .dicebg {background-color: FFFFFF;border:solid 2px #000000;}
- .dicefont {background-color: FFFFFF;color: 000000; font-weight:bold;}
- </style>
- <script type="text/javascript">
- //Dice Rolls In Posts v1.1
- //Copyright 4-23-2007 ~Wonder
- //May be reposted anywhere as long as this header remains in tact
- //Modified by Ross of vForums Support for vForums compatibility
- //Do you want the dice to line of horizontally(true) or vertically(false)
- diceAlignment=true;
- //Enter URL of the image you want to appear as the dice ubbc button
- UBBCdiceImage="http://img100.imageshack.us/img100/6118/diceicon9rx.gif";
- //Enter the default # of sides
- defaultSides=20;
- //Enable dice in preview? true or false
- enablePreview=false;
- rs="";
- mainForm="";
- if(document.post_form || document.quick_reply_form) {
- if(document.post_form) {
- mainForm=document.post_form;
- if(location.href.match(/action\/modify/)){enablePreview=true;}
- ubbc_holder = document.createElement('span');
- get('ubbc_buttons', ID).appendChild(ubbc_holder);
- } else {
- ubbc_holder = get('quick_reply_ubbc', ID);
- mainForm=document.quick_reply_form;
- }
- ubbc_holder.innerHTML+="<a href=javascript:add_ubbc(\"[dice="+defaultSides+"]\",\"\")><img src=\""+UBBCdiceImage+"\" alt=\"Insert Dice Roll\" border=\"0\"></a>";
- mainForm.onsubmit=addRand;
- mainForm.message.value=mainForm.message.value.replace(/(\[rand\=\d+\])/ig,"");
- rs=RegExp. ; rs=(/\[rand\=/.test(rs))?rs:"";
- if(location.href.match(/quote\/\d+/))
- {
- mainForm.message.value=mainForm.message.value.replace(/(\[dice\=\d+\])/ig,"");
- rs="";
- }
- }
- ///////////////////////
- if(location.href.match(/action\/(view_topic|search|recent|pm_view|post|modify|create_poll)/)) {
- td=document.getElementsByTagName("td");
- topic_summary = false;
- for(i=0;i<td.length;i++) {
- if(td.item(i).className == 'post' || topic_summary) {
- // Remove from message preview
- if(td.item(i).className == 'post' && location.href.match(/action\/(post|modify|create_poll)/) && !enablePreview) {
- td.item(i).innerHTML=td.item(i).innerHTML.replace(/\[rand\=(\d|\w|<|>|\/|\s)+\]/gi,"");
- }
- rand=td.item(i).innerHTML.match(/\[rand\=(\d|\w|<|>|\/|\s)+\]/);
- if(rand!=null) {
- td.item(i).innerHTML=td.item(i).innerHTML.replace(rand[0],"");
- rand=rand[0].replace(/[^\d]/g,"");
- dice=td.item(i).innerHTML.match(/\[dice\=\d+(\+\d+)?\]/ig);
- if(dice!=null) {
- for(k=0;k<dice.length;k++) {
- numb=dice[k].match(/\d+(\+\d+)?/);
- numb=numb[0].split("+");
- addon=numb.length>1?parseInt(numb[1],10):0;
- numb=parseInt(numb[0],10);
- roll=Math.round((parseFloat(rand.substring(k,k+2)+"."+rand.substring(k+2,rand.length))/100)*(numb-1))+1+addon;
- td.item(i).innerHTML=td.item(i).innerHTML.replace(dice[k],"<table "+(diceAlignment?"style=\"display:inline\"":"")+" border=0 cellpadding=0 cellspacing=0><tr><td><table class=dicebg cellpadding=1 cellspacing=0><tr><td><center><font class=dicefont size=\"+1\"><b>"+roll+"</b><br><font size=\"1\">"+numb+" sides"+(addon>0?"+"+addon:"")+"</font></font></center></td></tr></table></td></tr></table> ");
- }
- }
- }
- } else if(td.item(i).className == 'title1' && td.item(i).innerHTML.match(/>Topic Summary</i)) {
- topic_summary = true;
- }
- }
- }
- function addRand() {
- tinyMCE.triggerSave(true, true);
- mainForm.message.value=mainForm.message.value.replace(/(\[rand\=\d+\])/ig,"");
- if((rs.length==0 && mainForm.message.value.match(/(\[dice\=\d+(\+\d+)?\])/))) {
- mainForm.message.value+="[rand="+(Math.random()+"").replace(/0\./,"")+(Math.random()+"").replace(/0\./,"")+(Math.random()+"").replace(/0\./,"")+( Math.random()+"").replace(/0\./,"")+"]";
- } else {
- mainForm.message.value+=rs;
- }
- disable(mainForm);
- }
- </script>
-
I'm using this code on my forum : http://tropolis.virtualforums.co.uk/ and since the v2 update it stopped working . But only for members if you view my dice game thread as an guest , you will see the dice fine , but once you login as an member the dice no longer show/work . | |
click here We have 15 Different Skins/Templates for your vForum |
| Graham Support Administrator
Posts: 1,642 Status: Offline Gender: Male Location: Sussex, UK Age: 39 Joined:
Additional Groups: Support Team
pmwww | Re: Something Odd (12th Jul 09 at 5:18pm UTC) | | Unless one of the coders can work this out, then this might have to wait for Ross when he gets back from holiday. | |
| Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | | ManGoneMad New Member
Posts: 20 Status: Offline Gender: Male Location: West Coast of Michigan Age: 66 Joined:
pmwwwvForum | Re: Something Odd (12th Jul 09 at 9:30pm UTC) | | Wrighty, sorry to say , but no it wasn't, the post you pointed me to, in that thread, was from before the up-grade to v2, (Tue, June 9th to be exact) and it does not fix the problem. I think the trouble is code adds a UBBC button, & function, and in v2 we have the new WYSIWYG posting set-up. Just my $.02 worth. | |
|
| Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Something Odd (12th Jul 09 at 10:44pm UTC) | | Yes, that would be the problem. So what I need you two to tell me is - how you'd like to go ahead with this? | |
| CåñåÐå™ Full Member
Posts: 427 Status: Offline Gender: Male Location: Toronto Ontario Joined:
pmwww | Re: Something Odd (13th Jul 09 at 4:06am UTC) | | I would like the code to work . If it can't i'll remove it. But i think i did read on here you were going to write an code to change it to UBBC if members would have it the old way . Which i would like since i have no idea what most of the WYSIWYG really does. If you do make the code , shouldn't/wouldn't the dice code go back to be in working order ? | |
click here We have 15 Different Skins/Templates for your vForum |
| CåñåÐå™ Full Member
Posts: 427 Status: Offline Gender: Male Location: Toronto Ontario Joined:
pmwww | Re: Something Odd (17th Jul 09 at 2:50am UTC) | | Does anyone have an idea ?? Why ? | |
click here We have 15 Different Skins/Templates for your vForum |
| |
| |
|