event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / css / behaviors / showtableborders.htc
diff --git a/httemplate/elements/fckeditor/editor/css/behaviors/showtableborders.htc b/httemplate/elements/fckeditor/editor/css/behaviors/showtableborders.htc
new file mode 100644 (file)
index 0000000..77418b9
--- /dev/null
@@ -0,0 +1,36 @@
+<public:component lightweight="true">\r
+\r
+<public:attach event="oncontentready" onevent="ShowBorders()" />\r
+<public:attach event="onpropertychange" onevent="OnPropertyChange()" />\r
+\r
+<script language="javascript">\r
+\r
+var oClassRegex = /\s*FCK__ShowTableBorders/ ;\r
+\r
+function ShowBorders()\r
+{\r
+       if ( this.border == 0 )\r
+       {\r
+               if ( !oClassRegex.test( this.className ) )\r
+                       this.className += ' FCK__ShowTableBorders' ;\r
+       }\r
+       else\r
+       {\r
+               if ( oClassRegex.test( this.className ) )\r
+               {\r
+                       this.className = this.className.replace( oClassRegex, '' ) ;\r
+                       if ( this.className.length == 0 )\r
+                               this.removeAttribute( 'className', 0 ) ;\r
+               }\r
+       }\r
+}\r
+\r
+function OnPropertyChange()\r
+{\r
+       if ( event.propertyName == 'border' || event.propertyName == 'className' )\r
+               ShowBorders.call(this) ;\r
+}\r
+\r
+</script>\r
+\r
+</public:component>\r