Jump to content

Codebox - Select Text


Z3R0

Recommended Posts


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

New Button Now Appends to EVERY codebox...

This button says [ Select Text ]

This button DOES NOT copy to clipboard, however, does instantly select all text within the codebox for you to be able to right click copy or CTRL + C

Thanks

Z3R0

Sample

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

erm..it didnt work for me...

maybe there is some restriction for certain Browser ?

it doesnt copied anything even though i tried click on "Select text" and then i press Ctrl + C

maybe it didnt work for Google Chrome ?

Edited by Emistry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  241
  • Reputation:   46
  • Joined:  11/08/11
  • Last Seen:  

someone put some css on it lol , goob z3ro

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

it's not working atm :) lol it was working 2 seconds ago though

Note: Apparently the forums cache weird crap...

and so does chrome

Wipe your cache... seems to fix the problem

Some CSS Applied

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  967
  • Reputation:   53
  • Joined:  11/13/11
  • Last Seen:  

erm..it didnt work for me...

maybe there is some restriction for certain Browser ?

it doesnt copied anything even though i tried click on "Select text" and then i press Ctrl + C

maybe it didnt work for Google Chrome ?

Works Fine with Google Chrome

maybe your keyboard is crappy~

>__<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   28
  • Joined:  11/08/11
  • Last Seen:  

It didn't work because of a bug in the global javascript files, but it has already been fixed.

The WYSIWYG and other AJAX/javascript not working was my fault (post=53142).

The javascript stuff should work again now.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  967
  • Reputation:   53
  • Joined:  11/13/11
  • Last Seen:  

is it still possible to insert a colored text inside codebox

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

 [color=#ff0000]test[/color]

Apparently not...

I will take a look at it currently, it's not the easiest engine to work through, since it literally goes through EVERY line by cursor position in order to parse correctly.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

@KeiKun: yes it's possible, we can change it in the ACP. Each BBCode has this option

Prevent other codes parsing?

- yes prevents parsing other BBCode within

- no WILL make it parse BBCode, and colors will work

But I think in

[/font], [font=courier new,courier,monospace][code][/font], [font=courier new,courier,monospace][sql][/font], [font=courier new,courier,monospace][php][/font], and all those other "code" tags, it should NOT parse more BBCode because
  1. isn't the point that you want to show code, right? not code with markup.
  2. the stuff in "code" tags will already be colored by prettyprint / prettify
  3. if you want to show code with markup, maybe you could use [quote] or

Edited by Brian
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  967
  • Reputation:   53
  • Joined:  11/13/11
  • Last Seen:  

@KeiKun: yes it's possible, we can change it in the ACP. Each BBCode has this option

Prevent other codes parsing? (yes prevents parsing other BBCode within, no will make colors work)

But I think in

[/font], [font=courier new,courier,monospace][code][/font], [font=courier new,courier,monospace][sql][/font], [font=courier new,courier,monospace][php][/font], and all those other "code" tags, it should NOT parse more BBCode because
  1. isn't the point that you want to show code, right? not code with markup.
  2. the stuff i "code" tags will be colored by prettyprint / prettify
  3. if you want to show code with markup, maybe you could use [quote] or

    i almost forgot

    I was looking for the code for [code]

    >__<

    so anyways

    instead of using [code] or [code] if want the code to have color ( like on the old Forum )

    i will use

    ( i don't use Quote for codes~ )

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   28
  • Joined:  11/08/11
  • Last Seen:  

On the other forums there were quite many people using bbcode in the codeboxes, e.g. to format any changes in the code.

Using quote tags instead of code tags is a bad idea, because no multiple whitespaces will be shown and you wont be able to read the code easily nor can copy it with the indents.

For the code-tag there could be added another tag that with bbcode parsing enabled, but for the codebox-tag it would require some edits in the php files to make actually a second codebox-like tag possible.

Edited by Toshiro
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

uh no it wouldn't be hard... the only reason codebox is currently PHP'ified, is because it includes the new button with javascript... else it's simply a matter of using BBCode Management to add a new code with the <pre class='prettify'>{content}</pre> attributes, and instead, mark it as codebox-tag and allow parsing of other codes... mine only runs through the validator, because it parses the button... Chances are, you are only going to be making MINOR edits with the color change... and thus, I would use "CODE" for that, and since we don't parse a button to code... simply create a NEW BBCode as Code-Tag copy the CODE BBCode Replacement Data and Allow Parsing of Other Codes Found Within...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

Can someone fixed an html code with the codebox ? (because it's ugly !)

Replace

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"></input>

With

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"/>

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  186
  • Reputation:   51
  • Joined:  11/14/11
  • Last Seen:  

Can someone fixed an html code with the codebox ? (because it's ugly !)

Replace

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"></input>

With

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"/>

Since the content-type says, this page is a HTML, not XHTML, page, this would lead IE <8 and many other old browser for misshandling the page.

HTML dosnt support self-colsing tags, event HTML5 dosnt (HTML5 re-implements optionaly end-.tags like HTML 3.2..).

So its nicly to see, agree, but not valid :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

so do I need to modify it or is it fine, I think I did the </input> by mistake, I normally don't ever put those lol

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

@GodLesZ

It's a HTML5 doctype:

<!DOCTYPE html>

HTML5 accept

<input ... >

and

<input ... />

so it's valid :)

Edit: weird html tag in the post...

Edited by KeyWorld
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

GodLesZ just tried to point out, that old browsers wont accept self-colsing tags (and all other HTML5 tags :)).

(Don't think evrybody is using a modern browser; many companies still use IE6...)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  186
  • Reputation:   51
  • Joined:  11/14/11
  • Last Seen:  

GodLesZ just tried to point out, that old browsers wont accept self-colsing tags (and all other HTML5 tags :)).

(Don't think evrybody is using a modern browser; many companies still use IE6...)

As for the HTML5 definition, KeyWorld is right. For some weired reasons my source view showed just a <!DOCTYPE> which isent valid.

As for the lamness of IE (my researches found only problems on IE <8, no other browser), Kenpachi points it out. <3

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  241
  • Reputation:   46
  • Joined:  11/08/11
  • Last Seen:  

Can someone fixed an html code with the codebox ? (because it's ugly !)

Replace

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"></input>

With

<input value="Select Text" onclick="selectCode(this); return false;" class="select_all_button" type="submit"/>

Since the content-type says, this page is a HTML, not XHTML, page, this would lead IE <8 and many other old browser for misshandling the page.

HTML dosnt support self-colsing tags, event HTML5 dosnt (HTML5 re-implements optionaly end-.tags like HTML 3.2..).

So its nicly to see, agree, but not valid :D

GodLesZ just tried to point out, that old browsers wont accept self-colsing tags (and all other HTML5 tags :)).

(Don't think evrybody is using a modern browser; many companies still use IE6...)

As KeyWorld said , browsers even IE7 accepts this quite well, :) it doesn't even understand the doctype but it still works :D

see the screenshot 2uyotw7.png

and believe me most IE users are from china ;), and I don't think anyone that knows eA is lazy ? enough to use an old outdated insecure browser ;)

and what about other browsers? IE supports it right? yes you know what I mean lol ;),

Just my opinion

Thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

I know I'm developing website for this companies :)

But here, we are on a board with a html5 doctype, and this board sux on IE; so why don't respect standards ? :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

I will make the modifications later today :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  186
  • Reputation:   51
  • Joined:  11/14/11
  • Last Seen:  

I don't want to be opinionated, but just for example, see this jQuery bug: jQuery bug ticket #4622.

Self-closing tag's arent a problem directly, but after coming together with a bunch of DOM content, IE may fail sometimes.

I know that from personal experience. :)

Btw, sorry for the off topic. I just wanted to mention it again, since many web developers are traveling around here too.

As for the codebox feature, good job :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

@admins

Sorry if us posts are considerate like troll or something like this, it's not us intention.

@GodLesZ

You can't compare input with div. The only tags elements that can be self closing in standard are:

<base />
<basefont />
<frame />
<link />
<meta />
<area />
<br />
<col />
<hr />
<img />
<input />
<param />
and maybe others

You can't compare them to "div" that contain inner text (all specify before never contain inner text).

And you have also to know that the doctype here force IE to run the page in strict mode since it don't know the html5 doctype (and the bug isn't related to strict mode on your post - but maybe it bug in strict mode too :)).

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  128
  • Reputation:   4
  • Joined:  11/14/11
  • Last Seen:  

Instead of arguing standards and non-standards why don't WE,YOU (in general) grab a code so we can fix the copy to clipboard/select text button.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

It select perfectly in my computer, no problem.

What's your problem ? Having an error ? What browser do you use ? Do you refresh your cache ?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...