right-rails 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +1 -1
  4. data/init.rb +1 -0
  5. data/lib/generators/right_rails/right_rails_generator.rb +15 -6
  6. data/lib/right_rails.rb +1 -1
  7. data/lib/right_rails/controller_extensions.rb +28 -15
  8. data/lib/right_rails/helpers/misc.rb +38 -38
  9. data/lib/right_rails/helpers/rails.rb +50 -7
  10. data/lib/rjs_renderer.rb +26 -0
  11. data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
  12. data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
  13. data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
  14. data/vendor/assets/images/rightjs-ui/rte.png +0 -0
  15. data/vendor/assets/javascripts/right-safe-src.js +2 -2
  16. data/vendor/assets/javascripts/right-safe.js +2 -2
  17. data/vendor/assets/javascripts/right-src.js +386 -100
  18. data/vendor/assets/javascripts/right.js +2 -2
  19. data/vendor/assets/javascripts/right/calendar-src.js +19 -3
  20. data/vendor/assets/javascripts/right/calendar.js +2 -2
  21. data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
  22. data/vendor/assets/javascripts/right/colorpicker.js +2 -2
  23. data/vendor/assets/javascripts/right/i18n/de.js +43 -42
  24. data/vendor/assets/javascripts/right/i18n/es.js +1 -0
  25. data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
  26. data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
  27. data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
  28. data/vendor/assets/javascripts/right/i18n/it.js +1 -0
  29. data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
  30. data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
  31. data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
  32. data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
  33. data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
  34. data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
  35. data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
  36. data/vendor/assets/javascripts/right/jquerysh.js +2 -2
  37. data/vendor/assets/javascripts/right/rails-src.js +51 -15
  38. data/vendor/assets/javascripts/right/rails.js +2 -2
  39. data/vendor/assets/javascripts/right/resizable-src.js +11 -11
  40. data/vendor/assets/javascripts/right/rte-src.js +33 -13
  41. data/vendor/assets/javascripts/right/rte.js +2 -2
  42. data/vendor/assets/javascripts/right/slider-src.js +137 -28
  43. data/vendor/assets/javascripts/right/slider.js +2 -2
  44. metadata +24 -126
  45. data/generators/right_rails/right_rails_generator.rb +0 -46
  46. data/generators/right_rails/templates/iframed.html.erb +0 -10
  47. data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
  48. data/generators/right_scaffold/templates/controller.rb +0 -99
  49. data/generators/right_scaffold/templates/helper.rb +0 -2
  50. data/generators/right_scaffold/templates/layout.html.erb +0 -18
  51. data/generators/right_scaffold/templates/style.css +0 -54
  52. data/generators/right_scaffold/templates/view__form.html.erb +0 -16
  53. data/generators/right_scaffold/templates/view__item.html.erb +0 -13
  54. data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
  55. data/generators/right_scaffold/templates/view_index.html.erb +0 -9
  56. data/generators/right_scaffold/templates/view_new.html.erb +0 -5
  57. data/generators/right_scaffold/templates/view_show.html.erb +0 -10
  58. data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
  59. data/public/images/rightjs-ui/colorpicker.png +0 -0
  60. data/public/images/rightjs-ui/resizable.png +0 -0
  61. data/public/images/rightjs-ui/rte.png +0 -0
  62. data/public/javascripts/right-olds-src.js +0 -652
  63. data/public/javascripts/right-olds.js +0 -9
  64. data/public/javascripts/right-safe-src.js +0 -68
  65. data/public/javascripts/right-safe.js +0 -7
  66. data/public/javascripts/right-src.js +0 -6014
  67. data/public/javascripts/right.js +0 -7
  68. data/public/javascripts/right/autocompleter-src.js +0 -625
  69. data/public/javascripts/right/autocompleter.js +0 -7
  70. data/public/javascripts/right/billboard-src.js +0 -564
  71. data/public/javascripts/right/billboard.js +0 -7
  72. data/public/javascripts/right/calendar-src.js +0 -1464
  73. data/public/javascripts/right/calendar.js +0 -7
  74. data/public/javascripts/right/casting-src.js +0 -183
  75. data/public/javascripts/right/casting.js +0 -7
  76. data/public/javascripts/right/colorpicker-src.js +0 -981
  77. data/public/javascripts/right/colorpicker.js +0 -7
  78. data/public/javascripts/right/dialog-src.js +0 -768
  79. data/public/javascripts/right/dialog.js +0 -7
  80. data/public/javascripts/right/dnd-src.js +0 -591
  81. data/public/javascripts/right/dnd.js +0 -7
  82. data/public/javascripts/right/effects-src.js +0 -508
  83. data/public/javascripts/right/effects.js +0 -7
  84. data/public/javascripts/right/i18n/de.js +0 -95
  85. data/public/javascripts/right/i18n/en-us.js +0 -11
  86. data/public/javascripts/right/i18n/es.js +0 -95
  87. data/public/javascripts/right/i18n/fi.js +0 -96
  88. data/public/javascripts/right/i18n/fr.js +0 -95
  89. data/public/javascripts/right/i18n/hu.js +0 -100
  90. data/public/javascripts/right/i18n/it.js +0 -95
  91. data/public/javascripts/right/i18n/jp.js +0 -99
  92. data/public/javascripts/right/i18n/nl.js +0 -95
  93. data/public/javascripts/right/i18n/pt-br.js +0 -95
  94. data/public/javascripts/right/i18n/ru.js +0 -95
  95. data/public/javascripts/right/i18n/ua.js +0 -99
  96. data/public/javascripts/right/in-edit-src.js +0 -373
  97. data/public/javascripts/right/in-edit.js +0 -7
  98. data/public/javascripts/right/jquerysh-src.js +0 -362
  99. data/public/javascripts/right/jquerysh.js +0 -7
  100. data/public/javascripts/right/json-src.js +0 -147
  101. data/public/javascripts/right/json.js +0 -7
  102. data/public/javascripts/right/keys-src.js +0 -87
  103. data/public/javascripts/right/keys.js +0 -7
  104. data/public/javascripts/right/lightbox-src.js +0 -931
  105. data/public/javascripts/right/lightbox.js +0 -7
  106. data/public/javascripts/right/rails-src.js +0 -402
  107. data/public/javascripts/right/rails.js +0 -7
  108. data/public/javascripts/right/rater-src.js +0 -384
  109. data/public/javascripts/right/rater.js +0 -7
  110. data/public/javascripts/right/resizable-src.js +0 -465
  111. data/public/javascripts/right/resizable.js +0 -7
  112. data/public/javascripts/right/rte-src.js +0 -2685
  113. data/public/javascripts/right/rte.js +0 -7
  114. data/public/javascripts/right/selectable-src.js +0 -725
  115. data/public/javascripts/right/selectable.js +0 -7
  116. data/public/javascripts/right/sizzle-src.js +0 -1132
  117. data/public/javascripts/right/sizzle.js +0 -7
  118. data/public/javascripts/right/slider-src.js +0 -395
  119. data/public/javascripts/right/slider.js +0 -7
  120. data/public/javascripts/right/sortable-src.js +0 -430
  121. data/public/javascripts/right/sortable.js +0 -7
  122. data/public/javascripts/right/table-src.js +0 -176
  123. data/public/javascripts/right/table.js +0 -7
  124. data/public/javascripts/right/tabs-src.js +0 -1157
  125. data/public/javascripts/right/tabs.js +0 -7
  126. data/public/javascripts/right/tags-src.js +0 -745
  127. data/public/javascripts/right/tags.js +0 -7
  128. data/public/javascripts/right/tooltips-src.js +0 -331
  129. data/public/javascripts/right/tooltips.js +0 -7
  130. data/public/javascripts/right/uploader-src.js +0 -302
  131. data/public/javascripts/right/uploader.js +0 -7
@@ -61,6 +61,7 @@ RightJS.Object.each({
61
61
  Cut: 'Knippen',
62
62
  Copy: 'Kopieren',
63
63
  Paste: 'Plakken',
64
+ Pastetext: 'Paste as text',
64
65
  Left: 'Links uitlijnen',
65
66
  Center: 'Centreren',
66
67
  Right: 'Rechts uitlijnen',
@@ -61,6 +61,7 @@ RightJS.Object.each({
61
61
  Cut: 'Cut',
62
62
  Copy: 'Copy',
63
63
  Paste: 'Paste',
64
+ Pastetext: 'Paste as text',
64
65
  Left: 'Left',
65
66
  Center: 'Center',
66
67
  Right: 'Right',
@@ -61,6 +61,7 @@ RightJS.Object.each({
61
61
  Cut: 'Вырезать',
62
62
  Copy: 'Копировать',
63
63
  Paste: 'Вставить',
64
+ Pastetext: 'Вставить как текст',
64
65
  Left: 'Ровнять по левому краю',
65
66
  Center: 'Ровнять по центру',
66
67
  Right: 'Ровнять по правому краю',
@@ -65,6 +65,7 @@ RightJS.Object.each({
65
65
  Cut: 'Cut',
66
66
  Copy: 'Copy',
67
67
  Paste: 'Paste',
68
+ Pastetext: 'Вставить как текст',
68
69
  Left: 'Left',
69
70
  Center: 'Center',
70
71
  Right: 'Right',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * jQuery-like interfaces v2.2.0
2
+ * jQuery-like interfaces v2.2.1
3
3
  * http://rightjs.org/plugins/jquerysh
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
@@ -28,7 +28,7 @@ var rjs_$ = RightJS.$,
28
28
  * Copyright (C) 2011 Nikolay Nemshilov
29
29
  */
30
30
  RightJS.jQuerysh = {
31
- version: '2.2.0',
31
+ version: '2.2.1',
32
32
 
33
33
  // collection methods
34
34
  collectionMethods: {
@@ -233,11 +233,11 @@ RightJS.Element.include({
233
233
  return this.fade('out');
234
234
  },
235
235
 
236
- slideIn: function() {
236
+ slideDown: function() {
237
237
  return this.slide('in');
238
238
  },
239
239
 
240
- slideOut: function() {
240
+ slideUp: function() {
241
241
  return this.slide('out');
242
242
  }
243
243
 
@@ -1,7 +1,7 @@
1
1
  /**
2
- * jQuery-like interfaces v2.2.0
2
+ * jQuery-like interfaces v2.2.1
3
3
  * http://rightjs.org/plugins/jquerysh
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
6
6
  */
7
- (function(a){function l(a,b,c,d){typeof b==="function"&&(d=c,c=b,b=undefined);return{url:a,data:b,success:c,dataType:d}}function k(a,b){return j.ajax(f(l.apply(this,b),a))}var b=a.$,c=a.$$,d=a.$E,e=a.$A,f=a.$ext,g=a.Xhr,h=a.Browser,i=a.Object;a.jQuerysh={version:"2.2.0",collectionMethods:{live:function(a,b){this.cssRule.on(a,b);return this},die:function(a,b){this.cssRule.stopObserving(a,b);return this}}};var j=function(e){switch(typeof e){case"string":var g=e[0],h=e.substr(1);if(g==="#"&&/^[\w\-]+$/.test(h))return b(h);if(g==="<")return d("div",{html:e}).first();g=c(e),g.cssRule=a(e);return f(g,a.jQuerysh.collectionMethods);case"function":return b(document).onReady(e);default:return b(e)}};f(j,{browser:{webkit:h.WebKit,opera:h.Opera,msie:h.IE,mozilla:h.Gecko},isFunction:function(b){return a.isFunction(b)},isArray:function(b){return a.isArray(b)},isPlainObject:function(b){return a.isHash(b)},isEmptyObject:function(a){return i.empty(a)},globalEval:function(b){return a.$eval(b)},makeArray:function(a){return e(a)},each:function(a,b){return e(a,function(a,c){b(c,a)})},map:function(a){return e(value).map(a)},unique:function(a){return e(a).uniq()},merge:function(a,b){return e(a).merge(b)},extend:function(){return i.merge.apply(i,arguments)},proxy:function(b,c){return a(b).bind(c)},noop:function(){return a(function(){})}}),a.Element.include({appendTo:function(a){return this.insertTo(a)},prepend:function(a){return this.insert(a,"top")},before:function(a){return this.insert(a,"before")},after:function(a){return this.insert(a,"after")},insertBefore:function(a){return this.insertTo(a,"before")},attr:function(a,b){return b===undefined?this.get(a):this.set(a,b)},css:function(a,b){return typeof a==="string"&&b===undefined?this.getStyle(a):this.setStyle(a,b)},offset:function(){var a=this.position();return{left:a.x,top:a.y}},width:function(){return this.size().x},height:function(){return this.size().y},scrollLeft:function(){return this.scrolls().x},scrollTop:function(){return this.scrolls().y},bind:function(){return this.on.apply(this,arguments)},unbind:function(){return this.stopObserving.apply(this,arguments)},trigger:function(a,b){return this.fire(a,b)},animate:function(a,b,c){return this.morph(a,{duration:b,onFinish:c})},fadeIn:function(){return this.fade("in")},fadeOut:function(){return this.fade("out")},slideIn:function(){return this.slide("in")},slideOut:function(){return this.slide("out")}}),f(j,{param:function(a){return i.toQueryString(a)},ajax:function(a,b){function d(a,c){a(b.dataType==="json"?c.json:c.text,c.successful()?"success":"error",c)}b=b||{},typeof a==="string"?b.url=a:b=a;var c={};b.success&&(c.onSuccess=function(){d(b.success,this)}),b.error&&(c.onFailure=function(){d(b.error,this)}),b.complete&&(c.onComplete=function(){d(b.complete,this)}),c.method=b.type,b.headers&&(c.headers=b.headers),b.jsonp&&(c.jsonp=b.jsonp),b.url.indexOf("callback=?")>0&&(c.jsonp=!0,b.url=b.url.replace(/(\?|\&)callback=\?/,""));return(new g(b.url,c)).send(b.data)},get:function(){return k({type:"get"},arguments)},post:function(a,b,c,d){return k({type:"post"},arguments)},getJSON:function(a,b,c){return k({dataType:"json"},arguments)},getScript:function(a,b){return k({dataType:"script"},arguments)}}),g.include({success:function(a){return this.on("success",a)},error:function(a){return this.on("failure",a)},complete:function(a){return this.on("complete",a)}}),window.$=window.jQuery=j})(RightJS)
7
+ (function(a){function l(a,b,c,d){typeof b==="function"&&(d=c,c=b,b=undefined);return{url:a,data:b,success:c,dataType:d}}function k(a,b){return j.ajax(f(l.apply(this,b),a))}var b=a.$,c=a.$$,d=a.$E,e=a.$A,f=a.$ext,g=a.Xhr,h=a.Browser,i=a.Object;a.jQuerysh={version:"2.2.1",collectionMethods:{live:function(a,b){this.cssRule.on(a,b);return this},die:function(a,b){this.cssRule.stopObserving(a,b);return this}}};var j=function(e){switch(typeof e){case"string":var g=e[0],h=e.substr(1);if(g==="#"&&/^[\w\-]+$/.test(h))return b(h);if(g==="<")return d("div",{html:e}).first();g=c(e),g.cssRule=a(e);return f(g,a.jQuerysh.collectionMethods);case"function":return b(document).onReady(e);default:return b(e)}};f(j,{browser:{webkit:h.WebKit,opera:h.Opera,msie:h.IE,mozilla:h.Gecko},isFunction:function(b){return a.isFunction(b)},isArray:function(b){return a.isArray(b)},isPlainObject:function(b){return a.isHash(b)},isEmptyObject:function(a){return i.empty(a)},globalEval:function(b){return a.$eval(b)},makeArray:function(a){return e(a)},each:function(a,b){return e(a,function(a,c){b(c,a)})},map:function(a){return e(value).map(a)},unique:function(a){return e(a).uniq()},merge:function(a,b){return e(a).merge(b)},extend:function(){return i.merge.apply(i,arguments)},proxy:function(b,c){return a(b).bind(c)},noop:function(){return a(function(){})}}),a.Element.include({appendTo:function(a){return this.insertTo(a)},prepend:function(a){return this.insert(a,"top")},before:function(a){return this.insert(a,"before")},after:function(a){return this.insert(a,"after")},insertBefore:function(a){return this.insertTo(a,"before")},attr:function(a,b){return b===undefined?this.get(a):this.set(a,b)},css:function(a,b){return typeof a==="string"&&b===undefined?this.getStyle(a):this.setStyle(a,b)},offset:function(){var a=this.position();return{left:a.x,top:a.y}},width:function(){return this.size().x},height:function(){return this.size().y},scrollLeft:function(){return this.scrolls().x},scrollTop:function(){return this.scrolls().y},bind:function(){return this.on.apply(this,arguments)},unbind:function(){return this.stopObserving.apply(this,arguments)},trigger:function(a,b){return this.fire(a,b)},animate:function(a,b,c){return this.morph(a,{duration:b,onFinish:c})},fadeIn:function(){return this.fade("in")},fadeOut:function(){return this.fade("out")},slideDown:function(){return this.slide("in")},slideUp:function(){return this.slide("out")}}),f(j,{param:function(a){return i.toQueryString(a)},ajax:function(a,b){function d(a,c){a(b.dataType==="json"?c.json:c.text,c.successful()?"success":"error",c)}b=b||{},typeof a==="string"?b.url=a:b=a;var c={};b.success&&(c.onSuccess=function(){d(b.success,this)}),b.error&&(c.onFailure=function(){d(b.error,this)}),b.complete&&(c.onComplete=function(){d(b.complete,this)}),c.method=b.type,b.headers&&(c.headers=b.headers),b.jsonp&&(c.jsonp=b.jsonp),b.url.indexOf("callback=?")>0&&(c.jsonp=!0,b.url=b.url.replace(/(\?|\&)callback=\?/,""));return(new g(b.url,c)).send(b.data)},get:function(){return k({type:"get"},arguments)},post:function(a,b,c,d){return k({type:"post"},arguments)},getJSON:function(a,b,c){return k({dataType:"json"},arguments)},getScript:function(a,b){return k({dataType:"script"},arguments)}}),g.include({success:function(a){return this.on("success",a)},error:function(a){return this.on("failure",a)},complete:function(a){return this.on("complete",a)}}),window.$=window.jQuery=j})(RightJS)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RubyOnRails Support Module v2.2.2
2
+ * RubyOnRails Support Module v2.3.1
3
3
  * http://rightjs.org/plugins/rails
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
@@ -16,10 +16,11 @@ var R = RightJS,
16
16
  $$ = RightJS.$$,
17
17
  $E = RightJS.$E,
18
18
  Xhr = RightJS.Xhr,
19
- Object = RightJS.Object;
19
+ Object = RightJS.Object,
20
+ Input = RightJS.Input;
20
21
 
21
22
  RightJS.Rails = {
22
- version: '2.2.2'
23
+ version: '2.3.1'
23
24
  };
24
25
 
25
26
 
@@ -114,35 +115,68 @@ function user_cancels(event, element) {
114
115
  // adds XHR events to the element
115
116
  function add_xhr_events(element, options) {
116
117
  return Object.merge({
117
- onCreate: function() { element.fire('ajax:loading', {xhr: this}); },
118
- onComplete: function() { element.fire('ajax:complete', {xhr: this}); },
118
+ onCreate: function() {
119
+ disable_with(element);
120
+ element.fire('ajax:loading', {xhr: this});
121
+ },
122
+ onComplete: function() {
123
+ enable_with(element);
124
+ element.fire('ajax:complete', {xhr: this});
125
+ },
119
126
  onSuccess: function() { element.fire('ajax:success', {xhr: this}); },
120
127
  onFailure: function() { element.fire('ajax:failure', {xhr: this}); }
121
128
  }, options);
122
129
  }
123
130
 
131
+ // handles the data-disable-with option
132
+ function disable_with(element) {
133
+ get_disable_with_elements(element).each(function(element) {
134
+ var method = element instanceof Input ? 'value' : 'html';
135
+ element.__disable_with_html = element[method]();
136
+ element[method](element.get('data-disable-with'));
137
+ });
138
+ }
139
+
140
+ // restores the elements state after the data-disable-with option
141
+ function enable_with(element) {
142
+ get_disable_with_elements(element).each(function(element) {
143
+ if (element.__disable_with_html !== undefined) {
144
+ var method = element instanceof Input ? 'value' : 'html';
145
+ element[method](element.__disable_with_html);
146
+ delete(element.__disable_with_html);
147
+ }
148
+ });
149
+ }
150
+
151
+ // finds all the suitable disable-with targets
152
+ function get_disable_with_elements(element) {
153
+ return element.has('data-disable-with') ?
154
+ R([element]) : element.find('*[data-disable-with]');
155
+ }
156
+
124
157
  // processes link clicks
125
158
  function try_link_submit(event, link) {
126
159
  var url = link.get('href'),
127
160
  method = link.get('data-method'),
128
- remote = link.get('data-remote');
161
+ remote = link.get('data-remote'),
162
+ param = $$('meta[name=csrf-param]')[0],
163
+ token = $$('meta[name=csrf-token]')[0];
164
+
165
+ param = param && param.get('content');
166
+ token = token && token.get('content');
129
167
 
130
168
  if (user_cancels(event, link)) { return; }
131
169
  if (method || remote) { event.stop(); }
132
170
 
133
171
  if (remote) {
134
172
  Xhr.load(url, add_xhr_events(link, {
135
- method: method || 'get',
136
- spinner: link.get('data-spinner')
173
+ method: method || 'get',
174
+ spinner: link.get('data-spinner'),
175
+ params: new Function('return {"'+ param +'": "'+ token +'"}')()
137
176
  }));
138
177
 
139
178
  } else if (method) {
140
- var param = $$('meta[name=csrf-param]')[0],
141
- token = $$('meta[name=csrf-token]')[0],
142
- form = $E('form', {action: url, method: 'post'});
143
-
144
- param = param && param.get('content');
145
- token = token && token.get('content');
179
+ var form = $E('form', {action: url, method: 'post'});
146
180
 
147
181
  if (param && token) {
148
182
  form.insert('<input type="hidden" name="'+param+'" value="'+token+'" />');
@@ -150,6 +184,8 @@ function try_link_submit(event, link) {
150
184
 
151
185
  form.insert('<input type="hidden" name="_method" value="'+method+'"/>')
152
186
  .insertTo(document.body).submit();
187
+
188
+ disable_with(link);
153
189
  }
154
190
  }
155
191
 
@@ -371,7 +407,7 @@ var RR = {
371
407
  * @return RR this
372
408
  */
373
409
  rescan: function(scope) {
374
- $w('Draggable Droppable Tabs Tags Slider Selectable').each(function(name) {
410
+ $w('Draggable Droppable Tabs Tags Selectable').each(function(name) {
375
411
  if (name in window) {
376
412
  window[name].rescan(this.Options.rescanWithScopes ? scope : null);
377
413
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RubyOnRails Support Module v2.2.2
2
+ * RubyOnRails Support Module v2.3.1
3
3
  * http://rightjs.org/plugins/rails
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
6
6
  */
7
- (function(a,b,c){function l(a,c){var d=c.get("href"),e=c.get("data-method"),i=c.get("data-remote");if(!j(a,c)){(e||i)&&a.stop();if(i)h.load(d,k(c,{method:e||"get",spinner:c.get("data-spinner")}));else if(e){var l=f("meta[name=csrf-param]")[0],m=f("meta[name=csrf-token]")[0],n=g("form",{action:d,method:"post"});l=l&&l.get("content"),m=m&&m.get("content"),l&&m&&n.insert('<input type="hidden" name="'+l+'" value="'+m+'" />'),n.insert('<input type="hidden" name="_method" value="'+e+'"/>').insertTo(b.body).submit()}}}function k(a,b){return i.merge({onCreate:function(){a.fire("ajax:loading",{xhr:this})},onComplete:function(){a.fire("ajax:complete",{xhr:this})},onSuccess:function(){a.fire("ajax:success",{xhr:this})},onFailure:function(){a.fire("ajax:failure",{xhr:this})}},b)}function j(a,b){var c=b.get("data-confirm");if(c&&!confirm(c)){a.stop();return!0}}var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object;c.Rails={version:"2.2.2"},d([c.String.prototype,c.Array.prototype,c.Function.prototype,c.Object,c.Options,c.Observer,c.Observer.prototype,c.Window.prototype,c.Document.prototype]).each(function(a){for(var b in a)try{if(/[A-Z]/.test(b)&&typeof a[b]==="function"){var c=d(b).underscored();if(a[c]===null||a[c]===undefined)a[c]=a[b]}}catch(e){}}),d([c.Element,c.Event,c.Form,c.Input]).each(function(a){if(a){var b={},c=a.prototype;for(var e in c)/[A-Z]/.test(e)&&typeof c[e]==="function"&&(a.prototype[d(e).underscored()]=c[e])}}),c.$alias(c.String.prototype,{index_of:"indexOf",last_index_of:"lastIndexOf",to_f:"toFloat",to_i:"toInt",gsub:"replace",downcase:"toLowerCase",upcase:"toUpperCase",index:"indexOf",rindex:"lastIndexOf",strip:"trim"}),c.$alias(c.Array.prototype,{collect:"map",detect:"filter",index_of:"indexOf",last_index_of:"lastIndexOf",index:"indexOf",rindex:"lastIndexOf"}),e(b).on({click:function(a){var b=a.find("a");b&&l(a,b)},submit:function(a){var b=a.target;b.has("data-remote")&&!j(a,b)&&(a.stop(),b.send(k(b,{spinner:b.get("data-spinner")||b.first(".spinner")})))}});var m={Options:{format:"js",flashId:"flashes",flashHideFx:"slide",flashHideDelay:3200,highlightUpdates:!0,removeFx:"fade",insertFx:"fade",insertPosition:"bottom",linkToAjaxEdit:".ajax_edit",linkToAjaxDelete:".ajax_delete",rescanWithScopes:!0},update_flash:function(a){var b=e(this.Options.flashId);b&&this.replace(b,a).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var a=e(this.Options.flashId);a&&a.visible()&&a.hide.bind(a,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(a){e(a)&&this.Options.highlightUpdates&&e(a).highlight();return this},insert:function(a,b,c){var d=c||this.Options.insertPosition,f,g=e(a).insert(b,d);switch(d){case"bottom":f=g.children().last();break;case"top":f=g.first();break;case"before":f=g.prev();break;case"after":f=g.next()}f&&this.Options.insertFx?f.hide().show(this.Options.insertFx,{onFinish:this.highlight.bind(this,f)}):this.highlight(f);return this.rescan(a)},replace:function(a,b){e(a).replace(b);return this.highlight(a).rescan(a)},remove:function(a){e(a)&&e(a).remove(this.Options.removeFx)},remotize_form:function(a){var b=e(a);b&&(b.remotize().enable()._.action+="."+this.Options.format);return this},replace_form:function(a,b){var c=e(a);c&&(c.replace(b),this.remotize_form(a));return this.rescan(a)},show_form_for:function(a,b){e(a).find("form").each("remove"),e(a).insert(b);return this.remotize_form(e(a).first("form")).rescan(a)},process_click:function(a){var b;(b=a.find("a"+this.Options.linkToAjaxEdit))?(a.stop(),h.load(b.get("href")+"."+this.Options.format)):(b=a.find("a"+this.Options.linkToAjaxDelete))&&b.has("onclick")&&(a.stop(),(new Function("return "+b.onclick.toString().replace(".submit",".send")))().call(b))},rescan:function(b){$w("Draggable Droppable Tabs Tags Slider Selectable").each(function(c){c in a&&a[c].rescan(this.Options.rescanWithScopes?b:null)},this);return this}};e(b).on({ready:function(){m.hide_flash()},click:function(a){m.process_click(a)}}),a.RR=m})(window,document,RightJS)
7
+ (function(a,b,c){function p(a,c){var d=c.get("href"),e=c.get("data-method"),i=c.get("data-remote"),j=f("meta[name=csrf-param]")[0],n=f("meta[name=csrf-token]")[0];j=j&&j.get("content"),n=n&&n.get("content");if(!k(a,c)){(e||i)&&a.stop();if(i)h.load(d,l(c,{method:e||"get",spinner:c.get("data-spinner"),params:(new Function('return {"'+j+'": "'+n+'"}'))()}));else if(e){var o=g("form",{action:d,method:"post"});j&&n&&o.insert('<input type="hidden" name="'+j+'" value="'+n+'" />'),o.insert('<input type="hidden" name="_method" value="'+e+'"/>').insertTo(b.body).submit(),m(c)}}}function o(a){return a.has("data-disable-with")?d([a]):a.find("*[data-disable-with]")}function n(a){o(a).each(function(a){if(a.__disable_with_html!==undefined){var b=a instanceof j?"value":"html";a[b](a.__disable_with_html),delete a.__disable_with_html}})}function m(a){o(a).each(function(a){var b=a instanceof j?"value":"html";a.__disable_with_html=a[b](),a[b](a.get("data-disable-with"))})}function l(a,b){return i.merge({onCreate:function(){m(a),a.fire("ajax:loading",{xhr:this})},onComplete:function(){n(a),a.fire("ajax:complete",{xhr:this})},onSuccess:function(){a.fire("ajax:success",{xhr:this})},onFailure:function(){a.fire("ajax:failure",{xhr:this})}},b)}function k(a,b){var c=b.get("data-confirm");if(c&&!confirm(c)){a.stop();return!0}}var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object,j=c.Input;c.Rails={version:"2.3.1"},d([c.String.prototype,c.Array.prototype,c.Function.prototype,c.Object,c.Options,c.Observer,c.Observer.prototype,c.Window.prototype,c.Document.prototype]).each(function(a){for(var b in a)try{if(/[A-Z]/.test(b)&&typeof a[b]==="function"){var c=d(b).underscored();if(a[c]===null||a[c]===undefined)a[c]=a[b]}}catch(e){}}),d([c.Element,c.Event,c.Form,c.Input]).each(function(a){if(a){var b={},c=a.prototype;for(var e in c)/[A-Z]/.test(e)&&typeof c[e]==="function"&&(a.prototype[d(e).underscored()]=c[e])}}),c.$alias(c.String.prototype,{index_of:"indexOf",last_index_of:"lastIndexOf",to_f:"toFloat",to_i:"toInt",gsub:"replace",downcase:"toLowerCase",upcase:"toUpperCase",index:"indexOf",rindex:"lastIndexOf",strip:"trim"}),c.$alias(c.Array.prototype,{collect:"map",detect:"filter",index_of:"indexOf",last_index_of:"lastIndexOf",index:"indexOf",rindex:"lastIndexOf"}),e(b).on({click:function(a){var b=a.find("a");b&&p(a,b)},submit:function(a){var b=a.target;b.has("data-remote")&&!k(a,b)&&(a.stop(),b.send(l(b,{spinner:b.get("data-spinner")||b.first(".spinner")})))}});var q={Options:{format:"js",flashId:"flashes",flashHideFx:"slide",flashHideDelay:3200,highlightUpdates:!0,removeFx:"fade",insertFx:"fade",insertPosition:"bottom",linkToAjaxEdit:".ajax_edit",linkToAjaxDelete:".ajax_delete",rescanWithScopes:!0},update_flash:function(a){var b=e(this.Options.flashId);b&&this.replace(b,a).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var a=e(this.Options.flashId);a&&a.visible()&&a.hide.bind(a,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(a){e(a)&&this.Options.highlightUpdates&&e(a).highlight();return this},insert:function(a,b,c){var d=c||this.Options.insertPosition,f,g=e(a).insert(b,d);switch(d){case"bottom":f=g.children().last();break;case"top":f=g.first();break;case"before":f=g.prev();break;case"after":f=g.next()}f&&this.Options.insertFx?f.hide().show(this.Options.insertFx,{onFinish:this.highlight.bind(this,f)}):this.highlight(f);return this.rescan(a)},replace:function(a,b){e(a).replace(b);return this.highlight(a).rescan(a)},remove:function(a){e(a)&&e(a).remove(this.Options.removeFx)},remotize_form:function(a){var b=e(a);b&&(b.remotize().enable()._.action+="."+this.Options.format);return this},replace_form:function(a,b){var c=e(a);c&&(c.replace(b),this.remotize_form(a));return this.rescan(a)},show_form_for:function(a,b){e(a).find("form").each("remove"),e(a).insert(b);return this.remotize_form(e(a).first("form")).rescan(a)},process_click:function(a){var b;(b=a.find("a"+this.Options.linkToAjaxEdit))?(a.stop(),h.load(b.get("href")+"."+this.Options.format)):(b=a.find("a"+this.Options.linkToAjaxDelete))&&b.has("onclick")&&(a.stop(),(new Function("return "+b.onclick.toString().replace(".submit",".send")))().call(b))},rescan:function(b){$w("Draggable Droppable Tabs Tags Selectable").each(function(c){c in a&&a[c].rescan(this.Options.rescanWithScopes?b:null)},this);return this}};e(b).on({ready:function(){q.hide_flash()},click:function(a){q.process_click(a)}}),a.RR=q})(window,document,RightJS)
@@ -448,17 +448,17 @@ if ('Draggable' in RightJS) {
448
448
  });
449
449
  }
450
450
 
451
- var embed_style = document.createElement('style'),
452
- embed_rules = document.createTextNode(".rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/assets/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}");
453
-
454
- embed_style.type = 'text/css';
455
- document.getElementsByTagName('head')[0].appendChild(embed_style);
456
-
457
- if(embed_style.styleSheet) {
458
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
459
- } else {
460
- embed_style.appendChild(embed_rules);
461
- }
451
+ var embed_style = document.createElement('style'),
452
+ embed_rules = document.createTextNode(".rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/assets/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}");
453
+
454
+ embed_style.type = 'text/css';
455
+ document.getElementsByTagName('head')[0].appendChild(embed_style);
456
+
457
+ if(embed_style.styleSheet) {
458
+ embed_style.styleSheet.cssText = embed_rules.nodeValue;
459
+ } else {
460
+ embed_style.appendChild(embed_rules);
461
+ }
462
462
 
463
463
 
464
464
  return Resizable;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RightJS-UI RTE v2.2.0
2
+ * RightJS-UI RTE v2.2.1
3
3
  * http://rightjs.org/ui/rte
4
4
  *
5
5
  * Copyright (C) 2010-2011 Nikolay Nemshilov
@@ -133,7 +133,7 @@ var R = RightJS,
133
133
  var Rte = new Widget({
134
134
 
135
135
  extend: {
136
- version: '2.2.0',
136
+ version: '2.2.1',
137
137
 
138
138
  EVENTS: $w('change focus blur'),
139
139
 
@@ -258,6 +258,7 @@ var Rte = new Widget({
258
258
  Cut: 'Cut',
259
259
  Copy: 'Copy',
260
260
  Paste: 'Paste',
261
+ Pastetext: 'Paste as text',
261
262
  Left: 'Left',
262
263
  Center: 'Center',
263
264
  Right: 'Right',
@@ -2131,6 +2132,15 @@ Rte.Tools.Paste = new Class(Rte.Tools.Cut, {
2131
2132
  command: 'paste'
2132
2133
  });
2133
2134
 
2135
+ /**
2136
+ * The paste action
2137
+ *
2138
+ * Copyrigth (C) 2010-2011 Nikolay Nemshilov
2139
+ */
2140
+ Rte.Tools.Pastetext = new Class(Rte.Tools.Command, {
2141
+ command: 'paste'
2142
+ });
2143
+
2134
2144
  /**
2135
2145
  * the 'left' tool
2136
2146
  *
@@ -2417,6 +2427,16 @@ Rte.Tools.Source = new Class(Rte.Tool, {
2417
2427
  .insertTo(this.rte.editor, 'before')
2418
2428
  .resize(this.rte.editor.size())
2419
2429
  .setValue('' + this.rte.value())
2430
+ .onKeydown(function(event) {
2431
+ var raw = event._;
2432
+
2433
+ if (raw.metaKey || raw.ctrlKey) {
2434
+ if (raw.keyCode == 69) { // Ctrl+E
2435
+ event.stop();
2436
+ this.exec();
2437
+ }
2438
+ }
2439
+ }.bind(this))
2420
2440
  .focus();
2421
2441
 
2422
2442
  this.rte.focused = true;
@@ -2668,17 +2688,17 @@ Input.include({
2668
2688
  }
2669
2689
  });
2670
2690
 
2671
- var embed_style = document.createElement('style'),
2672
- embed_rules = document.createTextNode("div.rui-rte,div.rui-rte-toolbar,div.rui-rte-toolbar *,div.rui-rte-editor,div.rui-rte-status,div.rui-rte-status *{margin:0;padding:0;background:none;border:none;width:auto;height:auto}textarea[data-rte]{visibility:hidden}div.rui-rte{display:inline-block; *display:inline; *zoom:1;position:relative}div.rui-rte-toolbar{padding:.15em .3em;background:#eee;border-radius:.25em .25em 0 0;-moz-border-radius:.25em .25em 0 0;-webkit-border-radius:.25em .25em 0 0;border:1px solid #ccc;border-bottom:none}div.rui-rte-toolbar div.line{display:inline-block; *display:inline; *zoom:1;margin-bottom:1px}div.rui-rte-toolbar div.bar{display:inline-block; *display:inline; *zoom:1;margin-right:2px}div.rui-rte-toolbar div.tool{display:inline-block; *display:inline; *zoom:1;margin-right:1px;vertical-align:middle;position:relative;cursor:pointer;border:1px solid #bbb;background-image:url(/assets/rightjs-ui/rte.png);background-position:0px 0px;background-color:#fff;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}div.rui-rte-toolbar div.tool:hover{background-color:#ddd;border-color:#777}div.rui-rte-toolbar div.active{background-position:-20px 0px;background-color:#eee;border-color:#666;box-shadow:#aaa .025em .025em .5em;-moz-box-shadow:#aaa .025em .025em .5em;-webkit-box-shadow:#aaa .025em .025em .5em}div.rui-rte-toolbar div.disabled,div.rui-rte-toolbar div.disabled:hover{opacity:.4;filter:alpha(opacity=40);background-position:-40px 0px;background-color:#eee;border-color:#aaa;cursor:default}div.rui-rte-toolbar div.highlight{background-color:#BBB;border-color:#666}div.rui-rte-toolbar div.icon{height:20px;width:20px;background-image:url(/assets/rightjs-ui/rte.png);background-repeat:no-repeat;background-position:20px 20px}div.rui-rte-toolbar div.save div.icon{background-position:0px -20px}div.rui-rte-toolbar div.clear div.icon{background-position:-20px -20px}div.rui-rte-toolbar div.source div.icon{background-position:-40px -20px}div.rui-rte-toolbar div.bold div.icon{background-position:0px -40px}div.rui-rte-toolbar div.italic div.icon{background-position:-20px -40px}div.rui-rte-toolbar div.underline div.icon{background-position:-40px -40px}div.rui-rte-toolbar div.strike div.icon{background-position:-60px -40px}div.rui-rte-toolbar div.cut div.icon{background-position:0px -60px}div.rui-rte-toolbar div.copy div.icon{background-position:-20px -60px}div.rui-rte-toolbar div.paste div.icon{background-position:-40px -60px}div.rui-rte-toolbar div.left div.icon{background-position:0px -80px}div.rui-rte-toolbar div.center div.icon{background-position:-20px -80px}div.rui-rte-toolbar div.right div.icon{background-position:-40px -80px}div.rui-rte-toolbar div.justify div.icon{background-position:-60px -80px}div.rui-rte-toolbar div.undo div.icon{background-position:0px -100px}div.rui-rte-toolbar div.redo div.icon{background-position:-20px -100px}div.rui-rte-toolbar div.quote div.icon{background-position:0px -120px}div.rui-rte-toolbar div.code div.icon{background-position:-20px -120px}div.rui-rte-toolbar div.ttext div.icon{background-position:-40px -120px}div.rui-rte-toolbar div.header div.icon{background-position:-60px -120px}div.rui-rte-toolbar div.image div.icon{background-position:0px -140px}div.rui-rte-toolbar div.link div.icon{background-position:-20px -140px}div.rui-rte-toolbar div.video div.icon{background-position:-40px -140px}div.rui-rte-toolbar div.dotlist div.icon{background-position:0px -160px}div.rui-rte-toolbar div.numlist div.icon{background-position:-20px -160px}div.rui-rte-toolbar div.indent div.icon{background-position:-40px -160px}div.rui-rte-toolbar div.outdent div.icon{background-position:-60px -160px}div.rui-rte-toolbar div.forecolor div.icon{background-position:0px -180px}div.rui-rte-toolbar div.backcolor div.icon{background-position:-20px -180px}div.rui-rte-toolbar div.symbol div.icon{background-position:0px -200px}div.rui-rte-toolbar div.subscript div.icon{background-position:-20px -200px}div.rui-rte-toolbar div.superscript div.icon{background-position:-40px -200px}div.rui-rte-toolbar div.with-options{padding-right:8px}div.rui-rte-toolbar div.with-options div.trigger{position:absolute;right:0;height:100%;width:7px;text-align:center;background:#ccc;border-left:1px solid #bbb}div.rui-rte-toolbar div.bar div:hover div.trigger,div.rui-rte-toolbar div.bar div.active div.trigger{background:#aaa;border-color:#888}div.rui-rte-toolbar div.with-options div.icon{display:none}div.rui-rte-toolbar div.with-options div.display{display:block;line-height:20px;padding:0 6px;margin:0;color:#222;font-size:12px;background:#f8f8f8}div.rui-rte-toolbar div.with-options ul.options,div.rui-rte-toolbar div.with-options ul.options li{list-style:none;margin:0;padding:0}div.rui-rte-toolbar div.with-options ul.options{display:none;cursor:default;position:absolute;margin-bottom:1px;margin-left:-1px;background:#fff;border:1px solid #aaa;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em;box-shadow:#bbb .1em .1em .25em;-moz-box-shadow:#bbb .1em .1em .25em;-webkit-box-shadow:#bbb .1em .1em .25em}div.rui-rte-toolbar div.with-options ul.options li{padding:.2em .5em;white-space:nowrap;cursor:pointer}div.rui-rte-toolbar div.with-options ul.options li:hover{background-color:#eee}div.rui-rte-toolbar div.with-options ul.options li> *{margin:0;padding:0;border:none;position:static}div.rui-rte-toolbar div.color div.icon{display:block}div.rui-rte-toolbar div.color ul.options{padding-bottom:.5em}div.rui-rte-toolbar div.color ul.options li.group,div.rui-rte-toolbar div.color ul.options li.group:hover{background:none}div.rui-rte-toolbar div.color ul.options li.group ul{width:144px;clear:both;padding-top:.5em}div.rui-rte-toolbar div.color ul.options li.group ul li{float:left;width:16px;height:16px;line-height:16px;font-size:80%;text-align:center;text-indent:-9999em;padding:0;cursor:pointer;border:1px solid transparent}div.rui-rte-toolbar div.color ul.options li.group ul li:hover,div.rui-rte-toolbar div.color ul.options li.group ul li.active{background:none;border-color:#444;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.active{text-indent:0}div.rui-rte-toolbar div.color div.display{position:absolute;text-indent:-9999em;bottom:2px;left:3px;margin:0;padding:0;width:14px;height:4px;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.none{border-color:#444}div.rui-rte-toolbar div.color ul.options li.group ul li.label,div.rui-rte-toolbar div.color ul.options li.group ul li.label:hover{text-indent:0;border:none;margin-left:.5em;font-size:1em;cursor:default}div.rui-rte-editor{outline:none;outline:hidden;padding:.1em .3em;overflow:auto;background:white;border:1px solid #ccc}div.rui-rte-editor:focus{border-color:#aaa}div.rui-rte-editor> *:first-child{margin-top:0}div.rui-rte-editor> *:last-child{margin-bottom:0}div.rui-rte textarea.rui-rte-source{position:absolute;outline:none;resize:none}div.rui-rte-status{font-size:90%;height:1.4em;padding:0 .5em;color:#888;background:#eee;border:1px solid #ccc;border-top:none;border-radius:0 0 .25em .25em;-moz-border-radius:0 0 .25em .25em;-webkit-border-radius:0 0 .25em .25em}");
2673
-
2674
- embed_style.type = 'text/css';
2675
- document.getElementsByTagName('head')[0].appendChild(embed_style);
2676
-
2677
- if(embed_style.styleSheet) {
2678
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
2679
- } else {
2680
- embed_style.appendChild(embed_rules);
2681
- }
2691
+ var embed_style = document.createElement('style'),
2692
+ embed_rules = document.createTextNode("div.rui-rte,div.rui-rte-toolbar,div.rui-rte-toolbar *,div.rui-rte-editor,div.rui-rte-status,div.rui-rte-status *{margin:0;padding:0;background:none;border:none;width:auto;height:auto}textarea[data-rte]{visibility:hidden}div.rui-rte{display:inline-block; *display:inline; *zoom:1;position:relative}div.rui-rte-toolbar{padding:.15em .3em;background:#eee;border-radius:.25em .25em 0 0;-moz-border-radius:.25em .25em 0 0;-webkit-border-radius:.25em .25em 0 0;border:1px solid #ccc;border-bottom:none}div.rui-rte-toolbar div.line{display:inline-block; *display:inline; *zoom:1;margin-bottom:1px}div.rui-rte-toolbar div.bar{display:inline-block; *display:inline; *zoom:1;margin-right:2px}div.rui-rte-toolbar div.tool{display:inline-block; *display:inline; *zoom:1;margin-right:1px;vertical-align:middle;position:relative;cursor:pointer;border:1px solid #bbb;background-image:url(/assets/rightjs-ui/rte.png);background-position:0px 0px;background-color:#fff;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}div.rui-rte-toolbar div.tool:hover{background-color:#ddd;border-color:#777}div.rui-rte-toolbar div.active{background-position:-20px 0px;background-color:#eee;border-color:#666;box-shadow:#aaa .025em .025em .5em;-moz-box-shadow:#aaa .025em .025em .5em;-webkit-box-shadow:#aaa .025em .025em .5em}div.rui-rte-toolbar div.disabled,div.rui-rte-toolbar div.disabled:hover{opacity:.4;filter:alpha(opacity=40);background-position:-40px 0px;background-color:#eee;border-color:#aaa;cursor:default}div.rui-rte-toolbar div.highlight{background-color:#BBB;border-color:#666}div.rui-rte-toolbar div.icon{height:20px;width:20px;background-image:url(/assets/rightjs-ui/rte.png);background-repeat:no-repeat;background-position:20px 20px}div.rui-rte-toolbar div.save div.icon{background-position:0px -20px}div.rui-rte-toolbar div.clear div.icon{background-position:-20px -20px}div.rui-rte-toolbar div.source div.icon{background-position:-40px -20px}div.rui-rte-toolbar div.bold div.icon{background-position:0px -40px}div.rui-rte-toolbar div.italic div.icon{background-position:-20px -40px}div.rui-rte-toolbar div.underline div.icon{background-position:-40px -40px}div.rui-rte-toolbar div.strike div.icon{background-position:-60px -40px}div.rui-rte-toolbar div.cut div.icon{background-position:0px -60px}div.rui-rte-toolbar div.copy div.icon{background-position:-20px -60px}div.rui-rte-toolbar div.paste div.icon{background-position:-40px -60px}div.rui-rte-toolbar div.pastetext div.icon{background-position:-60px -60px}div.rui-rte-toolbar div.left div.icon{background-position:0px -80px}div.rui-rte-toolbar div.center div.icon{background-position:-20px -80px}div.rui-rte-toolbar div.right div.icon{background-position:-40px -80px}div.rui-rte-toolbar div.justify div.icon{background-position:-60px -80px}div.rui-rte-toolbar div.undo div.icon{background-position:0px -100px}div.rui-rte-toolbar div.redo div.icon{background-position:-20px -100px}div.rui-rte-toolbar div.quote div.icon{background-position:0px -120px}div.rui-rte-toolbar div.code div.icon{background-position:-20px -120px}div.rui-rte-toolbar div.ttext div.icon{background-position:-40px -120px}div.rui-rte-toolbar div.header div.icon{background-position:-60px -120px}div.rui-rte-toolbar div.image div.icon{background-position:0px -140px}div.rui-rte-toolbar div.link div.icon{background-position:-20px -140px}div.rui-rte-toolbar div.video div.icon{background-position:-40px -140px}div.rui-rte-toolbar div.dotlist div.icon{background-position:0px -160px}div.rui-rte-toolbar div.numlist div.icon{background-position:-20px -160px}div.rui-rte-toolbar div.indent div.icon{background-position:-40px -160px}div.rui-rte-toolbar div.outdent div.icon{background-position:-60px -160px}div.rui-rte-toolbar div.forecolor div.icon{background-position:0px -180px}div.rui-rte-toolbar div.backcolor div.icon{background-position:-20px -180px}div.rui-rte-toolbar div.symbol div.icon{background-position:0px -200px}div.rui-rte-toolbar div.subscript div.icon{background-position:-20px -200px}div.rui-rte-toolbar div.superscript div.icon{background-position:-40px -200px}div.rui-rte-toolbar div.with-options{padding-right:8px}div.rui-rte-toolbar div.with-options div.trigger{position:absolute;right:0;height:100%;width:7px;text-align:center;background:#ccc;border-left:1px solid #bbb}div.rui-rte-toolbar div.bar div:hover div.trigger,div.rui-rte-toolbar div.bar div.active div.trigger{background:#aaa;border-color:#888}div.rui-rte-toolbar div.with-options div.icon{display:none}div.rui-rte-toolbar div.with-options div.display{display:block;line-height:20px;padding:0 6px;margin:0;color:#222;font-size:12px;background:#f8f8f8}div.rui-rte-toolbar div.with-options ul.options,div.rui-rte-toolbar div.with-options ul.options li{list-style:none;margin:0;padding:0}div.rui-rte-toolbar div.with-options ul.options{display:none;cursor:default;position:absolute;margin-bottom:1px;margin-left:-1px;background:#fff;border:1px solid #aaa;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em;box-shadow:#bbb .1em .1em .25em;-moz-box-shadow:#bbb .1em .1em .25em;-webkit-box-shadow:#bbb .1em .1em .25em}div.rui-rte-toolbar div.with-options ul.options li{padding:.2em .5em;white-space:nowrap;cursor:pointer}div.rui-rte-toolbar div.with-options ul.options li:hover{background-color:#eee}div.rui-rte-toolbar div.with-options ul.options li> *{margin:0;padding:0;border:none;position:static}div.rui-rte-toolbar div.color div.icon{display:block}div.rui-rte-toolbar div.color ul.options{padding-bottom:.5em}div.rui-rte-toolbar div.color ul.options li.group,div.rui-rte-toolbar div.color ul.options li.group:hover{background:none}div.rui-rte-toolbar div.color ul.options li.group ul{width:144px;clear:both;padding-top:.5em}div.rui-rte-toolbar div.color ul.options li.group ul li{float:left;width:16px;height:16px;line-height:16px;font-size:80%;text-align:center;text-indent:-9999em;padding:0;cursor:pointer;border:1px solid transparent}div.rui-rte-toolbar div.color ul.options li.group ul li:hover,div.rui-rte-toolbar div.color ul.options li.group ul li.active{background:none;border-color:#444;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.active{text-indent:0}div.rui-rte-toolbar div.color div.display{position:absolute;text-indent:-9999em;bottom:2px;left:3px;margin:0;padding:0;width:14px;height:4px;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.none{border-color:#444}div.rui-rte-toolbar div.color ul.options li.group ul li.label,div.rui-rte-toolbar div.color ul.options li.group ul li.label:hover{text-indent:0;border:none;margin-left:.5em;font-size:1em;cursor:default}div.rui-rte-editor{outline:none;outline:hidden;padding:.1em .3em;overflow:auto;background:white;border:1px solid #ccc}div.rui-rte-editor:focus{border-color:#aaa}div.rui-rte-editor> *:first-child{margin-top:0}div.rui-rte-editor> *:last-child{margin-bottom:0}div.rui-rte textarea.rui-rte-source{position:absolute;outline:none;resize:none}div.rui-rte-status{font-size:90%;height:1.4em;padding:0 .5em;color:#888;background:#eee;border:1px solid #ccc;border-top:none;border-radius:0 0 .25em .25em;-moz-border-radius:0 0 .25em .25em;-webkit-border-radius:0 0 .25em .25em}");
2693
+
2694
+ embed_style.type = 'text/css';
2695
+ document.getElementsByTagName('head')[0].appendChild(embed_style);
2696
+
2697
+ if(embed_style.styleSheet) {
2698
+ embed_style.styleSheet.cssText = embed_rules.nodeValue;
2699
+ } else {
2700
+ embed_style.appendChild(embed_rules);
2701
+ }
2682
2702
 
2683
2703
 
2684
2704
  return Rte;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RightJS-UI RTE v2.2.0
2
+ * RightJS-UI RTE v2.2.1
3
3
  * http://rightjs.org/ui/rte
4
4
  *
5
5
  * Copyright (C) 2010-2011 Nikolay Nemshilov
6
6
  */
7
- var Rte=RightJS.Rte=function(a,b,c){function y(a){var b=0;while(a=a.previousSibling)b++;return b}function x(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function w(a){a.commonAncestorContainer=a._.parentElement()}function v(a){var c=a.parentElement(),d,e,f,g,h;d=b.body.createTextRange(),d.moveToElementText(c),d.setEndPoint("EndToStart",a),e=d.text.length,e<c.innerText.length/2?(f=1,g=c.firstChild):(f=-1,g=c.lastChild,d.moveToElementText(c),d.setEndPoint("StartToStart",a),e=d.text.length);while(g){switch(g.nodeType){case 3:h=g.data.length;if(h<e)e-=h,f===1?d.moveStart("character",e):d.moveEnd("character",-e);else return f===1?{node:g,offset:e}:{node:g,offset:h-e};break;case 1:h=g.innerText.length,f===1?d.moveStart("character",h):d.moveEnd("character",-h),e=e-h}g=f===1?g.nextSibling:g.previousSibling}return{node:c,offset:0}}function d(b,c){c||(c=b,b="DIV");var d=new a.Class(a.Element.Wrappers[b]||a.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof a.Input||this instanceof a.Form||e.unshift(b),this.$super.apply(this,e),a.isString(d)&&(d=a.$(d)),d instanceof a.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return a.Wrapper.Cache[a.$uid(this._)]=this},setOptions:function(b,c){c&&(b=a.Object.merge(b,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),b&&a.Options.setOptions.call(this,a.Object.merge(this.options,b));return this}}),e=new a.Class(d,c);a.Observer.createShortcuts(e.prototype,e.EVENTS||a([]));return e}var e=a,f=a.$,g=a.$$,h=a.$w,i=a.$E,j=a.$A,k=a.isArray,l=a.RegExp,m=a.Class,n=a.Element,o=a.Input,p=new d({extend:{version:"2.2.0",EVENTS:h("change focus blur"),supported:"contentEditable"in b.createElement("div"),Options:{toolbar:"small",autoresize:!0,showToolbar:!0,showStatus:!0,videoSize:"425x344",cssRule:"textarea[data-rte]"},Toolbars:{small:["Bold Italic Underline Strike Ttext|Cut Copy Paste|Header Code Quote|Link Image Video|Source"],basic:["Save Clear|Cut Copy Paste|Bold Italic Underline Strike Ttext|Left Center Right Justify","Undo Redo|Header Code Quote|Link Image Video|Dotlist Numlist|Indent Outdent|Source"],extra:["Save Clear|Cut Copy Paste|Bold Italic Underline Strike Ttext|Left Center Right Justify","Undo Redo|Header Code Quote|Link Image Video|Subscript Superscript|Dotlist Numlist|Indent Outdent","Format|Fontname Fontsize|Forecolor Backcolor|Source"]},Tools:{},Shortcuts:{Bold:"b",Italic:"i",Underline:"u",Header:"h",Link:"l",Cut:"x",Copy:"c",Paste:"v",Undo:"z",Redo:"shift+z",Source:"e",Code:"p",Save:"s"},Tags:{Bold:"b",Italic:"i",Underline:"u",Strike:"s",Ttext:"tt",Code:"pre",Quote:"blockquote",Header:"h2"},Formats:{h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",p:"Paragraph",pre:"Preformatted",blockquote:"Blockquote",tt:"Typetext",address:"Address"},FontNames:{"Andale Mono":"andale mono,times",Arial:"arial,helvetica,sans-serif","Arial Black":"arial black,avant garde","Book Antiqua":"book antiqua,palatino","Comic Sans MS":"comic sans ms,sans-serif","Courier New":"courier new,courier",Georgia:"georgia,palatino",Helvetica:"helvetica",Impact:"impact,chicago",Symbol:"symbol",Tahoma:"tahoma,arial,helvetica,sans-serif",Terminal:"terminal,monaco","Times New Roman":"times new roman,times","Trebuchet MS":"trebuchet ms,geneva",Verdana:"verdana,geneva",Webdings:"webdings",Wingdings:"wingdings,zapf dingbats"},FontSizes:"6pt 7pt 8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 36pt",Videos:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/,"$1/v/$2"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/,"$1/googleplayer.swf?docId=$2"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/,"$1/moogaloop.swf?clip_id=$2"]],i18n:{Clear:"Clear",Save:"Save",Source:"Source",Bold:"Bold",Italic:"Italic",Underline:"Underline",Strike:"Strike through",Ttext:"Typetext",Header:"Header",Cut:"Cut",Copy:"Copy",Paste:"Paste",Left:"Left",Center:"Center",Right:"Right",Justify:"Justify",Undo:"Undo",Redo:"Redo",Code:"Code block",Quote:"Block quote",Link:"Add link",Image:"Insert image",Video:"Insert video",Dotlist:"List with dots",Numlist:"List with numbers",Indent:"Indent",Outdent:"Outdent",Forecolor:"Text color",Backcolor:"Background color",Select:"Select",Remove:"Remove",Format:"Format",Fontname:"Font name",Fontsize:"Size",Subscript:"Subscript",Superscript:"Superscript",UrlAddress:"URL Address"},current:null},initialize:function(a,b){this.$super("rte",{}).setOptions(b,a).append(this.toolbar=new p.Toolbar(this),this.editor=new p.Editor(this),this.status=new p.Status(this)),this.options.showToolbar||this.toolbar.hide(),this.options.showStatus||this.status.hide(),a&&this.assignTo(a),this.undoer=new p.Undoer(this),this.selection=new p.Selection(this),this.selection.exec("styleWithCss",!1),this.status.update()},setValue:function(a){this.textarea&&this.textarea.value(a),this.editor.update(a);return this},getValue:function(){return this.editor._.innerHTML},value:function(a){return this[a===undefined?"getValue":"setValue"](a)},disable:function(){this.disabled=!0;return this.addClass("rui-rte-disabled")},enable:function(){this.disabled=!1;return this.removeClass("rui-rte-disabled")},focus:function(){p.current!==this&&(p.current=this,this.editor.focus());return this},blur:function(){p.current=null,this.editor.blur();return this},assignTo:function(a){var b=f(a),c=b.size();p.supported?(this.insertTo(b.setStyle("position:absolute;left:-9999em;"),"before"),this.editor.resize(c),this.setWidth(c.x),this.options.autoresize&&this.editor.setStyle({minHeight:c.y+"px",height:"auto"})):b.setStyle("visibility:visible"),this.setValue(b.value()),this.onChange(function(){b._.value=this.editor._.innerHTML}),this.textarea=b;return this}});p.Toolbar=new m(n,{initialize:function(a){this.$super("div",{"class":"rui-rte-toolbar"}),this.rte=a,a.tools={};var b=a.options,c=b.toolbar;e(p.Toolbars[c]||(k(c)?c:[c])).each(function(b){var c=i("div",{"class":"line"}).insertTo(this);e(b.split("|")).each(function(b){if(!e(b).blank()){var d=i("div",{"class":"bar"}).insertTo(c);e(b.split(" ")).each(function(b){b=e(b).capitalize(),d.insert(new p.Tools[b](a))})}})},this),a.tools.Undo||new p.Tools.Undo(a),a.tools.Redo||new p.Tools.Redo(a)},shortcut:function(a){var b=a._,c,d;for(c in this.rte.tools){d=this.rte.tools[c];if(d.shortcut===b.keyCode&&d.shiftKey===b.shiftKey)return d}return null}}),p.Editor=new m(n,{initialize:function(a){this.$super(a.append('<div contenteditable="true" class="rui-rte-editor"></div>').first("div.rui-rte-editor")._),this.rte=a,this.on({focus:this._focus,blur:this._blur,mouseup:this._mouseup,keypress:this._keypress,keydown:this._keydown,keyup:this._keyup})},update:function(a){this.$super(a);return this},focus:function(){this._.focus();return this},blur:function(){this._.blur();return this},removeElement:function(a){if(a!==null){var b=a.parentNode;while(a.firstChild)b.insertBefore(a.firstChild,a);b.removeChild(a)}},_focus:function(){this.rte.selection.restore(),this.rte.status.update(),this.rte.focused=!0},_blur:function(){this.rte.focused=!1,this.rte.status.update()},_mouseup:function(){this._focus()},_keypress:function(a){this.__stopped&&a.stop()},_keydown:function(a){var b=a._,c=!1,d;if(b.metaKey||b.ctrlKey)(d=this.rte.toolbar.shortcut(a))&&d.call(a),c=a.stopped;this.__stopped=c},_keyup:function(a){switch(a.keyCode){case 37:case 38:case 39:case 40:this.rte.status.update();break;default:var b=this.rte,d=this._;this._timer!==!1&&c.clearTimeout(this._timer),this._timer=c.setTimeout(function(){b.__old_value!==d.innerHTML&&(b.__old_value=d.innerHTML,b.fire("change"))},this._delay)}},_timer:!1,_delay:400}),p.Status=new m(n,{initialize:function(a){this.$super("div",{"class":"rui-rte-status"}),this.rte=a,this.nodes=[],this.tags=[],this.onMousedown(this._mousedown)},update:function(){this._findNodes(),this._checkTools();return this.$super(this.nodes.map(function(a,b){var c=a.tagName.toLowerCase();a.id&&(c+="#"+a.id),a.className&&(c+="."+a.className);return'<a href="" data-index="'+b+'" onclick="return false;" title="'+p.i18n.Select+'">'+c+"</a>"}).join(" &rsaquo; "))},findElement:function(a,b){if(a)for(var c=this.nodes.length-1,d,e;c>-1;c--)if(this.nodes[c].tagName===a){e=!0;for(d in b)b[d]instanceof l?e&=b[d].test(this.nodes[c].getAttribute(d)):e&=this.nodes[c].getAttribute(d)==b[d];if(e)return this.nodes[c]}return null},_checkTools:function(){var a=this.rte.tools,b;for(b in a)a[b].check()},_findNodes:function(){var a=this.rte.selection.element(),b=this.rte.editor._,c=this.rte._,d=[],e=[];this.nodes=[],this.tags=[];while(a&&a!==c){a.tagName&&(d.unshift(a),e.unshift(a.tagName)),a=a.parentNode;if(a===b){this.nodes=d,this.tags=e;break}}},_mousedown:function(a){var b=a.target;if(b._.tagName==="A"){a.stop();var c=b.get("data-index").toInt(),d=this.nodes[c];this.rte.selection.wrap(d)}}}),p.Undoer=new m({initialize:function(a){function b(){this.undoer.save()}this.rte=a,this.rte.on({focus:b,change:b}),this.clear()},clear:function(){this.stash=[],this.index=-1},hasUndo:function(){return this.stash.length>0&&this.index>0},hasRedo:function(){return this.stash.length-this.index>1},undo:function(){this.hasUndo()&&this.set(--this.index)},redo:function(){this.hasRedo()&&this.set(++this.index)},set:function(a){this.stash[this.index]&&(this.rte.editor.update(this.stash[this.index]),this.rte.selection.restore())},save:function(a){var b=a&&a.tool,c=this.rte.tools,d,e,f;if(!b||b!==c.Undo&&b!==c.Redo)this.rte.selection.store(),d=this.rte.editor._.innerHTML,e=d.replace(s,"").replace(t,""),f=(this.stash[this.index]||"").replace(s,"").replace(t,""),e!==f&&(this.stash.length=this.index+1,this.stash.push(d),this.index=this.stash.length-1,c.Undo.check(),c.Redo.check()),this.rte.selection.restore()}}),p.Selection=new m({initialize:function(a){this.rte=a},range:function(a){var d=c.getSelection&&c.getSelection();if(a)d?(d.removeAllRanges(),d.addRange(a)):a._&&a._.select();else{try{a=d.getRangeAt(0)}catch(e){try{a=b.createRange()}catch(f){a=new u}}return a}},element:function(){var a=this.range(),b=a.commonAncestorContainer;a.collapsed||a.startContainer===b&&a.startOffset-a.endOffset<2&&a.startContainer.hasChildNodes()&&(b=a.startContainer.childNodes[a.startOffset]),b=b&&b.nodeType===3?b.parentNode:b;return b||null},wrap:function(a){var b=this.range();b.selectNode(a),this.range(b)},text:function(){return this.range().toString()},empty:function(){return this.text()===""},html:function(){var a=this.range(),c,d;if(a._)return a._.htmlText;c=b.createElement("div"),d=a.cloneContents();while(d.firstChild)c.appendChild(d.firstChild);return c.innerHTML},exec:function(a,c){try{b.execCommand(a,!1,c)}catch(d){a==="inserthtml"&&this.range()._.pasteHTML(c)}},store:function(){function c(c){function j(a,b){b.nextSibling?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.appendChild(a)}var d=a[c+"Container"],e=a[c+"Offset"],f=b.createElement("span"),g=d.parentNode,h=d.nodeValue,i=b.createTextNode((""+h).substr(e));f.setAttribute("rrte-"+c,"1"),d.nodeType===3?e===0?g.insertBefore(f,c==="start"&&a.collapsed?d.previousSibling:d):e===h.length?j(f,d):(d.nodeValue=h.substr(0,e),j(i,d),g.insertBefore(f,i)):d.nodeType===1&&(e===0?d.firstChild?d.insertBefore(f,d.firstChild):d.hasChildNodes()&&d.appendChild(f):e===d.childNodes.length?d.appendChild(f):d.insertBefore(f,d.childNodes[e]))}var a=this.range();a={startContainer:a.startContainer,startOffset:a.startOffset,endContainer:a.endContainer,endOffset:a.endOffset,collapsed:a.collapsed},c("end"),c("start")},restore:function(){var a=j(this.rte.editor._.getElementsByTagName("span")),b=0,c,d,e,f=this.range();for(;b<a.length;b++)c=a[b].getAttribute("rrte-start")?"setStart":a[b].getAttribute("rrte-end")?"setEnd":!1,c&&(d=a[b].parentNode,f._?f[c](a[b]):(e=y(a[b]),f[c](d,e)),d.removeChild(a[b]));this.range(f)}});var q='<span rrte-start="1"></span>',r='<span rrte-end="1"></span>',s=new l(l.escape(q),"i"),t=new l(l.escape(r),"i"),u=new m({collapsed:null,startContainer:null,startOffset:null,endContainer:null,endOffset:null,commonAncestorContainer:null,initialize:function(){this._=b.selection.createRange();if(b.selection.type==="Control")this.startContainer=this.endContainer=this.commonAncestorContainer=this._(0),this.startOffset=this.endOffset=0;else{var a=this._.duplicate();a.collapse(!0),a=v(a),this.startContainer=a.node,this.startOffset=a.offset,a=this._.duplicate(),a.collapse(!1),a=v(a),this.endContainer=a.node,this.endOffset=a.offset,w(this)}x(this)},setStart:function(a,b){var c=this._.duplicate();c.moveToElementText(a),c.collapse(!0),this._.setEndPoint("StartToStart",c),this.startContainer=a,this.startOffset=b,this.endContainer===null&&this.endOffset===null&&(this.endContainer=a,this.endOffset=b),w(this),x(this)},setEnd:function(a,b){var c=this._.duplicate();c.moveToElementText(a),c.collapse(!0),this._.setEndPoint("EndToEnd",c),this.endContainer=a,this.endOffset=b,this.startContainer===null&&this.startOffset===null&&(this.startContainer=a,this.startOffset=b),w(this),x(this)},selectNode:function(a){this._.moveToElementText(a)},toString:function(){return""+this._.text}});p.Tool=new m(n,{block:!0,blip:!1,changes:!0,shortuct:null,shiftKey:!1,initialize:function(a){var b;for(b in p.Tools)if(p.Tools[b]===this.constructor)break;this.name=b,this.shortcut=this.shortcut||p.Shortcuts[b],this.$super("div",{html:'<div class="icon"></div>',"class":"tool "+b.toLowerCase(),title:(p.i18n[b]||b)+(this.shortcut?" ("+this.shortcut+")":"")}),this.rte=a,a.tools[b]=this,this.shortcut=this.shortcut&&this.shortcut.toLowerCase(),this.shiftKey=this.shortcut&&this.shortcut.indexOf("shift")>-1,this.shortcut=this.shortcut&&this.shortcut.toUpperCase().charCodeAt(this.shortcut.length-1),this.onMousedown(function(a){a.stop(),this.mousedown()});return this},exec:function(){},active:function(){return!1},enabled:function(){return!0},call:function(a){this.disabled||(a&&this.block&&a.stop(),this.exec(),this.rte.status.update(),this.rte.fire("change",{tool:this}),this.blip&&this.highlight())},check:function(){this._.className=this._.className.replace(" disabled",""),this.disabled=!1,this.name!=="Source"&&this.rte.srcMode===!0||!this.enabled()?(this._.className+=" disabled",this.disabled=!0):(this._.className=this._.className.replace(" active",""),this.active()&&(this._.className+=" active"))},highlight:function(){e(this.addClass("highlight").removeClass).bind(this,"highlight").delay(100)},mousedown:function(){this.call()}}),p.Tool.Command=new m(p.Tool,{command:null,value:null,exec:function(){this.rte.selection.exec(this.command,this.value)},enabled:function(){try{return b.queryCommandEnabled(this.command)}catch(a){return!1}},active:function(){try{return this.value===null?b.queryCommandState(this.command):b.queryCommandValue(this.command)==this.value}catch(a){return!1}}}),p.Tool.Format=new m(p.Tool,{tag:null,atts:{},initialize:function(a){this.$super(a),this.tag=(this.tag||p.Tags[this.name]||"").toUpperCase();return this},exec:function(){this[this.active()?"unformat":"format"]()},active:function(){return this.element()!==null},element:function(){return this.rte.status.findElement(this.tag,this.attrs)},unformat:function(){this._format(!1)},format:function(){this._format(!0)},_format:function(a){var b="<"+this.tag,c="</"+this.tag+">",d=this.rte.editor,e=this.rte.selection,f=e.range(),g=e.text(),h=this.element(),i=h&&(h.textContent||h.innerText);for(var j in this.attrs)b+=" "+j+'="'+this.attrs[j]+'"';b+=">",e.store(),!a&&f._&&d.html(d.html().replace(new l(l.escape(q+b),"i"),b+q)),a?d.html(d.html().replace(s,b+q).replace(t,r+c)):h&&g===i?d.removeElement(h):d.html(d.html().replace(s,c+q).replace(t,r+b).replace(/<([a-z]+)[^>]*?>\s*?<\/\1>/ig,"")),e.restore()}}),p.Tool.Options={build:function(a){this.trigger=i("div",{"class":"trigger",html:"&middot;"}),this.display=i("div",{"class":"display"}),this.options=i("ul",{"class":"options"}),this.addClass("with-options").append(this.display,this.options).insert(this.trigger,"top"),this.items={};for(var c in a)this.items[c]=i("li").insert(a[c]),this.items[c].insertTo(this.options).value=c;this.items[""]=i("li",{"class":"remove",html:"--",title:p.i18n.Remove}),this.items[""].insertTo(this.options,"top").value="",this.options.onMousedown(e(this.pick).bind(this));var d=e(this.options.hide).bind(this.options,null);f(b).on({mousedown:d,keydown:function(a){a.keyCode===27&&d()}}),this.value="",this.updateDisplay(null);return this},pick:function(a){var b=a.stop().target;b._.tagName!=="LI"&&(b=b.parent("LI")),b.value!==undefined&&(this.options.hide(),this.value=b.value,this.updateDisplay(this.value||null),this.markActive(),this.exec())},mousedown:function(){this.disabled||(g(".rui-rte-toolbar div.with-options ul.options").without(this.options).each("hide"),this.options.hidden()&&this.value!==null&&this.markActive(),this.options.toggle("fade",{duration:"short"}))},markActive:function(){for(var a in this.items)this.items[a][a===this.value?"addClass":"removeClass"]("active")},updateDisplay:function(a){this.display.update(a!==null&&a in this.items?this.items[a].text():this._.title)}},p.Tool.Style=new m(p.Tool.Format,{include:p.Tool.Options,tag:"span",style:null,initialize:function(a,b){this.re=new l("(^|;)\\s*"+l.escape(this.style+":")+"\\s*(.+?)\\s*(;|$)"),this.attrs={style:this.re},this.$super(a).build(b);return this},exec:function(){this.active()&&(this.attrs={style:this.style+":"+this._value},this.unformat()),this.value&&(this.attrs={style:this.style+":"+this.value},this.format()),this.attrs={style:this.re}},active:function(){var a=this.element(),b=!1,c=null;a!==null&&(this._value=c=this.getStyleValue(),b=!0),this.updateDisplay(c);return b},getStyleValue:function(){var a=this.element(),b=a!==null?a.getAttribute("style"):null;b!==null&&((b=b.match(this.re))!==null&&(b=b[2]));return b}}),p.Tool.Color=new m(p.Tool.Style,{extend:{COLORS:e(["000000 444444 666666 999999 cccccc eeeeee f4f4f4 ffffff","f24020 f79c33 fff84c 6af244 5ef9fd 0048f7 8950f7 ee5ff8","e39e9b f5cba1 fee3a1 bcd3ab a6c3c8 a2c6e5 b1abd3 d0aabc d77169 f1b374 fdd675 9cbe83 7ca4ae 74aad8 8983bf bb839f cc0100 e79138 f1c332 69a84f 45818e 3d85c6 674ea7 a64d79 990000 b45f05 bf9000 38761c 134f5c 0b5394 351b75 751a47 660000 783e03 7f6000 264e13 0b333d 063763 1f124c 4c1030"])},initialize:function(a){this.$super(a,{}).addClass("color"),this.display.clean(),p.Tool.Color.COLORS.each(function(a){var b=i("li",{"class":"group"}),c=i("ul").insertTo(b),d=a.split(" "),e=0,f,g;for(;e<d.length;e++){f="#"+d[e],g=(parseInt("ffffff",16)-parseInt(d[e],16)).toString(16);while(g.length<6)g+="0";this.items[f]=i("li",{html:"&bull;",style:{background:f,color:"#"+g}}),this.items[f].insertTo(c).value=f}this.options.append(b)},this);return this},getStyleValue:function(){var a=this.$super(),b;if(a!==null)if(b=/^#(\w)(\w)(\w)$/.exec(a))a="#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3];else if(b=/^\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)\s*$/.exec(a))a="#"+e(b.slice(1)).map(function(a){a=(a-0).toString(16);return a.length===1?"0"+a:a}).join("");return a},updateDisplay:function(a){this.display._.style.background=a===null?"transparent":a}}),p.Tool.Url=new m(p.Tool,{attr:null,exec:function(a){a===undefined?this.prompt():a?this[this.element()?"url":"create"](a):this.rte.editor.removeElement(this.element())},active:function(){return this.element()!==null},prompt:function(){var a=prompt(p.i18n.UrlAddress,this.url()||"http://some.url.com");a!==null&&this.exec(a)},url:function(a){if(this.element())if(a!==undefined)this.element()[this.attr]=a;else return this.element()[this.attr]},create:function(a){this.rte.selection.exec(this.command,a)}}),p.Tools.Bold=new m(p.Tool.Format,{}),p.Tools.Italic=new m(p.Tool.Format,{}),p.Tools.Underline=new m(p.Tool.Format,{}),p.Tools.Strike=new m(p.Tool.Format,{}),p.Tools.Cut=new m(p.Tool.Command,{command:"cut",block:!1,blip:!0}),p.Tools.Copy=new m(p.Tools.Cut,{command:"copy"}),p.Tools.Paste=new m(p.Tools.Cut,{command:"paste"}),p.Tools.Left=new m(p.Tool.Command,{command:"justifyleft"}),p.Tools.Center=new m(p.Tool.Command,{command:"justifycenter"}),p.Tools.Right=new m(p.Tool.Command,{command:"justifyright"}),p.Tools.Justify=new m(p.Tool.Command,{command:"justifyfull"}),p.Tools.Undo=new m(p.Tool,{blip:!0,exec:function(){this.rte.undoer.undo()},enabled:function(){return this.rte.undoer.hasUndo()}}),p.Tools.Redo=new m(p.Tool,{blip:!0,exec:function(){this.rte.undoer.redo()},enabled:function(){return this.rte.undoer.hasRedo()}}),p.Tools.Code=new m(p.Tool.Format,{}),p.Tools.Quote=new m(p.Tool.Format,{}),p.Tools.Ttext=new m(p.Tool.Format,{}),p.Tools.Header=new m(p.Tool.Format,{}),p.Tools.Link=new m(p.Tool.Url,{command:"createlink",attr:"href",enabled:function(){return!this.rte.selection.empty()||this.active()},element:function(){return this.rte.status.findElement("A",{})}}),p.Tools.Image=new m(p.Tool.Url,{command:"insertimage",attr:"src",element:function(){var a=this.rte.selection.element();return a!==null&&a.tagName==="IMG"?a:null}}),p.Tools.Video=new m(p.Tool.Url,{command:"inserthtml",enabled:function(){return!0},element:function(){return this.rte.status.findElement("OBJECT",{})},url:function(a){var b=this.element()&&this.element().getElementsByTagName("embed")[0];if(b)if(a!==undefined)b.src=this.swfUrl(a);else return b.src},create:function(a){var b=this.swfUrl(a),c='width="'+this.rte.options.videoSize.split("x")[0]+'" height="'+this.rte.options.videoSize.split("x")[1]+'"';this.$super("<object "+c+'><param name="src" value="'+b+'" /><embed src="'+b+'" type="application/x-shockwave-flash" '+c+" /></object>")},swfUrl:function(a){return e(p.Videos).map(function(b){return a.match(b[0])?a.replace(b[0],b[1]):null}).compact()[0]||a}}),p.Tools.Dotlist=new m(p.Tool.Command,{command:"insertunorderedlist"}),p.Tools.Numlist=new m(p.Tool.Command,{command:"insertorderedlist"}),p.Tools.Indent=new m(p.Tool.Command,{command:"indent"}),p.Tools.Outdent=new m(p.Tool.Command,{command:"outdent"}),p.Tools.Forecolor=new m(p.Tool.Color,{style:"color"}),p.Tools.Backcolor=new m(p.Tool.Color,{style:"background-color"}),p.Tools.Source=new m(p.Tool,{source:!1,exec:function(){this[this.rte.srcMode?"showPreview":"showSource"](),this.rte.srcMode=!this.rte.srcMode},active:function(){return this.rte.srcMode},showPreview:function(){this.rte.editor.setStyle("visibility:visible"),this.source&&(this.rte.value(this.source.value()),this.source.remove()),this.rte.editor.focus()},showSource:function(){this.rte.editor.setStyle("visibility:hidden;"),(this.source=this.source||i("textarea",{"class":"rui-rte-source"})).insertTo(this.rte.editor,"before").resize(this.rte.editor.size()).setValue(""+this.rte.value()).focus(),this.rte.focused=!0,this.rte.status.update();for(var a in this.rte.tools)this.rte.tools[a]!==this&&this.rte.tools[a].addClass("disabled")}}),p.Tools.Clear=new m(p.Tool,{exec:function(){this.rte.editor.clean()}}),p.Tools.Save=new m(p.Tool,{initialize:function(a){this.$super(a);if(!a.textarea||!a.textarea.form())this.disabled=!0,this.addClass("disabled")},exec:function(){this.disabled||this.rte.textarea.form().submit()},check:function(){}}),p.Tools.Format=new m(p.Tool.Format,{include:p.Tool.Options,initialize:function(a){var b={},c,d,e;this.formats={};for(c in p.Formats)if(e=c.match(/^([a-z0-9]+)(\.([a-z0-9_\-]+))?$/))d=e[1],this.formats[c]={tag:d.toUpperCase(),attrs:{},match:{}},e[3]&&(this.formats[c].attrs["class"]=e[3],this.formats[c].match["class"]=new l("(^|\\s+)"+l.escape(e[3])+"(\\s+|$)")),b[c]="<"+d+' class="'+e[3]+'">'+p.Formats[c]+"</"+d+">";this.$super(a).build(b);return this},exec:function(){this.active()&&this.rule&&(this.tag=this.formats[this.rule].tag,this.attrs=this.formats[this.rule].attrs,this.unformat()),this.value&&this.formats[this.value]&&(this.tag=this.formats[this.value].tag,this.attrs=this.formats[this.value].attrs,this.format())},active:function(){var a=this.element()!==null;this.updateDisplay(this.rule);return a},element:function(){var a,b,c=this.rte.status;for(a in this.formats){b=c.findElement(this.formats[a].tag,this.formats[a].match);if(b!==null){this.rule=a;return b}}return this.rule=null}}),p.Tools.Fontname=new m(p.Tool.Style,{style:"font-family",initialize:function(a){var b={},c,d=p.FontNames;for(c in d)b[d[c]]='<div style="font-family:'+d[c]+'">'+c+"</div>";return this.$super(a,b)}}),p.Tools.Fontsize=new m(p.Tool.Style,{style:"font-size",initialize:function(a){var b={},c=0,d=p.FontSizes.split(/\s+/);for(;c<d.length;c++)b[d[c]]='<div style="font-size:'+d[c]+'">'+d[c]+"</div>";return this.$super(a,b)}}),p.Tools.Subscript=new m(p.Tool.Command,{command:"subscript"}),p.Tools.Superscript=new m(p.Tool.Command,{command:"superscript"}),f(b).onReady(function(){g(p.Options.cssRule).each("getRich")}),o.include({getRich:function(a){this._.type==="textarea"&&!this.rte&&(this.rte=new p(this,a));return this.rte}});var z=b.createElement("style"),A=b.createTextNode("div.rui-rte,div.rui-rte-toolbar,div.rui-rte-toolbar *,div.rui-rte-editor,div.rui-rte-status,div.rui-rte-status *{margin:0;padding:0;background:none;border:none;width:auto;height:auto}textarea[data-rte]{visibility:hidden}div.rui-rte{display:inline-block; *display:inline; *zoom:1;position:relative}div.rui-rte-toolbar{padding:.15em .3em;background:#eee;border-radius:.25em .25em 0 0;-moz-border-radius:.25em .25em 0 0;-webkit-border-radius:.25em .25em 0 0;border:1px solid #ccc;border-bottom:none}div.rui-rte-toolbar div.line{display:inline-block; *display:inline; *zoom:1;margin-bottom:1px}div.rui-rte-toolbar div.bar{display:inline-block; *display:inline; *zoom:1;margin-right:2px}div.rui-rte-toolbar div.tool{display:inline-block; *display:inline; *zoom:1;margin-right:1px;vertical-align:middle;position:relative;cursor:pointer;border:1px solid #bbb;background-image:url(/assets/rightjs-ui/rte.png);background-position:0px 0px;background-color:#fff;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}div.rui-rte-toolbar div.tool:hover{background-color:#ddd;border-color:#777}div.rui-rte-toolbar div.active{background-position:-20px 0px;background-color:#eee;border-color:#666;box-shadow:#aaa .025em .025em .5em;-moz-box-shadow:#aaa .025em .025em .5em;-webkit-box-shadow:#aaa .025em .025em .5em}div.rui-rte-toolbar div.disabled,div.rui-rte-toolbar div.disabled:hover{opacity:.4;filter:alpha(opacity=40);background-position:-40px 0px;background-color:#eee;border-color:#aaa;cursor:default}div.rui-rte-toolbar div.highlight{background-color:#BBB;border-color:#666}div.rui-rte-toolbar div.icon{height:20px;width:20px;background-image:url(/images/rightjs-ui/rte.png);background-repeat:no-repeat;background-position:20px 20px}div.rui-rte-toolbar div.save div.icon{background-position:0px -20px}div.rui-rte-toolbar div.clear div.icon{background-position:-20px -20px}div.rui-rte-toolbar div.source div.icon{background-position:-40px -20px}div.rui-rte-toolbar div.bold div.icon{background-position:0px -40px}div.rui-rte-toolbar div.italic div.icon{background-position:-20px -40px}div.rui-rte-toolbar div.underline div.icon{background-position:-40px -40px}div.rui-rte-toolbar div.strike div.icon{background-position:-60px -40px}div.rui-rte-toolbar div.cut div.icon{background-position:0px -60px}div.rui-rte-toolbar div.copy div.icon{background-position:-20px -60px}div.rui-rte-toolbar div.paste div.icon{background-position:-40px -60px}div.rui-rte-toolbar div.left div.icon{background-position:0px -80px}div.rui-rte-toolbar div.center div.icon{background-position:-20px -80px}div.rui-rte-toolbar div.right div.icon{background-position:-40px -80px}div.rui-rte-toolbar div.justify div.icon{background-position:-60px -80px}div.rui-rte-toolbar div.undo div.icon{background-position:0px -100px}div.rui-rte-toolbar div.redo div.icon{background-position:-20px -100px}div.rui-rte-toolbar div.quote div.icon{background-position:0px -120px}div.rui-rte-toolbar div.code div.icon{background-position:-20px -120px}div.rui-rte-toolbar div.ttext div.icon{background-position:-40px -120px}div.rui-rte-toolbar div.header div.icon{background-position:-60px -120px}div.rui-rte-toolbar div.image div.icon{background-position:0px -140px}div.rui-rte-toolbar div.link div.icon{background-position:-20px -140px}div.rui-rte-toolbar div.video div.icon{background-position:-40px -140px}div.rui-rte-toolbar div.dotlist div.icon{background-position:0px -160px}div.rui-rte-toolbar div.numlist div.icon{background-position:-20px -160px}div.rui-rte-toolbar div.indent div.icon{background-position:-40px -160px}div.rui-rte-toolbar div.outdent div.icon{background-position:-60px -160px}div.rui-rte-toolbar div.forecolor div.icon{background-position:0px -180px}div.rui-rte-toolbar div.backcolor div.icon{background-position:-20px -180px}div.rui-rte-toolbar div.symbol div.icon{background-position:0px -200px}div.rui-rte-toolbar div.subscript div.icon{background-position:-20px -200px}div.rui-rte-toolbar div.superscript div.icon{background-position:-40px -200px}div.rui-rte-toolbar div.with-options{padding-right:8px}div.rui-rte-toolbar div.with-options div.trigger{position:absolute;right:0;height:100%;width:7px;text-align:center;background:#ccc;border-left:1px solid #bbb}div.rui-rte-toolbar div.bar div:hover div.trigger,div.rui-rte-toolbar div.bar div.active div.trigger{background:#aaa;border-color:#888}div.rui-rte-toolbar div.with-options div.icon{display:none}div.rui-rte-toolbar div.with-options div.display{display:block;line-height:20px;padding:0 6px;margin:0;color:#222;font-size:12px;background:#f8f8f8}div.rui-rte-toolbar div.with-options ul.options,div.rui-rte-toolbar div.with-options ul.options li{list-style:none;margin:0;padding:0}div.rui-rte-toolbar div.with-options ul.options{display:none;cursor:default;position:absolute;margin-bottom:1px;margin-left:-1px;background:#fff;border:1px solid #aaa;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em;box-shadow:#bbb .1em .1em .25em;-moz-box-shadow:#bbb .1em .1em .25em;-webkit-box-shadow:#bbb .1em .1em .25em}div.rui-rte-toolbar div.with-options ul.options li{padding:.2em .5em;white-space:nowrap;cursor:pointer}div.rui-rte-toolbar div.with-options ul.options li:hover{background-color:#eee}div.rui-rte-toolbar div.with-options ul.options li> *{margin:0;padding:0;border:none;position:static}div.rui-rte-toolbar div.color div.icon{display:block}div.rui-rte-toolbar div.color ul.options{padding-bottom:.5em}div.rui-rte-toolbar div.color ul.options li.group,div.rui-rte-toolbar div.color ul.options li.group:hover{background:none}div.rui-rte-toolbar div.color ul.options li.group ul{width:144px;clear:both;padding-top:.5em}div.rui-rte-toolbar div.color ul.options li.group ul li{float:left;width:16px;height:16px;line-height:16px;font-size:80%;text-align:center;text-indent:-9999em;padding:0;cursor:pointer;border:1px solid transparent}div.rui-rte-toolbar div.color ul.options li.group ul li:hover,div.rui-rte-toolbar div.color ul.options li.group ul li.active{background:none;border-color:#444;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.active{text-indent:0}div.rui-rte-toolbar div.color div.display{position:absolute;text-indent:-9999em;bottom:2px;left:3px;margin:0;padding:0;width:14px;height:4px;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.none{border-color:#444}div.rui-rte-toolbar div.color ul.options li.group ul li.label,div.rui-rte-toolbar div.color ul.options li.group ul li.label:hover{text-indent:0;border:none;margin-left:.5em;font-size:1em;cursor:default}div.rui-rte-editor{outline:none;outline:hidden;padding:.1em .3em;overflow:auto;background:white;border:1px solid #ccc}div.rui-rte-editor:focus{border-color:#aaa}div.rui-rte-editor> *:first-child{margin-top:0}div.rui-rte-editor> *:last-child{margin-bottom:0}div.rui-rte textarea.rui-rte-source{position:absolute;outline:none;resize:none}div.rui-rte-status{font-size:90%;height:1.4em;padding:0 .5em;color:#888;background:#eee;border:1px solid #ccc;border-top:none;border-radius:0 0 .25em .25em;-moz-border-radius:0 0 .25em .25em;-webkit-border-radius:0 0 .25em .25em}");z.type="text/css",b.getElementsByTagName("head")[0].appendChild(z),z.styleSheet?z.styleSheet.cssText=A.nodeValue:z.appendChild(A);return p}(RightJS,document,window)
7
+ var Rte=RightJS.Rte=function(a,b,c){function y(a){var b=0;while(a=a.previousSibling)b++;return b}function x(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset}function w(a){a.commonAncestorContainer=a._.parentElement()}function v(a){var c=a.parentElement(),d,e,f,g,h;d=b.body.createTextRange(),d.moveToElementText(c),d.setEndPoint("EndToStart",a),e=d.text.length,e<c.innerText.length/2?(f=1,g=c.firstChild):(f=-1,g=c.lastChild,d.moveToElementText(c),d.setEndPoint("StartToStart",a),e=d.text.length);while(g){switch(g.nodeType){case 3:h=g.data.length;if(h<e)e-=h,f===1?d.moveStart("character",e):d.moveEnd("character",-e);else return f===1?{node:g,offset:e}:{node:g,offset:h-e};break;case 1:h=g.innerText.length,f===1?d.moveStart("character",h):d.moveEnd("character",-h),e=e-h}g=f===1?g.nextSibling:g.previousSibling}return{node:c,offset:0}}function d(b,c){c||(c=b,b="DIV");var d=new a.Class(a.Element.Wrappers[b]||a.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof a.Input||this instanceof a.Form||e.unshift(b),this.$super.apply(this,e),a.isString(d)&&(d=a.$(d)),d instanceof a.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return a.Wrapper.Cache[a.$uid(this._)]=this},setOptions:function(b,c){c&&(b=a.Object.merge(b,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),b&&a.Options.setOptions.call(this,a.Object.merge(this.options,b));return this}}),e=new a.Class(d,c);a.Observer.createShortcuts(e.prototype,e.EVENTS||a([]));return e}var e=a,f=a.$,g=a.$$,h=a.$w,i=a.$E,j=a.$A,k=a.isArray,l=a.RegExp,m=a.Class,n=a.Element,o=a.Input,p=new d({extend:{version:"2.2.1",EVENTS:h("change focus blur"),supported:"contentEditable"in b.createElement("div"),Options:{toolbar:"small",autoresize:!0,showToolbar:!0,showStatus:!0,videoSize:"425x344",cssRule:"textarea[data-rte]"},Toolbars:{small:["Bold Italic Underline Strike Ttext|Cut Copy Paste|Header Code Quote|Link Image Video|Source"],basic:["Save Clear|Cut Copy Paste|Bold Italic Underline Strike Ttext|Left Center Right Justify","Undo Redo|Header Code Quote|Link Image Video|Dotlist Numlist|Indent Outdent|Source"],extra:["Save Clear|Cut Copy Paste|Bold Italic Underline Strike Ttext|Left Center Right Justify","Undo Redo|Header Code Quote|Link Image Video|Subscript Superscript|Dotlist Numlist|Indent Outdent","Format|Fontname Fontsize|Forecolor Backcolor|Source"]},Tools:{},Shortcuts:{Bold:"b",Italic:"i",Underline:"u",Header:"h",Link:"l",Cut:"x",Copy:"c",Paste:"v",Undo:"z",Redo:"shift+z",Source:"e",Code:"p",Save:"s"},Tags:{Bold:"b",Italic:"i",Underline:"u",Strike:"s",Ttext:"tt",Code:"pre",Quote:"blockquote",Header:"h2"},Formats:{h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",p:"Paragraph",pre:"Preformatted",blockquote:"Blockquote",tt:"Typetext",address:"Address"},FontNames:{"Andale Mono":"andale mono,times",Arial:"arial,helvetica,sans-serif","Arial Black":"arial black,avant garde","Book Antiqua":"book antiqua,palatino","Comic Sans MS":"comic sans ms,sans-serif","Courier New":"courier new,courier",Georgia:"georgia,palatino",Helvetica:"helvetica",Impact:"impact,chicago",Symbol:"symbol",Tahoma:"tahoma,arial,helvetica,sans-serif",Terminal:"terminal,monaco","Times New Roman":"times new roman,times","Trebuchet MS":"trebuchet ms,geneva",Verdana:"verdana,geneva",Webdings:"webdings",Wingdings:"wingdings,zapf dingbats"},FontSizes:"6pt 7pt 8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 36pt",Videos:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/,"$1/v/$2"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/,"$1/googleplayer.swf?docId=$2"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/,"$1/moogaloop.swf?clip_id=$2"]],i18n:{Clear:"Clear",Save:"Save",Source:"Source",Bold:"Bold",Italic:"Italic",Underline:"Underline",Strike:"Strike through",Ttext:"Typetext",Header:"Header",Cut:"Cut",Copy:"Copy",Paste:"Paste",Pastetext:"Paste as text",Left:"Left",Center:"Center",Right:"Right",Justify:"Justify",Undo:"Undo",Redo:"Redo",Code:"Code block",Quote:"Block quote",Link:"Add link",Image:"Insert image",Video:"Insert video",Dotlist:"List with dots",Numlist:"List with numbers",Indent:"Indent",Outdent:"Outdent",Forecolor:"Text color",Backcolor:"Background color",Select:"Select",Remove:"Remove",Format:"Format",Fontname:"Font name",Fontsize:"Size",Subscript:"Subscript",Superscript:"Superscript",UrlAddress:"URL Address"},current:null},initialize:function(a,b){this.$super("rte",{}).setOptions(b,a).append(this.toolbar=new p.Toolbar(this),this.editor=new p.Editor(this),this.status=new p.Status(this)),this.options.showToolbar||this.toolbar.hide(),this.options.showStatus||this.status.hide(),a&&this.assignTo(a),this.undoer=new p.Undoer(this),this.selection=new p.Selection(this),this.selection.exec("styleWithCss",!1),this.status.update()},setValue:function(a){this.textarea&&this.textarea.value(a),this.editor.update(a);return this},getValue:function(){return this.editor._.innerHTML},value:function(a){return this[a===undefined?"getValue":"setValue"](a)},disable:function(){this.disabled=!0;return this.addClass("rui-rte-disabled")},enable:function(){this.disabled=!1;return this.removeClass("rui-rte-disabled")},focus:function(){p.current!==this&&(p.current=this,this.editor.focus());return this},blur:function(){p.current=null,this.editor.blur();return this},assignTo:function(a){var b=f(a),c=b.size();p.supported?(this.insertTo(b.setStyle("position:absolute;left:-9999em;"),"before"),this.editor.resize(c),this.setWidth(c.x),this.options.autoresize&&this.editor.setStyle({minHeight:c.y+"px",height:"auto"})):b.setStyle("visibility:visible"),this.setValue(b.value()),this.onChange(function(){b._.value=this.editor._.innerHTML}),this.textarea=b;return this}});p.Toolbar=new m(n,{initialize:function(a){this.$super("div",{"class":"rui-rte-toolbar"}),this.rte=a,a.tools={};var b=a.options,c=b.toolbar;e(p.Toolbars[c]||(k(c)?c:[c])).each(function(b){var c=i("div",{"class":"line"}).insertTo(this);e(b.split("|")).each(function(b){if(!e(b).blank()){var d=i("div",{"class":"bar"}).insertTo(c);e(b.split(" ")).each(function(b){b=e(b).capitalize(),d.insert(new p.Tools[b](a))})}})},this),a.tools.Undo||new p.Tools.Undo(a),a.tools.Redo||new p.Tools.Redo(a)},shortcut:function(a){var b=a._,c,d;for(c in this.rte.tools){d=this.rte.tools[c];if(d.shortcut===b.keyCode&&d.shiftKey===b.shiftKey)return d}return null}}),p.Editor=new m(n,{initialize:function(a){this.$super(a.append('<div contenteditable="true" class="rui-rte-editor"></div>').first("div.rui-rte-editor")._),this.rte=a,this.on({focus:this._focus,blur:this._blur,mouseup:this._mouseup,keypress:this._keypress,keydown:this._keydown,keyup:this._keyup})},update:function(a){this.$super(a);return this},focus:function(){this._.focus();return this},blur:function(){this._.blur();return this},removeElement:function(a){if(a!==null){var b=a.parentNode;while(a.firstChild)b.insertBefore(a.firstChild,a);b.removeChild(a)}},_focus:function(){this.rte.selection.restore(),this.rte.status.update(),this.rte.focused=!0},_blur:function(){this.rte.focused=!1,this.rte.status.update()},_mouseup:function(){this._focus()},_keypress:function(a){this.__stopped&&a.stop()},_keydown:function(a){var b=a._,c=!1,d;if(b.metaKey||b.ctrlKey)(d=this.rte.toolbar.shortcut(a))&&d.call(a),c=a.stopped;this.__stopped=c},_keyup:function(a){switch(a.keyCode){case 37:case 38:case 39:case 40:this.rte.status.update();break;default:var b=this.rte,d=this._;this._timer!==!1&&c.clearTimeout(this._timer),this._timer=c.setTimeout(function(){b.__old_value!==d.innerHTML&&(b.__old_value=d.innerHTML,b.fire("change"))},this._delay)}},_timer:!1,_delay:400}),p.Status=new m(n,{initialize:function(a){this.$super("div",{"class":"rui-rte-status"}),this.rte=a,this.nodes=[],this.tags=[],this.onMousedown(this._mousedown)},update:function(){this._findNodes(),this._checkTools();return this.$super(this.nodes.map(function(a,b){var c=a.tagName.toLowerCase();a.id&&(c+="#"+a.id),a.className&&(c+="."+a.className);return'<a href="" data-index="'+b+'" onclick="return false;" title="'+p.i18n.Select+'">'+c+"</a>"}).join(" &rsaquo; "))},findElement:function(a,b){if(a)for(var c=this.nodes.length-1,d,e;c>-1;c--)if(this.nodes[c].tagName===a){e=!0;for(d in b)b[d]instanceof l?e&=b[d].test(this.nodes[c].getAttribute(d)):e&=this.nodes[c].getAttribute(d)==b[d];if(e)return this.nodes[c]}return null},_checkTools:function(){var a=this.rte.tools,b;for(b in a)a[b].check()},_findNodes:function(){var a=this.rte.selection.element(),b=this.rte.editor._,c=this.rte._,d=[],e=[];this.nodes=[],this.tags=[];while(a&&a!==c){a.tagName&&(d.unshift(a),e.unshift(a.tagName)),a=a.parentNode;if(a===b){this.nodes=d,this.tags=e;break}}},_mousedown:function(a){var b=a.target;if(b._.tagName==="A"){a.stop();var c=b.get("data-index").toInt(),d=this.nodes[c];this.rte.selection.wrap(d)}}}),p.Undoer=new m({initialize:function(a){function b(){this.undoer.save()}this.rte=a,this.rte.on({focus:b,change:b}),this.clear()},clear:function(){this.stash=[],this.index=-1},hasUndo:function(){return this.stash.length>0&&this.index>0},hasRedo:function(){return this.stash.length-this.index>1},undo:function(){this.hasUndo()&&this.set(--this.index)},redo:function(){this.hasRedo()&&this.set(++this.index)},set:function(a){this.stash[this.index]&&(this.rte.editor.update(this.stash[this.index]),this.rte.selection.restore())},save:function(a){var b=a&&a.tool,c=this.rte.tools,d,e,f;if(!b||b!==c.Undo&&b!==c.Redo)this.rte.selection.store(),d=this.rte.editor._.innerHTML,e=d.replace(s,"").replace(t,""),f=(this.stash[this.index]||"").replace(s,"").replace(t,""),e!==f&&(this.stash.length=this.index+1,this.stash.push(d),this.index=this.stash.length-1,c.Undo.check(),c.Redo.check()),this.rte.selection.restore()}}),p.Selection=new m({initialize:function(a){this.rte=a},range:function(a){var d=c.getSelection&&c.getSelection();if(a)d?(d.removeAllRanges(),d.addRange(a)):a._&&a._.select();else{try{a=d.getRangeAt(0)}catch(e){try{a=b.createRange()}catch(f){a=new u}}return a}},element:function(){var a=this.range(),b=a.commonAncestorContainer;a.collapsed||a.startContainer===b&&a.startOffset-a.endOffset<2&&a.startContainer.hasChildNodes()&&(b=a.startContainer.childNodes[a.startOffset]),b=b&&b.nodeType===3?b.parentNode:b;return b||null},wrap:function(a){var b=this.range();b.selectNode(a),this.range(b)},text:function(){return this.range().toString()},empty:function(){return this.text()===""},html:function(){var a=this.range(),c,d;if(a._)return a._.htmlText;c=b.createElement("div"),d=a.cloneContents();while(d.firstChild)c.appendChild(d.firstChild);return c.innerHTML},exec:function(a,c){try{b.execCommand(a,!1,c)}catch(d){a==="inserthtml"&&this.range()._.pasteHTML(c)}},store:function(){function c(c){function j(a,b){b.nextSibling?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.appendChild(a)}var d=a[c+"Container"],e=a[c+"Offset"],f=b.createElement("span"),g=d.parentNode,h=d.nodeValue,i=b.createTextNode((""+h).substr(e));f.setAttribute("rrte-"+c,"1"),d.nodeType===3?e===0?g.insertBefore(f,c==="start"&&a.collapsed?d.previousSibling:d):e===h.length?j(f,d):(d.nodeValue=h.substr(0,e),j(i,d),g.insertBefore(f,i)):d.nodeType===1&&(e===0?d.firstChild?d.insertBefore(f,d.firstChild):d.hasChildNodes()&&d.appendChild(f):e===d.childNodes.length?d.appendChild(f):d.insertBefore(f,d.childNodes[e]))}var a=this.range();a={startContainer:a.startContainer,startOffset:a.startOffset,endContainer:a.endContainer,endOffset:a.endOffset,collapsed:a.collapsed},c("end"),c("start")},restore:function(){var a=j(this.rte.editor._.getElementsByTagName("span")),b=0,c,d,e,f=this.range();for(;b<a.length;b++)c=a[b].getAttribute("rrte-start")?"setStart":a[b].getAttribute("rrte-end")?"setEnd":!1,c&&(d=a[b].parentNode,f._?f[c](a[b]):(e=y(a[b]),f[c](d,e)),d.removeChild(a[b]));this.range(f)}});var q='<span rrte-start="1"></span>',r='<span rrte-end="1"></span>',s=new l(l.escape(q),"i"),t=new l(l.escape(r),"i"),u=new m({collapsed:null,startContainer:null,startOffset:null,endContainer:null,endOffset:null,commonAncestorContainer:null,initialize:function(){this._=b.selection.createRange();if(b.selection.type==="Control")this.startContainer=this.endContainer=this.commonAncestorContainer=this._(0),this.startOffset=this.endOffset=0;else{var a=this._.duplicate();a.collapse(!0),a=v(a),this.startContainer=a.node,this.startOffset=a.offset,a=this._.duplicate(),a.collapse(!1),a=v(a),this.endContainer=a.node,this.endOffset=a.offset,w(this)}x(this)},setStart:function(a,b){var c=this._.duplicate();c.moveToElementText(a),c.collapse(!0),this._.setEndPoint("StartToStart",c),this.startContainer=a,this.startOffset=b,this.endContainer===null&&this.endOffset===null&&(this.endContainer=a,this.endOffset=b),w(this),x(this)},setEnd:function(a,b){var c=this._.duplicate();c.moveToElementText(a),c.collapse(!0),this._.setEndPoint("EndToEnd",c),this.endContainer=a,this.endOffset=b,this.startContainer===null&&this.startOffset===null&&(this.startContainer=a,this.startOffset=b),w(this),x(this)},selectNode:function(a){this._.moveToElementText(a)},toString:function(){return""+this._.text}});p.Tool=new m(n,{block:!0,blip:!1,changes:!0,shortuct:null,shiftKey:!1,initialize:function(a){var b;for(b in p.Tools)if(p.Tools[b]===this.constructor)break;this.name=b,this.shortcut=this.shortcut||p.Shortcuts[b],this.$super("div",{html:'<div class="icon"></div>',"class":"tool "+b.toLowerCase(),title:(p.i18n[b]||b)+(this.shortcut?" ("+this.shortcut+")":"")}),this.rte=a,a.tools[b]=this,this.shortcut=this.shortcut&&this.shortcut.toLowerCase(),this.shiftKey=this.shortcut&&this.shortcut.indexOf("shift")>-1,this.shortcut=this.shortcut&&this.shortcut.toUpperCase().charCodeAt(this.shortcut.length-1),this.onMousedown(function(a){a.stop(),this.mousedown()});return this},exec:function(){},active:function(){return!1},enabled:function(){return!0},call:function(a){this.disabled||(a&&this.block&&a.stop(),this.exec(),this.rte.status.update(),this.rte.fire("change",{tool:this}),this.blip&&this.highlight())},check:function(){this._.className=this._.className.replace(" disabled",""),this.disabled=!1,this.name!=="Source"&&this.rte.srcMode===!0||!this.enabled()?(this._.className+=" disabled",this.disabled=!0):(this._.className=this._.className.replace(" active",""),this.active()&&(this._.className+=" active"))},highlight:function(){e(this.addClass("highlight").removeClass).bind(this,"highlight").delay(100)},mousedown:function(){this.call()}}),p.Tool.Command=new m(p.Tool,{command:null,value:null,exec:function(){this.rte.selection.exec(this.command,this.value)},enabled:function(){try{return b.queryCommandEnabled(this.command)}catch(a){return!1}},active:function(){try{return this.value===null?b.queryCommandState(this.command):b.queryCommandValue(this.command)==this.value}catch(a){return!1}}}),p.Tool.Format=new m(p.Tool,{tag:null,atts:{},initialize:function(a){this.$super(a),this.tag=(this.tag||p.Tags[this.name]||"").toUpperCase();return this},exec:function(){this[this.active()?"unformat":"format"]()},active:function(){return this.element()!==null},element:function(){return this.rte.status.findElement(this.tag,this.attrs)},unformat:function(){this._format(!1)},format:function(){this._format(!0)},_format:function(a){var b="<"+this.tag,c="</"+this.tag+">",d=this.rte.editor,e=this.rte.selection,f=e.range(),g=e.text(),h=this.element(),i=h&&(h.textContent||h.innerText);for(var j in this.attrs)b+=" "+j+'="'+this.attrs[j]+'"';b+=">",e.store(),!a&&f._&&d.html(d.html().replace(new l(l.escape(q+b),"i"),b+q)),a?d.html(d.html().replace(s,b+q).replace(t,r+c)):h&&g===i?d.removeElement(h):d.html(d.html().replace(s,c+q).replace(t,r+b).replace(/<([a-z]+)[^>]*?>\s*?<\/\1>/ig,"")),e.restore()}}),p.Tool.Options={build:function(a){this.trigger=i("div",{"class":"trigger",html:"&middot;"}),this.display=i("div",{"class":"display"}),this.options=i("ul",{"class":"options"}),this.addClass("with-options").append(this.display,this.options).insert(this.trigger,"top"),this.items={};for(var c in a)this.items[c]=i("li").insert(a[c]),this.items[c].insertTo(this.options).value=c;this.items[""]=i("li",{"class":"remove",html:"--",title:p.i18n.Remove}),this.items[""].insertTo(this.options,"top").value="",this.options.onMousedown(e(this.pick).bind(this));var d=e(this.options.hide).bind(this.options,null);f(b).on({mousedown:d,keydown:function(a){a.keyCode===27&&d()}}),this.value="",this.updateDisplay(null);return this},pick:function(a){var b=a.stop().target;b._.tagName!=="LI"&&(b=b.parent("LI")),b.value!==undefined&&(this.options.hide(),this.value=b.value,this.updateDisplay(this.value||null),this.markActive(),this.exec())},mousedown:function(){this.disabled||(g(".rui-rte-toolbar div.with-options ul.options").without(this.options).each("hide"),this.options.hidden()&&this.value!==null&&this.markActive(),this.options.toggle("fade",{duration:"short"}))},markActive:function(){for(var a in this.items)this.items[a][a===this.value?"addClass":"removeClass"]("active")},updateDisplay:function(a){this.display.update(a!==null&&a in this.items?this.items[a].text():this._.title)}},p.Tool.Style=new m(p.Tool.Format,{include:p.Tool.Options,tag:"span",style:null,initialize:function(a,b){this.re=new l("(^|;)\\s*"+l.escape(this.style+":")+"\\s*(.+?)\\s*(;|$)"),this.attrs={style:this.re},this.$super(a).build(b);return this},exec:function(){this.active()&&(this.attrs={style:this.style+":"+this._value},this.unformat()),this.value&&(this.attrs={style:this.style+":"+this.value},this.format()),this.attrs={style:this.re}},active:function(){var a=this.element(),b=!1,c=null;a!==null&&(this._value=c=this.getStyleValue(),b=!0),this.updateDisplay(c);return b},getStyleValue:function(){var a=this.element(),b=a!==null?a.getAttribute("style"):null;b!==null&&((b=b.match(this.re))!==null&&(b=b[2]));return b}}),p.Tool.Color=new m(p.Tool.Style,{extend:{COLORS:e(["000000 444444 666666 999999 cccccc eeeeee f4f4f4 ffffff","f24020 f79c33 fff84c 6af244 5ef9fd 0048f7 8950f7 ee5ff8","e39e9b f5cba1 fee3a1 bcd3ab a6c3c8 a2c6e5 b1abd3 d0aabc d77169 f1b374 fdd675 9cbe83 7ca4ae 74aad8 8983bf bb839f cc0100 e79138 f1c332 69a84f 45818e 3d85c6 674ea7 a64d79 990000 b45f05 bf9000 38761c 134f5c 0b5394 351b75 751a47 660000 783e03 7f6000 264e13 0b333d 063763 1f124c 4c1030"])},initialize:function(a){this.$super(a,{}).addClass("color"),this.display.clean(),p.Tool.Color.COLORS.each(function(a){var b=i("li",{"class":"group"}),c=i("ul").insertTo(b),d=a.split(" "),e=0,f,g;for(;e<d.length;e++){f="#"+d[e],g=(parseInt("ffffff",16)-parseInt(d[e],16)).toString(16);while(g.length<6)g+="0";this.items[f]=i("li",{html:"&bull;",style:{background:f,color:"#"+g}}),this.items[f].insertTo(c).value=f}this.options.append(b)},this);return this},getStyleValue:function(){var a=this.$super(),b;if(a!==null)if(b=/^#(\w)(\w)(\w)$/.exec(a))a="#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3];else if(b=/^\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)\s*$/.exec(a))a="#"+e(b.slice(1)).map(function(a){a=(a-0).toString(16);return a.length===1?"0"+a:a}).join("");return a},updateDisplay:function(a){this.display._.style.background=a===null?"transparent":a}}),p.Tool.Url=new m(p.Tool,{attr:null,exec:function(a){a===undefined?this.prompt():a?this[this.element()?"url":"create"](a):this.rte.editor.removeElement(this.element())},active:function(){return this.element()!==null},prompt:function(){var a=prompt(p.i18n.UrlAddress,this.url()||"http://some.url.com");a!==null&&this.exec(a)},url:function(a){if(this.element())if(a!==undefined)this.element()[this.attr]=a;else return this.element()[this.attr]},create:function(a){this.rte.selection.exec(this.command,a)}}),p.Tools.Bold=new m(p.Tool.Format,{}),p.Tools.Italic=new m(p.Tool.Format,{}),p.Tools.Underline=new m(p.Tool.Format,{}),p.Tools.Strike=new m(p.Tool.Format,{}),p.Tools.Cut=new m(p.Tool.Command,{command:"cut",block:!1,blip:!0}),p.Tools.Copy=new m(p.Tools.Cut,{command:"copy"}),p.Tools.Paste=new m(p.Tools.Cut,{command:"paste"}),p.Tools.Pastetext=new m(p.Tools.Command,{command:"paste"}),p.Tools.Left=new m(p.Tool.Command,{command:"justifyleft"}),p.Tools.Center=new m(p.Tool.Command,{command:"justifycenter"}),p.Tools.Right=new m(p.Tool.Command,{command:"justifyright"}),p.Tools.Justify=new m(p.Tool.Command,{command:"justifyfull"}),p.Tools.Undo=new m(p.Tool,{blip:!0,exec:function(){this.rte.undoer.undo()},enabled:function(){return this.rte.undoer.hasUndo()}}),p.Tools.Redo=new m(p.Tool,{blip:!0,exec:function(){this.rte.undoer.redo()},enabled:function(){return this.rte.undoer.hasRedo()}}),p.Tools.Code=new m(p.Tool.Format,{}),p.Tools.Quote=new m(p.Tool.Format,{}),p.Tools.Ttext=new m(p.Tool.Format,{}),p.Tools.Header=new m(p.Tool.Format,{}),p.Tools.Link=new m(p.Tool.Url,{command:"createlink",attr:"href",enabled:function(){return!this.rte.selection.empty()||this.active()},element:function(){return this.rte.status.findElement("A",{})}}),p.Tools.Image=new m(p.Tool.Url,{command:"insertimage",attr:"src",element:function(){var a=this.rte.selection.element();return a!==null&&a.tagName==="IMG"?a:null}}),p.Tools.Video=new m(p.Tool.Url,{command:"inserthtml",enabled:function(){return!0},element:function(){return this.rte.status.findElement("OBJECT",{})},url:function(a){var b=this.element()&&this.element().getElementsByTagName("embed")[0];if(b)if(a!==undefined)b.src=this.swfUrl(a);else return b.src},create:function(a){var b=this.swfUrl(a),c='width="'+this.rte.options.videoSize.split("x")[0]+'" height="'+this.rte.options.videoSize.split("x")[1]+'"';this.$super("<object "+c+'><param name="src" value="'+b+'" /><embed src="'+b+'" type="application/x-shockwave-flash" '+c+" /></object>")},swfUrl:function(a){return e(p.Videos).map(function(b){return a.match(b[0])?a.replace(b[0],b[1]):null}).compact()[0]||a}}),p.Tools.Dotlist=new m(p.Tool.Command,{command:"insertunorderedlist"}),p.Tools.Numlist=new m(p.Tool.Command,{command:"insertorderedlist"}),p.Tools.Indent=new m(p.Tool.Command,{command:"indent"}),p.Tools.Outdent=new m(p.Tool.Command,{command:"outdent"}),p.Tools.Forecolor=new m(p.Tool.Color,{style:"color"}),p.Tools.Backcolor=new m(p.Tool.Color,{style:"background-color"}),p.Tools.Source=new m(p.Tool,{source:!1,exec:function(){this[this.rte.srcMode?"showPreview":"showSource"](),this.rte.srcMode=!this.rte.srcMode},active:function(){return this.rte.srcMode},showPreview:function(){this.rte.editor.setStyle("visibility:visible"),this.source&&(this.rte.value(this.source.value()),this.source.remove()),this.rte.editor.focus()},showSource:function(){this.rte.editor.setStyle("visibility:hidden;"),(this.source=this.source||i("textarea",{"class":"rui-rte-source"})).insertTo(this.rte.editor,"before").resize(this.rte.editor.size()).setValue(""+this.rte.value()).onKeydown(function(a){var b=a._;if(b.metaKey||b.ctrlKey)b.keyCode==69&&(a.stop(),this.exec())}.bind(this)).focus(),this.rte.focused=!0,this.rte.status.update();for(var a in this.rte.tools)this.rte.tools[a]!==this&&this.rte.tools[a].addClass("disabled")}}),p.Tools.Clear=new m(p.Tool,{exec:function(){this.rte.editor.clean()}}),p.Tools.Save=new m(p.Tool,{initialize:function(a){this.$super(a);if(!a.textarea||!a.textarea.form())this.disabled=!0,this.addClass("disabled")},exec:function(){this.disabled||this.rte.textarea.form().submit()},check:function(){}}),p.Tools.Format=new m(p.Tool.Format,{include:p.Tool.Options,initialize:function(a){var b={},c,d,e;this.formats={};for(c in p.Formats)if(e=c.match(/^([a-z0-9]+)(\.([a-z0-9_\-]+))?$/))d=e[1],this.formats[c]={tag:d.toUpperCase(),attrs:{},match:{}},e[3]&&(this.formats[c].attrs["class"]=e[3],this.formats[c].match["class"]=new l("(^|\\s+)"+l.escape(e[3])+"(\\s+|$)")),b[c]="<"+d+' class="'+e[3]+'">'+p.Formats[c]+"</"+d+">";this.$super(a).build(b);return this},exec:function(){this.active()&&this.rule&&(this.tag=this.formats[this.rule].tag,this.attrs=this.formats[this.rule].attrs,this.unformat()),this.value&&this.formats[this.value]&&(this.tag=this.formats[this.value].tag,this.attrs=this.formats[this.value].attrs,this.format())},active:function(){var a=this.element()!==null;this.updateDisplay(this.rule);return a},element:function(){var a,b,c=this.rte.status;for(a in this.formats){b=c.findElement(this.formats[a].tag,this.formats[a].match);if(b!==null){this.rule=a;return b}}return this.rule=null}}),p.Tools.Fontname=new m(p.Tool.Style,{style:"font-family",initialize:function(a){var b={},c,d=p.FontNames;for(c in d)b[d[c]]='<div style="font-family:'+d[c]+'">'+c+"</div>";return this.$super(a,b)}}),p.Tools.Fontsize=new m(p.Tool.Style,{style:"font-size",initialize:function(a){var b={},c=0,d=p.FontSizes.split(/\s+/);for(;c<d.length;c++)b[d[c]]='<div style="font-size:'+d[c]+'">'+d[c]+"</div>";return this.$super(a,b)}}),p.Tools.Subscript=new m(p.Tool.Command,{command:"subscript"}),p.Tools.Superscript=new m(p.Tool.Command,{command:"superscript"}),f(b).onReady(function(){g(p.Options.cssRule).each("getRich")}),o.include({getRich:function(a){this._.type==="textarea"&&!this.rte&&(this.rte=new p(this,a));return this.rte}});var z=b.createElement("style"),A=b.createTextNode("div.rui-rte,div.rui-rte-toolbar,div.rui-rte-toolbar *,div.rui-rte-editor,div.rui-rte-status,div.rui-rte-status *{margin:0;padding:0;background:none;border:none;width:auto;height:auto}textarea[data-rte]{visibility:hidden}div.rui-rte{display:inline-block; *display:inline; *zoom:1;position:relative}div.rui-rte-toolbar{padding:.15em .3em;background:#eee;border-radius:.25em .25em 0 0;-moz-border-radius:.25em .25em 0 0;-webkit-border-radius:.25em .25em 0 0;border:1px solid #ccc;border-bottom:none}div.rui-rte-toolbar div.line{display:inline-block; *display:inline; *zoom:1;margin-bottom:1px}div.rui-rte-toolbar div.bar{display:inline-block; *display:inline; *zoom:1;margin-right:2px}div.rui-rte-toolbar div.tool{display:inline-block; *display:inline; *zoom:1;margin-right:1px;vertical-align:middle;position:relative;cursor:pointer;border:1px solid #bbb;background-image:url(/assets/rightjs-ui/rte.png);background-position:0px 0px;background-color:#fff;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}div.rui-rte-toolbar div.tool:hover{background-color:#ddd;border-color:#777}div.rui-rte-toolbar div.active{background-position:-20px 0px;background-color:#eee;border-color:#666;box-shadow:#aaa .025em .025em .5em;-moz-box-shadow:#aaa .025em .025em .5em;-webkit-box-shadow:#aaa .025em .025em .5em}div.rui-rte-toolbar div.disabled,div.rui-rte-toolbar div.disabled:hover{opacity:.4;filter:alpha(opacity=40);background-position:-40px 0px;background-color:#eee;border-color:#aaa;cursor:default}div.rui-rte-toolbar div.highlight{background-color:#BBB;border-color:#666}div.rui-rte-toolbar div.icon{height:20px;width:20px;background-image:url(/assets/rightjs-ui/rte.png);background-repeat:no-repeat;background-position:20px 20px}div.rui-rte-toolbar div.save div.icon{background-position:0px -20px}div.rui-rte-toolbar div.clear div.icon{background-position:-20px -20px}div.rui-rte-toolbar div.source div.icon{background-position:-40px -20px}div.rui-rte-toolbar div.bold div.icon{background-position:0px -40px}div.rui-rte-toolbar div.italic div.icon{background-position:-20px -40px}div.rui-rte-toolbar div.underline div.icon{background-position:-40px -40px}div.rui-rte-toolbar div.strike div.icon{background-position:-60px -40px}div.rui-rte-toolbar div.cut div.icon{background-position:0px -60px}div.rui-rte-toolbar div.copy div.icon{background-position:-20px -60px}div.rui-rte-toolbar div.paste div.icon{background-position:-40px -60px}div.rui-rte-toolbar div.pastetext div.icon{background-position:-60px -60px}div.rui-rte-toolbar div.left div.icon{background-position:0px -80px}div.rui-rte-toolbar div.center div.icon{background-position:-20px -80px}div.rui-rte-toolbar div.right div.icon{background-position:-40px -80px}div.rui-rte-toolbar div.justify div.icon{background-position:-60px -80px}div.rui-rte-toolbar div.undo div.icon{background-position:0px -100px}div.rui-rte-toolbar div.redo div.icon{background-position:-20px -100px}div.rui-rte-toolbar div.quote div.icon{background-position:0px -120px}div.rui-rte-toolbar div.code div.icon{background-position:-20px -120px}div.rui-rte-toolbar div.ttext div.icon{background-position:-40px -120px}div.rui-rte-toolbar div.header div.icon{background-position:-60px -120px}div.rui-rte-toolbar div.image div.icon{background-position:0px -140px}div.rui-rte-toolbar div.link div.icon{background-position:-20px -140px}div.rui-rte-toolbar div.video div.icon{background-position:-40px -140px}div.rui-rte-toolbar div.dotlist div.icon{background-position:0px -160px}div.rui-rte-toolbar div.numlist div.icon{background-position:-20px -160px}div.rui-rte-toolbar div.indent div.icon{background-position:-40px -160px}div.rui-rte-toolbar div.outdent div.icon{background-position:-60px -160px}div.rui-rte-toolbar div.forecolor div.icon{background-position:0px -180px}div.rui-rte-toolbar div.backcolor div.icon{background-position:-20px -180px}div.rui-rte-toolbar div.symbol div.icon{background-position:0px -200px}div.rui-rte-toolbar div.subscript div.icon{background-position:-20px -200px}div.rui-rte-toolbar div.superscript div.icon{background-position:-40px -200px}div.rui-rte-toolbar div.with-options{padding-right:8px}div.rui-rte-toolbar div.with-options div.trigger{position:absolute;right:0;height:100%;width:7px;text-align:center;background:#ccc;border-left:1px solid #bbb}div.rui-rte-toolbar div.bar div:hover div.trigger,div.rui-rte-toolbar div.bar div.active div.trigger{background:#aaa;border-color:#888}div.rui-rte-toolbar div.with-options div.icon{display:none}div.rui-rte-toolbar div.with-options div.display{display:block;line-height:20px;padding:0 6px;margin:0;color:#222;font-size:12px;background:#f8f8f8}div.rui-rte-toolbar div.with-options ul.options,div.rui-rte-toolbar div.with-options ul.options li{list-style:none;margin:0;padding:0}div.rui-rte-toolbar div.with-options ul.options{display:none;cursor:default;position:absolute;margin-bottom:1px;margin-left:-1px;background:#fff;border:1px solid #aaa;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em;box-shadow:#bbb .1em .1em .25em;-moz-box-shadow:#bbb .1em .1em .25em;-webkit-box-shadow:#bbb .1em .1em .25em}div.rui-rte-toolbar div.with-options ul.options li{padding:.2em .5em;white-space:nowrap;cursor:pointer}div.rui-rte-toolbar div.with-options ul.options li:hover{background-color:#eee}div.rui-rte-toolbar div.with-options ul.options li> *{margin:0;padding:0;border:none;position:static}div.rui-rte-toolbar div.color div.icon{display:block}div.rui-rte-toolbar div.color ul.options{padding-bottom:.5em}div.rui-rte-toolbar div.color ul.options li.group,div.rui-rte-toolbar div.color ul.options li.group:hover{background:none}div.rui-rte-toolbar div.color ul.options li.group ul{width:144px;clear:both;padding-top:.5em}div.rui-rte-toolbar div.color ul.options li.group ul li{float:left;width:16px;height:16px;line-height:16px;font-size:80%;text-align:center;text-indent:-9999em;padding:0;cursor:pointer;border:1px solid transparent}div.rui-rte-toolbar div.color ul.options li.group ul li:hover,div.rui-rte-toolbar div.color ul.options li.group ul li.active{background:none;border-color:#444;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.active{text-indent:0}div.rui-rte-toolbar div.color div.display{position:absolute;text-indent:-9999em;bottom:2px;left:3px;margin:0;padding:0;width:14px;height:4px;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em}div.rui-rte-toolbar div.color ul.options li.group ul li.none{border-color:#444}div.rui-rte-toolbar div.color ul.options li.group ul li.label,div.rui-rte-toolbar div.color ul.options li.group ul li.label:hover{text-indent:0;border:none;margin-left:.5em;font-size:1em;cursor:default}div.rui-rte-editor{outline:none;outline:hidden;padding:.1em .3em;overflow:auto;background:white;border:1px solid #ccc}div.rui-rte-editor:focus{border-color:#aaa}div.rui-rte-editor> *:first-child{margin-top:0}div.rui-rte-editor> *:last-child{margin-bottom:0}div.rui-rte textarea.rui-rte-source{position:absolute;outline:none;resize:none}div.rui-rte-status{font-size:90%;height:1.4em;padding:0 .5em;color:#888;background:#eee;border:1px solid #ccc;border-top:none;border-radius:0 0 .25em .25em;-moz-border-radius:0 0 .25em .25em;-webkit-border-radius:0 0 .25em .25em}");z.type="text/css",b.getElementsByTagName("head")[0].appendChild(z),z.styleSheet?z.styleSheet.cssText=A.nodeValue:z.appendChild(A);return p}(RightJS,document,window)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RightJS-UI Slider v2.2.3
2
+ * RightJS-UI Slider v2.3.0
3
3
  * http://rightjs.org/ui/slider
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
@@ -177,7 +177,7 @@ var Slider = new Widget({
177
177
  include: Updater,
178
178
 
179
179
  extend: {
180
- version: '2.2.3',
180
+ version: '2.3.0',
181
181
 
182
182
  EVENTS: $w('change'),
183
183
 
@@ -185,7 +185,9 @@ var Slider = new Widget({
185
185
  min: 0, // the min value
186
186
  max: 100, // the max value
187
187
  snap: 0, // the values threshold
188
+ range: false, // whether a single handle slider or a range slider
188
189
  value: null, // start value, if null then the min value will be used
190
+ values: null, // range values when range = true, if null then then min/max value will be used
189
191
  direction: 'x', // slider direction 'x', 'y'
190
192
  update: null, // reference to an element to update
191
193
  round: 0 // the number of symbols after the decimal pointer
@@ -216,16 +218,31 @@ var Slider = new Widget({
216
218
  .on('selectstart', 'stopEvent'); // disable select under IE
217
219
 
218
220
  this.level = this.first('.level') || $E('div', {'class': 'level'}).insertTo(this);
219
- this.handle = this.first('.handle') || $E('div', {'class': 'handle'}).insertTo(this);
220
221
 
221
222
  options = this.options;
222
223
  this.value = options.value === null ? options.min : options.value;
223
224
 
225
+ if (options.range === true) {
226
+ this.handles = new Array();
227
+ this.handles[0] = this.first('.handle.from') || $E('div', {'class': 'handle from'}).insertTo(this);
228
+ this.handles[1] = this.first('.handle.to') || $E('div', {'class': 'handle to'}).insertTo(this);
229
+
230
+ this.values = [0, 0];
231
+ this.values[0] = options.values === null ? options.min : options.values[0];
232
+ this.values[1] = options.values === null ? options.max : options.values[1];
233
+
234
+ this.setValue(this.values[0], 'from');
235
+ this.setValue(this.values[1], 'to');
236
+
237
+ } else {
238
+ this.handle = this.first('.handle') || $E('div', {'class': 'handle'}).insertTo(this);
239
+ this.setValue(this.value);
240
+ }
241
+
224
242
  if (options.update) { this.assignTo(options.update); }
225
243
  if (options.direction === 'y') { this.addClass('rui-slider-vertical'); }
226
244
  else if (this.hasClass('rui-slider-vertical')) { options.direction = 'y'; }
227
245
 
228
- this.setValue(this.value);
229
246
  },
230
247
 
231
248
  /**
@@ -233,11 +250,11 @@ var Slider = new Widget({
233
250
  *
234
251
  * NOTE: will get snapped according to the options
235
252
  *
236
- * @param mixed string or number value
253
+ * @param mixed string or number value, an optional type specifying 'from' or 'to' when using with range slider
237
254
  * @return Slider this
238
255
  */
239
- setValue: function(value) {
240
- return this.precalc().shiftTo(value);
256
+ setValue: function(value, type) {
257
+ return this.precalc().shiftTo(value, type);
241
258
  },
242
259
 
243
260
  /**
@@ -246,7 +263,20 @@ var Slider = new Widget({
246
263
  * @return Float number
247
264
  */
248
265
  getValue: function() {
249
- return this.value;
266
+ if (this.options.range === true) {
267
+ return this.values[0];
268
+ } else {
269
+ return this.value;
270
+ }
271
+ },
272
+
273
+ /**
274
+ * Returns the values that used to store the range
275
+ *
276
+ * @return An array storing the from/to float numbers
277
+ */
278
+ getValues: function() {
279
+ return this.values;
250
280
  },
251
281
 
252
282
  /**
@@ -264,19 +294,42 @@ var Slider = new Widget({
264
294
 
265
295
  // precalculates dimensions, direction and offset for further use
266
296
  precalc: function() {
267
- var horizontal = this.options.direction === 'x',
268
- handle = this.handle.setStyle(horizontal ? {left: 0} : {bottom: 0}).dimensions(),
269
- handle_size = this.hSize = horizontal ? handle.width : handle.height,
270
- dims = this.dims = this.dimensions();
297
+ var horizontal = this.options.direction === 'x',
298
+ dims = this.dims = this.dimensions();
299
+
300
+ if (this.options.range === true) {
301
+ var handle_f = this.handles[0].setStyle(horizontal ? {left: 0} : {bottom: 0}).dimensions(),
302
+ handle_size = this.hSize = horizontal ? handle_f.width : handle_f.height;
303
+ // Assuming both handles are in the same size
304
+
305
+ this.offset = horizontal ? handle_f.left - dims.left : dims.top + dims.height - handle_f.top - handle_size;
306
+ this.space = (horizontal ? dims.width : dims.height) - handle_size - (this.offset * 2);
271
307
 
272
- this.offset = horizontal ? handle.left - dims.left : dims.top + dims.height - handle.top - handle_size;
273
- this.space = (horizontal ? dims.width : dims.height) - handle_size - this.offset * 2;
308
+ var handle_t = this.handles[1].setStyle(horizontal ? {left: this.space + 'px'} :
309
+ {bottom: this.space + 'px'}).dimensions();
310
+
311
+ } else {
312
+ var handle = this.handle.setStyle(horizontal ? {left: 0} : {bottom: 0}).dimensions(),
313
+ handle_size = this.hSize = horizontal ? handle.width : handle.height;
314
+
315
+ this.offset = horizontal ? handle.left - dims.left : dims.top + dims.height - handle.top - handle_size;
316
+ this.space = (horizontal ? dims.width : dims.height) - handle_size - this.offset * 2;
317
+ }
274
318
 
275
319
  return this;
276
320
  },
277
321
 
278
322
  // initializes the slider drag
279
323
  start: function(event) {
324
+ this._type = null
325
+ if (event.target.hasClass('handle')) {
326
+ if (event.target.hasClass('from')) {
327
+ this._type = "from";
328
+ } else if (event.target.hasClass('to')) {
329
+ this._type = "to";
330
+ }
331
+ }
332
+
280
333
  return this.precalc().e2val(event);
281
334
  },
282
335
 
@@ -286,7 +339,7 @@ var Slider = new Widget({
286
339
  },
287
340
 
288
341
  // shifts the slider to the value
289
- shiftTo: function(value) {
342
+ shiftTo: function(value, type) {
290
343
  var options = this.options, base = Math.pow(10, options.round), horizontal = options.direction === 'x';
291
344
 
292
345
  // rounding the value up
@@ -295,24 +348,71 @@ var Slider = new Widget({
295
348
  // checking the value constraings
296
349
  if (value < options.min) { value = options.min; }
297
350
  if (value > options.max) { value = options.max; }
351
+
352
+ // if range slider check if the "from" handle's value is larger than the "to" handle's
353
+ if (options.range === true) {
354
+ if ((type === "to") && (value < this.values[0])) {
355
+ value = this.values[0];
356
+ }
357
+ if ((type === "from") || (type === undefined)) {
358
+ if (value > this.values[1]) {
359
+ value = this.values[1];
360
+ }
361
+ }
362
+ }
363
+
298
364
  if (options.snap) {
299
365
  var snap = options.snap;
300
366
  var diff = (value - options.min) % snap;
301
367
  value = diff < snap/2 ? value - diff : value - diff + snap;
302
368
  }
303
369
 
304
- // calculating and setting the actual position
305
- var position = this.space / (options.max - options.min) * (value - options.min);
306
-
307
- this.handle._.style[horizontal ? 'left' : 'bottom'] = position + 'px';
308
- this.level._.style[horizontal ? 'width': 'height'] = ((position > 0 ? position : 0) + 2) + 'px';
370
+ if (options.range === true) {
371
+ var value_f = (type === "from") ? value : this.values[0];
372
+ var value_t = (type === "to") ? value : this.values[1];
373
+
374
+ // calculating and setting the actual position
375
+ var position_f = this.space / (options.max - options.min) * (value_f - options.min);
376
+ var position_t = this.space / (options.max - options.min) * (value_t - options.min);
377
+ var length = position_t - position_f;
378
+
379
+ if (type === "to") {
380
+ this.handles[1]._.style[horizontal ? 'left' : 'bottom'] = position_t + 'px';
381
+ } else {
382
+ this.handles[0]._.style[horizontal ? 'left' : 'bottom'] = position_f + 'px';
383
+ }
384
+
385
+ this.level._.style[horizontal ? 'left': 'top'] = ((position_f > 0 ? position_f : 0) + 2) + 'px';
386
+ this.level._.style[horizontal ? 'width': 'height'] = ((length > 0 ? length : 0) + 2) + 'px';
387
+
388
+ // checking the change status
389
+ var fireEvent = false;
390
+ if ((type === "from") && (value !== this.values[0])) {
391
+ this.values[0] = value;
392
+ fireEvent = true;
393
+ }
394
+ if ((type === "to") && (value !== this.values[1])) {
395
+ this.values[1] = value;
396
+ fireEvent = true;
397
+ }
398
+ if (fireEvent) {
399
+ this.fire('change', {value: value, values: this.values});
400
+ }
309
401
 
310
- // checking the change status
311
- if (value !== this.value) {
312
- this.value = value;
313
- this.fire('change', {value: value});
402
+ } else {
403
+ // calculating and setting the actual position
404
+ var position = this.space / (options.max - options.min) * (value - options.min);
405
+ this.handle._.style[horizontal ? 'left' : 'bottom'] = position + 'px';
406
+ this.level._.style[horizontal ? 'width': 'height'] = ((position > 0 ? position : 0) + 2) + 'px';
407
+
408
+ // checking the change status
409
+ if (value !== this.value) {
410
+ this.value = value;
411
+ this.fire('change', {value: value});
412
+ }
314
413
  }
315
414
 
415
+
316
416
  return this;
317
417
  },
318
418
 
@@ -322,9 +422,18 @@ var Slider = new Widget({
322
422
  dims = this.dims, offset = this.offset, space = this.space,
323
423
  cur_pos = event.position()[horizontal ? 'x' : 'y'] - offset - this.hSize/2,
324
424
  min_pos = horizontal ? dims.left + offset : dims.top + offset,
325
- value = (options.max - options.min) / space * (cur_pos - min_pos);
326
-
327
- return this.shiftTo(horizontal ? options.min + value : options.max - value);
425
+ value = (options.max - options.min) / space * (cur_pos - min_pos),
426
+ type = this._type;
427
+
428
+ if (type == null) {
429
+ return this.shiftTo(horizontal ? options.min + value : options.max - value);
430
+ } else if (type === "to") {
431
+ this.shiftTo(this.values[0], "from");
432
+ return this.shiftTo(horizontal ? options.min + value : options.max - value, "to");
433
+ } else {
434
+ this.shiftTo(this.values[1], "to");
435
+ return this.shiftTo(horizontal ? options.min + value : options.max - value, "from");
436
+ }
328
437
  }
329
438
  });
330
439
 
@@ -379,7 +488,7 @@ $(window).onBlur(function() {
379
488
 
380
489
 
381
490
  var embed_style = document.createElement('style'),
382
- embed_rules = document.createTextNode("div.rui-slider,div.rui-slider .handle div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");
491
+ embed_rules = document.createTextNode("div.rui-slider,div.rui-slider .handle,div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");
383
492
 
384
493
  embed_style.type = 'text/css';
385
494
  document.getElementsByTagName('head')[0].appendChild(embed_style);