[FIX] web: backport of 2331b14
authorParamjit Singh Sahota <psa@tinyerp.com>
Tue, 4 Mar 2014 13:25:34 +0000 (18:55 +0530)
committerMartin Trigaux <mat@odoo.com>
Mon, 3 Nov 2014 16:34:45 +0000 (17:34 +0100)
Update the cleditor lib from v1.3.0 to v1.4.4 fixing IE11 issue, opw 614826

addons/web/static/lib/cleditor/jquery.cleditor.css
addons/web/static/lib/cleditor/jquery.cleditor.js
addons/web/static/lib/cleditor/jquery.cleditor.min.js

index 6ac490b..1966940 100644 (file)
@@ -6,7 +6,7 @@
 .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('images/buttons.gif')}\r
 .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)}\r
 .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC}\r
-.cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}\r
+.cleditorPopup {border:solid 1px #999; background-color:white; color:#333333; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000}\r
 .cleditorList div {padding:2px 4px 2px 4px}\r
 .cleditorList p,\r
 .cleditorList h1,\r
index 3de9089..7852037 100644 (file)
@@ -1,18 +1,13 @@
-/**\r
- @preserve CLEditor WYSIWYG HTML Editor v1.3.0\r
- http://premiumsoftware.net/cleditor\r
+/*!\r
+ CLEditor WYSIWYG HTML Editor v1.4.4\r
+ http://premiumsoftware.net/CLEditor\r
  requires jQuery v1.4.2 or later\r
 \r
  Copyright 2010, Chris Landowski, Premium Software, LLC\r
  Dual licensed under the MIT or GPL Version 2 licenses.\r
 */\r
 \r
-// ==ClosureCompiler==\r
-// @compilation_level SIMPLE_OPTIMIZATIONS\r
-// @output_file_name jquery.cleditor.min.js\r
-// ==/ClosureCompiler==\r
-\r
-(function($) {\r
+(function ($) {\r
 \r
   //==============\r
   // jQuery Plugin\r
@@ -22,7 +17,7 @@
 \r
     // Define the defaults used for all new cleditor instances\r
     defaultOptions: {\r
-      width:        500, // width not including margins, borders or padding\r
+      width:        'auto', // width not including margins, borders or padding\r
       height:       250, // height not including margins, borders or padding\r
       controls:     // controls to add to the toolbar\r
                     "bold italic underline strikethrough subscript superscript | font size " +\r
                     [["Paragraph", "<p>"], ["Header 1", "<h1>"], ["Header 2", "<h2>"],\r
                     ["Header 3", "<h3>"],  ["Header 4","<h4>"],  ["Header 5","<h5>"],\r
                     ["Header 6","<h6>"]],\r
-      useCSS:       false, // use CSS to style HTML when possible (not supported in ie)\r
+      useCSS:       true, // use CSS to style HTML when possible (not supported in ie)\r
       docType:      // Document type contained within the editor\r
                     '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',\r
       docCSSFile:   // CSS file used to style the document contained within the editor\r
                     "", \r
       bodyStyle:    // style to assign to document body contained within the editor\r
-                    "margin:4px; color:#4c4c4c; font-size:13px; font-family:\"Lucida Grande\",Helvetica,Verdana,Arial,sans-serif; cursor:text"\r
+                    "margin:4px; font:10pt Arial,Verdana; cursor:text"\r
     },\r
 \r
     // Define all usable toolbar buttons - the init string property is \r
     //   expanded during initialization back into the buttons object and \r
-    //   seperate object properties are created for each button.\r
+    //   separate object properties are created for each button.\r
     //   e.g. buttons.size.title = "Font Size"\r
     buttons: {\r
       // name,title,command,popupName (""=use name)\r
 \r
     // Loop through all matching textareas and create the editors\r
     this.each(function(idx, elem) {\r
-      if (elem.tagName == "TEXTAREA") {\r
+      if (elem.tagName.toUpperCase() === "TEXTAREA") {\r
         var data = $.data(elem, CLEDITOR);\r
         if (!data) data = new cleditor(elem, options);\r
         $result = $result.add(data);\r
 \r
   // Misc constants\r
   BACKGROUND_COLOR = "backgroundColor",\r
+  BLURRED          = "blurred",\r
   BUTTON           = "button",\r
   BUTTON_NAME      = "buttonName",\r
   CHANGE           = "change",\r
   CLICK            = "click",\r
   DISABLED         = "disabled",\r
   DIV_TAG          = "<div>",\r
+  FOCUSED          = "focused",\r
   TRANSPARENT      = "transparent",\r
   UNSELECTABLE     = "unselectable",\r
 \r
   PROMPT_CLASS     = "cleditorPrompt",  // prompt popup divs inside body\r
   MSG_CLASS        = "cleditorMsg",     // message popup div inside body\r
 \r
-  // Test for ie\r
-  ie = $.browser.msie,\r
-  ie6 = /msie\s6/i.test(navigator.userAgent),\r
+  // Browser detection\r
+  ua = navigator.userAgent.toLowerCase(),\r
+  ie = /msie/.test(ua),\r
+  ie6 = /msie\s6/.test(ua),\r
+  iege11 = /(trident)(?:.*rv:([\w.]+))?/.test(ua),\r
+  webkit = /webkit/.test(ua),\r
 \r
   // Test for iPhone/iTouch/iPad\r
-  iOS = /iphone|ipad|ipod/i.test(navigator.userAgent),\r
+  iOS = /iphone|ipad|ipod/i.test(ua),\r
 \r
   // Popups are created once as needed and shared by all editor instances\r
   popups = {},\r
     var $group = $(DIV_TAG)\r
       .addClass(GROUP_CLASS)\r
       .appendTo($toolbar);\r
+\r
+    // Initialize the group width\r
+    var groupWidth = 0;\r
     \r
     // Add the buttons to the toolbar\r
     $.each(options.controls.split(" "), function(idx, buttonName) {\r
       if (buttonName === "") return true;\r
 \r
       // Divider\r
-      if (buttonName == "|") {\r
+      if (buttonName === "|") {\r
 \r
         // Add a new divider to the group\r
         var $div = $(DIV_TAG)\r
           .addClass(DIVIDER_CLASS)\r
           .appendTo($group);\r
 \r
+        // Update the group width\r
+        $group.width(groupWidth + 1);\r
+        groupWidth = 0;\r
+\r
         // Create a new group\r
         $group = $(DIV_TAG)\r
           .addClass(GROUP_CLASS)\r
           .appendTo($group)\r
           .hover(hoverEnter, hoverLeave);\r
 \r
+        // Update the group width\r
+        groupWidth += 24;\r
+        $group.width(groupWidth + 1);\r
+\r
         // Prepare the button image\r
         var map = {};\r
         if (button.css) map = button.css;\r
 \r
     // Bind the window resize event when the width or height is auto or %\r
     if (/auto|%/.test("" + options.width + options.height))\r
-      $(window).resize(function() {\r
-        //Forcefully blurred iframe contentWindow, chrome, IE, safari doesn't trigger blur on window resize and due to which text disappears\r
-        var contentWindow = editor.$frame[0].contentWindow;\r
-        if(!$.browser.mozilla && contentWindow){\r
-          $(contentWindow).trigger('blur');\r
-        }\r
-        // CHM Note MonkeyPatch: if the DOM is not remove, refresh the cleditor\r
-        if(editor.$main.parent().parent().size()) {\r
-          refresh(editor);\r
-        }\r
-      });\r
+      $(window).bind('resize.cleditor', function () { refresh(editor); });\r
 \r
     // Create the iframe and resize the controls\r
     refresh(editor);\r
       return editor;\r
     };\r
   });\r
+  \r
+  // blurred - shortcut for .bind("blurred", handler) or .trigger("blurred")\r
+  fn.blurred = function(handler) {\r
+    var $this = $(this);\r
+    return handler ? $this.bind(BLURRED, handler) : $this.trigger(BLURRED);\r
+  };\r
 \r
   // change - shortcut for .bind("change", handler) or .trigger("change")\r
-  fn.change = function(handler) {\r
+  fn.change = function change(handler) {\r
+    console.log('change test');\r
     var $this = $(this);\r
     return handler ? $this.bind(CHANGE, handler) : $this.trigger(CHANGE);\r
   };\r
 \r
+  // focused - shortcut for .bind("focused", handler) or .trigger("focused")\r
+  fn.focused = function(handler) {\r
+    var $this = $(this);\r
+    return handler ? $this.bind(FOCUSED, handler) : $this.trigger(FOCUSED);\r
+  };\r
+\r
   //===============\r
   // Event Handlers\r
   //===============\r
         popup = popups[popupName];\r
 \r
     // Check if disabled\r
-    if (editor.disabled || $(buttonDiv).attr(DISABLED) == DISABLED)\r
+    if (editor.disabled || $(buttonDiv).attr(DISABLED) === DISABLED)\r
       return;\r
 \r
     // Fire the buttonClick event\r
       return false;\r
 \r
     // Toggle source\r
-    if (buttonName == "source") {\r
+    if (buttonName === "source") {\r
 \r
       // Show the iframe\r
       if (sourceMode(editor)) {\r
         var $popup = $(popup);\r
 \r
         // URL\r
-        if (popupName == "url") {\r
+        if (popupName === "url") {\r
 \r
           // Check for selection before showing the link url popup\r
-          if (buttonName == "link" && selectedText(editor) === "") {\r
+          if (buttonName === "link" && selectedText(editor) === "") {\r
             showMessage(editor, "A selection is required when inserting a link.", buttonDiv);\r
             return false;\r
           }\r
         }\r
 \r
         // Paste as Text\r
-        else if (popupName == "pastetext") {\r
+        else if (popupName === "pastetext") {\r
 \r
           // Wire up the submit button click event handler\r
           $popup.children(":button")\r
           return false; // stop propagination to document click\r
         }\r
 \r
-        // propaginate to documnt click\r
+        // propaginate to document click\r
         return;\r
 \r
       }\r
 \r
       // Print\r
-      else if (buttonName == "print")\r
+      else if (buttonName === "print")\r
         editor.$frame[0].contentWindow.print();\r
 \r
       // All other buttons\r
         useCSS = editor.options.useCSS;\r
 \r
     // Get the command value\r
-    if (buttonName == "font")\r
+    if (buttonName === "font")\r
       // Opera returns the fontfamily wrapped in quotes\r
       value = target.style.fontFamily.replace(/"/g, "");\r
-    else if (buttonName == "size") {\r
-      if (target.tagName == "DIV")\r
+    else if (buttonName === "size") {\r
+      if (target.tagName.toUpperCase() === "DIV")\r
         target = target.children[0];\r
       value = target.innerHTML;\r
     }\r
-    else if (buttonName == "style")\r
+    else if (buttonName === "style")\r
       value = "<" + target.tagName + ">";\r
-    else if (buttonName == "color")\r
+    else if (buttonName === "color")\r
       value = hex(target.style.backgroundColor);\r
-    else if (buttonName == "highlight") {\r
+    else if (buttonName === "highlight") {\r
       value = hex(target.style.backgroundColor);\r
       if (ie) command = 'backcolor';\r
       else useCSS = true;\r
   //==================\r
   // Private Functions\r
   //==================\r
-\r
+
   // checksum - returns a checksum using the Adler-32 method\r
   function checksum(text)\r
   {\r
       $popup.html(popupContent);\r
 \r
     // Color\r
-    else if (popupName == "color") {\r
+    else if (popupName === "color") {\r
       var colors = options.colors.split(" ");\r
       if (colors.length < 10)\r
         $popup.width("auto");\r
     }\r
 \r
     // Font\r
-    else if (popupName == "font")\r
+    else if (popupName === "font")\r
       $.each(options.fonts.split(","), function(idx, font) {\r
         $(DIV_TAG).appendTo($popup)\r
           .css("fontFamily", font)\r
       });\r
 \r
     // Size\r
-    else if (popupName == "size")\r
+    else if (popupName === "size")\r
       $.each(options.sizes.split(","), function(idx, size) {\r
         $(DIV_TAG).appendTo($popup)\r
-          .html("<font size=" + size + ">" + size + "</font>");\r
+          .html('<font size="' + size + '">' + size + '</font>');\r
       });\r
 \r
     // Style\r
-    else if (popupName == "style")\r
+    else if (popupName === "style")\r
       $.each(options.styles, function(idx, style) {\r
         $(DIV_TAG).appendTo($popup)\r
           .html(style[1] + style[0] + style[1].replace("<", "</"));\r
       });\r
 \r
     // URL\r
-    else if (popupName == "url") {\r
-      $popup.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');\r
+    else if (popupName === "url") {\r
+      $popup.html('Enter URL:<br /><input type="text" value="http://" size="35" /><br /><input type="button" value="Submit" />');\r
       popupTypeClass = PROMPT_CLASS;\r
     }\r
 \r
     // Paste as Text\r
-    else if (popupName == "pastetext") {\r
-      $popup.html('Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>');\r
+    else if (popupName === "pastetext") {\r
+      $popup.html('Paste your content here and click submit.<br /><textarea cols="40" rows="3"></textarea><br /><input type="button" value="Submit" />');\r
       popupTypeClass = PROMPT_CLASS;\r
     }\r
 \r
     }\r
 \r
     // Execute the command and check for error\r
-    var success = true, description;\r
-    if (ie && command.toLowerCase() == "inserthtml")\r
+    var success = true, message;\r
+    if (ie && command.toLowerCase() === "inserthtml")\r
       getRange(editor).pasteHTML(value);\r
     else {\r
       try { success = editor.doc.execCommand(command, 0, value || null); }\r
-      catch (err) { description = err.description; success = false; }\r
+      catch (err) { message = err.message; success = false; }\r
       if (!success) {\r
         if ("cutcopypaste".indexOf(command) > -1)\r
           showMessage(editor, "For security reasons, your browser does not support the " +\r
             button);\r
         else\r
           showMessage(editor,\r
-            (description ? description : "Error executing the " + command + " command."),\r
+            (message ? message : "Error executing the " + command + " command."),\r
             button);\r
       }\r
     }\r
 \r
-    // Enable the buttons\r
+    // Enable the buttons and update the textarea\r
     refreshButtons(editor);\r
+    updateTextArea(editor, true);\r
     return success;\r
 \r
   }\r
     return editor.$frame[0].contentWindow.getSelection();\r
   }\r
 \r
-  // Returns the hex value for the passed in string.\r
-  //   hex("rgb(255, 0, 0)"); // #FF0000\r
-  //   hex("#FF0000"); // #FF0000\r
-  //   hex("#F00"); // #FF0000\r
+  // hex - returns the hex value for the passed in color string\r
   function hex(s) {\r
-    var m = /rgba?\((\d+), (\d+), (\d+)/.exec(s),\r
-      c = s.split("");\r
+\r
+    // hex("rgb(255, 0, 0)") returns #FF0000\r
+    var m = /rgba?\((\d+), (\d+), (\d+)/.exec(s);\r
     if (m) {\r
-      s = ( m[1] << 16 | m[2] << 8 | m[3] ).toString(16);\r
+      s = (m[1] << 16 | m[2] << 8 | m[3]).toString(16);\r
       while (s.length < 6)\r
         s = "0" + s;\r
+      return "#" + s;\r
     }\r
-    return "#" + (s.length == 6 ? s : c[1] + c[1] + c[2] + c[2] + c[3] + c[3]);\r
+\r
+    // hex("#F00") returns #FF0000\r
+    var c = s.split("");\r
+    if (s.length === 4)\r
+      return "#" + c[1] + c[1] + c[2] + c[2] + c[3] + c[3];\r
+\r
+    // hex("#FF0000") returns #FF0000\r
+    return s;\r
+\r
   }\r
 \r
   // hidePopups - hides all popups\r
 \r
   // imagesPath - returns the path to the images folder\r
   function imagesPath() {\r
-    var cssFile = "jquery.cleditor.css",\r
-        href = $("link[href$='" + cssFile +"']").attr("href");\r
-    return href.substr(0, href.length - cssFile.length) + "images/";\r
+    var href = $("link[href*=cleditor]").attr("href");\r
+    return href.replace(/^(.*\/)[^\/]+$/, '$1') + "images/";\r
   }\r
 \r
   // imageUrl - Returns the css url string for a filemane\r
       editor.$frame.remove();\r
 \r
     // Create a new iframe\r
-    var $frame = editor.$frame = $('<iframe frameborder="0" src="javascript:true;">')\r
+    var $frame = editor.$frame = $('<iframe frameborder="0" src="javascript:true;" />')\r
       .hide()\r
       .appendTo($main);\r
 \r
 \r
     // Work around for bug in IE which causes the editor to lose\r
     // focus when clicking below the end of the document.\r
-    if (ie)\r
+    if (ie || iege11)\r
       $doc.click(function() {focus(editor);});\r
 \r
     // Load the content\r
     updateFrame(editor);\r
 \r
     // Bind the ie specific iframe event handlers\r
-    if (ie) {\r
+    if (ie || iege11) {\r
 \r
       // Save the current user selection. This code is needed since IE will\r
       // reset the selection just after the beforedeactivate event and just\r
       $doc.bind("beforedeactivate beforeactivate selectionchange keypress", function(e) {\r
         \r
         // Flag the editor as inactive\r
-        if (e.type == "beforedeactivate")\r
+        if (e.type === "beforedeactivate")\r
           editor.inactive = true;\r
-        \r
-        // Get rid of the bogus selection and flag the editor as active\r
-        else if (e.type == "beforeactivate") {\r
+\r
+          // Get rid of the bogus selection and flag the editor as active\r
+        else if (e.type === "beforeactivate") {\r
           if (!editor.inactive && editor.range && editor.range.length > 1)\r
             editor.range.shift();\r
           delete editor.inactive;\r
         }\r
 \r
-        // Save the selection when the editor is active\r
+          // Save the selection when the editor is active\r
         else if (!editor.inactive) {\r
-          if (!editor.range) \r
+          if (!editor.range)\r
             editor.range = [];\r
           editor.range.unshift(getRange(editor));\r
 \r
 \r
       });\r
 \r
-      // Restore the text range when the iframe gains focus\r
+      // Restore the text range and trigger focused event when the iframe gains focus\r
       $frame.focus(function() {\r
         restoreRange(editor);\r
+        $(editor).triggerHandler(FOCUSED);\r
+      });\r
+\r
+      // Trigger blurred event when the iframe looses focus\r
+      $frame.blur(function() {\r
+        $(editor).triggerHandler(BLURRED);\r
       });\r
 \r
     }\r
 \r
-    // Update the textarea when the iframe loses focus\r
-    ($.browser.mozilla ? $doc : $(contentWindow)).blur(function() {\r
-      updateTextArea(editor, true);\r
-    });\r
+      // Trigger focused and blurred events for all other browsers\r
+    else {\r
+      $(editor.$frame[0].contentWindow)\r
+        .focus(function () { $(editor).triggerHandler(FOCUSED); })\r
+        .blur(function () { $(editor).triggerHandler(BLURRED); });\r
+    }\r
 \r
-    // Enable the toolbar buttons as the user types or clicks\r
+    // Enable the toolbar buttons and update the textarea as the user types or clicks\r
     $doc.click(hidePopups)\r
       .bind("keyup mouseup", function() {\r
         refreshButtons(editor);\r
+        updateTextArea(editor, true);\r
       });\r
 \r
     // Show the textarea for iPhone/iTouch/iPad or\r
 \r
       var $toolbar = editor.$toolbar,\r
           $group = $toolbar.children("div:last"),\r
-          wid = /%/.test("" + options.width) ? options.width : $main.width();\r
+          wid = $main.width();\r
 \r
       // Resize the toolbar\r
       var hgt = $group.offset().top + $group.outerHeight() - $toolbar.offset().top + 1;\r
       $toolbar.height(hgt);\r
 \r
       // Resize the iframe\r
-      hgt = (/%/.test("" + options.height) ? $main.height() : parseInt(options.height)) - hgt;\r
+      hgt = (/%/.test("" + options.height) ? $main.height() : parseInt(options.height, 10)) - hgt;\r
       $frame.width(wid).height(hgt);\r
 \r
       // Resize the textarea. IE6 textareas have a 1px top\r
   function refreshButtons(editor) {\r
 \r
     // Webkit requires focus before queryCommandEnabled will return anything but false\r
-    if (!iOS && $.browser.webkit && !editor.focused) {\r
+    if (!iOS && webkit && !editor.focused) {\r
       editor.$frame[0].contentWindow.focus();\r
       window.focus();\r
       editor.focused = true;\r
         if (enabled === undefined)\r
           enabled = true;\r
       }\r
-      else if (((inSourceMode || iOS) && button.name != "source") ||\r
-      (ie && (command == "undo" || command == "redo")))\r
+      else if (((inSourceMode || iOS) && button.name !== "source") ||\r
+      (ie && (command === "undo" || command === "redo")))\r
         enabled = false;\r
-      else if (command && command != "print") {\r
-        if (ie && command == "hilitecolor")\r
+      else if (command && command !== "print") {\r
+        if (ie && command === "hilitecolor")\r
           command = "backcolor";\r
         // IE does not support inserthtml, so it's always enabled\r
-        if (!ie || command != "inserthtml") {\r
+        if (!ie || command !== "inserthtml") {\r
           try {enabled = queryObj.queryCommandEnabled(command);}\r
           catch (err) {enabled = false;}\r
         }\r
 \r
   // restoreRange - restores the current ie selection\r
   function restoreRange(editor) {\r
-    if (ie && editor.range)\r
-      editor.range[0].select();\r
+    if (editor.range) {\r
+      if (ie)\r
+        editor.range[0].select();\r
+      else if (iege11)\r
+        getSelection(editor).addRange(editor.range[0]);\r
+    }\r
   }\r
 \r
   // select - selects all the text in either the textarea or iframe\r
     // of potentially heavy updateFrame callbacks.\r
     if (updateFrameCallback) {\r
       var sum = checksum(code);\r
-      if (checkForChange && editor.areaChecksum == sum)\r
+      if (checkForChange && editor.areaChecksum === sum)\r
         return;\r
       editor.areaChecksum = sum;\r
     }\r
       editor.frameChecksum = checksum(html);\r
 \r
     // Update the iframe and trigger the change event\r
-    if (html != $body.html()) {\r
+    if (html !== $body.html()) {\r
       $body.html(html);\r
       $(editor).triggerHandler(CHANGE);\r
     }\r
     // of potentially heavy updateTextArea callbacks.\r
     if (updateTextAreaCallback) {\r
       var sum = checksum(html);\r
-      if (checkForChange && editor.frameChecksum == sum)\r
+      if (checkForChange && editor.frameChecksum === sum)\r
         return;\r
       editor.frameChecksum = sum;\r
     }\r
       editor.areaChecksum = checksum(code);\r
 \r
     // Update the textarea and trigger the change event\r
-    if (code != $area.val()) {\r
+    if (code !== $area.val()) {\r
       $area.val(code);\r
       $(editor).triggerHandler(CHANGE);\r
     }\r
index 5afec04..5d94c26 100644 (file)
@@ -1,31 +1,8 @@
-/*
- CLEditor WYSIWYG HTML Editor v1.3.0
- http://premiumsoftware.net/cleditor
+/*!
+ CLEditor WYSIWYG HTML Editor v1.4.4
+ http://premiumsoftware.net/CLEditor
  requires jQuery v1.4.2 or later
-
  Copyright 2010, Chris Landowski, Premium Software, LLC
  Dual licensed under the MIT or GPL Version 2 licenses.
 */
-(function(e){function aa(a){var b=this,c=a.target,d=e.data(c,x),h=s[d],f=h.popupName,i=p[f];if(!(b.disabled||e(c).attr(n)==n)){var g={editor:b,button:c,buttonName:d,popup:i,popupName:f,command:h.command,useCSS:b.options.useCSS};if(h.buttonClick&&h.buttonClick(a,g)===false)return false;if(d=="source"){if(t(b)){delete b.range;b.$area.hide();b.$frame.show();c.title=h.title}else{b.$frame.hide();b.$area.show();c.title="Show Rich Text"}setTimeout(function(){u(b)},100)}else if(!t(b))if(f){var j=e(i);if(f==
-"url"){if(d=="link"&&M(b)===""){z(b,"A selection is required when inserting a link.",c);return false}j.children(":button").unbind(q).bind(q,function(){var k=j.find(":text"),o=e.trim(k.val());o!==""&&v(b,g.command,o,null,g.button);k.val("http://");r();w(b)})}else f=="pastetext"&&j.children(":button").unbind(q).bind(q,function(){var k=j.find("textarea"),o=k.val().replace(/\n/g,"<br />");o!==""&&v(b,g.command,o,null,g.button);k.val("");r();w(b)});if(c!==e.data(i,A)){N(b,i,c);return false}return}else if(d==
-"print")b.$frame[0].contentWindow.print();else if(!v(b,g.command,g.value,g.useCSS,c))return false;w(b)}}function O(a){a=e(a.target).closest("div");a.css(H,a.data(x)?"#FFF":"#FFC")}function P(a){e(a.target).closest("div").css(H,"transparent")}function ba(a){var b=a.data.popup,c=a.target;if(!(b===p.msg||e(b).hasClass(B))){var d=e.data(b,A),h=e.data(d,x),f=s[h],i=f.command,g,j=this.options.useCSS;if(h=="font")g=c.style.fontFamily.replace(/"/g,"");else if(h=="size"){if(c.tagName=="DIV")c=c.children[0];
-g=c.innerHTML}else if(h=="style")g="<"+c.tagName+">";else if(h=="color")g=Q(c.style.backgroundColor);else if(h=="highlight"){g=Q(c.style.backgroundColor);if(l)i="backcolor";else j=true}b={editor:this,button:d,buttonName:h,popup:b,popupName:f.popupName,command:i,value:g,useCSS:j};if(!(f.popupClick&&f.popupClick(a,b)===false)){if(b.command&&!v(this,b.command,b.value,b.useCSS,d))return false;r();w(this)}}}function C(a){for(var b=1,c=0,d=0;d<a.length;++d){b=(b+a.charCodeAt(d))%65521;c=(c+b)%65521}return c<<
-16|b}function R(a,b,c,d,h){if(p[a])return p[a];var f=e(m).hide().addClass(ca).appendTo("body");if(d)f.html(d);else if(a=="color"){b=b.colors.split(" ");b.length<10&&f.width("auto");e.each(b,function(i,g){e(m).appendTo(f).css(H,"#"+g)});c=da}else if(a=="font")e.each(b.fonts.split(","),function(i,g){e(m).appendTo(f).css("fontFamily",g).html(g)});else if(a=="size")e.each(b.sizes.split(","),function(i,g){e(m).appendTo(f).html("<font size="+g+">"+g+"</font>")});else if(a=="style")e.each(b.styles,function(i,
-g){e(m).appendTo(f).html(g[1]+g[0]+g[1].replace("<","</"))});else if(a=="url"){f.html('Enter URL:<br><input type=text value="http://" size=35><br><input type=button value="Submit">');c=B}else if(a=="pastetext"){f.html("Paste your content here and click submit.<br /><textarea cols=40 rows=3></textarea><br /><input type=button value=Submit>");c=B}if(!c&&!d)c=S;f.addClass(c);l&&f.attr(I,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(I,"on");if(f.hasClass(S)||h===true)f.children().hover(O,P);p[a]=f[0];
-return f[0]}function T(a,b){if(b){a.$area.attr(n,n);a.disabled=true}else{a.$area.removeAttr(n);delete a.disabled}try{if(l)a.doc.body.contentEditable=!b;else a.doc.designMode=!b?"on":"off"}catch(c){}u(a)}function v(a,b,c,d,h){D(a);if(!l){if(d===undefined||d===null)d=a.options.useCSS;a.doc.execCommand("styleWithCSS",0,d.toString())}d=true;var f;if(l&&b.toLowerCase()=="inserthtml")y(a).pasteHTML(c);else{try{d=a.doc.execCommand(b,0,c||null)}catch(i){f=i.description;d=false}d||("cutcopypaste".indexOf(b)>
--1?z(a,"For security reasons, your browser does not support the "+b+" command. Try using the keyboard shortcut or context menu instead.",h):z(a,f?f:"Error executing the "+b+" command.",h))}u(a);return d}function w(a){setTimeout(function(){t(a)?a.$area.focus():a.$frame[0].contentWindow.focus();u(a)},0)}function y(a){if(l)return J(a).createRange();return J(a).getRangeAt(0)}function J(a){if(l)return a.doc.selection;return a.$frame[0].contentWindow.getSelection()}function Q(a){var b=/rgba?\((\d+), (\d+), (\d+)/.exec(a),
-c=a.split("");if(b)for(a=(b[1]<<16|b[2]<<8|b[3]).toString(16);a.length<6;)a="0"+a;return"#"+(a.length==6?a:c[1]+c[1]+c[2]+c[2]+c[3]+c[3])}function r(){e.each(p,function(a,b){e(b).hide().unbind(q).removeData(A)})}function U(){var a=e("link[href$='jquery.cleditor.css']").attr("href");return a.substr(0,a.length-19)+"images/"}function K(a){var b=a.$main,c=a.options;a.$frame&&a.$frame.remove();var d=a.$frame=e('<iframe frameborder="0" src="javascript:true;">').hide().appendTo(b),h=d[0].contentWindow,f=
-a.doc=h.document,i=e(f);f.open();f.write(c.docType+"<html>"+(c.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+c.docCSSFile+'" /></head>')+'<body style="'+c.bodyStyle+'"></body></html>');f.close();l&&i.click(function(){w(a)});E(a);if(l){i.bind("beforedeactivate beforeactivate selectionchange keypress",function(g){if(g.type=="beforedeactivate")a.inactive=true;else if(g.type=="beforeactivate"){!a.inactive&&a.range&&a.range.length>1&&a.range.shift();delete a.inactive}else if(!a.inactive){if(!a.range)a.range=
-[];for(a.range.unshift(y(a));a.range.length>2;)a.range.pop()}});d.focus(function(){D(a)})}(e.browser.mozilla?i:e(h)).blur(function(){V(a,true)});i.click(r).bind("keyup mouseup",function(){u(a)});L?a.$area.show():d.show();e(function(){var g=a.$toolbar,j=g.children("div:last"),k=b.width();j=j.offset().top+j.outerHeight()-g.offset().top+1;g.height(j);j=(/%/.test(""+c.height)?b.height():parseInt(c.height))-j;d.width(k).height(j);a.$area.width(k).height(ea?j-2:j);T(a,a.disabled);u(a)})}function u(a){if(!L&&
-e.browser.webkit&&!a.focused){a.$frame[0].contentWindow.focus();window.focus();a.focused=true}var b=a.doc;if(l)b=y(a);var c=t(a);e.each(a.$toolbar.find("."+W),function(d,h){var f=e(h),i=e.cleditor.buttons[e.data(h,x)],g=i.command,j=true;if(a.disabled)j=false;else if(i.getEnabled){j=i.getEnabled({editor:a,button:h,buttonName:i.name,popup:p[i.popupName],popupName:i.popupName,command:i.command,useCSS:a.options.useCSS});if(j===undefined)j=true}else if((c||L)&&i.name!="source"||l&&(g=="undo"||g=="redo"))j=
-false;else if(g&&g!="print"){if(l&&g=="hilitecolor")g="backcolor";if(!l||g!="inserthtml")try{j=b.queryCommandEnabled(g)}catch(k){j=false}}if(j){f.removeClass(X);f.removeAttr(n)}else{f.addClass(X);f.attr(n,n)}})}function D(a){l&&a.range&&a.range[0].select()}function M(a){D(a);if(l)return y(a).text;return J(a).toString()}function z(a,b,c){var d=R("msg",a.options,fa);d.innerHTML=b;N(a,d,c)}function N(a,b,c){var d,h,f=e(b);if(c){var i=e(c);d=i.offset();h=--d.left;d=d.top+i.height()}else{i=a.$toolbar;
-d=i.offset();h=Math.floor((i.width()-f.width())/2)+d.left;d=d.top+i.height()-2}r();f.css({left:h,top:d}).show();if(c){e.data(b,A,c);f.bind(q,{popup:b},e.proxy(ba,a))}setTimeout(function(){f.find(":text,textarea").eq(0).focus().select()},100)}function t(a){return a.$area.is(":visible")}function E(a,b){var c=a.$area.val(),d=a.options,h=d.updateFrame,f=e(a.doc.body);if(h){var i=C(c);if(b&&a.areaChecksum==i)return;a.areaChecksum=i}c=h?h(c):c;c=c.replace(/<(?=\/?script)/ig,"&lt;");if(d.updateTextArea)a.frameChecksum=
-C(c);if(c!=f.html()){f.html(c);e(a).triggerHandler(F)}}function V(a,b){var c=e(a.doc.body).html(),d=a.options,h=d.updateTextArea,f=a.$area;if(h){var i=C(c);if(b&&a.frameChecksum==i)return;a.frameChecksum=i}c=h?h(c):c;if(d.updateFrame)a.areaChecksum=C(c);if(c!=f.val()){f.val(c);e(a).triggerHandler(F)}}e.cleditor={defaultOptions:{width:500,height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",
-colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],
-["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:false,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},
-imagesPath:function(){return U()}};e.fn.cleditor=function(a){var b=e([]);this.each(function(c,d){if(d.tagName=="TEXTAREA"){var h=e.data(d,Y);h||(h=new cleditor(d,a));b=b.add(h)}});return b};var H="backgroundColor",A="button",x="buttonName",F="change",Y="cleditor",q="click",n="disabled",m="<div>",I="unselectable",W="cleditorButton",X="cleditorDisabled",ca="cleditorPopup",S="cleditorList",da="cleditorColor",B="cleditorPrompt",fa="cleditorMsg",l=e.browser.msie,ea=/msie\s6/i.test(navigator.userAgent),
-L=/iphone|ipad|ipod/i.test(navigator.userAgent),p={},Z,s=e.cleditor.buttons;e.each(s.init.split("|"),function(a,b){var c=b.split(","),d=c[0];s[d]={stripIndex:a,name:d,title:c[1]===""?d.charAt(0).toUpperCase()+d.substr(1):c[1],command:c[2]===""?d:c[2],popupName:c[3]===""?d:c[3]}});delete s.init;cleditor=function(a,b){var c=this;c.options=b=e.extend({},e.cleditor.defaultOptions,b);var d=c.$area=e(a).hide().data(Y,c).blur(function(){E(c,true)}),h=c.$main=e(m).addClass("cleditorMain").width(b.width).height(b.height),
-f=c.$toolbar=e(m).addClass("cleditorToolbar").appendTo(h),i=e(m).addClass("cleditorGroup").appendTo(f);e.each(b.controls.split(" "),function(g,j){if(j==="")return true;if(j=="|"){e(m).addClass("cleditorDivider").appendTo(i);i=e(m).addClass("cleditorGroup").appendTo(f)}else{var k=s[j],o=e(m).data(x,k.name).addClass(W).attr("title",k.title).bind(q,e.proxy(aa,c)).appendTo(i).hover(O,P),G={};if(k.css)G=k.css;else if(k.image)G.backgroundImage="url("+U()+k.image+")";if(k.stripIndex)G.backgroundPosition=
-k.stripIndex*-24;o.css(G);l&&o.attr(I,"on");k.popupName&&R(k.popupName,b,k.popupClass,k.popupContent,k.popupHover)}});h.insertBefore(d).append(d);if(!Z){e(document).click(function(g){g=e(g.target);g.add(g.parents()).is("."+B)||r()});Z=true}/auto|%/.test(""+b.width+b.height)&&e(window).resize(function(){K(c)});K(c)};var $=cleditor.prototype;e.each([["clear",function(a){a.$area.val("");E(a)}],["disable",T],["execCommand",v],["focus",w],["hidePopups",r],["sourceMode",t,true],["refresh",K],["select",
-function(a){setTimeout(function(){t(a)?a.$area.select():v(a,"selectall")},0)}],["selectedHTML",function(a){D(a);a=y(a);if(l)return a.htmlText;var b=e("<layer>")[0];b.appendChild(a.cloneContents());return b.innerHTML},true],["selectedText",M,true],["showMessage",z],["updateFrame",E],["updateTextArea",V]],function(a,b){$[b[0]]=function(){for(var c=[this],d=0;d<arguments.length;d++)c.push(arguments[d]);c=b[1].apply(this,c);if(b[2])return c;return this}});$.change=function(a){var b=e(this);return a?b.bind(F,
-a):b.trigger(F)}})(jQuery);
\ No newline at end of file
+(function(n){function vi(t){var i=this,v=t.target,p=n.data(v,a),w=o[p],k=w.popupName,g=f[k],y,d;if(!i.disabled&&n(v).attr(r)!==r){if(y={editor:i,button:v,buttonName:p,popup:g,popupName:k,command:w.command,useCSS:i.options.useCSS},w.buttonClick&&w.buttonClick(t,y)===!1)return!1;if(p==="source")l(i)?(delete i.range,i.$area.hide(),i.$frame.show(),v.title=w.title):(i.$frame.hide(),i.$area.show(),v.title="Show Rich Text"),setTimeout(function(){c(i)},100);else if(!l(i)){if(k){if(d=n(g),k==="url"){if(p==="link"&&ri(i)==="")return rt(i,"A selection is required when inserting a link.",v),!1;d.children(":button").unbind(u).bind(u,function(){var t=d.find(":text"),r=n.trim(t.val());r!==""&&s(i,y.command,r,null,y.button);t.val("http://");e();h(i)})}else k==="pastetext"&&d.children(":button").unbind(u).bind(u,function(){var n=d.find("textarea"),t=n.val().replace(/\n/g,"<br />");t!==""&&s(i,y.command,t,null,y.button);n.val("");e();h(i)});return v!==n.data(g,b)?(ui(i,g,v),!1):void 0}if(p==="print")i.$frame[0].contentWindow.print();else if(!s(i,y.command,y.value,y.useCSS,v))return!1}h(i)}}function kt(t){var i=n(t.target).closest("div");i.css(ft,i.data(a)?"#FFF":"#FFC")}function dt(t){n(t.target).closest("div").css(ft,"transparent")}function yi(i){var v=this,y=i.data.popup,r=i.target,l;if(y!==f.msg&&!n(y).hasClass(g)){var w=n.data(y,b),u=n.data(w,a),p=o[u],k=p.command,c,d=v.options.useCSS;if(u==="font"?c=r.style.fontFamily.replace(/"/g,""):u==="size"?(r.tagName.toUpperCase()==="DIV"&&(r=r.children[0]),c=r.innerHTML):u==="style"?c="<"+r.tagName+">":u==="color"?c=ti(r.style.backgroundColor):u==="highlight"&&(c=ti(r.style.backgroundColor),t?k="backcolor":d=!0),l={editor:v,button:w,buttonName:u,popup:y,popupName:p.popupName,command:k,value:c,useCSS:d},!p.popupClick||p.popupClick(i,l)!==!1){if(l.command&&!s(v,l.command,l.value,l.useCSS,w))return!1;e();h(v)}}}function nt(n){for(var t=1,i=0,r=0;r<n.length;++r)t=(t+n.charCodeAt(r))%65521,i=(i+t)%65521;return i<<16|t}function pi(n){n.$area.val("");ut(n)}function gt(r,u,e,o,s){var h,c;return f[r]?f[r]:(h=n(i).hide().addClass(si).appendTo("body"),o?h.html(o):r==="color"?(c=u.colors.split(" "),c.length<10&&h.width("auto"),n.each(c,function(t,r){n(i).appendTo(h).css(ft,"#"+r)}),e=hi):r==="font"?n.each(u.fonts.split(","),function(t,r){n(i).appendTo(h).css("fontFamily",r).html(r)}):r==="size"?n.each(u.sizes.split(","),function(t,r){n(i).appendTo(h).html('<font size="'+r+'">'+r+"<\/font>")}):r==="style"?n.each(u.styles,function(t,r){n(i).appendTo(h).html(r[1]+r[0]+r[1].replace("<","<\/"))}):r==="url"?(h.html('Enter URL:<br /><input type="text" value="http://" size="35" /><br /><input type="button" value="Submit" />'),e=g):r==="pastetext"&&(h.html('Paste your content here and click submit.<br /><textarea cols="40" rows="3"><\/textarea><br /><input type="button" value="Submit" />'),e=g),e||o||(e=pt),h.addClass(e),t&&h.attr(et,"on").find("div,font,p,h1,h2,h3,h4,h5,h6").attr(et,"on"),(h.hasClass(pt)||s===!0)&&h.children().hover(kt,dt),f[r]=h[0],h[0])}function ni(n,i){i?(n.$area.attr(r,r),n.disabled=!0):(n.$area.removeAttr(r),delete n.disabled);try{t?n.doc.body.contentEditable=!i:n.doc.designMode=i?"off":"on"}catch(u){}c(n)}function s(n,i,r,u,f){it(n);t||((u===undefined||u===null)&&(u=n.options.useCSS),n.doc.execCommand("styleWithCSS",0,u.toString()));var e=!0,o;if(t&&i.toLowerCase()==="inserthtml")p(n).pasteHTML(r);else{try{e=n.doc.execCommand(i,0,r||null)}catch(s){o=s.message;e=!1}e||("cutcopypaste".indexOf(i)>-1?rt(n,"For security reasons, your browser does not support the "+i+" command. Try using the keyboard shortcut or context menu instead.",f):rt(n,o?o:"Error executing the "+i+" command.",f))}return c(n),ct(n,!0),e}function h(n){setTimeout(function(){l(n)?n.$area.focus():n.$frame[0].contentWindow.focus();c(n)},0)}function p(n){return t?tt(n).createRange():tt(n).getRangeAt(0)}function tt(n){return t?n.doc.selection:n.$frame[0].contentWindow.getSelection()}function ti(n){var i=/rgba?\((\d+), (\d+), (\d+)/.exec(n),t;if(i){for(n=(i[1]<<16|i[2]<<8|i[3]).toString(16);n.length<6;)n="0"+n;return"#"+n}return(t=n.split(""),n.length===4)?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:n}function e(){n.each(f,function(t,i){n(i).hide().unbind(u).removeData(b)})}function ii(){var t=n("link[href*=cleditor]").attr("href");return t.replace(/^(.*\/)[^\/]+$/,"$1")+"images/"}function wi(n){return"url("+ii()+n+")"}function ht(i){var o=i.$main,r=i.options;i.$frame&&i.$frame.remove();var u=i.$frame=n('<iframe frameborder="0" src="javascript:true;" />').hide().appendTo(o),l=u[0].contentWindow,f=i.doc=l.document,s=n(f);f.open();f.write(r.docType+"<html>"+(r.docCSSFile===""?"":'<head><link rel="stylesheet" type="text/css" href="'+r.docCSSFile+'" /><\/head>')+'<body style="'+r.bodyStyle+'"><\/body><\/html>');f.close();(t||ot)&&s.click(function(){h(i)});ut(i);t||ot?(s.bind("beforedeactivate beforeactivate selectionchange keypress",function(n){if(n.type==="beforedeactivate")i.inactive=!0;else if(n.type==="beforeactivate")!i.inactive&&i.range&&i.range.length>1&&i.range.shift(),delete i.inactive;else if(!i.inactive)for(i.range||(i.range=[]),i.range.unshift(p(i));i.range.length>2;)i.range.pop()}),u.focus(function(){it(i);n(i).triggerHandler(d)}),u.blur(function(){n(i).triggerHandler(w)})):n(i.$frame[0].contentWindow).focus(function(){n(i).triggerHandler(d)}).blur(function(){n(i).triggerHandler(w)});s.click(e).bind("keyup mouseup",function(){c(i);ct(i,!0)});st?i.$area.show():u.show();n(function(){var t=i.$toolbar,f=t.children("div:last"),e=o.width(),n=f.offset().top+f.outerHeight()-t.offset().top+1;t.height(n);n=(/%/.test(""+r.height)?o.height():parseInt(r.height,10))-n;u.width(e).height(n);i.$area.width(e).height(li?n-2:n);ni(i,i.disabled);c(i)})}function c(i){var u,e;st||!ai||i.focused||(i.$frame[0].contentWindow.focus(),window.focus(),i.focused=!0);u=i.doc;t&&(u=p(i));e=l(i);n.each(i.$toolbar.find("."+vt),function(o,s){var v=n(s),h=n.cleditor.buttons[n.data(s,a)],c=h.command,l=!0,y;if(i.disabled)l=!1;else if(h.getEnabled)y={editor:i,button:s,buttonName:h.name,popup:f[h.popupName],popupName:h.popupName,command:h.command,useCSS:i.options.useCSS},l=h.getEnabled(y),l===undefined&&(l=!0);else if((e||st)&&h.name!=="source"||t&&(c==="undo"||c==="redo"))l=!1;else if(c&&c!=="print"&&(t&&c==="hilitecolor"&&(c="backcolor"),!t||c!=="inserthtml"))try{l=u.queryCommandEnabled(c)}catch(p){l=!1}l?(v.removeClass(yt),v.removeAttr(r)):(v.addClass(yt),v.attr(r,r))})}function it(n){n.range&&(t?n.range[0].select():ot&&tt(n).addRange(n.range[0]))}function bi(n){setTimeout(function(){l(n)?n.$area.select():s(n,"selectall")},0)}function ki(i){var u,r,f;return(it(i),u=p(i),t)?u.htmlText:(r=n("<layer>")[0],r.appendChild(u.cloneContents()),f=r.innerHTML,r=null,f)}function ri(n){return(it(n),t)?p(n).text:tt(n).toString()}function rt(n,t,i){var r=gt("msg",n.options,ci);r.innerHTML=t;ui(n,r,i)}function ui(t,i,r){var f,h,c,o=n(i),l,s;r?(l=n(r),f=l.offset(),h=--f.left,c=f.top+l.height()):(s=t.$toolbar,f=s.offset(),h=Math.floor((s.width()-o.width())/2)+f.left,c=f.top+s.height()-2);e();o.css({left:h,top:c}).show();r&&(n.data(i,b,r),o.bind(u,{popup:i},n.proxy(yi,t)));setTimeout(function(){o.find(":text,textarea").eq(0).focus().select()},100)}function l(n){return n.$area.is(":visible")}function ut(t,i){var u=t.$area.val(),o=t.options,f=o.updateFrame,s=n(t.doc.body),e,r;if(f){if(e=nt(u),i&&t.areaChecksum===e)return;t.areaChecksum=e}r=f?f(u):u;r=r.replace(/<(?=\/?script)/ig,"&lt;");o.updateTextArea&&(t.frameChecksum=nt(r));r!==s.html()&&(s.html(r),n(t).triggerHandler(k))}function ct(t,i){var u=n(t.doc.body).html(),o=t.options,f=o.updateTextArea,s=t.$area,e,r;if(f){if(e=nt(u),i&&t.frameChecksum===e)return;t.frameChecksum=e}r=f?f(u):u;o.updateFrame&&(t.areaChecksum=nt(r));r!==s.val()&&(s.val(r),n(t).triggerHandler(k))}var y,bt;n.cleditor={defaultOptions:{width:"auto",height:250,controls:"bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",colors:"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C 666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636 000 300 630 633 330 030 033 006 309 303",fonts:"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",sizes:"1,2,3,4,5,6,7",styles:[["Paragraph","<p>"],["Header 1","<h1>"],["Header 2","<h2>"],["Header 3","<h3>"],["Header 4","<h4>"],["Header 5","<h5>"],["Header 6","<h6>"]],useCSS:!0,docType:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',docCSSFile:"",bodyStyle:"margin:4px; font:10pt Arial,Verdana; cursor:text"},buttons:{init:"bold,,|italic,,|underline,,|strikethrough,,|subscript,,|superscript,,|font,,fontname,|size,Font Size,fontsize,|style,,formatblock,|color,Font Color,forecolor,|highlight,Text Highlight Color,hilitecolor,color|removeformat,Remove Formatting,|bullets,,insertunorderedlist|numbering,,insertorderedlist|outdent,,|indent,,|alignleft,Align Text Left,justifyleft|center,,justifycenter|alignright,Align Text Right,justifyright|justify,,justifyfull|undo,,|redo,,|rule,Insert Horizontal Rule,inserthorizontalrule|image,Insert Image,insertimage,url|link,Insert Hyperlink,createlink,url|unlink,Remove Hyperlink,|cut,,|copy,,|paste,,|pastetext,Paste as Text,inserthtml,|print,,|source,Show Source"},imagesPath:function(){return ii()}};n.fn.cleditor=function(t){var i=n([]);return this.each(function(r,u){if(u.tagName.toUpperCase()==="TEXTAREA"){var f=n.data(u,lt);f||(f=new cleditor(u,t));i=i.add(f)}}),i};var ft="backgroundColor",w="blurred",b="button",a="buttonName",k="change",lt="cleditor",u="click",r="disabled",i="<div>",d="focused",et="unselectable",fi="cleditorMain",ei="cleditorToolbar",at="cleditorGroup",vt="cleditorButton",yt="cleditorDisabled",oi="cleditorDivider",si="cleditorPopup",pt="cleditorList",hi="cleditorColor",g="cleditorPrompt",ci="cleditorMsg",v=navigator.userAgent.toLowerCase(),t=/msie/.test(v),li=/msie\s6/.test(v),ot=/(trident)(?:.*rv:([\w.]+))?/.test(v),ai=/webkit/.test(v),st=/iphone|ipad|ipod/i.test(v),f={},wt,o=n.cleditor.buttons;n.each(o.init.split("|"),function(n,t){var i=t.split(","),r=i[0];o[r]={stripIndex:n,name:r,title:i[1]===""?r.charAt(0).toUpperCase()+r.substr(1):i[1],command:i[2]===""?r:i[2],popupName:i[3]===""?r:i[3]}});delete o.init;cleditor=function(r,f){var s=this;s.options=f=n.extend({},n.cleditor.defaultOptions,f);var l=s.$area=n(r).hide().data(lt,s).blur(function(){ut(s,!0)}),v=s.$main=n(i).addClass(fi).width(f.width).height(f.height),y=s.$toolbar=n(i).addClass(ei).appendTo(v),h=n(i).addClass(at).appendTo(y),c=0;n.each(f.controls.split(" "),function(r,e){var w,l,p,v;if(e==="")return!0;e==="|"?(w=n(i).addClass(oi).appendTo(h),h.width(c+1),c=0,h=n(i).addClass(at).appendTo(y)):(l=o[e],p=n(i).data(a,l.name).addClass(vt).attr("title",l.title).bind(u,n.proxy(vi,s)).appendTo(h).hover(kt,dt),c+=24,h.width(c+1),v={},l.css?v=l.css:l.image&&(v.backgroundImage=wi(l.image)),l.stripIndex&&(v.backgroundPosition=l.stripIndex*-24),p.css(v),t&&p.attr(et,"on"),l.popupName&&gt(l.popupName,f,l.popupClass,l.popupContent,l.popupHover))});v.insertBefore(l).append(l);wt||(n(document).click(function(t){var i=n(t.target);i.add(i.parents()).is("."+g)||e()}),wt=!0);/auto|%/.test(""+f.width+f.height)&&n(window).bind("resize.cleditor",function(){ht(s)});ht(s)};y=cleditor.prototype;bt=[["clear",pi],["disable",ni],["execCommand",s],["focus",h],["hidePopups",e],["sourceMode",l,!0],["refresh",ht],["select",bi],["selectedHTML",ki,!0],["selectedText",ri,!0],["showMessage",rt],["updateFrame",ut],["updateTextArea",ct]];n.each(bt,function(n,t){y[t[0]]=function(){for(var u,n=this,r=[n],i=0;i<arguments.length;i++)r.push(arguments[i]);return(u=t[1].apply(n,r),t[2])?u:n}});y.blurred=function(t){var i=n(this);return t?i.bind(w,t):i.trigger(w)};y.change=function(t){console.log("change test");var i=n(this);return t?i.bind(k,t):i.trigger(k)};y.focused=function(t){var i=n(this);return t?i.bind(d,t):i.trigger(d)}})(jQuery);
\ No newline at end of file