Welcome to Geeklog Saturday, August 24 2019 @ 07:56 am EDT

Geeklog Forums

\ madness


Status: offline

dreness

Forum User
Newbie
Registered: 06/08/03
Posts: 11
I'm going a little insane. Here's why:

Every time I want to modify a story that's in html mode, and that story contains literal greater than / less than symbols, or back slashes (which happens quite often, since I paste a lot of code), I have to pick through the entire story and add the proper html codes, e.g. & g t ; or & # 9 2 ; (spaces added to prevent the codes from actually rendering like they're supposed to). *Every time* I edit the story, I have to re-insert these codes in their proper place.

Is there any way around this, other than using an external editor and using a script to prepare the output for geeklog?

Me too

Anonymous
I've already reported this behavior in an old post, but the main reply to which was basically "that's life".

But if I choose your method, then when I edit the story, &# 9 2 is still that! I don't have to write it again! So at least I should work only once.

Alas, I have decided to pick up the glove and do just what you suggested. So yes, I have a working javascript that takes a given text and turns EVERY:
1) bigger than
2) smaller than
3) back slash
into its html escape codes (i.e. &# "something&quotWink.

Do you want the script?

BTW, it does it live. What I mean is, it has 2 windows and the second one is updated at real time as you're writing in the first one (the first one is where you write fluently while the second one is the one which text you end up coping and pasting to Geeklog).

Also, I've added this to style.css so I can use code boxes:
.code {
font-size: 80%; color: #006600;
background-color: #FAFAFA; border: #D1D7DC; border-style: solid;
border-left-width: 1; border-top-width: 1; border-right-width: 1; border-bottom-width: 1
}

Me too

Anonymous
Oh, I forgot to mention 2 more things:
1) Unfortunately, font-size: 80% (or any other percent or fixed number, for that matter) seems to have no effect whatsoever!

2) In html mode, you can't use the "pre" tab because it doesn't wrap up lines, and there is no other tab in the world that will save you from using endless "p"s and "br"s.
That's why I've added to my javascript the following feature:
auto br!
That's right, everytime you press in the original textbox, the second one will begin the next line with "br" in it automatically!

So all in all, my script kills 2 birds with one stone (html esacpe codes AND auto brs).

Me too

Anonymous
(Someone please delete my earlier post because it contained some mistakes)

Oh, I forgot to mention 2 more things:
1) Unfortunately, font-size: 80% (or any other percent or fixed number, for that matter) seems to have no effect whatsoever!

2) In html mode, you can't use the "pre" tab because it doesn't wrap up lines, and there is no other tab in the world that will save you from using endless "p"s and "br"s.
That's why I've added to my javascript the following feature:
Auto BRs!
That's right, everytime you press ENTER in the original textbox, the second one will begin the next line with "br" in it automatically!

So all in all, my script kills 2 birds with one stone (html esacpe codes AND auto BRs).

Status: offline

dreness

Forum User
Newbie
Registered: 06/08/03
Posts: 11
Quote by Me too: So all in all, my script kills 2 birds with one stone (html esacpe codes AND auto BRs).


Yeah I'd love a copy of the script. If you're willing, I suggest pasting it to this forum as I suspect it might be useful to others as well. Also please include basic directions, as I've never really done much with javascript. Is this essentially a modification made to geeklog, or something that's run as a local script?

Thanks!

(also, if you register, I believe you can delete your own posts, plus you can be notified of replies to your own posts)

-Andre

LWC

Anonymous
It's a totally local script that is not Geeklog based or anything.
It just takes the text from the first window and outputs it live on the second window with said changes.

And yea, of course I know that reg'ing would do do that, but you know...

So here it is.

And note that yes, it was posted in HTML mode!




onfocus="clearsearch(this.form.source)" onblur="unclearsearch(this.form.source)">
Write Your Code Here




Converted Escape Codes Will Appear Here


LWC

Anonymous
Sorry, it worked in the preview. The forum works differently than the blog.

I'll upload it to soon and tell you when.

Or maybe you can convince the powers that be to let me upload it to their download section.

LWC

Anonymous
Alright, it looks like the "everyone" in "everyone wants it" is basically you (at least in this forum), but nonetheless, it's on my site now as promised (link in previous post).

Please tell me what you think.

dreness

Anonymous
Quote by LWC: Alright, it looks like the "everyone" in "everyone wants it" is basically you (at least in this forum), but nonetheless, it's on my site now as promised (link in previous post).

Please tell me what you think.


I have a problem getting it to work, and I left a message on your site. Once we get it ironed out into a nice drop-in solution, I will petition dirk to post it in a permanent area

LWC

Anonymous
Oops...

As I said back there, how can I tell Geeklog what chars to replace without using the chars...? ;-)
We should name it The Geeklog Paradox.

I guess (if you saw the other post) I'll finally have to install file management and upload it as a file, which Geeklog can't interfere with...

It just seems like a lot of work (for a supposedly auto installed plug in).

LWC

Anonymous
Alright, I have it for regular download now, for anyone who's interested.

Status: offline

Blaine

Forum User
Full Member
Registered: 16/07/02
Posts: 1233
Location:Canada
Have you tried posting using the code tags?

The forum has the bb style code tag support and stories and comments have support for this as well.

This is the function in lib-common - notice how all the HTML is preserved in this post.
PHP Formatted Code

function COM_handleCode( $str )
{
    $str = str_replace( '\', '\', $str );
    $str = str_replace( '
<', '<', $str );
    $str = str_replace( '
>', '>', $str );

    return( $str );
}



Geeklog components by PortalParts -- www.portalparts.com

LWC

Anonymous
Not really. You've just ruined the code like I have...

It shouldn't be $str = str_replace( '', '', $str );
But
str = replace(str, "
(the "and" and "lt" should be without space, of course)

LWC

Anonymous
Ok, one more attempt..............

PHP Formatted Code

It shouldn't be str = str_replace( '', '', $str );
But
str = replace(str, "<", "& lt;")
(the "and" and "lt" should be without space, of course)


LWC

Anonymous
Ok, I give up...

But in any case, if you think this is hard, it's 100000000 times harder in regular stories and that's why I've made the javascript.

That way, it does it for me. In any case, it works and I'm happy (at least until Geeklog implements something like that javascript that does it automatically...).

All times are EDT. The time is now 07:56 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content