Simple Quotes

2

Hello, I made a simple quote script, that helps to quote text parts of pages and comments by selecting this text and pressing Ctrl+Q.


Here you can see the video demonstration of this script. If you want, I can share it.



Comments

  1. With absolute path for sub pages

    js/default.js
    JAVASCRIPT
    function all_init () // initialization everything
    {
    	if (wikiedit)
    		we_init(wikiedit);
    	if (dbclick)
    		dclick(dbclick);
    	init_travel();
    	crit_init();
    	quote_init();
    }
    
    function quote_init()
    {
    	document.onkeydown = function(e)
    	{
    		if (!e) e = window.event;
    		if (e.keyCode == 81 && e.ctrlKey)
    		{
    			var txt = '';
    			if (txt = window.getSelection) {
    				var node = window.getSelection().anchorNode.parentNode.parentNode;
    				if (node.className == "page")
    				{
    					txt = "# ";
    				}
    				else if (node.className == "comment")
    				{
    					txt = "((/" + node.id + " # )) ";
    				}
    				else
    				{
    					return;
    				}
    				txt += window.getSelection().toString();
    			}
    			else
    			{
    				txt = document.selection.createRange().text;
    			}
    			if (txt)
    			{
    				textarea = document.getElementById("addcomment");
    				br = "";
    				if (textarea.value != "")
    				{
    					br = "\r\n\r\n";
    				}
    				document.getElementById("addcomment").value += br + "<[" + txt + "]> \r\n";
    			}
    		}
    	}
    }
    
    • WikiAdmin
    • 11/12/2011 18:43 edited
  2. Comment 244

    yes, but this code is quite bad and works not correctly in IE. i'm working on it this time and publish my code soon
    • MrBell
    • 11/20/2011 19:47 edited
Log in or create an account to post a comment.