Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 19:42

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 1 post ] 
Author Message
PostPosted: 04 Feb 2012, 12:58 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Undo/Redo Buttons for Postbox

This Snippet adds an Undo/Redo Button to Postbox

Author: 4seven

Credit: Turnea Iulian for base script

Demo: posting.php?mode=post&f=2 (un: test / pw: testuser)

Instruction

open

styles/prosilver/template/posting_buttons.html

find

Code:
// ]]>
</script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/editor.js"></script>

before add

Code:
    /* 
    Undo/Redo Buttons for Postbox / 4seven / 2012
    Credit: Turnea Iulian :: http://www.eurografic.ro 
    */
    function iObject() {
      this.i;
      return this;
    }

    var myObject=new iObject();
    myObject.i=0;
    var myObject2=new iObject();
    myObject2.i=0;
    store_text=new Array();

    store_text[0]="";

    function countclik(tag) {
      myObject.i++;
      var y=myObject.i;
      var x=tag.value;
      store_text[y]=x;
    }

    function undo(tag) {
      if ((myObject2.i)<(myObject.i)) {
        myObject2.i++;
      } else {
        alert("Finish Undo Action");
      }
      var z=store_text.length;
      z=z-myObject2.i;
      if (store_text[z]) {
          tag.value=store_text[z];
      } else {
          tag.value=store_text[0];
      }
    }

    function redo(tag) {
      if((myObject2.i)>1) {
        myObject2.i--;
      } else {
        alert("Finish Redo Action");
      }
      var z=store_text.length;
      z=z-myObject2.i;
      if (store_text[z]) {
        tag.value=store_text[z];
      } else {
      tag.value=store_text[0];
      }
    }    
    
/* 
    Undo/Redo Buttons for Postbox / 4seven / 2012
    Credit: Turnea Iulian :: http://www.eurografic.ro 
    */ 

find

Code:
<div id="format-buttons">

after add

Code:
    <input type="button"  class="button2" value="Undo" onmousedown="undo(document.postform.message);">
    <input type="button" class="button2" value="Redo" onmousedown="redo(document.postform.message);">

open

styles/prosilver/template/posting_layout.html

find

Code:
<form id="postform"

replace with

Code:
<form name="postform" id="postform"

Clear all Board-, Template-, Style- and Browser-Caches..

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.027s | 22 Queries | GZIP : Off ]