OSDN Git Service

replace openWYSIWYG -> WYMeditor
[feedblog/feedgenerator.git] / wymeditor / plugins / hovertools / jquery.wymeditor.hovertools.js
1 /*
2  * WYMeditor : what you see is What You Mean web-based editor
3  * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
4  * Dual licensed under the MIT (MIT-license.txt)
5  * and GPL (GPL-license.txt) licenses.
6  *
7  * For further information visit:
8  *        http://www.wymeditor.org/
9  *
10  * File Name:
11  *        jquery.wymeditor.hovertools.js
12  *        hovertools plugin for WYMeditor
13  *
14  * File Authors:
15  *        Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
16  */
17
18 //Extend WYMeditor
19 WYMeditor.editor.prototype.hovertools = function() {
20   
21   var wym = this;
22   
23   //bind events on buttons
24   jQuery(this._box).find(this._options.toolSelector).hover(
25     function() {
26       wym.status(jQuery(this).html());
27     },
28     function() {
29       wym.status(' ');
30     }
31   );
32
33   //classes: add/remove a style attr to matching elems
34   //while mouseover/mouseout
35   jQuery(this._box).find(this._options.classSelector).hover(
36     function() {
37       var aClasses = eval(wym._options.classesItems);
38       var sName = jQuery(this).attr(WYMeditor.NAME);
39       var oClass = WYMeditor.Helper.findByName(aClasses, sName);
40
41       if(oClass){
42         jqexpr = oClass.expr;
43         //don't use jQuery.find() on the iframe body
44         //because of MSIE + jQuery + expando issue (#JQ1143)
45         if(!jQuery.browser.msie)
46           jQuery(wym._doc).find(jqexpr).css('background-color','#cfc');
47       }
48     },
49     function() {
50       //don't use jQuery.find() on the iframe body
51       //because of MSIE + jQuery + expando issue (#JQ1143)
52       if(!jQuery.browser.msie)
53         jQuery(wym._doc).find('*').removeAttr('style');
54     }
55   );
56
57 };