Advertise Here

Author Topic: [help] Need help with Reason for edit and source code  (Read 2566 times)

0 Members and 1 Guest are viewing this topic.

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
[help] Need help with Reason for edit and source code
« on: April 19, 2009, 01:56:49 pm »
Ok so I took the Reason for Edit code and modified it to make a "Source" code so if I got the information in the post from somewhere I could put the link in the text box.

But the problem is I can't get the Reason for Edit AND the Source code to work at the same time. It always changes back to the Reason for Edit code. I want these two codes to work AT THE SAME TIME. Can some one help me do this?

Reason for Edit
Code: [Select]
<script type="text/javascript">
if(document.forms.postmodify){
var o = document.forms.postmodify;
o.message.parentNode.innerHTML += '<br /><span id="makenew"><b>Reason for Edit:</b> <input id="reasonForEdit" type="text" size="40" value=""></span>';
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
readd = '[i][size=1]' + RegExp.$1 + '[/size][/i]';
document.getElementById("makenew").innerHTML="There is currently a recent reason for edit. <input type='button' value='Create New Reason?' onclick='makeNew();'>";
}
o.onsubmit=function(){
var theVal = o.message.value;
var editInfo = document.getElementById('reasonForEdit').value;
if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value = theVal + '\n\n[color=red][i][size=1]Reason for Edit: ' + editInfo + '[/size][/i][/color]';
}
else{
o.message.value = theVal + readd;
}
}
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value=o.message.value.split("[i][size=1]"+RegExp.$1+"[/size][/i]").join("");
}
}
function makeNew(){
document.getElementById("makenew").innerHTML='<b>Reason for Edit:</b> <input id="reasonForEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Reason?" onclick="keepIt()">';
}
function keepIt(){
document.getElementById("makenew").innerHTML="There is currently a recent reason for edit. <input type='button' value='Create New Reason?' onclick='makeNew();'>";
}
</script>

Source code
Code: [Select]
<script type="text/javascript">
if(document.forms.postmodify){
var o = document.forms.postmodify;
o.message.parentNode.innerHTML += '<br /><span id="makenew"><b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""></span>';
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
readd = '[i][size=1]' + RegExp.$1 + '[/size][/i]';
document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew();'>";
}
o.onsubmit=function(){
var theVal = o.message.value;
var editInfo = document.getElementById('sourceEdit').value;
if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value = theVal + '\n\n[color=red][i][size=1]Source: ' + editInfo + '[/size][/i][/color]';
}
else{
o.message.value = theVal + readd;
}
}
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value=o.message.value.split("[i][size=1]"+RegExp.$1+"[/size][/i]").join("");
}
}
function makeNew(){
document.getElementById("makenew").innerHTML='<b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Source?" onclick="keepIt()">';
}
function keepIt(){
document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew();'>";
}
</script>

Both go in the Footers
<--- Donate to SMF For Free! :D

Offline мσנσвσנσ82

  • SMF For Free Sr. Member
  • *
  • Posts: 310
    • View Profile
    • Darkilscape

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [help] Need help with Reason for edit and source code
« Reply #1 on: April 19, 2009, 04:55:25 pm »
so this code isn't working and you need somebody to fix it?



Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [help] Need help with Reason for edit and source code
« Reply #2 on: April 19, 2009, 05:19:26 pm »
The codes work... just not at the same time. If I use both, only the Reason for Edit works. But without it, it works fine!
<--- Donate to SMF For Free! :D

Offline мσנσвσנσ82

  • SMF For Free Sr. Member
  • *
  • Posts: 310
    • View Profile
    • Darkilscape

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [help] Need help with Reason for edit and source code
« Reply #3 on: April 19, 2009, 06:28:06 pm »
:O. I'll make a test forum and try it out just to see wht needs to be fixed



Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [help] Need help with Reason for edit and source code
« Reply #4 on: April 22, 2009, 09:59:57 am »
Still need help ;)

They both work. Just not at the same time.
<--- Donate to SMF For Free! :D

Offline Andrew

  • Helpers
  • *
  • Posts: 2060
  • Andrew at your service
    • View Profile
    • Alabama Weather Prediction

  • Total Badges: 32
    Badges: (View All)
    10 Poll Votes Level 6 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary
Re: [help] Need help with Reason for edit and source code
« Reply #5 on: April 24, 2009, 06:46:21 pm »
I see your problem....I think...

Quote
<script type="text/javascript">
if(document.forms.postmodify){
   var o = document.forms.postmodify;
   o.message.parentNode.innerHTML += '<br /><span id="makenew"><b>Reason for Edit:</b> <input id="reasonForEdit" type="text" size="40" value=""></span>';
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      readd = '' + RegExp.$1 + '';
      document.getElementById("makenew").innerHTML="There is currently a recent reason for edit. <input type='button' value='Create New Reason?' onclick='makeNew();'>";
   }
   o.onsubmit=function(){
      var theVal = o.message.value;
      var editInfo = document.getElementById('reasonForEdit').value;
      if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
         o.message.value = theVal + '\n\nReason for Edit: ' + editInfo + '';
      }
      else{
         o.message.value = theVal + readd;
      }
   }
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      o.message.value=o.message.value.split(""+RegExp.$1+"").join("");
   }
}
function makeNew(){
   document.getElementById("makenew").innerHTML='<b>Reason for Edit:</b> <input id="reasonForEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Reason?" onclick="keepIt()">';
}
function keepIt(){
   document.getElementById("makenew").innerHTML="There is currently a recent reason for edit. <input type='button' value='Create New Reason?' onclick='makeNew();'>";
}
</script>

Quote
<script type="text/javascript">
if(document.forms.postmodify){
   var o = document.forms.postmodify;
   o.message.parentNode.innerHTML += '<br /><span id="makenew"><b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""></span>';
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      readd = '' + RegExp.$1 + '';
      document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew();'>";
   }
   o.onsubmit=function(){
      var theVal = o.message.value;
      var editInfo = document.getElementById('sourceEdit').value;
      if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
         o.message.value = theVal + '\n\nSource: ' + editInfo + '';
      }
      else{
         o.message.value = theVal + readd;
      }
   }
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      o.message.value=o.message.value.split(""+RegExp.$1+"").join("");
   }
}
function makeNew(){
   document.getElementById("makenew").innerHTML='<b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Source?" onclick="keepIt()">';
}
function keepIt(){
   document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew();'>";
}
</script>
Try changing what is in red on the 2nd one to source info

Ill go try both of these out on my test forum and see what they do



Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [help] Need help with Reason for edit and source code
« Reply #6 on: April 24, 2009, 07:45:54 pm »
Ahh i see... looked over that.

Ya i tried everything i could think of  :P

lol.. thanks
<--- Donate to SMF For Free! :D

Offline Celebrus

  • SMF For Free Hero
  • *
  • Posts: 941
    • View Profile
    • Vikhyat Korrapati

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [help] Need help with Reason for edit and source code
« Reply #7 on: April 25, 2009, 08:08:12 am »
I think the problem is that both codes have 2 functions that use the same name.

Try this for the source one:
Code: [Select]
<script type="text/javascript">
if(document.forms.postmodify){
   var o = document.forms.postmodify;
   o.message.parentNode.innerHTML += '<br /><span id="smakenew"><b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""></span>';
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      readd = '' + RegExp.$1 + '';
      document.getElementById("smakenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='sMakeNew();'>";
   }
   o.onsubmit=function(){
      var theVal = o.message.value;
      var editInfo = document.getElementById('sourceEdit').value;
      if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
         o.message.value = theVal + '\n\nSource: ' + editInfo + '';
      }
      else{
         o.message.value = theVal + readd;
      }
   }
   if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
      o.message.value=o.message.value.split(""+RegExp.$1+"").join("");
   }
}
function sMakeNew(){
   document.getElementById("smakenew").innerHTML='<b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Source?" onclick="sKeepIt()">';
}
function sKeepIt(){
   document.getElementById("smakenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='sMakeNew();'>";
}
</script>

Not sure whether or not it will work but it's probably worth a try.

Offline Seldom Fail

  • Helpers
  • *
  • Posts: 2082
  • Helping for 3 years! :)
    • View Profile
    • My Site!

  • Total Badges: 26
    Badges: (View All)
    Sixth year Anniversary Fifth year Anniversary Apple User Search Poll Voter
Re: [help] Need help with Reason for edit and source code
« Reply #8 on: April 28, 2009, 08:26:28 pm »
Still not working  :-\
<--- Donate to SMF For Free! :D

Offline Andrew

  • Helpers
  • *
  • Posts: 2060
  • Andrew at your service
    • View Profile
    • Alabama Weather Prediction

  • Total Badges: 32
    Badges: (View All)
    10 Poll Votes Level 6 Eighth year Anniversary Seventh year Anniversary Sixth year Anniversary
Re: [help] Need help with Reason for edit and source code
« Reply #9 on: May 10, 2009, 04:22:14 pm »
Here Jaron I have tried re-writing the Source code by changing all the functions

Try this one for the source code:
Only use this one if you are using them both together

Code: [Select]
<script type="text/javascript">
if(document.forms.postmodify){
var o = document.forms.postmodify;
o.message.parentNode.innerHTML += '<br /><span id="makenew"><b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""></span>';
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
readd = '[i][size=1]' + RegExp.$1 + '[/size][/i]';
document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew2();'>";
}
o.onsubmit=function2(){
var theVal = o.message.value;
var editInfo = document.getElementById('sourceEdit').value;
if(editInfo != "" && !theVal.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value = theVal + '\n\n[color=red][i][size=1]Source: ' + sourceInfo + '[/size][/i][/color]';
}
else{
o.message.value = theVal + readd;
}
}
if(o.message.value.match(/\[i\]\[size=1\](.*)\[\/size\]\[\/i\]/i)){
o.message.value=o.message.value.split("[i][size=1]"+RegExp.$1+"[/size][/i]").join("");
}
}
function makeNew2(){
document.getElementById2("makenew").innerHTML='<b>Source:</b> <input id="sourceEdit" type="text" size="40" value=""> <input type="button" value="Keep Current Source?" onclick="keepIt2()">';
}
function keepIt2(){
document.getElementById("makenew").innerHTML="There is currently a recent source for post. <input type='button' value='Create New Source?' onclick='makeNew2();'>";
}
</script>

 

Related Topics

  Subject / Started by Replies Last post
20 Replies
5684 Views
Last post January 09, 2009, 09:44:08 pm
by Andrew
11 Replies
4471 Views
Last post February 01, 2009, 12:36:15 pm
by Andrew
1 Replies
1291 Views
Last post April 24, 2009, 06:42:29 pm
by Andrew
28 Replies
11752 Views
Last post August 02, 2010, 06:52:50 pm
by The Fate
1 Replies
979 Views
Last post July 11, 2009, 08:00:31 pm
by simply sibyl