vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Code Requests & Support :: Custom UBBC - Simple Version - View Topic
Topic Rating: *****
Printable View
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Custom UBBC - Simple Version (4th Mar 10 at 5:43pm UTC)
Code:
 
  1. <script>
  2.  
  3. function CustomUBBC(code){
  4.  
  5. code = code.replace(/\[anime\](.+?)\[\/anime\]/gi,'<center>' + RegExp.$1 + '</center>');
  6.  
  7. document.write(code);
  8.  
  9. }
  10.  
  11. CustomUBBC('[anime]Naruto[/anime]');
  12.  
  13. </script>
 


The way it is right now is to just try to get the replacement to work,
right now when I use this code it displays as http at the location it is used at

Later I want 2 functions:
The first will be used for posts as [anime]Anime Title[/anime] and any other Custom UBBC I want,
The second will directly refer to the 2nd function in the global h/f where I want it to display

Note: The <center></center> in the replacement code is just for testing, it will be different later when it is working and I figure out how I want it, I just want to figure out the core of the function first

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
dog199200
Guest
Re: Custom UBBC - Simple Version (4th Mar 10 at 6:24pm UTC)
yo be 100% honestly, after ross redid the system a while back, i don't think it can actually be added onto anymore, i always got an error of some kind when i tried, BUT maybe michael or marc can help you out, i'm just saying i'm not sure if its 100% possible anymore
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Custom UBBC - Simple Version (4th Mar 10 at 7:37pm UTC)
I'm going to be using post template, getting {message} and sending it through the CustomUBBC function but the code isn't ready for that yet, just worry about the code itself

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
dog199200
Guest
Re: Custom UBBC - Simple Version (5th Mar 10 at 12:34am UTC)
umm ok give me a second, if your going to do it like that, that I have a code for you to look at and i'm sure you can figure it out from there


This is a modified version of the spoiler script, i added in a few things, and at the bottom is the code to add a button. I'm sure you can see how it is done and get a better idea on how to revise your script. I'd rewrite your code to make it work, but as we both know my JS sucks, i dont use it enough.

Code:
 
  1. <script type="text/javascript">
  2. <!--
  3. //Spoiler Script
  4. //Written by Dranew
  5. //Do not rip or claim as your own.
  6.  
  7. if(location.href.match(/view_topic/)) {
  8.   var post = get('td','tag');
  9.   var sid = 0;
  10.   for(a=0;a<post.length;a++) {
  11.     if(post[a].className == "post") {
  12.       post[a].innerHTML = post[a].innerHTML.replace(/\[spoiler\]/g, "<div id='spoiler'>").replace(/\[\/spoiler\]/g, "</div>");
  13.     }
  14.   }
  15.   for(b=0;b<post.length;b++) {
  16.     if(post[b].className == "post") {
  17.       var div = post[b].getElementsByTagName('div')
  18.       for(c=0;c<div.length;c++) {
  19.         if(div[c].id == "spoiler") {
  20.           var spoil = div[c].innerHTML
  21.           div[c].innerHTML = "<center><span class='header' style='width: 498px; height: 20px;'></span><span class='head' style='width: 496px;'><center><a href='javascript:dispSpoil("+sid+")' id='sl"+sid+"'>Open Spoiler</a></center></span><span class=' window1 text' style='display: none; width: 496px;' id='s"+sid+"'>"+spoil+"</span><span class='base' style='width: 498px; height: 20px;'></span></center>";
  22.           sid++
  23.         }
  24.       }
  25.     }
  26.   }
  27.   function dispSpoil(ID) {
  28.     var spoilText = document.getElementById("s"+ID)
  29.     var spoilLabel = document.getElementById("sl"+ID)
  30.     spoilLabel.innerHTML = (spoilLabel.innerHTML == "Open Spoiler")? 'Close Spoiler' : 'Open Spoiler';
  31.     spoilText.style.display = (spoilText.style.display == "none")? '' : 'none';
  32.   }
  33. }
  34. var icon = 'http://i25.photobucket.com/albums/c51/dog199200/Digimon/spoiltag.png'
  35. var testid = 'Spoiler'
  36.  
  37. function qrbuild(){
  38.     _a = document.createElement('a');
  39.     _a.href = testid;
  40.     _a.onclick = function(){add_ubbc('[spoiler]','[/spoiler]');};
  41.     _a.style.cssText = "cursor: pointer;";
  42.     _a.appendChild(_i);
  43. }
  44. function build(){
  45.     var _i = document.createElement('img');
  46.     _i.src = icon;
  47.     _i.style.border='0';
  48.     _a = document.createElement('a');
  49.     _a.onclick = function(){add_ubbc('[spoiler]','[/spoiler]');};
  50.     _a.style.cssText = "cursor: pointer;";
  51.     _a.appendChild(_i);
  52. }
  53.  
  54. if(get('ubbc_buttons','id')){
  55.     build();
  56.     get('ubbc_buttons','id').firstChild.insertBefore(_a, get('ubbc_buttons','id').firstChild.getElementsByTagName('br')[0]);
  57. }
  58. if(get('quick_reply_ubbc','id')){
  59.     qrbuild();
  60.     get('quick_reply_ubbc','id').childNodes[1].appendChild(_a);
  61. }
  62. //-->
  63. </script>
 



Keep in mind the input system did work before ross change the messaging system, so with that said if separating out the functions to work with the templating system, it should work.



edit: actually i think something like this would be closer to what you wan't:

Code:
 
  1. <script>
  2. function CustomUBBC(anime){
  3.     _a = document.createElement('a');
  4.     _a.onclick = function(){add_ubbc('[anime]','[/anime]');};
  5.     _a.style.cssText = "cursor: pointer;";
  6. }
  7.  
  8. CustomUBBC(anime);
  9.  
  10. }
  11. </script>
 


That should just create the function, you'd have to edit it yourself and make a few adjustments.
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Custom UBBC - Simple Version (4th Apr 10 at 3:51am UTC)
I just need the replacement part, I have it on my forum: http://tfah.vforums.us/

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
 Printable View

All times are GMT+0 :: The current time is 8:40pm
Page generated in 1.1135 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums