Jump to content

Add Content Copy on Codebox  

12 members have voted

You do not have permission to vote in this poll, or see the poll results. Please sign in or register to vote in this poll.

Recommended Posts

Posted (edited)

erm..i got some little suggestion for the CODE / Quote Wrap features...

hope you can consider this also in the future after you have done the rest important stuffs in Forum ^^

since from the past eA ( eAthena.ws ) there are alot users ( Include me ) alway posting the Script in CODE / CODEBOX Wrapping

So, i was wondering could the Forum install a "Select All" Features ? which work to Copy all the Content inside a CODE / CODEBOX ?

Here is a Picture so that i hope you all can understand what i am saying since my language is kinda poor..>.<

The Select Button is used for Users to click on it and then all the Content in the CODEBOX will be copied just like what we do usually ( Highligh All and Copy ) but now it come to a more easier way...

Edited by Emistry
Posted

agreed, Brian and I can look into it, if it doesn't exist as an add-on feature, we can probably code one ourselves... chances are, it's just a bit of javascript :)

Posted

I would call it "Auto Copy" or "Copy to Clipboard" since that's what it's obviously going to do when you click it

Posted

Yes..this features work just like what Z3R0 has mentioned....

all the content inside the CODEBOX / CODE will be Copied upon we click on the "Select"

*and sorry for those other who didnt fully get my idea due to my poor explaination*

Posted

I'm currently in the process of attempting to create the code... apparently it does not like javascript very much but I am almost there I think

Posted

I have given the code to Brian for "Select All" the reason being is that "copy" apparently is a lot harder than it looks...

Many people resort to using "Flash" which I do not want to do... I'll have to look into a library feature that may enable this... the ckeditor has it, but I have no earthly idea how to depict it's clipboard usage... I've tried :)

Posted

Yeah there is no clipboard stuff in javascript yet, you can select the text, but can't copy it.

I know you can do it on IE and maybe on firefox/netscape with some privileges but that's all.

There is a new HTML5 feature in progress to work with but it seems to be oncopy/onpaste/oncut event, nothing to setting data.

The only cross-browser way as far I know is to use a plugin : flash or java or silverlight...

Posted

ya, I'm looking into integrating zeroclipboard into my own local version... apparently Brian attempted to install the information in the files and failed... lol

Posted

a little bit of both, jquery and pure js

I'm talking with JGuy right now, about getting ftp access to fix the files that brian accidently messed up lol

Posted

selectCode function isn't defined (missing included javascript file ?)

You can try with this for moment:

function selectCode(btn) { //Don't know why btn send (this) in arg ?
   var code = btn.parentNode.lastChild, range, selection;   
   if (document.body.createTextRange) {
       range = document.body.createTextRange();
       range.moveToElementText(code);
       range.select();
   } else if (window.getSelection) {
       selection = window.getSelection();
       if (selection.setBaseAndExtent) {
           selection.setBaseAndExtent(code, 0, code, 1);
       } else {
           range = document.createRange();
           range.selectNodeContents(code);
           selection.removeAllRanges();
           selection.addRange(range);
       }
   }
}

Posted (edited)

I'd like to add this up if ever this has been made via javascript or w.e. not .swf. :) Darn, cant paste the html. Just CSS.

Just to be suitable for this forum's theme.

Preview:

35ivorq.png





.button{ cursor: pointer; text-decoration: none; box-shadow:inset 0 1px 0 #528cbc; font: normal 11px/16px "lucida grande",tahoma,verdana,arial,sans-serif; color: #ffffff; font-weight: bold; border: 1px solid #316897; text-align: center;  background: #416d9b; width: 120px; height: 28px; -moz-border-radius: 10px;-webkit-border-radius: 2px;border-radius: 2px;-khtml-border-radius: 2px;}
.button:active { background:#2d5885;}





Edited by simplynice
Posted

[...]

You can try with this for moment[...]

Confirmed, worked for me also in some private projects long time ago.It's a nice cross-browser solution for selecting the text in the node.

Posted (edited)

There's still one problem (that has also been on the other forums) once the select-all button works. The forum automatically converts tabs to spaces, so if you'd post an eA script (or anything else that relies on tabs), you still had to adjust the file to make it valid.

This is (at least in the new forum versions) caused by the PrettyPrint javascript function the board uses.

To remove the functionality that tabs are converted, the following piece needs to be removed from the http://eathena.sourc...ify/prettify.js file.

http://toshiro.skylinero.net/eatab.txt (code piece linked, because.. well the tab would have been removed)

Also right now there's a piece (lines 83, 92, 4251, 4260) of javascript that breaks the complete functionality of the javascript components of the board.http://eathena.sourc...ublic/js/ipb.js:

s.addRange®;

That's probably also the reason why the select-all-button is not working yet.

Edited by Toshiro
Posted

I will take a look at preserving tabs... didn't realize it did that... (select text) works though

Posted

Thanks Toshiro, I removed the line so tabs aren't converted to spaces.

Should be updated in about 5 mins (because that's how long Varnish caches for).

Posted

Awesome! If anyone can make a nice button bg image or something for the button, I can get that modified :)

 current 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...