[UserJs] Code/Formatting Tools in Quick-Reply

Forums » General Opera topics » User JavaScript

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

12. April 2007, 22:27:02

AyushJ

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 ... sad


cheers

13. April 2007, 00:16:39

xErath

javascript guru

Posts: 6588

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
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

13. April 2007, 03:03:13

AyushJ

Posts: 4754

Originally posted by xErath:

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


Done!

13. April 2007, 09:50:57

Zalex108

Posts: 2974

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!¿? bigsmile bigsmile

13. April 2007, 10:30:09

Zalex108

Posts: 2974

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

13. April 2007, 17:52:44

xErath

javascript guru

Posts: 6588

Originally posted by AyushJ:

Done!


I'll look at it sunday or monday wink
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

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

AyushJ

Posts: 4754

Download v1.1: http://snipurl.com/QuickReply_ToolsCode tools/buttons in QuickReply[/URL][/FONT]


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


cheers

14. April 2007, 02:31:43

nabucco

Las Palmas (Africa)

Posts: 3462

Wonderfull! Macanudo!

Nunca discutas con un imbécil: te verás obligado a descender a su nivel y entonces, con su experiencia, te derrotará.

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

Zalex108

Posts: 2974

Jajajaja!!
Really faster!!
Thx! wink


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

14. April 2007, 21:21:01

Opera Software

d.i.z.

bug hunter

Posts: 3029

Awesome!
Was missing such thing.

16. April 2007, 22:50:35

xErath

javascript guru

Posts: 6588

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
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

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

AyushJ

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

17. April 2007, 07:40:41

xErath

javascript guru

Posts: 6588

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.
For a collection of user scripts visit
http://my.opera.com/xErath/blog/

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

GeekK

14° 29' E

Posts: 775

eek Nice! up

Hm, one thing: it doesn't align with the comments-box on eg. desktop blog (bottom).
Opera 12 64-bit [latest build] |Windows 7 64-bit | Intel Pentium Dual-Core E5500 2.8 GHz | 4 GB | Nederlandse/Vlaamse forums | Opera topic op GoT

17. April 2007, 08:20:10

AyushJ

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).

18. April 2007, 01:53:26

AyushJ

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 bigsmile .

Download v1.2.1

18. April 2007, 13:05:48

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

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.
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

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

AyushJ

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. bigsmile

18. April 2007, 16:12:00

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

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.
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

19. April 2007, 01:53:31

AyushJ

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.

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

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

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/,'');
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

21. April 2007, 01:38:53

AyushJ

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 !

21. April 2007, 05:06:07

GT500

GT500.org

Posts: 3478

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

21. April 2007, 07:33:20

Opera Software

d.i.z.

bug hunter

Posts: 3029

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.

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

AyushJ

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 party 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] party .

21. April 2007, 14:13:15

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

another thing, you didn't update the scripts internal version number.
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

7. May 2007, 17:26:29

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

Just one thing: bigsmile
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... sad

See image here:
Quick Reply After Smileys Closed Again.png
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

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

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

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

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
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

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

AyushJ

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 sad

7. May 2007, 20:46:13

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

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... bigsmile

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==
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

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

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

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... sad

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... bigsmile

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

Now I have removed it, and your both 'Userscripts' are compliant... bigsmile
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... sad
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

8. May 2007, 11:27:03

AyushJ

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. sad

8. May 2007, 11:44:03

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

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... sad

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

OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

8. May 2007, 12:23:39

AyushJ

Posts: 4754

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

8. May 2007, 12:57:01

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

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

Now the only thing remaining is, that the 'Ospell' button should also follow...
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

8. May 2007, 13:16:46

AyushJ

Posts: 4754

Originally posted by HaJotKE:

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


Redownload.

8. May 2007, 14:25:53

HaJotKE

Grumbling Hyper-Critical Cantankerous Curmudgeon!

Banned user

Wow, that's great... up

Working perfectly here, AFAICS!
Thank you sooooooooo much, *AyushJ*! cheers bigsmile
OPERA V8.54 (Win NT4) & V9.27 & V9.52[b10108] & V9.62[b10467] & V10[b1413] standard on (Win 98 SE) / (Win NT4) / (Win 2000 pro)
◇◇ UserJavascript "zz-spoof-id"! ◇◇◇ [Thanks for Finally Considering this Petition!] Composing Emails in the HTML Format in Opera

8. May 2007, 15:33:53

Opera Software

d.i.z.

bug hunter

Posts: 3029

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.

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

AyushJ

Posts: 4754

Download Formatting tools in quick reply v1.2.2 -

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

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

fearphage

Trained Swordsman of Unwanted Opera Termination

Posts: 2234

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.
Always latest weekly; XP Pro SP2
My bugs / disable RSS subscription prompt (This will disable email and chat as well) / Receive emailed copies of your bug reports

quote from desktopteam blog Feb 23 2007 06:49.36 (direct link to comment)

Originally posted by borg:

we will not be satisfied before we have the best developer tools in the industry

Source: Mozilla Links - 5 things I’d like to see in Opera

Originally posted by Percy Cabello:

One of the main reasons I prefer Firefox is that it starts from the belief that it can’t be the ideal browser for everybody

24. June 2007, 15:37:28

AyushJ

Posts: 4754

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

4. September 2007, 13:07:37

Saddle Magic

Psycho Chicken What_The_Cluck

Posts: 19690

This script does not appear to work with Kestrel (Opera 9.5a) cry
Opera 12.02 Build 1578 | 3.00 GHz Pentium 4 | 2 GB DDR | WinXP Pro sp3 | 10 GB access | 22" Widescreen LCD, Synaptics Touchpad & $5 Keyboard

Forums » General Opera topics » User JavaScript