Sign up | Lost password? | Help

[ advanced search ]

[UserJs] Code/Formatting Tools in Quick-Reply

Forums » Opera Community » General Opera topics » User JavaScript


Go to last post

Thursday, 12. April 2007, 22:27:02

AyushJ

avatar

Posts: 4754

[UserJs] Code/Formatting Tools in Quick-Reply

A little userjs that adds formatting tools (b,i,u,list,url,sub,font,color etc...) in quickreply. See <> screenshots.

Script also supports keyboard shortcuts. Press [Ctrl] key dont hold it down then press the shortcut key.
Example: to activate Bold(B), press Ctrl then press B

There is also a Reselect text feature. If you dont like that, open the script and set AutoReSelect to 0.

Download: Code Tools in Quick Reply :yes:

note: the smilies button isn't working yet ... :frown:


:cheers:

Friday, 13. April 2007, 00:16:39

xErath

avatar

javascript guru

Posts: 6399

Norway

Opera Software

ah ! p:
hey. Can you edit it a bit, for it to integrate with my quick-edit script ?
Like placing a function that will patch a textarea, in window.opera
http://my.opera.com/community/forums/findpost.pl?id=1945901
Then I'll edit mine :yes:

Friday, 13. April 2007, 03:03:13

AyushJ

avatar

Posts: 4754

Originally posted by xErath:

Can you edit it a bit, for it to integrate with my quick-edit script ?


Done!

Friday, 13. April 2007, 09:50:57

Zalex108

avatar

Posts: 955

Spain

Thx Guys!!
Great Scripts! :up:

Fos Spanish Forums, we have to add one more line, changing "community" by "espanol", now works well! :yes:
When the Smiles will fix!¿? :D :D

Friday, 13. April 2007, 10:30:09

Zalex108

avatar

Posts: 955

Spain

Well,
now there is another user that no needs to make this change... maybe it just in my case...

Friday, 13. April 2007, 17:52:44

xErath

avatar

javascript guru

Posts: 6399

Norway

Opera Software

Originally posted by AyushJ:

Done!


I'll look at it sunday or monday :wink:

Saturday, 14. April 2007, 02:09:01 (edited)

AyushJ

avatar

Posts: 4754

Download v1.1: Code tools/buttons in QuickReply


Smilies !
More Sizes,Fonts and Colors in the list.


:cheers:

Saturday, 14. April 2007, 02:31:43

nabucco

avatar

Canarias (Africa)

Posts: 1531

Wonderfull! Macanudo!

Saturday, 14. April 2007, 02:57:48 (edited)

Zalex108

avatar

Posts: 955

Spain

Jajajaja!!
Really faster!!
Thx! :wink:


PD: Wow!! Thanks for fixing about the spanish & all forums! :wink:

Saturday, 14. April 2007, 21:21:01

d.i.z.

avatar

bug hunter

Posts: 2934

Poland

Awesome!
Was missing such thing.

Monday, 16. April 2007, 22:50:35

xErath

avatar

javascript guru

Posts: 6399

Norway

Opera Software

Ok. It's done.
Check my quick-edit script,
http://my.opera.com/community/forums/topic.dml?id=172834&t=1176763697&page=3#comment1945901
but before AyushJ you need to do some changes.
Compare with this version.
myopera-community-format-quickreply.js

Tuesday, 17. April 2007, 02:57:06 (edited)

AyushJ

avatar

Posts: 4754

Download v1.2: Code buttons in QuickReply/ Comments/ PM Reply/ Quick Edit


----------------------------------------------------------------


Originally posted by xErath:

Compare with this version.myopera-community-format-quickreply.js


why this :
from- createElement("div")
  to- createElement("t_div")
 !important   on all styles ??

from- tDiv.style.width=TxtArea.offsetWidth+"px"
  to- width:100%!important

^^i dont think this is better because then the toolbar can be larger than textarea(if the container's width is bigger than txtarea) and it will not look good but i fixed this for your script..


"div.fpost "+t1+">img {width:22px!important;height:22px!important;margin-right:0!important}"+

why dont you just pass the extra styles in 3rd argument like:
AddCodeTools(xx,xx,{Styles:"div.fpost ...."})


btw.. nice suggestion of preloading images
new Image().src = base+curr;

but you script will not preload the images because the function will get called AFTER you click on smilies button...


----------------------------------------------------------------


Download v1.2: Code buttons in QuickReply/ Comments/ PM Reply/ Quick Edit

Tuesday, 17. April 2007, 07:40:41

xErath

avatar

javascript guru

Posts: 6399

Norway

Opera Software

Originally posted by AyushJ:

^^i dont think this is better because then the toolbar can be larger than textarea(if the container's width is bigger than txtarea) and it will not look good but i fixed this for your script..


Because I was having trouble with the forums stylesheet. IF you can use div and keep the toolbar displaying ok, then good :smile:

Originally posted by AyushJ:

why dont you just pass the extra styles in 3rd argument like:AddCodeTools(xx,xx,{Styles:"div.fpost ...."})

because you lacked documentation p:

Originally posted by AyushJ:

but you script will not preload the images because the function will get called AFTER you click on smilies button...

:right: thanks for noticing.


I addded the function to the window.opera object and used a wrapper function to prevent global scope symbol polution, which is a good policy when writing scripts.

Tuesday, 17. April 2007, 08:29:49 (edited)

GeekK

avatar

14° 29' E

Posts: 627

Netherlands

:eek: Nice! :up:

Hm, one thing: it doesn't align with the comments-box on eg. desktop blog (bottom).

Tuesday, 17. April 2007, 08:20:10

AyushJ

avatar

Posts: 4754

Originally posted by xErath:

and used a wrapper function to prevent global scope symbol polution



i didn't use the wrapper function (function(){ .. })() because there are no variabled/named functions defined outside the AddCodeTools function(which is now in window.opera object).

Wednesday, 18. April 2007, 01:53:26

AyushJ

avatar

Posts: 4754

Originally posted by GeekK:

Hm, one thing: it doesn't align with the comments-box on eg. desktop blog (bottom).




Try v1.2.1. Now the script uses data: URls instead of loading the images from my.opera.com :D .

Download v1.2.1

Wednesday, 18. April 2007, 13:05:48

fearphage

avatar

Trained Swordsman of Unwanted Opera Termination

Posts: 1996

USA

Nice work. One more thing that could be converted to data uri is the bg image:
t1+"{ border-top:1px solid #A8A8A8;background : #DADADA url(/community/graphics/blogform/bg.gif) repeat-x scroll left top } " +


@AyushJ: any reason you don't put direct links to the files? Why http://snipurl.com/QuickReply_Tools instead of http://files.myopera.com/AyushJ/scripts/Format%20tools%20for%20QuickReply.js ? Just curious.

Wednesday, 18. April 2007, 13:39:03 (edited)

AyushJ

avatar

Posts: 4754

Originally posted by fearphage:

One more thing that could be converted to data uri is the bg image


The size of image is only 283 bytes ..

Originally posted by fearphage:

any reason you don't put direct links to the files?


Yes. I can then 1)Change the name/location of file(target) and check the number of hits on the link. :D

Wednesday, 18. April 2007, 16:12:00

fearphage

avatar

Trained Swordsman of Unwanted Opera Termination

Posts: 1996

USA

Originally posted by AyushJ:

The size of image is only 283 bytes

It does take time to make the request and received the reply but I'll fix it in mine. Thanks again.

Thursday, 19. April 2007, 01:53:31

AyushJ

avatar

Posts: 4754

Originally posted by fearphage:

It does take time to make the request and received the reply



OK.Done- Now the script uses data: url for bgimage if UseDataURLs is 1.

Saturday, 21. April 2007, 01:34:40 (edited)

fearphage

avatar

Trained Swordsman of Unwanted Opera Termination

Posts: 1996

USA

I found a couple of typos that pollute the error console, but nothing major. I don't know the line numbers because the code has been altered.

  • Message: Unexpected end of file
    Error: missing '}' to close the style tag
    Where: Near the end, in the last 5-6 lines
    div.OperaEditTools{width: '+BlogComm.offsetWidth+'px;'}
    changed to
    div.OperaEditTools{width: '+BlogComm.offsetWidth+'px;}'}


  • Message: Invalid value for property: color
    Error: assigning the word 'color' to an element's style.color
    Fix: Make it skip the first iteration
    Where: In the loop where font elements are created
    Font = {COLOR:['COLOR','black','sky blue',...]}
    
    for (var iX in Font) {
      ...
      for (var iXX = 0, curr=Font[iX], cOpt; iXX < curr.length; iXX++) {
        ...
        if(coloring)cOpt.style.color = curr[iXX].replace(/\W/,'');
    changed to
    if(coloring && iXX)cOpt.style.color = curr[iXX].replace(/\W/,'');

Saturday, 21. April 2007, 01:38:53

AyushJ

avatar

Posts: 4754

Originally posted by fearphage:

I found a couple of typos that pollute the error console


:irked: The error console is always buggy for me..e.g. If i use Clear button and reopen the Error console, all errors reappear and it never shows errors of my.opera.com pages !!! If i create a simple userjs :
var ff=gg

then the error console doesn't show this error in my.opera.com pages but if i load e.g google.com then i can see the error:
JavaScript - http://www.google.com/
User Javascript thread
Error:
name: ReferenceError
message: Statement on line 8: Reference to undefined variable: gg
Backtrace:
  Line 8 of User JS script 
    var ff = gg;




anyway, thanks for reporting the errors !

Saturday, 21. April 2007, 05:06:07

GT500

avatar

Security Industry

Posts: 3450

Fighting Malware

Nice script.

I don't normally use the formatting toolbar, but it's nice to have it there in case I want it.

BTW: Spaces in the file name are not necessarily a good thing. Granted it isn't a big issue, because the file name can be easily edited with underscores instead of spaces when saving the script, but it's at least something to consider. :wink:

Saturday, 21. April 2007, 07:33:20

d.i.z.

avatar

bug hunter

Posts: 2934

Poland

Originally posted by AyushJ:

it never shows errors of my.opera.com pages


Remove my.opera and preferably all others from here opera:config#UserPrefs|ErrorConsoleFilter.

Saturday, 21. April 2007, 19:46:13 (edited)

AyushJ

avatar

Posts: 4754

Originally posted by d.i.z.:

Remove my.opera and preferably all others from here opera:config#UserPrefs|ErrorConsoleFilter.


:yes: :yes: Now i can see the errors :hat: Thanks :up:

Spaces in the file name are not necessarily a good thing.

:rolleyes: I will update the name in the next version (if i made one).



just noticed that this topic is currently #1 in [Most spotlighted topics] :hat: .

Saturday, 21. April 2007, 14:13:15

fearphage

avatar

Trained Swordsman of Unwanted Opera Termination

Posts: 1996

USA

another thing, you didn't update the scripts internal version number.

Monday, 7. May 2007, 17:26:29

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

Just one thing: :D
after having opened the smileys and closing them again, the toolbar is left this way, namely with the three drop-down selectors now moved downwards on a separate line... :frown:

See image here:
Quick Reply After Smileys Closed Again.png

Monday, 7. May 2007, 17:45:14

AyushJ

avatar

Posts: 4754

No problem here :confused:

Monday, 7. May 2007, 19:05:12 (edited)

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

I checked it out!
It's your "Google Translation in tooltip[mf]" script, which is interfering... :D

There is also another interference with "ospell.js", inasmuch the button from "Ospell" at the lower right corner is not considered when the lower border of the text field moves downwards during the display of the smileys...
Nothing really earnest however, just for the beauty!
UserJavascript Interferences

Monday, 7. May 2007, 19:46:43 (edited)

AyushJ

avatar

Posts: 4754

Originally posted by HaJotKE:

It's your "Google Translation in tooltip[mf]" script, which is interfering...


Are you sure ? This script works fine with google_translation js for me :confused:

Originally posted by HaJotKE:

There is also another interference with "ospell.js"


The button is controlled by OSpell script, i cant fix it :frown:

Monday, 7. May 2007, 20:46:13

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

Originally posted by AyushJ:

Are you sure ? This script works fine with google_translation js for me

I have cross checked it, and it's reproducible...

But I am using other scripts too...
If I knew where to look and whatfor, I could help... :D

Here is my listing of currently active UserJavascripts:

1_ospell_preferences.js
auto-copy.js
Format tools for QuickReply.js
highlighter.js
mathml.js
operapedia.js
ops.js
ospell.js
scroller.js
syntax-highlighting.js
Thread title & genealogy before quick reply.js
xml-tree.user.js

With google-translation.js removed, everything is fine!

// ==UserScript==
// @name Google Translation in tooltip[mf]
// @author Ayush
// ==/UserScript==

Tuesday, 8. May 2007, 10:51:56 (edited)

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

As this problem still annoys me and it's clearly reproducible we should check the differences in our installations, please.

Having the above mentioned 'Userscript' "Google Translation in tooltip[mf]" installed the dislocation is always happening, having it removed, it never happens... :frown:

My script "Format tools for QuickReply.js" is version 1.2.1!
I am on Windows 2000 Professional here.

[EDIT]
It's additionally triggered by some third 'Userscript' however, because if I remove all except those two, the effect doesn't show... :D

Found: it's "ospell.js"!
All others have no influence!

Now I have removed it, and your both 'Userscripts' are compliant... :D
What can be done?
Could you have a look into "ospell.js", please!
I am now using version 1.0 beta 27, together with "a_ospell_prefs.js" version 1003 (also only now).
a-ospell_prefs.js
ospell.js

I will also write a PM to *d.i.z.* and *sombria*... :smile:
M/B they are colliding because they are doing virtually the same: translating...
Although I didn't use Google in Ospell...

I've removed for now "Google Translation in tooltip[mf]".
But there still remain these button displacements... :frown:

Tuesday, 8. May 2007, 11:27:03

AyushJ

avatar

Posts: 4754

HaJotKe: I downloaded those attached files to userjs folder and removed every script except formatting-tools and google-translation and still no problem here. :frown:

Tuesday, 8. May 2007, 11:44:03

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

I'll add now here all those files I have in my UserJS - folder.
To make sure we are using the identical versions...
Thread title & genealogy before QuickReply.js Format tools for QuickReply.js Google-translation.js

Together with the two from above, I always get this odd behavior...
It happens for the first time after the closing of the Smileys again, and from then on always... :frown:

BTW:
OPERA Version 9.20
Build 8771
Platform Win32
System Windows 2000

Tuesday, 8. May 2007, 12:23:39

AyushJ

avatar

Posts: 4754

yes.i can reproduce the problem now. Problem Fixed:, download the Google-translation again.

Tuesday, 8. May 2007, 12:57:01

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

Ah, finally...
I really began thinking I am dreaming all this... :D
Yes, it's working fine now! Thanks a lot! :up:

Now the only thing remaining is, that the 'Ospell' button should also follow...

Tuesday, 8. May 2007, 13:16:46

AyushJ

avatar

Posts: 4754

Originally posted by HaJotKE:

Now the only thing remaining is, that the 'Ospell' button should also follow...


Redownload.

Tuesday, 8. May 2007, 14:25:53

HaJotKE

avatar

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned User

Germany

Wow, that's great... :up:

Working perfectly here, AFAICS!
Thank you sooooooooo much, *AyushJ*! :cheers: :D

Tuesday, 8. May 2007, 15:33:53

d.i.z.

avatar

bug hunter

Posts: 2934

Poland

Originally posted by HaJotKE:

Now the only thing remaining is, that the 'Ospell' button should also follow...


Yep, happens sometimes.
We do not monitor if size or position of textarea changes - it's only positioned on focus.

It might be fixed/changed though.

Saturday, 23. June 2007, 03:15:14 (edited)

AyushJ

avatar

Posts: 4754

Download Formatting tools in quick reply v1.2.2 -

  • 6 new smilies in the list :right: - awww flirt :beard: penguin :domo: chuck norris - :left:
  • Option to show smilies list automatically on page load
  • some minor fixes

Saturday, 23. June 2007, 18:18:30

GT500

avatar

Security Industry

Posts: 3450

Fighting Malware

I like the penguin 'smiley'... penguin

Sunday, 24. June 2007, 02:38:02 (edited)

fearphage

avatar

Trained Swordsman of Unwanted Opera Termination

Posts: 1996

USA

You should add
// @exclude */xml/*
to the header. It causes an error on the rss links. You may not see the error if you have the email client enabled.

Sunday, 24. June 2007, 15:37:28

AyushJ

avatar

Posts: 4754

Ok. I changed - document.forms.quickform to document.forms&&document.forms.quickform :smile:

Tuesday, 4. September 2007, 13:07:37

Saddle Magic

avatar

Psycho Chicken What_The_Cluck!

Posts: 19063

This script does not appear to work with Kestrel (Opera 9.5a) :cry:

Tuesday, 4. September 2007, 13:18:53

AyushJ

avatar

Posts: 4754

@Saddle Magic: Try it now..

Forums » Opera Community » General Opera topics » User JavaScript