Sha256: 1333a58efc78fc1826f7402c5f3e93725609527c764a5de3368d79ca5bf075bb

Contents?: true

Size: 1.76 KB

Versions: 11

Compression:

Stored size: 1.76 KB

Contents

/**
 @preserve CLEditor Icon Plugin v1.0
 http://premiumsoftware.net/cleditor
 requires CLEditor v1.2 or later
 
 Copyright 2010, Chris Landowski, Premium Software, LLC
 Dual licensed under the MIT or GPL Version 2 licenses.
*/

// ==ClosureCompiler==
// @compilation_level SIMPLE_OPTIMIZATIONS
// @output_file_name jquery.cleditor.icon.min.js
// ==/ClosureCompiler==

(function($) {

  // Constants
  var FOLDER = $.cleditor.imagesPath() + "icons/",
      STRIP = "icons",
      EXT = ".gif",
      URL = "URL(" + FOLDER + STRIP + EXT + ")",
      BUTTON_COUNT = 12,
      BUTTON_WIDTH = 20,
      BUTTON_HEIGHT = 20;

  // Define the icon button
  $.cleditor.buttons.icon = {
    name: "icon",
    css: {
      backgroundImage: URL,
      backgroundPosition: "2px 2px"
    },
    title: "Insert Icon",
    command: "insertimage",
    popupName: "Icon",
    popupHover: true,
    buttonClick: function(e, data) {
      $(data.popup).width(60);
    },
    popupClick: function(e, data) {
      var index = -parseInt(e.target.style.backgroundPosition) / BUTTON_WIDTH + 1;
      data.value = FOLDER + index + EXT;
    }
  };

  // Build the popup content
  var $content = $("<div>");
  for (var x = 0; x < BUTTON_COUNT; x++) {
    $("<div>")
      .css({
        width: BUTTON_WIDTH,
        height: BUTTON_HEIGHT,
        backgroundImage: URL,
        backgroundPosition: x * -BUTTON_WIDTH
      })
      .css("float", "left") // closure comiler errors when float is mapped
      .appendTo($content);
  }
  $.cleditor.buttons.icon.popupContent = $content.children();

  // Add the button to the default controls
  $.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls
    .replace("| cut", "icon | cut");

})(jQuery);

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
radiant-forum-extension-3.0.7 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.6 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.5 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.4 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.3 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.2 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.1 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.0 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.0.rc6 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.0.rc4 public/cleditor/jquery.cleditor.icon.js
radiant-forum-extension-3.0.0.rc3 public/cleditor/jquery.cleditor.icon.js