code stringlengths 1 2.08M | language stringclasses 1 value |
|---|---|
/**
* Attaches the calendar behavior to all required fields
*/
(function ($) {
Drupal.behaviors.date_popup = {
attach: function (context) {
for (var id in Drupal.settings.datePopup) {
$('#'+ id).bind('focus', Drupal.settings.datePopup[id], function(e) {
if (!$(this).hasClass('date-popup-init')) {
var datePopup = e.data;
// Explicitely filter the methods we accept.
switch (datePopup.func) {
case 'datepicker':
$(this)
.datepicker(datePopup.settings)
.addClass('date-popup-init')
$(this).click(function(){
$(this).focus();
});
break;
case 'timeEntry':
$(this)
.timeEntry(datePopup.settings)
.addClass('date-popup-init')
$(this).click(function(){
$(this).focus();
});
break;
case 'timepicker':
// Translate the PHP date format into the style the timepicker uses.
datePopup.settings.timeFormat = datePopup.settings.timeFormat
// 12-hour, leading zero,
.replace('h', 'hh')
// 12-hour, no leading zero.
.replace('g', 'h')
// 24-hour, leading zero.
.replace('H', 'HH')
// 24-hour, no leading zero.
.replace('G', 'H')
// AM/PM.
.replace('A', 'p')
// Minutes with leading zero.
.replace('i', 'mm')
// Seconds with leading zero.
.replace('s', 'ss');
datePopup.settings.startTime = new Date(datePopup.settings.startTime);
$(this)
.timepicker(datePopup.settings)
.addClass('date-popup-init');
$(this).click(function(){
$(this).focus();
});
break;
}
}
});
}
}
};
})(jQuery);
| JavaScript |
(function ($) {
Drupal.behaviors.dateYearRange = {};
Drupal.behaviors.dateYearRange.attach = function (context, settings) {
var $textfield, $textfields, i;
// Turn the years back and forward fieldsets into dropdowns.
$textfields = $('input.select-list-with-custom-option', context).once('date-year-range');
for (i = 0; i < $textfields.length; i++) {
$textfield = $($textfields[i]);
new Drupal.dateYearRange.SelectListWithCustomOption($textfield);
}
};
Drupal.dateYearRange = {};
/**
* Constructor for the SelectListWithCustomOption object.
*
* This object is responsible for turning the years back and forward textfields
* into dropdowns with an 'other' option that lets the user enter a custom
* value.
*/
Drupal.dateYearRange.SelectListWithCustomOption = function ($textfield) {
this.$textfield = $textfield;
this.$description = $textfield.next('div.description');
this.defaultValue = $textfield.val();
this.$dropdown = this.createDropdown();
this.$dropdown.insertBefore($textfield);
};
/**
* Get the value of the textfield as it existed on page load.
*
* @param {String} type
* The type of the variable to be returned. Defaults to string.
* @return
* The original value of the textfield. Returned as an integer, if the type
* parameter was 'int'.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.getOriginal = function (type) {
var original;
if (type === 'int') {
original = parseInt(this.defaultValue, 10);
if (window.isNaN(original)) {
original = 0;
}
}
else {
original = this.defaultValue;
}
return original;
};
/**
* Get the correct first value for the dropdown.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.getStartValue = function () {
var direction = this.getDirection();
var start;
switch (direction) {
case 'back':
// For the 'years back' dropdown, the first option should be -10, unless
// the default value of the textfield is even smaller than that.
start = Math.min(this.getOriginal('int'), -10);
break;
case 'forward':
start = 0;
break;
}
return start;
};
/**
* Get the correct last value for the dropdown.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.getEndValue = function () {
var direction = this.getDirection();
var end;
var originalString = this.getOriginal();
switch (direction) {
case 'back':
end = 0;
break;
case 'forward':
// If the original value of the textfield is an absolute year such as
// 2020, don't try to include it in the dropdown.
if (originalString.indexOf('+') === -1) {
end = 10;
}
// If the original value is a relative value (+x), we want it to be
// included in the possible dropdown values.
else {
end = Math.max(this.getOriginal('int'), 10);
}
break;
}
return end;
};
/**
* Create a dropdown select list with the correct options for this textfield.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.createDropdown = function () {
var $dropdown = $('<select>').addClass('form-select date-year-range-select');
var $option, i, value;
var start = this.getStartValue();
var end = this.getEndValue();
var direction = this.getDirection();
for (i = start; i <= end; i++) {
// Make sure we include the +/- sign in the option value.
value = i;
if (i > 0) {
value = '+' + i;
}
// Zero values must have a + or - in front.
if (i === 0) {
if (direction === 'back') {
value = '-' + i;
}
else {
value = '+' + i;
}
}
$option = $('<option>' + Drupal.formatPlural(value, '@count year from now', '@count years from now') + '</option>').val(value);
$dropdown.append($option);
}
// Create an 'Other' option.
$option = $('<option class="custom-option">' + Drupal.t('Other') + '</option>').val('');
$dropdown.append($option);
// When the user changes the selected option in the dropdown, perform
// appropriate actions (such as showing or hiding the textfield).
$dropdown.bind('change', $.proxy(this.handleDropdownChange, this));
// Set the initial value of the dropdown.
this._setInitialDropdownValue($dropdown);
return $dropdown;
};
Drupal.dateYearRange.SelectListWithCustomOption.prototype._setInitialDropdownValue = function ($dropdown) {
var textfieldValue = this.getOriginal();
// Determine whether the original textfield value exists in the dropdown.
var possible = $dropdown.find('option[value="' + textfieldValue + '"]');
// If the original textfield value is one of the dropdown options, preselect
// it and hide the 'other' textfield.
if (possible.length) {
$dropdown.val(textfieldValue);
this.hideTextfield();
}
// If the original textfield value isn't one of the dropdown options, choose
// the 'Other' option in the dropdown.
else {
$dropdown.val('');
}
};
/**
* Determine whether this is the "years back" or "years forward" textfield.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.getDirection = function () {
if (this.direction) {
return this.direction;
}
var direction;
if (this.$textfield.hasClass('back')) {
direction = 'back';
}
else if (this.$textfield.hasClass('forward')) {
direction = 'forward';
}
this.direction = direction;
return direction;
};
/**
* Change handler for the dropdown, to modify the textfield as appropriate.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.handleDropdownChange = function () {
// Since the dropdown changed, we need to make the content of the textfield
// match the (new) selected option.
this.syncTextfield();
// Show the textfield if the 'Other' option was selected, and hide it if one
// of the preset options was selected.
if ($(':selected', this.$dropdown).hasClass('custom-option')) {
this.revealTextfield();
}
else {
this.hideTextfield();
}
};
/**
* Display the textfield and its description.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.revealTextfield = function () {
this.$textfield.show();
this.$description.show();
};
/**
* Hide the textfield and its description.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.hideTextfield = function () {
this.$textfield.hide();
this.$description.hide();
};
/**
* Copy the selected value of the dropdown to the textfield.
*
* FAPI doesn't know about the JS-only dropdown, so the textfield needs to
* reflect the value of the dropdown.
*/
Drupal.dateYearRange.SelectListWithCustomOption.prototype.syncTextfield = function () {
var value = this.$dropdown.val();
this.$textfield.val(value);
};
})(jQuery);
| JavaScript |
(function ($) {
Drupal.behaviors.dateAdmin = {};
Drupal.behaviors.dateAdmin.attach = function (context, settings) {
// Remove timezone handling options for fields without hours granularity.
var $hour = $('#edit-field-settings-granularity-hour').once('date-admin');
if ($hour.length) {
new Drupal.dateAdmin.TimezoneHandler($hour);
}
};
Drupal.dateAdmin = {};
/**
* Constructor for the TimezoneHandler object.
*
* This object is responsible for showing the timezone handling options dropdown
* when the user has chosen to collect hours as part of the date field, and
* hiding it otherwise.
*/
Drupal.dateAdmin.TimezoneHandler = function ($checkbox) {
this.$checkbox = $checkbox;
this.$dropdown = $('#edit-field-settings-tz-handling');
this.$timezoneDiv = $('.form-item-field-settings-tz-handling');
// Store the initial value of the timezone handling dropdown.
this.storeTimezoneHandling();
// Toggle the timezone handling section when the user clicks the "Hour"
// checkbox.
this.$checkbox.bind('click', $.proxy(this.clickHandler, this));
// Trigger the click handler so that if the checkbox is unchecked on initial
// page load, the timezone handling section will be hidden.
this.clickHandler();
};
/**
* Event handler triggered when the user clicks the "Hour" checkbox.
*/
Drupal.dateAdmin.TimezoneHandler.prototype.clickHandler = function () {
if (this.$checkbox.is(':checked')) {
this.restoreTimezoneHandlingOptions();
}
else {
this.hideTimezoneHandlingOptions();
}
};
/**
* Hide the timezone handling options section of the form.
*/
Drupal.dateAdmin.TimezoneHandler.prototype.hideTimezoneHandlingOptions = function () {
this.storeTimezoneHandling();
this.$dropdown.val('none');
this.$timezoneDiv.hide();
};
/**
* Show the timezone handling options section of the form.
*/
Drupal.dateAdmin.TimezoneHandler.prototype.restoreTimezoneHandlingOptions = function () {
var val = this.getTimezoneHandling();
this.$dropdown.val(val);
this.$timezoneDiv.show();
};
/**
* Store the current value of the timezone handling dropdown.
*/
Drupal.dateAdmin.TimezoneHandler.prototype.storeTimezoneHandling = function () {
this._timezoneHandling = this.$dropdown.val();
};
/**
* Return the stored value of the timezone handling dropdown.
*/
Drupal.dateAdmin.TimezoneHandler.prototype.getTimezoneHandling = function () {
return this._timezoneHandling;
};
})(jQuery);
| JavaScript |
(function ($) {
Drupal.behaviors.dateSelect = {};
Drupal.behaviors.dateSelect.attach = function (context, settings) {
var $widget = $('.form-type-date-select').parents('fieldset').once('date');
var i;
for (i = 0; i < $widget.length; i++) {
new Drupal.date.EndDateHandler($widget[i]);
}
};
Drupal.date = Drupal.date || {};
/**
* Constructor for the EndDateHandler object.
*
* The EndDateHandler is responsible for synchronizing a date select widget's
* end date with its start date. This behavior lasts until the user
* interacts with the end date widget.
*
* @param widget
* The fieldset DOM element containing the from and to dates.
*/
Drupal.date.EndDateHandler = function (widget) {
this.$widget = $(widget);
this.$start = this.$widget.find('.form-type-date-select[class$=value]');
this.$end = this.$widget.find('.form-type-date-select[class$=value2]');
if (this.$end.length == 0) {
return;
}
this.initializeSelects();
// Only act on date fields where the end date is completely blank or already
// the same as the start date. Otherwise, we do not want to override whatever
// the default value was.
if (this.endDateIsBlank() || this.endDateIsSame()) {
this.bindClickHandlers();
// Start out with identical start and end dates.
this.syncEndDate();
}
};
/**
* Store all the select dropdowns in an array on the object, for later use.
*/
Drupal.date.EndDateHandler.prototype.initializeSelects = function () {
var $starts = this.$start.find('select');
var $end, $start, endId, i, id;
this.selects = {};
for (i = 0; i < $starts.length; i++) {
$start = $($starts[i]);
id = $start.attr('id');
endId = id.replace('-value-', '-value2-');
$end = $('#' + endId);
this.selects[id] = {
'id': id,
'start': $start,
'end': $end
};
}
};
/**
* Returns true if all dropdowns in the end date widget are blank.
*/
Drupal.date.EndDateHandler.prototype.endDateIsBlank = function () {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
if (this.selects[id].end.val() != '') {
return false;
}
}
}
return true;
};
/**
* Returns true if the end date widget has the same value as the start date.
*/
Drupal.date.EndDateHandler.prototype.endDateIsSame = function () {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
if (this.selects[id].end.val() != this.selects[id].start.val()) {
return false;
}
}
}
return true;
};
/**
* Add a click handler to each of the start date's select dropdowns.
*/
Drupal.date.EndDateHandler.prototype.bindClickHandlers = function () {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
this.selects[id].start.bind('click.endDateHandler', this.startClickHandler.bind(this));
this.selects[id].end.bind('focus', this.endFocusHandler.bind(this));
}
}
};
/**
* Click event handler for each of the start date's select dropdowns.
*/
Drupal.date.EndDateHandler.prototype.startClickHandler = function (event) {
this.syncEndDate();
};
/**
* Focus event handler for each of the end date's select dropdowns.
*/
Drupal.date.EndDateHandler.prototype.endFocusHandler = function (event) {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
this.selects[id].start.unbind('click.endDateHandler');
}
}
$(event.target).unbind('focus', this.endFocusHandler);
};
Drupal.date.EndDateHandler.prototype.syncEndDate = function () {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
this.selects[id].end.val(this.selects[id].start.val());
}
}
};
}(jQuery));
/**
* Function.prototype.bind polyfill for older browsers.
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
*/
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") // closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable");
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
| JavaScript |
/**
* Wysiwyg API integration helper function.
*/
function imceImageBrowser(field_name, url, type, win) {
// TinyMCE.
if (win !== 'undefined') {
win.open(Drupal.settings.imce.url + encodeURIComponent(field_name), '', 'width=760,height=560,resizable=1');
}
}
/**
* CKeditor integration.
*/
var imceCkeditSendTo = function (file, win) {
var parts = /\?(?:.*&)?CKEditorFuncNum=(\d+)(?:&|$)/.exec(win.location.href);
if (parts && parts.length > 1) {
CKEDITOR.tools.callFunction(parts[1], file.url);
win.close();
}
else {
throw 'CKEditorFuncNum parameter not found or invalid: ' + win.location.href;
}
};
| JavaScript |
(function ($) {
Drupal.behaviors.tokenTree = {
attach: function (context, settings) {
$('table.token-tree', context).once('token-tree', function () {
$(this).treeTable();
});
}
};
Drupal.behaviors.tokenDialog = {
attach: function (context, settings) {
$('a.token-dialog', context).once('token-dialog').click(function() {
var url = $(this).attr('href');
var dialog = $('<div style="display: none" class="loading">' + Drupal.t('Loading token browser...') + '</div>').appendTo('body');
dialog.dialog({
title: $(this).attr('title') || Drupal.t('Available tokens'),
width: 700,
close: function(event, ui) {
dialog.remove();
}
});
// Load the token tree using AJAX.
dialog.load(
url,
{},
function (responseText, textStatus, XMLHttpRequest) {
dialog.removeClass('loading');
}
);
// Prevent browser from following the link.
return false;
});
}
}
Drupal.behaviors.tokenInsert = {
attach: function (context, settings) {
// Keep track of which textfield was last selected/focused.
$('textarea, input[type="text"]', context).focus(function() {
Drupal.settings.tokenFocusedField = this;
});
$('.token-click-insert .token-key', context).once('token-click-insert', function() {
var newThis = $('<a href="javascript:void(0);" title="' + Drupal.t('Insert this token into your form') + '">' + $(this).html() + '</a>').click(function(){
if (typeof Drupal.settings.tokenFocusedField == 'undefined') {
alert(Drupal.t('First click a text field to insert your tokens into.'));
}
else {
var myField = Drupal.settings.tokenFocusedField;
var myValue = $(this).text();
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
$('html,body').animate({scrollTop: $(myField).offset().top}, 500);
}
return false;
});
$(this).html(newThis);
});
}
};
})(jQuery);
| JavaScript |
/*
* jQuery treeTable Plugin 2.3.0
* http://ludo.cubicphuse.nl/jquery-plugins/treeTable/
*
* Copyright 2010, Ludo van den Boom
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function($) {
// Helps to make options available to all functions
// TODO: This gives problems when there are both expandable and non-expandable
// trees on a page. The options shouldn't be global to all these instances!
var options;
var defaultPaddingLeft;
$.fn.treeTable = function(opts) {
options = $.extend({}, $.fn.treeTable.defaults, opts);
return this.each(function() {
$(this).addClass("treeTable").find("tbody tr").each(function() {
// Initialize root nodes only if possible
if(!options.expandable || $(this)[0].className.search(options.childPrefix) == -1) {
// To optimize performance of indentation, I retrieve the padding-left
// value of the first root node. This way I only have to call +css+
// once.
if (isNaN(defaultPaddingLeft)) {
defaultPaddingLeft = parseInt($($(this).children("td")[options.treeColumn]).css('padding-left'), 10);
}
initialize($(this));
} else if(options.initialState == "collapsed") {
this.style.display = "none"; // Performance! $(this).hide() is slow...
}
});
});
};
$.fn.treeTable.defaults = {
childPrefix: "child-of-",
clickableNodeNames: false,
expandable: true,
indent: 19,
initialState: "collapsed",
treeColumn: 0
};
// Recursively hide all node's children in a tree
$.fn.collapse = function() {
$(this).addClass("collapsed");
childrenOf($(this)).each(function() {
if(!$(this).hasClass("collapsed")) {
$(this).collapse();
}
this.style.display = "none"; // Performance! $(this).hide() is slow...
});
return this;
};
// Recursively show all node's children in a tree
$.fn.expand = function() {
$(this).removeClass("collapsed").addClass("expanded");
childrenOf($(this)).each(function() {
initialize($(this));
if($(this).is(".expanded.parent")) {
$(this).expand();
}
// this.style.display = "table-row"; // Unfortunately this is not possible with IE :-(
$(this).show();
});
return this;
};
// Reveal a node by expanding all ancestors
$.fn.reveal = function() {
$(ancestorsOf($(this)).reverse()).each(function() {
initialize($(this));
$(this).expand().show();
});
return this;
};
// Add an entire branch to +destination+
$.fn.appendBranchTo = function(destination) {
var node = $(this);
var parent = parentOf(node);
var ancestorNames = $.map(ancestorsOf($(destination)), function(a) { return a.id; });
// Conditions:
// 1: +node+ should not be inserted in a location in a branch if this would
// result in +node+ being an ancestor of itself.
// 2: +node+ should not have a parent OR the destination should not be the
// same as +node+'s current parent (this last condition prevents +node+
// from being moved to the same location where it already is).
// 3: +node+ should not be inserted as a child of +node+ itself.
if($.inArray(node[0].id, ancestorNames) == -1 && (!parent || (destination.id != parent[0].id)) && destination.id != node[0].id) {
indent(node, ancestorsOf(node).length * options.indent * -1); // Remove indentation
if(parent) { node.removeClass(options.childPrefix + parent[0].id); }
node.addClass(options.childPrefix + destination.id);
move(node, destination); // Recursively move nodes to new location
indent(node, ancestorsOf(node).length * options.indent);
}
return this;
};
// Add reverse() function from JS Arrays
$.fn.reverse = function() {
return this.pushStack(this.get().reverse(), arguments);
};
// Toggle an entire branch
$.fn.toggleBranch = function() {
if($(this).hasClass("collapsed")) {
$(this).expand();
} else {
$(this).removeClass("expanded").collapse();
}
return this;
};
// === Private functions
function ancestorsOf(node) {
var ancestors = [];
while(node = parentOf(node)) {
ancestors[ancestors.length] = node[0];
}
return ancestors;
};
function childrenOf(node) {
return $(node).siblings("tr." + options.childPrefix + node[0].id);
};
function getPaddingLeft(node) {
var paddingLeft = parseInt(node[0].style.paddingLeft, 10);
return (isNaN(paddingLeft)) ? defaultPaddingLeft : paddingLeft;
}
function indent(node, value) {
var cell = $(node.children("td")[options.treeColumn]);
cell[0].style.paddingLeft = getPaddingLeft(cell) + value + "px";
childrenOf(node).each(function() {
indent($(this), value);
});
};
function initialize(node) {
if(!node.hasClass("initialized")) {
node.addClass("initialized");
var childNodes = childrenOf(node);
if(!node.hasClass("parent") && childNodes.length > 0) {
node.addClass("parent");
}
if(node.hasClass("parent")) {
var cell = $(node.children("td")[options.treeColumn]);
var padding = getPaddingLeft(cell) + options.indent;
childNodes.each(function() {
$(this).children("td")[options.treeColumn].style.paddingLeft = padding + "px";
});
if(options.expandable) {
cell.prepend('<span style="margin-left: -' + options.indent + 'px; padding-left: ' + options.indent + 'px" class="expander"></span>');
$(cell[0].firstChild).click(function() { node.toggleBranch(); });
if(options.clickableNodeNames) {
cell[0].style.cursor = "pointer";
$(cell).click(function(e) {
// Don't double-toggle if the click is on the existing expander icon
if (e.target.className != 'expander') {
node.toggleBranch();
}
});
}
// Check for a class set explicitly by the user, otherwise set the default class
if(!(node.hasClass("expanded") || node.hasClass("collapsed"))) {
node.addClass(options.initialState);
}
if(node.hasClass("expanded")) {
node.expand();
}
}
}
}
};
function move(node, destination) {
node.insertAfter(destination);
childrenOf(node).reverse().each(function() { move($(this), node[0]); });
};
function parentOf(node) {
var classNames = node[0].className.split(' ');
for(key in classNames) {
if(classNames[key].match(options.childPrefix)) {
return $(node).siblings("#" + classNames[key].substring(options.childPrefix.length));
}
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.markitup = function(context, params, settings) {
$('#' + params.field, context).markItUp(settings);
// Adjust CSS for editor buttons.
$.each(settings.markupSet, function (button) {
$('.' + settings.nameSpace + ' .' + this.className + ' a')
.css({ backgroundImage: 'url(' + settings.root + 'sets/default/images/' + button + '.png' + ')' })
.parents('li').css({ backgroundImage: 'none' });
});
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.markitup = function (context, params, trigger) {
if (trigger == 'serialize') {
return;
}
if (typeof params != 'undefined') {
$('#' + params.field, context).markItUpRemove();
}
else {
$('.markItUpEditor', context).markItUpRemove();
}
};
Drupal.wysiwyg.editor.instance.markitup = {
insert: function (content) {
$.markItUp({ replaceWith: content });
},
setContent: function (content) {
$('#' + this.field).val(content);
},
getContent: function () {
return $('#' + this.field).val();
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Initialize editor instances.
*
* @todo Is the following note still valid for 3.x?
* This function needs to be called before the page is fully loaded, as
* calling tinyMCE.init() after the page is loaded breaks IE6.
*
* @param editorSettings
* An object containing editor settings for each input format.
*/
Drupal.wysiwyg.editor.init.tinymce = function(settings) {
// Fix Drupal toolbar obscuring editor toolbar in fullscreen mode.
var $drupalToolbar = $('#toolbar', Drupal.overlayChild ? window.parent.document : document);
tinyMCE.onAddEditor.add(function (mgr, ed) {
if (ed.id == 'mce_fullscreen') {
$drupalToolbar.hide();
}
});
tinyMCE.onRemoveEditor.add(function (mgr, ed) {
if (ed.id == 'mce_fullscreen') {
$drupalToolbar.show();
}
});
// Initialize editor configurations.
for (var format in settings) {
if (Drupal.settings.wysiwyg.plugins[format]) {
// Load native external plugins.
// Array syntax required; 'native' is a predefined token in JavaScript.
for (var plugin in Drupal.settings.wysiwyg.plugins[format]['native']) {
tinymce.PluginManager.load(plugin, Drupal.settings.wysiwyg.plugins[format]['native'][plugin]);
}
// Load Drupal plugins.
for (var plugin in Drupal.settings.wysiwyg.plugins[format].drupal) {
Drupal.wysiwyg.editor.instance.tinymce.addPlugin(plugin, Drupal.settings.wysiwyg.plugins[format].drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin]);
}
}
}
};
/**
* Attach this editor to a target element.
*
* See Drupal.wysiwyg.editor.attach.none() for a full desciption of this hook.
*/
Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) {
// Configure editor settings for this input format.
var ed = new tinymce.Editor(params.field, settings);
// Reset active instance id on any event.
ed.onEvent.add(function(ed, e) {
Drupal.wysiwyg.activeId = ed.id;
});
// Indicate that the DOM has been loaded (in case of Ajax).
tinymce.dom.Event.domLoaded = true;
// Make toolbar buttons wrappable (required for IE).
ed.onPostRender.add(function (ed) {
var $toolbar = $('<div class="wysiwygToolbar"></div>');
$('#' + ed.editorContainer + ' table.mceToolbar > tbody > tr > td').each(function () {
$('<div></div>').addClass(this.className).append($(this).children()).appendTo($toolbar);
});
$('#' + ed.editorContainer + ' table.mceLayout td.mceToolbar').append($toolbar);
$('#' + ed.editorContainer + ' table.mceToolbar').remove();
});
// Remove TinyMCE's internal mceItem class, which was incorrectly added to
// submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class
// for placeholder elements. If preemptively set, the class prevents (native)
// editor plugins from gaining an active state, so we have to manually remove
// it prior to attaching the editor. This is done on the client-side instead
// of the server-side, as Wysiwyg has no way to figure out where content is
// stored, and the class only affects editing.
$field = $('#' + params.field);
$field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2'));
// Attach editor.
ed.render();
};
/**
* Detach a single or all editors.
*
* See Drupal.wysiwyg.editor.detach.none() for a full desciption of this hook.
*/
Drupal.wysiwyg.editor.detach.tinymce = function (context, params, trigger) {
if (typeof params != 'undefined') {
var instance = tinyMCE.get(params.field);
if (instance) {
instance.save();
if (trigger != 'serialize') {
instance.remove();
}
}
}
else {
// Save contents of all editors back into textareas.
tinyMCE.triggerSave();
if (trigger != 'serialize') {
// Remove all editor instances.
for (var instance in tinyMCE.editors) {
tinyMCE.editors[instance].remove();
}
}
}
};
Drupal.wysiwyg.editor.instance.tinymce = {
addPlugin: function(plugin, settings, pluginSettings) {
if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') {
return;
}
tinymce.create('tinymce.plugins.' + plugin, {
/**
* Initialize the plugin, executed after the plugin has been created.
*
* @param ed
* The tinymce.Editor instance the plugin is initialized in.
* @param url
* The absolute URL of the plugin location.
*/
init: function(ed, url) {
// Register an editor command for this plugin, invoked by the plugin's button.
ed.addCommand(plugin, function() {
if (typeof Drupal.wysiwyg.plugins[plugin].invoke == 'function') {
var data = { format: 'html', node: ed.selection.getNode(), content: ed.selection.getContent() };
// TinyMCE creates a completely new instance for fullscreen mode.
var instanceId = ed.id == 'mce_fullscreen' ? ed.getParam('fullscreen_editor_id') : ed.id;
Drupal.wysiwyg.plugins[plugin].invoke(data, pluginSettings, instanceId);
}
});
// Register the plugin button.
ed.addButton(plugin, {
title : settings.iconTitle,
cmd : plugin,
image : settings.icon
});
// Load custom CSS for editor contents on startup.
ed.onInit.add(function() {
if (settings.css) {
ed.dom.loadCSS(settings.css);
}
});
// Attach: Replace plain text with HTML representations.
ed.onBeforeSetContent.add(function(ed, data) {
var editorId = (ed.id == 'mce_fullscreen' ? ed.getParam('fullscreen_editor_id') : ed.id);
if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
data.content = Drupal.wysiwyg.plugins[plugin].attach(data.content, pluginSettings, editorId);
data.content = Drupal.wysiwyg.editor.instance.tinymce.prepareContent(data.content);
}
});
// Detach: Replace HTML representations with plain text.
ed.onGetContent.add(function(ed, data) {
var editorId = (ed.id == 'mce_fullscreen' ? ed.getParam('fullscreen_editor_id') : ed.id);
if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
data.content = Drupal.wysiwyg.plugins[plugin].detach(data.content, pluginSettings, editorId);
}
});
// isNode: Return whether the plugin button should be enabled for the
// current selection.
ed.onNodeChange.add(function(ed, command, node) {
if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') {
command.setActive(plugin, Drupal.wysiwyg.plugins[plugin].isNode(node));
}
});
},
/**
* Return information about the plugin as a name/value array.
*/
getInfo: function() {
return {
longname: settings.title
};
}
});
// Register plugin.
tinymce.PluginManager.add(plugin, tinymce.plugins[plugin]);
},
openDialog: function(dialog, params) {
var instanceId = this.getInstanceId();
var editor = tinyMCE.get(instanceId);
editor.windowManager.open({
file: dialog.url + '/' + instanceId,
width: dialog.width,
height: dialog.height,
inline: 1
}, params);
},
closeDialog: function(dialog) {
var editor = tinyMCE.get(this.getInstanceId());
editor.windowManager.close(dialog);
},
prepareContent: function(content) {
// Certain content elements need to have additional DOM properties applied
// to prevent this editor from highlighting an internal button in addition
// to the button of a Drupal plugin.
var specialProperties = {
img: { 'class': 'mceItem' }
};
var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :(
// Find all placeholder/replacement content of Drupal plugins.
$content.find('.drupal-content').each(function() {
// Recursively process DOM elements below this element to apply special
// properties.
var $drupalContent = $(this);
$.each(specialProperties, function(element, properties) {
$drupalContent.find(element).andSelf().each(function() {
for (var property in properties) {
if (property == 'class') {
$(this).addClass(properties[property]);
}
else {
$(this).attr(property, properties[property]);
}
}
});
});
});
return $content.html();
},
insert: function(content) {
content = this.prepareContent(content);
tinyMCE.execInstanceCommand(this.getInstanceId(), 'mceInsertContent', false, content);
},
setContent: function (content) {
content = this.prepareContent(content);
tinyMCE.execInstanceCommand(this.getInstanceId(), 'mceSetContent', false, content);
},
getContent: function () {
return tinyMCE.get(this.getInstanceId()).getContent();
},
isFullscreen: function() {
// TinyMCE creates a completely new instance for fullscreen mode.
return tinyMCE.activeEditor.id == 'mce_fullscreen' && tinyMCE.activeEditor.getParam('fullscreen_editor_id') == this.field;
},
getInstanceId: function () {
return this.isFullscreen() ? 'mce_fullscreen' : this.field;
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Initialize editor instances.
*
* This function needs to be called before the page is fully loaded, as
* calling tinyMCE.init() after the page is loaded breaks IE6.
*
* @param editorSettings
* An object containing editor settings for each input format.
*/
Drupal.wysiwyg.editor.init.tinymce = function(settings) {
// Initialize editor configurations.
for (var format in settings) {
tinyMCE.init(settings[format]);
if (Drupal.settings.wysiwyg.plugins[format]) {
// Load native external plugins.
// Array syntax required; 'native' is a predefined token in JavaScript.
for (var plugin in Drupal.settings.wysiwyg.plugins[format]['native']) {
tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwyg.plugins[format]['native'][plugin]);
}
// Load Drupal plugins.
for (var plugin in Drupal.settings.wysiwyg.plugins[format].drupal) {
Drupal.wysiwyg.editor.instance.tinymce.addPlugin(plugin, Drupal.settings.wysiwyg.plugins[format].drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin]);
}
}
}
};
/**
* Attach this editor to a target element.
*
* See Drupal.wysiwyg.editor.attach.none() for a full desciption of this hook.
*/
Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) {
// Configure editor settings for this input format.
for (var setting in settings) {
tinyMCE.settings[setting] = settings[setting];
}
// Remove TinyMCE's internal mceItem class, which was incorrectly added to
// submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class
// for placeholder elements. If preemptively set, the class prevents (native)
// editor plugins from gaining an active state, so we have to manually remove
// it prior to attaching the editor. This is done on the client-side instead
// of the server-side, as Wysiwyg has no way to figure out where content is
// stored, and the class only affects editing.
$field = $('#' + params.field);
$field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2'));
// Attach editor.
tinyMCE.execCommand('mceAddControl', true, params.field);
};
/**
* Detach a single or all editors.
*
* See Drupal.wysiwyg.editor.detach.none() for a full desciption of this hook.
*/
Drupal.wysiwyg.editor.detach.tinymce = function (context, params, trigger) {
if (typeof params != 'undefined') {
tinyMCE.removeMCEControl(tinyMCE.getEditorId(params.field));
$('#' + params.field).removeAttr('style');
}
// else if (tinyMCE.activeEditor) {
// tinyMCE.triggerSave();
// tinyMCE.activeEditor.remove();
// }
};
Drupal.wysiwyg.editor.instance.tinymce = {
addPlugin: function(plugin, settings, pluginSettings) {
if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') {
return;
}
tinyMCE.addPlugin(plugin, {
// Register an editor command for this plugin, invoked by the plugin's button.
execCommand: function(editor_id, element, command, user_interface, value) {
switch (command) {
case plugin:
if (typeof Drupal.wysiwyg.plugins[plugin].invoke == 'function') {
var ed = tinyMCE.getInstanceById(editor_id);
var data = { format: 'html', node: ed.getFocusElement(), content: ed.getFocusElement() };
Drupal.wysiwyg.plugins[plugin].invoke(data, pluginSettings, ed.formTargetElementId);
return true;
}
}
// Pass to next handler in chain.
return false;
},
// Register the plugin button.
getControlHTML: function(control_name) {
switch (control_name) {
case plugin:
return tinyMCE.getButtonHTML(control_name, settings.iconTitle, settings.icon, plugin);
}
return '';
},
// Load custom CSS for editor contents on startup.
initInstance: function(ed) {
if (settings.css) {
tinyMCE.importCSS(ed.getDoc(), settings.css);
}
},
cleanup: function(type, content) {
switch (type) {
case 'insert_to_editor':
// Attach: Replace plain text with HTML representations.
if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
content = Drupal.wysiwyg.plugins[plugin].attach(content, pluginSettings, tinyMCE.selectedInstance.editorId);
content = Drupal.wysiwyg.editor.instance.tinymce.prepareContent(content);
}
break;
case 'get_from_editor':
// Detach: Replace HTML representations with plain text.
if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
content = Drupal.wysiwyg.plugins[plugin].detach(content, pluginSettings, tinyMCE.selectedInstance.editorId);
}
break;
}
// Pass through to next handler in chain
return content;
},
// isNode: Return whether the plugin button should be enabled for the
// current selection.
handleNodeChange: function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
if (node === null) {
return;
}
if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') {
if (Drupal.wysiwyg.plugins[plugin].isNode(node)) {
tinyMCE.switchClass(editor_id + '_' + plugin, 'mceButtonSelected');
return true;
}
}
tinyMCE.switchClass(editor_id + '_' + plugin, 'mceButtonNormal');
return true;
},
/**
* Return information about the plugin as a name/value array.
*/
getInfo: function() {
return {
longname: settings.title
};
}
});
},
openDialog: function(dialog, params) {
var editor = tinyMCE.getInstanceById(this.field);
tinyMCE.openWindow({
file: dialog.url + '/' + this.field,
width: dialog.width,
height: dialog.height,
inline: 1
}, params);
},
closeDialog: function(dialog) {
var editor = tinyMCE.getInstanceById(this.field);
tinyMCEPopup.close();
},
prepareContent: function(content) {
// Certain content elements need to have additional DOM properties applied
// to prevent this editor from highlighting an internal button in addition
// to the button of a Drupal plugin.
var specialProperties = {
img: { 'name': 'mce_drupal' }
};
var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :(
jQuery.each(specialProperties, function(element, properties) {
$content.find(element).each(function() {
for (var property in properties) {
if (property == 'class') {
$(this).addClass(properties[property]);
}
else {
$(this).attr(property, properties[property]);
}
}
});
});
return $content.html();
},
insert: function(content) {
content = this.prepareContent(content);
var editor = tinyMCE.getInstanceById(this.field);
editor.execCommand('mceInsertContent', false, content);
editor.repaint();
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.jwysiwyg = function(context, params, settings) {
// Attach editor.
$('#' + params.field).wysiwyg();
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.jwysiwyg = function (context, params, trigger) {
var $field = $('#' + params.field);
var editor = $field.data('wysiwyg');
if (typeof editor != 'undefined') {
editor.saveContent();
if (trigger != 'serialize') {
editor.element.remove();
}
}
$field.removeData('wysiwyg');
if (trigger != 'serialize') {
$field.show();
}
};
Drupal.wysiwyg.editor.instance.jwysiwyg = {
insert: function (content) {
$('#' + this.field).wysiwyg('insertHtml', content);
},
setContent: function (content) {
$('#' + this.field).wysiwyg('setContent', content);
},
getContent: function () {
return $('#' + this.field).wysiwyg('getContent');
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* An object containing input format parameters. Default parameters are:
* - editor: The internal editor name.
* - theme: The name/key of the editor theme/profile to use.
* - field: The CSS id of the target element.
* @param settings
* An object containing editor settings for all enabled editor themes.
*/
Drupal.wysiwyg.editor.attach.none = function(context, params, settings) {
if (params.resizable) {
var $wrapper = $('#' + params.field).parents('.form-textarea-wrapper:first');
$wrapper.addClass('resizable');
if (Drupal.behaviors.textarea) {
Drupal.behaviors.textarea.attach();
}
}
};
/**
* Detach a single or all editors.
*
* The editor syncs its contents back to the original field before its instance
* is removed.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* (optional) An object containing input format parameters. If defined,
* only the editor instance in params.field should be detached. Otherwise,
* all editors should be detached and saved, so they can be submitted in
* AJAX/AHAH applications.
* @param trigger
* A string describing why the editor is being detached.
* Possible triggers are:
* - unload: (default) Another or no editor is about to take its place.
* - move: Currently expected to produce the same result as unload.
* - serialize: The form is about to be serialized before an AJAX request or
* a normal form submission. If possible, perform a quick detach and leave
* the editor's GUI elements in place to avoid flashes or scrolling issues.
* @see Drupal.detachBehaviors
*/
Drupal.wysiwyg.editor.detach.none = function (context, params, trigger) {
if (typeof params != 'undefined' && (trigger != 'serialize')) {
var $wrapper = $('#' + params.field).parents('.form-textarea-wrapper:first');
$wrapper.removeOnce('textarea').removeClass('.resizable-textarea')
.find('.grippie').remove();
}
};
/**
* Instance methods for plain text areas.
*/
Drupal.wysiwyg.editor.instance.none = {
insert: function(content) {
var editor = document.getElementById(this.field);
// IE support.
if (document.selection) {
editor.focus();
var sel = document.selection.createRange();
sel.text = content;
}
// Mozilla/Firefox/Netscape 7+ support.
else if (editor.selectionStart || editor.selectionStart == '0') {
var startPos = editor.selectionStart;
var endPos = editor.selectionEnd;
editor.value = editor.value.substring(0, startPos) + content + editor.value.substring(endPos, editor.value.length);
}
// Fallback, just add to the end of the content.
else {
editor.value += content;
}
},
setContent: function (content) {
$('#' + this.field).val(content);
},
getContent: function () {
return $('#' + this.field).val();
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.fckeditor = function(context, params, settings) {
var FCKinstance = new FCKeditor(params.field, settings.Width, settings.Height, settings.ToolbarSet);
// Apply editor instance settings.
FCKinstance.BasePath = settings.EditorPath;
FCKinstance.Config.wysiwygFormat = params.format;
FCKinstance.Config.CustomConfigurationsPath = settings.CustomConfigurationsPath;
// Load Drupal plugins and apply format specific settings.
// @see fckeditor.config.js
// @see Drupal.wysiwyg.editor.instance.fckeditor.init()
// Attach editor.
FCKinstance.ReplaceTextarea();
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.fckeditor = function (context, params, trigger) {
var instances = [];
if (typeof params != 'undefined' && typeof FCKeditorAPI != 'undefined') {
var instance = FCKeditorAPI.GetInstance(params.field);
if (instance) {
instances[params.field] = instance;
}
}
else {
instances = FCKeditorAPI.__Instances;
}
for (var instanceName in instances) {
var instance = instances[instanceName];
instance.UpdateLinkedField();
if (trigger == 'serialize') {
// The editor is not being removed from the DOM, so updating the linked
// field is the only action necessary.
continue;
}
// Since we already detach the editor and update the textarea, the submit
// event handler needs to be removed to prevent data loss (in IE).
// FCKeditor uses 2 nested iFrames; instance.EditingArea.Window is the
// deepest. Its parent is the iFrame containing the editor.
var instanceScope = instance.EditingArea.Window.parent;
instanceScope.FCKTools.RemoveEventListener(instance.GetParentForm(), 'submit', instance.UpdateLinkedField);
// Run cleanups before forcing an unload of the iFrames or IE crashes.
// This also deletes the instance from the FCKeditorAPI.__Instances array.
instanceScope.FCKTools.RemoveEventListener(instanceScope, 'unload', instanceScope.FCKeditorAPI_Cleanup);
instanceScope.FCKTools.RemoveEventListener(instanceScope, 'beforeunload', instanceScope.FCKeditorAPI_ConfirmCleanup);
if (jQuery.isFunction(instanceScope.FCKIECleanup_Cleanup)) {
instanceScope.FCKIECleanup_Cleanup();
}
instanceScope.FCKeditorAPI_ConfirmCleanup();
instanceScope.FCKeditorAPI_Cleanup();
// Remove the editor elements.
$('#' + instanceName + '___Config').remove();
$('#' + instanceName + '___Frame').remove();
$('#' + instanceName).show();
}
};
Drupal.wysiwyg.editor.instance.fckeditor = {
init: function(instance) {
// Track which editor instance is active.
instance.FCK.Events.AttachEvent('OnFocus', function(editorInstance) {
Drupal.wysiwyg.activeId = editorInstance.Name;
});
// Create a custom data processor to wrap the default one and allow Drupal
// plugins modify the editor contents.
var wysiwygDataProcessor = function() {};
wysiwygDataProcessor.prototype = new instance.FCKDataProcessor();
// Attach: Convert text into HTML.
wysiwygDataProcessor.prototype.ConvertToHtml = function(data) {
// Called from SetData() with stripped comments/scripts, revert those
// manipulations and attach Drupal plugins.
var data = instance.FCKConfig.ProtectedSource.Revert(data);
if (Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat] && Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
for (var plugin in Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].attach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], instance.FCK.Name);
data = Drupal.wysiwyg.editor.instance.fckeditor.prepareContent(data);
}
}
}
// Re-protect the source and use the original data processor to convert it
// into XHTML.
data = instance.FCKConfig.ProtectedSource.Protect(data);
return instance.FCKDataProcessor.prototype.ConvertToHtml.call(this, data);
};
// Detach: Convert HTML into text.
wysiwygDataProcessor.prototype.ConvertToDataFormat = function(rootNode, excludeRoot, ignoreIfEmptyParagraph, format) {
// Called from GetData(), convert the content's DOM into a XHTML string
// using the original data processor and detach Drupal plugins.
var data = instance.FCKDataProcessor.prototype.ConvertToDataFormat.call(this, rootNode, excludeRoot, ignoreIfEmptyParagraph, format);
if (Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat] && Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
for (var plugin in Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].detach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], instance.FCK.Name);
}
}
}
return data;
};
instance.FCK.DataProcessor = new wysiwygDataProcessor();
},
addPlugin: function(plugin, settings, pluginSettings, instance) {
if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') {
return;
}
if (Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal[plugin].css) {
instance.FCKConfig.EditorAreaCSS += ',' + Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal[plugin].css;
}
// @see fckcommands.js, fck_othercommands.js, fckpastewordcommand.js
instance.FCKCommands.RegisterCommand(plugin, {
// Invoke the plugin's button.
Execute: function () {
if (typeof Drupal.wysiwyg.plugins[plugin].invoke == 'function') {
var data = { format: 'html', node: instance.FCKSelection.GetParentElement() };
// @todo This is NOT the same as data.node.
data.content = data.node.innerHTML;
Drupal.wysiwyg.plugins[plugin].invoke(data, pluginSettings, instance.FCK.Name);
}
},
// isNode: Return whether the plugin button should be enabled for the
// current selection.
// @see FCKUnlinkCommand.prototype.GetState()
GetState: function () {
// Always disabled if not in WYSIWYG mode.
if (instance.FCK.EditMode != FCK_EDITMODE_WYSIWYG) {
return FCK_TRISTATE_DISABLED;
}
var state = instance.FCK.GetNamedCommandState(this.Name);
// FCKeditor sets the wrong state in WebKit browsers.
if (!$.support.queryCommandEnabled && state == FCK_TRISTATE_DISABLED) {
state = FCK_TRISTATE_OFF;
}
if (state == FCK_TRISTATE_OFF && instance.FCK.EditMode == FCK_EDITMODE_WYSIWYG) {
if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') {
var node = instance.FCKSelection.GetSelectedElement();
state = Drupal.wysiwyg.plugins[plugin].isNode(node) ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF;
}
}
return state;
},
/**
* Return information about the plugin as a name/value array.
*/
Name: plugin
});
// Register the plugin button.
// Arguments: commandName, label, tooltip, style, sourceView, contextSensitive, icon.
instance.FCKToolbarItems.RegisterItem(plugin, new instance.FCKToolbarButton(plugin, settings.iconTitle, settings.iconTitle, null, false, true, settings.icon));
},
openDialog: function(dialog, params) {
// @todo Implement open dialog.
},
closeDialog: function(dialog) {
// @todo Implement close dialog.
},
prepareContent: function(content) {
// @todo Not needed for FCKeditor?
return content;
},
insert: function(content) {
var instance = FCKeditorAPI.GetInstance(this.field);
// @see FCK.InsertHtml(), FCK.InsertElement()
instance.InsertHtml(content);
},
getContent: function () {
var instance = FCKeditorAPI.GetInstance(this.field);
return instance.GetData();
},
setContent: function (content) {
var instance = FCKeditorAPI.GetInstance(this.field);
instance.SetHTML(content);
}
};
})(jQuery);
| JavaScript |
Drupal = window.parent.Drupal;
/**
* Fetch and provide original editor settings as local variable.
*
* FCKeditor does not support to pass complex variable types to the editor.
* Instance settings passed to FCKinstance.Config are temporarily stored in
* FCKConfig.PageConfig.
*/
var wysiwygFormat = FCKConfig.PageConfig.wysiwygFormat;
var wysiwygSettings = Drupal.settings.wysiwyg.configs.fckeditor[wysiwygFormat];
var pluginSettings = (Drupal.settings.wysiwyg.plugins[wysiwygFormat] ? Drupal.settings.wysiwyg.plugins[wysiwygFormat] : { 'native': {}, 'drupal': {} });
/**
* Apply format-specific settings.
*/
for (var setting in wysiwygSettings) {
if (setting == 'buttons') {
// Apply custom Wysiwyg toolbar for this format.
// FCKConfig.ToolbarSets['Wysiwyg'] = wysiwygSettings.buttons;
// Temporarily stack buttons into multiple button groups and remove
// separators until #277954 is solved.
FCKConfig.ToolbarSets['Wysiwyg'] = [];
for (var i = 0; i < wysiwygSettings.buttons[0].length; i++) {
FCKConfig.ToolbarSets['Wysiwyg'].push([wysiwygSettings.buttons[0][i]]);
}
FCKTools.AppendStyleSheet(document, '#xToolbar .TB_Start { display:none; }');
// Set valid height of select element in silver and office2003 skins.
if (FCKConfig.SkinPath.match(/\/office2003\/$/)) {
FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 24px; } #xToolbar .TB_End { display: none; }');
}
else if (FCKConfig.SkinPath.match(/\/silver\/$/)) {
FCKTools.AppendStyleSheet(document, '#xToolbar .SC_FieldCaption { height: 27px; }');
}
}
else {
FCKConfig[setting] = wysiwygSettings[setting];
}
}
// Fix Drupal toolbar obscuring editor toolbar in fullscreen mode.
var oldFitWindowExecute = FCKFitWindow.prototype.Execute;
var $drupalToolbar = window.parent.jQuery('#toolbar', Drupal.overlayChild ? window.parent.window.parent.document : window.parent.document);
FCKFitWindow.prototype.Execute = function() {
oldFitWindowExecute.apply(this, arguments);
if (this.IsMaximized) {
$drupalToolbar.hide();
}
else {
$drupalToolbar.show();
}
}
/**
* Initialize this editor instance.
*/
Drupal.wysiwyg.editor.instance.fckeditor.init(window);
/**
* Register native plugins for this input format.
*
* Parameters to Plugins.Add are:
* - Plugin name.
* - Languages the plugin is available in.
* - Location of the plugin folder; <plugin_name>/fckplugin.js is appended.
*/
for (var plugin in pluginSettings['native']) {
// Languages and path may be undefined for internal plugins.
FCKConfig.Plugins.Add(plugin, pluginSettings['native'][plugin].languages, pluginSettings['native'][plugin].path);
}
/**
* Register Drupal plugins for this input format.
*
* Parameters to addPlugin() are:
* - Plugin name.
* - Format specific plugin settings.
* - General plugin settings.
* - A reference to this window so the plugin setup can access FCKConfig.
*/
for (var plugin in pluginSettings.drupal) {
Drupal.wysiwyg.editor.instance.fckeditor.addPlugin(plugin, pluginSettings.drupal[plugin], Drupal.settings.wysiwyg.plugins.drupal[plugin], window);
}
| JavaScript |
var wysiwygWhizzywig = { currentField: null, fields: {} };
var buttonPath = null;
/**
* Override Whizzywig's document.write() function.
*
* Whizzywig uses document.write() by default, which leads to a blank page when
* invoked in jQuery.ready(). Luckily, Whizzywig developers implemented a
* shorthand w() substitute function that we can override to redirect the output
* into the global wysiwygWhizzywig variable.
*
* @see o()
*/
var w = function (string) {
if (string) {
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] += string;
}
return wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField];
};
/**
* Override Whizzywig's document.getElementById() function.
*
* Since we redirect the output of w() into a temporary string upon attaching
* an editor, we also have to override the o() shorthand substitute function
* for document.getElementById() to search in the document or our container.
* This override function also inserts the editor instance when Whizzywig
* tries to access its IFRAME, so it has access to the full/regular window
* object.
*
* @see w()
*/
var o = function (id) {
// Upon first access to "whizzy" + id, Whizzywig tries to access its IFRAME,
// so we need to insert the editor into the DOM.
if (id == 'whizzy' + wysiwygWhizzywig.currentField && wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField]) {
jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig"></div>');
// Iframe's .contentWindow becomes null in Webkit if inserted via .after().
jQuery('#' + wysiwygWhizzywig.currentField + '-whizzywig').html(w());
// Prevent subsequent invocations from inserting the editor multiple times.
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = '';
}
// If id exists in the regular window.document, return it.
if (jQuery('#' + id).size()) {
return jQuery('#' + id).get(0);
}
// Otherwise return id from our container.
return jQuery('#' + id, w()).get(0);
};
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) {
// Assign button images path, if available.
if (settings.buttonPath) {
window.buttonPath = settings.buttonPath;
}
// Create Whizzywig container.
wysiwygWhizzywig.currentField = params.field;
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = '';
// Whizzywig needs to have the width set 'inline'.
$field = $('#' + params.field);
var originalValues = Drupal.wysiwyg.instances[params.field];
originalValues.originalStyle = $field.attr('style');
$field.css('width', $field.width() + 'px');
// Attach editor.
makeWhizzyWig(params.field, (settings.buttons ? settings.buttons : 'all'));
// Whizzywig fails to detect and set initial textarea contents.
$('#whizzy' + params.field).contents().find('body').html(tidyD($field.val()));
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.whizzywig = function (context, params, trigger) {
var detach = function (index) {
var id = whizzies[index], $field = $('#' + id), instance = Drupal.wysiwyg.instances[id];
// Save contents of editor back into textarea.
$field.val(instance.getContent());
// If the editor is just being serialized (not detached), our work is done.
if (trigger == 'serialize') {
return;
}
// Remove editor instance.
$('#' + id + '-whizzywig').remove();
whizzies.splice(index, 1);
// Restore original textarea styling.
$field.removeAttr('style').attr('style', instance.originalStyle);
};
if (typeof params != 'undefined') {
for (var i = 0; i < whizzies.length; i++) {
if (whizzies[i] == params.field) {
detach(i);
break;
}
}
}
else {
while (whizzies.length > 0) {
detach(0);
}
}
};
/**
* Instance methods for Whizzywig.
*/
Drupal.wysiwyg.editor.instance.whizzywig = {
insert: function (content) {
// Whizzywig executes any string beginning with 'js:'.
insHTML(content.replace(/^js:/, 'js:'));
},
setContent: function (content) {
var $field = $('#' + this.field);
// Whizzywig shows the original textarea in source mode.
if ($field.css('display') == 'block') {
$field.val(content);
}
else {
var doc = $('#whizzy' + this.field).contents()[0];
doc.open();
doc.write(content);
doc.close();
}
},
getContent: function () {
var $field = $('#' + this.field),
// Whizzywig shows the original textarea in source mode.
content = ($field.css('display') == 'block' ?
$field.val() : $('#whizzy' + this.field).contents().find('body').html()
);
content = tidyH(content);
// Whizzywig's get_xhtml() addon, if defined, expects a DOM node.
if ($.isFunction(window.get_xhtml)) {
var pre = document.createElement('pre');
pre.innerHTML = content;
content = get_xhtml(pre);
}
return content.replace(location.href + '#', '#');
}
};
})(jQuery);
| JavaScript |
(function($) {
Drupal.wysiwyg.editor.init.ckeditor = function(settings) {
// Plugins must only be loaded once. Only the settings from the first format
// will be used but they're identical anyway.
var registeredPlugins = {};
for (var format in settings) {
if (Drupal.settings.wysiwyg.plugins[format]) {
// Register native external plugins.
// Array syntax required; 'native' is a predefined token in JavaScript.
for (var pluginName in Drupal.settings.wysiwyg.plugins[format]['native']) {
if (!registeredPlugins[pluginName]) {
var plugin = Drupal.settings.wysiwyg.plugins[format]['native'][pluginName];
CKEDITOR.plugins.addExternal(pluginName, plugin.path, plugin.fileName);
registeredPlugins[pluginName] = true;
}
}
// Register Drupal plugins.
for (var pluginName in Drupal.settings.wysiwyg.plugins[format].drupal) {
if (!registeredPlugins[pluginName]) {
Drupal.wysiwyg.editor.instance.ckeditor.addPlugin(pluginName, Drupal.settings.wysiwyg.plugins[format].drupal[pluginName], Drupal.settings.wysiwyg.plugins.drupal[pluginName]);
registeredPlugins[pluginName] = true;
}
}
}
// Register Font styles (versions 3.2.1 and above).
if (Drupal.settings.wysiwyg.configs.ckeditor[format].stylesSet) {
CKEDITOR.stylesSet.add(format, Drupal.settings.wysiwyg.configs.ckeditor[format].stylesSet);
}
}
};
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) {
// Apply editor instance settings.
CKEDITOR.config.customConfig = '';
var $drupalToolbar = $('#toolbar', Drupal.overlayChild ? window.parent.document : document);
settings.on = {
instanceReady: function(ev) {
var editor = ev.editor;
// Get a list of block, list and table tags from CKEditor's XHTML DTD.
// @see http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting.
var dtd = CKEDITOR.dtd;
var tags = CKEDITOR.tools.extend({}, dtd.$block, dtd.$listItem, dtd.$tableContent);
// Set source formatting rules for each listed tag except <pre>.
// Linebreaks can be inserted before or after opening and closing tags.
if (settings.apply_source_formatting) {
// Mimic FCKeditor output, by breaking lines between tags.
for (var tag in tags) {
if (tag == 'pre') {
continue;
}
this.dataProcessor.writer.setRules(tag, {
indent: true,
breakBeforeOpen: true,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: true
});
}
}
else {
// CKEditor adds default formatting to <br>, so we want to remove that
// here too.
tags.br = 1;
// No indents or linebreaks;
for (var tag in tags) {
if (tag == 'pre') {
continue;
}
this.dataProcessor.writer.setRules(tag, {
indent: false,
breakBeforeOpen: false,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: false
});
}
}
},
pluginsLoaded: function(ev) {
// Override the conversion methods to let Drupal plugins modify the data.
var editor = ev.editor;
if (editor.dataProcessor && Drupal.settings.wysiwyg.plugins[params.format]) {
editor.dataProcessor.toHtml = CKEDITOR.tools.override(editor.dataProcessor.toHtml, function(originalToHtml) {
// Convert raw data for display in WYSIWYG mode.
return function(data, fixForBody) {
for (var plugin in Drupal.settings.wysiwyg.plugins[params.format].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].attach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], editor.name);
data = Drupal.wysiwyg.instances[params.field].prepareContent(data);
}
}
return originalToHtml.call(this, data, fixForBody);
};
});
editor.dataProcessor.toDataFormat = CKEDITOR.tools.override(editor.dataProcessor.toDataFormat, function(originalToDataFormat) {
// Convert WYSIWYG mode content to raw data.
return function(data, fixForBody) {
data = originalToDataFormat.call(this, data, fixForBody);
for (var plugin in Drupal.settings.wysiwyg.plugins[params.format].drupal) {
if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
data = Drupal.wysiwyg.plugins[plugin].detach(data, Drupal.settings.wysiwyg.plugins.drupal[plugin], editor.name);
}
}
return data;
};
});
}
},
selectionChange: function (event) {
var pluginSettings = Drupal.settings.wysiwyg.plugins[params.format];
if (pluginSettings && pluginSettings.drupal) {
$.each(pluginSettings.drupal, function (name) {
var plugin = Drupal.wysiwyg.plugins[name];
if ($.isFunction(plugin.isNode)) {
var node = event.data.selection.getSelectedElement();
var state = plugin.isNode(node ? node.$ : null) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
event.editor.getCommand(name).setState(state);
}
});
}
},
focus: function(ev) {
Drupal.wysiwyg.activeId = ev.editor.name;
},
afterCommandExec: function(ev) {
// Fix Drupal toolbar obscuring editor toolbar in fullscreen mode.
if (ev.data.name != 'maximize') {
return;
}
if (ev.data.command.state == CKEDITOR.TRISTATE_ON) {
$drupalToolbar.hide();
}
else {
$drupalToolbar.show();
}
}
};
// Attach editor.
CKEDITOR.replace(params.field, settings);
};
/**
* Detach a single or all editors.
*
* @todo 3.x: editor.prototype.getInstances() should always return an array
* containing all instances or the passed in params.field instance, but
* always return an array to simplify all detach functions.
*/
Drupal.wysiwyg.editor.detach.ckeditor = function (context, params, trigger) {
var method = (trigger == 'serialize') ? 'updateElement' : 'destroy';
if (typeof params != 'undefined') {
var instance = CKEDITOR.instances[params.field];
if (instance) {
instance[method]();
}
}
else {
for (var instanceName in CKEDITOR.instances) {
if (CKEDITOR.instances.hasOwnProperty(instanceName)) {
CKEDITOR.instances[instanceName][method]();
}
}
}
};
Drupal.wysiwyg.editor.instance.ckeditor = {
addPlugin: function(pluginName, settings, pluginSettings) {
CKEDITOR.plugins.add(pluginName, {
// Wrap Drupal plugin in a proxy pluygin.
init: function(editor) {
if (settings.css) {
editor.on('mode', function(ev) {
if (ev.editor.mode == 'wysiwyg') {
// Inject CSS files directly into the editing area head tag.
$('head', $('#cke_contents_' + ev.editor.name + ' iframe').eq(0).contents()).append('<link rel="stylesheet" href="' + settings.css + '" type="text/css" >');
}
});
}
if (typeof Drupal.wysiwyg.plugins[pluginName].invoke == 'function') {
var pluginCommand = {
exec: function (editor) {
var data = { format: 'html', node: null, content: '' };
var selection = editor.getSelection();
if (selection) {
data.node = selection.getSelectedElement();
if (data.node) {
data.node = data.node.$;
}
if (selection.getType() == CKEDITOR.SELECTION_TEXT) {
if (CKEDITOR.env.ie) {
data.content = selection.getNative().createRange().text;
}
else {
data.content = selection.getNative().toString();
}
}
else if (data.node) {
// content is supposed to contain the "outerHTML".
data.content = data.node.parentNode.innerHTML;
}
}
Drupal.wysiwyg.plugins[pluginName].invoke(data, pluginSettings, editor.name);
}
};
editor.addCommand(pluginName, pluginCommand);
}
editor.ui.addButton(pluginName, {
label: settings.iconTitle,
command: pluginName,
icon: settings.icon
});
// @todo Add button state handling.
}
});
},
prepareContent: function(content) {
// @todo Don't know if we need this yet.
return content;
},
insert: function(content) {
content = this.prepareContent(content);
CKEDITOR.instances[this.field].insertHtml(content);
},
setContent: function (content) {
CKEDITOR.instances[this.field].setData(content);
},
getContent: function () {
return CKEDITOR.instances[this.field].getData();
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.epiceditor = function (context, params, settings) {
var $target = $('#' + params.field);
var containerId = params.field + '-epiceditor';
var defaultContent = $target.val();
$target.hide().after('<div id="' + containerId + '" />');
settings.container = containerId;
settings.file = {
defaultContent: defaultContent
};
settings.theme = {
preview: '/themes/preview/preview-dark.css',
editor: '/themes/editor/' + settings.theme + '.css'
}
var editor = new EpicEditor(settings).load();
$target.data('epiceditor', editor);
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.epiceditor = function (context, params, trigger) {
var $target = $('#' + params.field);
var editor = $target.data('epiceditor');
$target.val(editor.exportFile());
editor.unload(function () {
$target.show();
});
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.wymeditor = function (context, params, settings) {
// Prepend basePath to wymPath.
settings.wymPath = settings.basePath + settings.wymPath;
// Update activeId on focus.
settings.postInit = function (instance) {
$(instance._doc).focus(function () {
Drupal.wysiwyg.activeId = params.field;
});
};
// Attach editor.
$('#' + params.field).wymeditor(settings);
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.wymeditor = function (context, params, trigger) {
if (typeof params != 'undefined') {
var $field = $('#' + params.field);
var index = $field.data(WYMeditor.WYM_INDEX);
if (typeof index != 'undefined') {
var instance = WYMeditor.INSTANCES[index];
instance.update();
if (trigger != 'serialize') {
$(instance._box).remove();
$(instance._element).show();
delete instance;
}
}
if (trigger != 'serialize') {
$field.show();
}
}
else {
jQuery.each(WYMeditor.INSTANCES, function () {
this.update();
if (trigger != 'serialize') {
$(this._box).remove();
$(this._element).show();
delete this;
}
});
}
};
Drupal.wysiwyg.editor.instance.wymeditor = {
insert: function (content) {
this.getInstance().insert(content);
},
setContent: function (content) {
this.getInstance().html(content);
},
getContent: function () {
return this.getInstance().xhtml();
},
getInstance: function () {
var $field = $('#' + this.field);
var index = $field.data(WYMeditor.WYM_INDEX);
if (typeof index != 'undefined') {
return WYMeditor.INSTANCES[index];
}
return null;
}
};
})(jQuery);
| JavaScript |
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.nicedit = function(context, params, settings) {
// Intercept and ignore submit handlers or they will revert changes made
// since the instance was removed. The handlers are anonymous and hidden out
// of scope in a closure so we can't unbind them. The same operations are
// performed when the instance is detached anyway.
var oldAddEvent = bkLib.addEvent;
bkLib.addEvent = function(obj, type, fn) {
if (type != 'submit') {
oldAddEvent(obj, type, fn);
}
}
// Attach editor.
var editor = new nicEditor(settings);
editor.panelInstance(params.field);
// The old addEvent() must be restored after creating a new instance, as
// plugins with dialogs use it to bind submit handlers to their forms.
bkLib.addEvent = oldAddEvent;
editor.addEvent('focus', function () {
Drupal.wysiwyg.activeId = params.field;
});
};
/**
* Detach a single or all editors.
*
* See Drupal.wysiwyg.editor.detach.none() for a full description of this hook.
*/
Drupal.wysiwyg.editor.detach.nicedit = function (context, params, trigger) {
if (typeof params != 'undefined') {
var instance = nicEditors.findEditor(params.field);
if (instance) {
if (trigger == 'serialize') {
instance.saveContent();
}
else {
instance.ne.removeInstance(params.field);
instance.ne.removePanel();
}
}
}
else {
for (var e in nicEditors.editors) {
// Save contents of all editors back into textareas.
var instances = nicEditors.editors[e].nicInstances;
for (var i = 0; i < instances.length; i++) {
if (trigger == 'serialize') {
instances[i].saveContent();
}
else {
instances[i].remove();
}
}
// Remove all editor instances.
if (trigger != 'serialize') {
nicEditors.editors[e].nicInstances = [];
}
}
}
};
/**
* Instance methods for nicEdit.
*/
Drupal.wysiwyg.editor.instance.nicedit = {
insert: function (content) {
var instance = nicEditors.findEditor(this.field);
var editingArea = instance.getElm();
var sel = instance.getSel();
// IE.
if (document.selection) {
editingArea.focus();
sel.createRange().pasteHTML(content);
}
else {
// Convert selection to a range.
var range;
// W3C compatible.
if (sel.getRangeAt) {
range = sel.getRangeAt(0);
}
// Safari.
else {
range = editingArea.ownerDocument.createRange();
range.setStart(sel.anchorNode, sel.anchorOffset);
range.setEnd(sel.focusNode, userSeletion.focusOffset);
}
// The code below doesn't work in IE, but it never gets here.
var fragment = editingArea.ownerDocument.createDocumentFragment();
// Fragments don't support innerHTML.
var wrapper = editingArea.ownerDocument.createElement('div');
wrapper.innerHTML = content;
while (wrapper.firstChild) {
fragment.appendChild(wrapper.firstChild);
}
range.deleteContents();
// Only fragment children are inserted.
range.insertNode(fragment);
}
},
setContent: function (content) {
nicEditors.findEditor(this.field).setContent(content);
},
getContent: function () {
return nicEditors.findEditor(this.field).getContent();
}
};
})(jQuery);
| JavaScript |
// Backup $ and reset it to jQuery.
Drupal.wysiwyg._openwysiwyg = $;
$ = jQuery;
// Wrap openWYSIWYG's methods to temporarily use its version of $.
jQuery.each(WYSIWYG, function (key, value) {
if (jQuery.isFunction(value)) {
WYSIWYG[key] = function () {
var old$ = $;
$ = Drupal.wysiwyg._openwysiwyg;
var result = value.apply(this, arguments);
$ = old$;
return result;
};
}
});
// Override editor functions.
WYSIWYG.getEditor = function (n) {
return Drupal.wysiwyg._openwysiwyg("wysiwyg" + n);
};
(function($) {
// Fix Drupal toolbar obscuring editor toolbar in fullscreen mode.
var oldMaximize = WYSIWYG.maximize;
WYSIWYG.maximize = function (n) {
var $drupalToolbar = $('#toolbar', Drupal.overlayChild ? window.parent.document : document);
oldMaximize.apply(this, arguments);
if (this.maximized[n]) {
$drupalToolbar.hide();
}
else {
$drupalToolbar.show();
}
}
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.openwysiwyg = function(context, params, settings) {
// Initialize settings.
settings.ImagesDir = settings.path + 'images/';
settings.PopupsDir = settings.path + 'popups/';
settings.CSSFile = settings.path + 'styles/wysiwyg.css';
//settings.DropDowns = [];
var config = new WYSIWYG.Settings();
for (var setting in settings) {
config[setting] = settings[setting];
}
// Attach editor.
WYSIWYG.setSettings(params.field, config);
WYSIWYG_Core.includeCSS(WYSIWYG.config[params.field].CSSFile);
WYSIWYG._generate(params.field, config);
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.openwysiwyg = function (context, params, trigger) {
if (typeof params != 'undefined') {
var instance = WYSIWYG.config[params.field];
if (typeof instance != 'undefined') {
WYSIWYG.updateTextArea(params.field);
if (trigger != 'serialize') {
jQuery('#wysiwyg_div_' + params.field).remove();
delete instance;
}
}
if (trigger != 'serialize') {
jQuery('#' + params.field).show();
}
}
else {
jQuery.each(WYSIWYG.config, function(field) {
WYSIWYG.updateTextArea(field);
if (trigger != 'serialize') {
jQuery('#wysiwyg_div_' + field).remove();
delete this;
jQuery('#' + field).show();
}
});
}
};
/**
* Instance methods for openWYSIWYG.
*/
Drupal.wysiwyg.editor.instance.openwysiwyg = {
insert: function (content) {
// If IE has dropped focus content will be inserted at the top of the page.
$('#wysiwyg' + this.field).contents().find('body').focus();
WYSIWYG.insertHTML(content, this.field);
},
setContent: function (content) {
// Based on openWYSIWYG's _generate() method.
var doc = WYSIWYG.getEditorWindow(this.field).document;
if (WYSIWYG.config[this.field].ReplaceLineBreaks) {
content = content.replace(/\n\r|\n/ig, '<br />');
}
if (WYSIWYG.viewTextMode[this.field]) {
var html = document.createTextNode(content);
doc.body.innerHTML = '';
doc.body.appendChild(html);
}
else {
doc.open();
doc.write(content);
doc.close();
}
},
getContent: function () {
// Based on openWYSIWYG's updateTextarea() method.
var content = '';
var doc = WYSIWYG.getEditorWindow(this.field).document;
if (WYSIWYG.viewTextMode[this.field]) {
if (WYSIWYG_Core.isMSIE) {
content = doc.body.innerText;
}
else {
var range = doc.body.ownerDocument.createRange();
range.selectNodeContents(doc.body);
content = range.toString();
}
}
else {
content = doc.body.innerHTML;
}
content = WYSIWYG.stripURLPath(this.field, content);
content = WYSIWYG_Core.replaceRGBWithHexColor(content);
if (WYSIWYG.config[this.field].ReplaceLineBreaks) {
content = content.replace(/(\r\n)|(\n)/ig, '');
}
return content;
}
};
})(jQuery);
| JavaScript |
var buttonPath = null;
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) {
// Previous versions used per-button images found in this location,
// now it is only used for custom buttons.
if (settings.buttonPath) {
window.buttonPath = settings.buttonPath;
}
// Assign the toolbar image path used for native buttons, if available.
if (settings.toolbarImagePath) {
btn._f = settings.toolbarImagePath;
}
// Fall back to text labels for all buttons.
else {
window.buttonPath = 'textbuttons';
}
// Whizzywig needs to have the width set 'inline'.
$field = $('#' + params.field);
var originalValues = Drupal.wysiwyg.instances[params.field];
originalValues.originalStyle = $field.attr('style');
$field.css('width', $field.width() + 'px');
// Attach editor.
makeWhizzyWig(params.field, (settings.buttons ? settings.buttons : 'all'));
// Whizzywig fails to detect and set initial textarea contents.
$('#whizzy' + params.field).contents().find('body').html(tidyD($field.val()));
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.whizzywig = function (context, params, trigger) {
var detach = function (index) {
var id = whizzies[index], $field = $('#' + id), instance = Drupal.wysiwyg.instances[id];
// Save contents of editor back into textarea.
$field.val(instance.getContent());
// If the editor is just being serialized (not detached), our work is done.
if (trigger == 'serialize') {
return;
}
// Move original textarea back to its previous location.
var $container = $('#CONTAINER' + id);
$field.insertBefore($container);
// Remove editor instance.
$container.remove();
whizzies.splice(index, 1);
// Restore original textarea styling.
$field.removeAttr('style').attr('style', instance.originalStyle);
}
if (typeof params != 'undefined') {
for (var i = 0; i < whizzies.length; i++) {
if (whizzies[i] == params.field) {
detach(i);
break;
}
}
}
else {
while (whizzies.length > 0) {
detach(0);
}
}
};
/**
* Instance methods for Whizzywig.
*/
Drupal.wysiwyg.editor.instance.whizzywig = {
insert: function (content) {
// Whizzywig executes any string beginning with 'js:'.
insHTML(content.replace(/^js:/, 'js:'));
},
setContent: function (content) {
// Whizzywig shows the original textarea in source mode.
if ($field.css('display') == 'block') {
$('#' + this.field).val(content);
}
else {
var doc = $('#whizzy' + this.field).contents()[0];
doc.open();
doc.write(content);
doc.close();
}
},
getContent: function () {
// Whizzywig's tidyH() expects a document node. Clone the editing iframe's
// document so tidyH() won't mess with it if this gets called while editing.
var clone = $($('#whizzy' + this.field).contents()[0].documentElement).clone()[0].ownerDocument;
// Whizzywig shows the original textarea in source mode so update the body.
if ($field.css('display') == 'block') {
clone.body.innerHTML = $('#' + this.field).val();
}
return tidyH(clone);
}
};
})(jQuery);
| JavaScript |
var wysiwygWhizzywig = { currentField: null, fields: {} };
var buttonPath = null;
/**
* Override Whizzywig's document.write() function.
*
* Whizzywig uses document.write() by default, which leads to a blank page when
* invoked in jQuery.ready(). Luckily, Whizzywig developers implemented a
* shorthand w() substitute function that we can override to redirect the output
* into the global wysiwygWhizzywig variable.
*
* @see o()
*/
var w = function (string) {
if (string) {
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] += string;
}
return wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField];
};
/**
* Override Whizzywig's document.getElementById() function.
*
* Since we redirect the output of w() into a temporary string upon attaching
* an editor, we also have to override the o() shorthand substitute function
* for document.getElementById() to search in the document or our container.
* This override function also inserts the editor instance when Whizzywig
* tries to access its IFRAME, so it has access to the full/regular window
* object.
*
* @see w()
*/
var o = function (id) {
// Upon first access to "whizzy" + id, Whizzywig tries to access its IFRAME,
// so we need to insert the editor into the DOM.
if (id == 'whizzy' + wysiwygWhizzywig.currentField && wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField]) {
jQuery('#' + wysiwygWhizzywig.currentField).after('<div id="' + wysiwygWhizzywig.currentField + '-whizzywig"></div>');
// Iframe's .contentWindow becomes null in Webkit if inserted via .after().
jQuery('#' + wysiwygWhizzywig.currentField + '-whizzywig').html(w());
// Prevent subsequent invocations from inserting the editor multiple times.
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = '';
}
// If id exists in the regular window.document, return it.
if (jQuery('#' + id).size()) {
return jQuery('#' + id).get(0);
}
// Otherwise return id from our container.
return jQuery('#' + id, w()).get(0);
};
(function($) {
/**
* Attach this editor to a target element.
*/
Drupal.wysiwyg.editor.attach.whizzywig = function(context, params, settings) {
// Previous versions used per-button images found in this location,
// now it is only used for custom buttons.
if (settings.buttonPath) {
window.buttonPath = settings.buttonPath;
}
// Assign the toolbar image path used for native buttons, if available.
if (settings.toolbarImagePath) {
btn._f = settings.toolbarImagePath;
}
// Fall back to text labels for all buttons.
else {
window.buttonPath = 'textbuttons';
}
// Create Whizzywig container.
wysiwygWhizzywig.currentField = params.field;
wysiwygWhizzywig.fields[wysiwygWhizzywig.currentField] = '';
// Whizzywig needs to have the width set 'inline'.
$field = $('#' + params.field);
var originalValues = Drupal.wysiwyg.instances[params.field];
originalValues.originalStyle = $field.attr('style');
$field.css('width', $field.width() + 'px');
// Attach editor.
makeWhizzyWig(params.field, (settings.buttons ? settings.buttons : 'all'));
// Whizzywig fails to detect and set initial textarea contents.
$('#whizzy' + params.field).contents().find('body').html(tidyD($field.val()));
};
/**
* Detach a single or all editors.
*/
Drupal.wysiwyg.editor.detach.whizzywig = function (context, params, trigger) {
var detach = function (index) {
var id = whizzies[index], $field = $('#' + id), instance = Drupal.wysiwyg.instances[id];
// Save contents of editor back into textarea.
$field.val(instance.getContent());
// If the editor is just being serialized (not detached), our work is done.
if (trigger == 'serialize') {
return;
}
// Remove editor instance.
$('#' + id + '-whizzywig').remove();
whizzies.splice(index, 1);
// Restore original textarea styling.
$field.removeAttr('style').attr('style', instance.originalStyle);
};
if (typeof params != 'undefined') {
for (var i = 0; i < whizzies.length; i++) {
if (whizzies[i] == params.field) {
detach(i);
break;
}
}
}
else {
while (whizzies.length > 0) {
detach(0);
}
}
};
/**
* Instance methods for Whizzywig.
*/
Drupal.wysiwyg.editor.instance.whizzywig = {
insert: function (content) {
// Whizzywig executes any string beginning with 'js:'.
insHTML(content.replace(/^js:/, 'js:'));
},
setContent: function (content) {
// Whizzywig shows the original textarea in source mode.
if ($field.css('display') == 'block') {
$('#' + this.field).val(content);
}
else {
var doc = $('#whizzy' + this.field).contents()[0];
doc.open();
doc.write(content);
doc.close();
}
},
getContent: function () {
// Whizzywig's tidyH() expects a document node. Clone the editing iframe's
// document so tidyH() won't mess with it if this gets called while editing.
var clone = $($('#whizzy' + this.field).contents()[0].documentElement).clone()[0].ownerDocument;
// Whizzywig shows the original textarea in source mode so update the body.
if ($field.css('display') == 'block') {
clone.body.innerHTML = $('#' + this.field).val();
}
return tidyH(clone);
}
};
})(jQuery);
| JavaScript |
(function ($) {
// @todo Array syntax required; 'break' is a predefined token in JavaScript.
Drupal.wysiwyg.plugins['break'] = {
/**
* Return whether the passed node belongs to this plugin.
*/
isNode: function(node) {
return ($(node).is('img.wysiwyg-break'));
},
/**
* Execute the button.
*/
invoke: function(data, settings, instanceId) {
if (data.format == 'html') {
// Prevent duplicating a teaser break.
if ($(data.node).is('img.wysiwyg-break')) {
return;
}
var content = this._getPlaceholder(settings);
}
else {
// Prevent duplicating a teaser break.
// @todo data.content is the selection only; needs access to complete content.
if (data.content.match(/<!--break-->/)) {
return;
}
var content = '<!--break-->';
}
if (typeof content != 'undefined') {
Drupal.wysiwyg.instances[instanceId].insert(content);
}
},
/**
* Replace all <!--break--> tags with images.
*/
attach: function(content, settings, instanceId) {
content = content.replace(/<!--break-->/g, this._getPlaceholder(settings));
return content;
},
/**
* Replace images with <!--break--> tags in content upon detaching editor.
*/
detach: function(content, settings, instanceId) {
var $content = $('<div>' + content + '</div>'); // No .outerHTML() in jQuery :(
// #404532: document.createComment() required or IE will strip the comment.
// #474908: IE 8 breaks when using jQuery methods to replace the elements.
// @todo Add a generic implementation for all Drupal plugins for this.
$.each($('img.wysiwyg-break', $content), function (i, elem) {
elem.parentNode.insertBefore(document.createComment('break'), elem);
elem.parentNode.removeChild(elem);
});
return $content.html();
},
/**
* Helper function to return a HTML placeholder.
*/
_getPlaceholder: function (settings) {
return '<img src="' + settings.path + '/images/spacer.gif" alt="<--break->" title="<--break-->" class="wysiwyg-break drupal-content" />';
}
};
})(jQuery);
| JavaScript |
tinyMCE.addToLang('break', {
title: 'Inserir marcador de document retallat',
desc: 'Generar el punt de separació entre la versió retallada del document i la resta del contingut'
});
| JavaScript |
tinyMCE.addToLang('break', {
title: 'Anrisstext trennen',
desc: 'Separiert den Anrisstext und Textkörper des Inhalts an dieser Stelle'
});
| JavaScript |
tinyMCE.addToLang('break', {
title: 'Insertar marcador de documento recortado',
desc: 'Generar el punto de separación entre la versión recortada del documento y el resto del contenido'
});
| JavaScript |
tinyMCE.addToLang('break', {
title: 'Insert teaser break',
desc: 'Separate teaser and body of this content'
});
| JavaScript |
/**
* Wysiwyg plugin button implementation for Awesome plugin.
*/
Drupal.wysiwyg.plugins.awesome = {
/**
* Return whether the passed node belongs to this plugin.
*
* @param node
* The currently focused DOM element in the editor content.
*/
isNode: function(node) {
return ($(node).is('img.mymodule-awesome'));
},
/**
* Execute the button.
*
* @param data
* An object containing data about the current selection:
* - format: 'html' when the passed data is HTML content, 'text' when the
* passed data is plain-text content.
* - node: When 'format' is 'html', the focused DOM element in the editor.
* - content: The textual representation of the focused/selected editor
* content.
* @param settings
* The plugin settings, as provided in the plugin's PHP include file.
* @param instanceId
* The ID of the current editor instance.
*/
invoke: function(data, settings, instanceId) {
// Generate HTML markup.
if (data.format == 'html') {
// Prevent duplicating a teaser break.
if ($(data.node).is('img.mymodule-awesome')) {
return;
}
var content = this._getPlaceholder(settings);
}
// Generate plain text.
else {
var content = '<!--break-->';
}
// Insert new content into the editor.
if (typeof content != 'undefined') {
Drupal.wysiwyg.instances[instanceId].insert(content);
}
},
/**
* Prepare all plain-text contents of this plugin with HTML representations.
*
* Optional; only required for "inline macro tag-processing" plugins.
*
* @param content
* The plain-text contents of a textarea.
* @param settings
* The plugin settings, as provided in the plugin's PHP include file.
* @param instanceId
* The ID of the current editor instance.
*/
attach: function(content, settings, instanceId) {
content = content.replace(/<!--break-->/g, this._getPlaceholder(settings));
return content;
},
/**
* Process all HTML placeholders of this plugin with plain-text contents.
*
* Optional; only required for "inline macro tag-processing" plugins.
*
* @param content
* The HTML content string of the editor.
* @param settings
* The plugin settings, as provided in the plugin's PHP include file.
* @param instanceId
* The ID of the current editor instance.
*/
detach: function(content, settings, instanceId) {
var $content = $('<div>' + content + '</div>');
$.each($('img.mymodule-awesome', $content), function (i, elem) {
//...
});
return $content.html();
},
/**
* Helper function to return a HTML placeholder.
*
* The 'drupal-content' CSS class is required for HTML elements in the editor
* content that shall not trigger any editor's native buttons (such as the
* image button for this example placeholder markup).
*/
_getPlaceholder: function (settings) {
return '<img src="' + settings.path + '/images/spacer.gif" alt="<--break->" title="<--break-->" class="wysiwyg-break drupal-content" />';
}
};
| JavaScript |
(function($) {
/**
* Initialize editor libraries.
*
* Some editors need to be initialized before the DOM is fully loaded. The
* init hook gives them a chance to do so.
*/
Drupal.wysiwygInit = function() {
// This breaks in Konqueror. Prevent it from running.
if (/KDE/.test(navigator.vendor)) {
return;
}
jQuery.each(Drupal.wysiwyg.editor.init, function(editor) {
// Clone, so original settings are not overwritten.
this(jQuery.extend(true, {}, Drupal.settings.wysiwyg.configs[editor]));
});
};
/**
* Attach editors to input formats and target elements (f.e. textareas).
*
* This behavior searches for input format selectors and formatting guidelines
* that have been preprocessed by Wysiwyg API. All CSS classes of those elements
* with the prefix 'wysiwyg-' are parsed into input format parameters, defining
* the input format, configured editor, target element id, and variable other
* properties, which are passed to the attach/detach hooks of the corresponding
* editor.
*
* Furthermore, an "enable/disable rich-text" toggle link is added after the
* target element to allow users to alter its contents in plain text.
*
* This is executed once, while editor attach/detach hooks can be invoked
* multiple times.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
*/
Drupal.behaviors.attachWysiwyg = {
attach: function (context, settings) {
// This breaks in Konqueror. Prevent it from running.
if (/KDE/.test(navigator.vendor)) {
return;
}
$('.wysiwyg', context).once('wysiwyg', function () {
if (!this.id || typeof Drupal.settings.wysiwyg.triggers[this.id] === 'undefined') {
return;
}
var $this = $(this);
var params = Drupal.settings.wysiwyg.triggers[this.id];
for (var format in params) {
params[format].format = format;
params[format].trigger = this.id;
params[format].field = params.field;
}
var format = 'format' + this.value;
// Directly attach this editor, if the input format is enabled or there is
// only one input format at all.
if ($this.is(':input')) {
Drupal.wysiwygAttach(context, params[format]);
}
// Attach onChange handlers to input format selector elements.
if ($this.is('select')) {
$this.change(function() {
// If not disabled, detach the current and attach a new editor.
Drupal.wysiwygDetach(context, params[format]);
format = 'format' + this.value;
Drupal.wysiwygAttach(context, params[format]);
});
}
// Detach any editor when the containing form is submitted.
$('#' + params.field).parents('form').submit(function (event) {
// Do not detach if the event was cancelled.
if (event.isDefaultPrevented()) {
return;
}
Drupal.wysiwygDetach(context, params[format], 'serialize');
});
});
},
detach: function (context, settings, trigger) {
var wysiwygs;
// The 'serialize' trigger indicates that we should simply update the
// underlying element with the new text, without destroying the editor.
if (trigger == 'serialize') {
// Removing the wysiwyg-processed class guarantees that the editor will
// be reattached. Only do this if we're planning to destroy the editor.
wysiwygs = $('.wysiwyg-processed', context);
}
else {
wysiwygs = $('.wysiwyg', context).removeOnce('wysiwyg');
}
wysiwygs.each(function () {
var params = Drupal.settings.wysiwyg.triggers[this.id];
Drupal.wysiwygDetach(context, params, trigger);
});
}
};
/**
* Attach an editor to a target element.
*
* This tests whether the passed in editor implements the attach hook and
* invokes it if available. Editor profile settings are cloned first, so they
* cannot be overridden. After attaching the editor, the toggle link is shown
* again, except in case we are attaching no editor.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* An object containing input format parameters.
*/
Drupal.wysiwygAttach = function(context, params) {
if (typeof Drupal.wysiwyg.editor.attach[params.editor] == 'function') {
// (Re-)initialize field instance.
Drupal.wysiwyg.instances[params.field] = {};
// Provide all input format parameters to editor instance.
jQuery.extend(Drupal.wysiwyg.instances[params.field], params);
// Provide editor callbacks for plugins, if available.
if (typeof Drupal.wysiwyg.editor.instance[params.editor] == 'object') {
jQuery.extend(Drupal.wysiwyg.instances[params.field], Drupal.wysiwyg.editor.instance[params.editor]);
}
// Store this field id, so (external) plugins can use it.
// @todo Wrong point in time. Probably can only supported by editors which
// support an onFocus() or similar event.
Drupal.wysiwyg.activeId = params.field;
// Attach or update toggle link, if enabled.
if (params.toggle) {
Drupal.wysiwygAttachToggleLink(context, params);
}
// Otherwise, ensure that toggle link is hidden.
else {
$('#wysiwyg-toggle-' + params.field).hide();
}
// Attach editor, if enabled by default or last state was enabled.
if (params.status) {
Drupal.wysiwyg.editor.attach[params.editor](context, params, (Drupal.settings.wysiwyg.configs[params.editor] ? jQuery.extend(true, {}, Drupal.settings.wysiwyg.configs[params.editor][params.format]) : {}));
}
// Otherwise, attach default behaviors.
else {
Drupal.wysiwyg.editor.attach.none(context, params);
Drupal.wysiwyg.instances[params.field].editor = 'none';
}
}
};
/**
* Detach all editors from a target element.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* An object containing input format parameters.
* @param trigger
* A string describing what is causing the editor to be detached.
*
* @see Drupal.detachBehaviors
*/
Drupal.wysiwygDetach = function (context, params, trigger) {
// Do not attempt to detach an unknown editor instance (Ajax).
if (typeof Drupal.wysiwyg.instances[params.field] == 'undefined') {
return;
}
trigger = trigger || 'unload';
var editor = Drupal.wysiwyg.instances[params.field].editor;
if (jQuery.isFunction(Drupal.wysiwyg.editor.detach[editor])) {
Drupal.wysiwyg.editor.detach[editor](context, params, trigger);
}
};
/**
* Append or update an editor toggle link to a target element.
*
* @param context
* A DOM element, supplied by Drupal.attachBehaviors().
* @param params
* An object containing input format parameters.
*/
Drupal.wysiwygAttachToggleLink = function(context, params) {
if (!$('#wysiwyg-toggle-' + params.field).length) {
var text = document.createTextNode(params.status ? Drupal.settings.wysiwyg.disable : Drupal.settings.wysiwyg.enable);
var a = document.createElement('a');
$(a).attr({ id: 'wysiwyg-toggle-' + params.field, href: 'javascript:void(0);' }).append(text);
var div = document.createElement('div');
$(div).addClass('wysiwyg-toggle-wrapper').append(a);
$('#' + params.field).after(div);
}
$('#wysiwyg-toggle-' + params.field)
.html(params.status ? Drupal.settings.wysiwyg.disable : Drupal.settings.wysiwyg.enable).show()
.unbind('click.wysiwyg', Drupal.wysiwyg.toggleWysiwyg)
.bind('click.wysiwyg', { params: params, context: context }, Drupal.wysiwyg.toggleWysiwyg);
// Hide toggle link in case no editor is attached.
if (params.editor == 'none') {
$('#wysiwyg-toggle-' + params.field).hide();
}
};
/**
* Callback for the Enable/Disable rich editor link.
*/
Drupal.wysiwyg.toggleWysiwyg = function (event) {
var context = event.data.context;
var params = event.data.params;
if (params.status) {
// Detach current editor.
params.status = false;
Drupal.wysiwygDetach(context, params);
// After disabling the editor, re-attach default behaviors.
// @todo We HAVE TO invoke Drupal.wysiwygAttach() here.
Drupal.wysiwyg.editor.attach.none(context, params);
Drupal.wysiwyg.instances[params.field] = Drupal.wysiwyg.editor.instance.none;
Drupal.wysiwyg.instances[params.field].editor = 'none';
Drupal.wysiwyg.instances[params.field].field = params.field;
$(this).html(Drupal.settings.wysiwyg.enable).blur();
}
else {
// Before enabling the editor, detach default behaviors.
Drupal.wysiwyg.editor.detach.none(context, params);
// Attach new editor using parameters of the currently selected input format.
params = Drupal.settings.wysiwyg.triggers[params.trigger]['format' + $('#' + params.trigger).val()];
params.status = true;
Drupal.wysiwygAttach(context, params);
$(this).html(Drupal.settings.wysiwyg.disable).blur();
}
}
/**
* Parse the CSS classes of an input format DOM element into parameters.
*
* Syntax for CSS classes is "wysiwyg-name-value".
*
* @param element
* An input format DOM element containing CSS classes to parse.
* @param params
* (optional) An object containing input format parameters to update.
*/
Drupal.wysiwyg.getParams = function(element, params) {
var classes = element.className.split(' ');
var params = params || {};
for (var i = 0; i < classes.length; i++) {
if (classes[i].substr(0, 8) == 'wysiwyg-') {
var parts = classes[i].split('-');
var value = parts.slice(2).join('-');
params[parts[1]] = value;
}
}
// Convert format id into string.
params.format = 'format' + params.format;
// Convert numeric values.
params.status = parseInt(params.status, 10);
params.toggle = parseInt(params.toggle, 10);
params.resizable = parseInt(params.resizable, 10);
return params;
};
/**
* Allow certain editor libraries to initialize before the DOM is loaded.
*/
Drupal.wysiwygInit();
// Respond to CTools detach behaviors event.
$(document).bind('CToolsDetachBehaviors', function(event, context) {
Drupal.behaviors.attachWysiwyg.detach(context, {}, 'unload');
});
})(jQuery);
| JavaScript |
Drupal.wysiwyg = Drupal.wysiwyg || { 'instances': {} };
Drupal.wysiwyg.editor = Drupal.wysiwyg.editor || { 'init': {}, 'attach': {}, 'detach': {}, 'instance': {} };
Drupal.wysiwyg.plugins = Drupal.wysiwyg.plugins || {};
(function ($) {
// Determine support for queryCommandEnabled().
// An exception should be thrown for non-existing commands.
// Safari and Chrome (WebKit based) return -1 instead.
try {
document.queryCommandEnabled('__wysiwygTestCommand');
$.support.queryCommandEnabled = false;
}
catch (error) {
$.support.queryCommandEnabled = true;
}
})(jQuery);
| JavaScript |
(function ($) {
Drupal.viewsSlideshow = Drupal.viewsSlideshow || {};
/**
* Views Slideshow Controls
*/
Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {};
/**
* Implement the play hook for controls.
*/
Drupal.viewsSlideshowControls.play = function (options) {
// Route the control call to the correct control type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the pause hook for controls.
*/
Drupal.viewsSlideshowControls.pause = function (options) {
// Route the control call to the correct control type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') {
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Views Slideshow Text Controls
*/
// Add views slieshow api calls for views slideshow text controls.
Drupal.behaviors.viewsSlideshowControlsText = {
attach: function (context) {
// Process previous link
$('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', '');
$(this).click(function() {
Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID });
return false;
});
});
// Process next link
$('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', '');
$(this).click(function() {
Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID });
return false;
});
});
// Process pause link
$('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() {
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', '');
$(this).click(function() {
if (Drupal.settings.viewsSlideshow[uniqueID].paused) {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true });
}
else {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true });
}
return false;
});
});
}
};
Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {};
/**
* Implement the pause hook for text controls.
*/
Drupal.viewsSlideshowControlsText.pause = function (options) {
var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : '';
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText);
};
/**
* Implement the play hook for text controls.
*/
Drupal.viewsSlideshowControlsText.play = function (options) {
var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : '';
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText);
};
// Theme the resume control.
Drupal.theme.prototype.viewsSlideshowControlsPause = function () {
return Drupal.t('Resume');
};
// Theme the pause control.
Drupal.theme.prototype.viewsSlideshowControlsPlay = function () {
return Drupal.t('Pause');
};
/**
* Views Slideshow Pager
*/
Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {};
/**
* Implement the transitionBegin hook for pagers.
*/
Drupal.viewsSlideshowPager.transitionBegin = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the goToSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.goToSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the previousSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.previousSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Implement the nextSlide hook for pagers.
*/
Drupal.viewsSlideshowPager.nextSlide = function (options) {
// Route the pager call to the correct pager type.
// Need to use try catch so we don't have to check to make sure every part
// of the object is defined.
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
try {
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') {
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options);
}
}
catch(err) {
// Don't need to do anything on error.
}
};
/**
* Views Slideshow Pager Fields
*/
// Add views slieshow api calls for views slideshow pager fields.
Drupal.behaviors.viewsSlideshowPagerFields = {
attach: function (context) {
// Process pause on hover.
$('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() {
// Parse out the location and unique id from the full id.
var pagerInfo = $(this).attr('id').split('_');
var location = pagerInfo[2];
pagerInfo.splice(0, 3);
var uniqueID = pagerInfo.join('_');
// Add the activate and pause on pager hover event to each pager item.
if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) {
$(this).children().each(function(index, pagerItem) {
var mouseIn = function() {
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID });
}
var mouseOut = function() {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID });
}
if (jQuery.fn.hoverIntent) {
$(pagerItem).hoverIntent(mouseIn, mouseOut);
}
else {
$(pagerItem).hover(mouseIn, mouseOut);
}
});
}
else {
$(this).children().each(function(index, pagerItem) {
$(pagerItem).click(function() {
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
});
});
}
});
}
};
Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {};
/**
* Implement the transitionBegin hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
}
};
/**
* Implement the goToSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.goToSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
}
};
/**
* Implement the previousSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Get the current active pager.
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
// If we are on the first pager then activate the last pager.
// Otherwise activate the previous pager.
if (pagerNum == 0) {
pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1;
}
else {
pagerNum--;
}
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active');
}
};
/**
* Implement the nextSlide hook for pager fields pager.
*/
Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
// Get the current active pager.
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length();
// If we are on the last pager then activate the first pager.
// Otherwise activate the next pager.
pagerNum++;
if (pagerNum == totalPagers) {
pagerNum = 0;
}
// Remove active class from pagers
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
// Add active class to active pager.
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active');
}
};
/**
* Views Slideshow Slide Counter
*/
Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {};
/**
* Implement the transitionBegin for the slide counter.
*/
Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) {
$('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1);
};
/**
* This is used as a router to process actions for the slideshow.
*/
Drupal.viewsSlideshow.action = function (options) {
// Set default values for our return status.
var status = {
'value': true,
'text': ''
}
// If an action isn't specified return false.
if (typeof options.action == 'undefined' || options.action == '') {
status.value = false;
status.text = Drupal.t('There was no action specified.');
return error;
}
// If we are using pause or play switch paused state accordingly.
if (options.action == 'pause') {
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1;
// If the calling method is forcing a pause then mark it as such.
if (options.force) {
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1;
}
}
else if (options.action == 'play') {
// If the slideshow isn't forced pause or we are forcing a play then play
// the slideshow.
// Otherwise return telling the calling method that it was forced paused.
if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) {
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0;
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0;
}
else {
status.value = false;
status.text += ' ' + Drupal.t('This slideshow is forced paused.');
return status;
}
}
// We use a switch statement here mainly just to limit the type of actions
// that are available.
switch (options.action) {
case "goToSlide":
case "transitionBegin":
case "transitionEnd":
// The three methods above require a slide number. Checking if it is
// defined and it is a number that is an integer.
if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) {
status.value = false;
status.text = Drupal.t('An invalid integer was specified for slideNum.');
}
case "pause":
case "play":
case "nextSlide":
case "previousSlide":
// Grab our list of methods.
var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods'];
// if the calling method specified methods that shouldn't be called then
// exclude calling them.
var excludeMethodsObj = {};
if (typeof options.excludeMethods !== 'undefined') {
// We need to turn the excludeMethods array into an object so we can use the in
// function.
for (var i=0; i < excludeMethods.length; i++) {
excludeMethodsObj[excludeMethods[i]] = '';
}
}
// Call every registered method and don't call excluded ones.
for (i = 0; i < methods[options.action].length; i++) {
if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) {
Drupal[methods[options.action][i]][options.action](options);
}
}
break;
// If it gets here it's because it's an invalid action.
default:
status.value = false;
status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action });
}
return status;
};
})(jQuery);
| JavaScript |
/**
* @file
* Javascript to enhance the views slideshow cycle form options.
*/
/**
* This will set our initial behavior, by starting up each individual slideshow.
*/
(function ($) {
// Since Drupal 7 doesn't support having a field based on one of 3 values of
// a select box we need to add our own javascript handling.
Drupal.behaviors.viewsSlideshowCycleAmountAllowedVisible = {
attach: function (context) {
// If necessary at start hide the amount allowed visible box.
var type = $(":input[name='style_options[views_slideshow_cycle][pause_when_hidden_type]']").val();
if (type == 'full') {
$(":input[name='style_options[views_slideshow_cycle][amount_allowed_visible]']").parent().hide();
}
// Handle dependency on action advanced checkbox.
$(":input[name='style_options[views_slideshow_cycle][action_advanced]']").change(function() {
processValues('action_advanced');
});
// Handle dependency on pause when hidden checkbox.
$(':input[name="style_options[views_slideshow_cycle][pause_when_hidden]"]').change(function() {
processValues('pause_when_hidden');
});
// Handle dependency on pause when hidden type select box.
$(":input[name='style_options[views_slideshow_cycle][pause_when_hidden_type]']").change(function() {
processValues('pause_when_hidden_type');
});
// Process our dependencies.
function processValues(field) {
switch (field) {
case 'action_advanced':
if (!$(':input[name="style_options[views_slideshow_cycle][action_advanced]"]').is(':checked')) {
$(":input[name='style_options[views_slideshow_cycle][amount_allowed_visible]']").parent().hide();
break;
}
case 'pause_when_hidden':
if (!$(':input[name="style_options[views_slideshow_cycle][pause_when_hidden]"]').is(':checked')) {
$(":input[name='style_options[views_slideshow_cycle][amount_allowed_visible]']").parent().hide();
break;
}
case 'pause_when_hidden_type':
if ($(":input[name='style_options[views_slideshow_cycle][pause_when_hidden_type]']").val() == 'full') {
$(":input[name='style_options[views_slideshow_cycle][amount_allowed_visible]']").parent().hide();
}
else {
$(":input[name='style_options[views_slideshow_cycle][amount_allowed_visible]']").parent().show();
}
}
}
}
}
// Manage advanced options
Drupal.behaviors.viewsSlideshowCycleOptions = {
attach: function (context) {
if ($(":input[name='style_options[views_slideshow_cycle][advanced_options]']").length) {
$(":input[name='style_options[views_slideshow_cycle][advanced_options]']").parent().hide();
$(":input[name='style_options[views_slideshow_cycle][advanced_options_entry]']").parent().after(
'<div style="margin-left: 10px; padding: 10px 0;">' +
'<a id="edit-style-options-views-slideshow-cycle-advanced-options-update-link" href="#">' + Drupal.t('Update Advanced Option') + '</a>' +
'</div>'
);
$("#edit-style-options-views-slideshow-cycle-advanced-options-table").append('<tr><th colspan="2">' + Drupal.t('Applied Options') + '</th><tr>')
var initialValue = $(":input[name='style_options[views_slideshow_cycle][advanced_options]']").val();
var advancedOptions = JSON.parse(initialValue);
for (var option in advancedOptions) {
viewsSlideshowCycleAdvancedOptionsAddRow(option);
}
// Add the remove event to the advanced items.
viewsSlideshowCycleAdvancedOptionsRemoveEvent();
$(":input[name='style_options[views_slideshow_cycle][advanced_options_choices]']").change(function() {
var selectedValue = $(":input[name='style_options[views_slideshow_cycle][advanced_options_choices]'] option:selected").val();
if (typeof advancedOptions[selectedValue] !== 'undefined') {
$(":input[name='style_options[views_slideshow_cycle][advanced_options_entry]']").val(advancedOptions[selectedValue]);
}
else {
$(":input[name='style_options[views_slideshow_cycle][advanced_options_entry]']").val('');
}
});
$('#edit-style-options-views-slideshow-cycle-advanced-options-update-link').click(function() {
var option = $(":input[name='style_options[views_slideshow_cycle][advanced_options_choices]']").val();
if (option) {
var value = $(":input[name='style_options[views_slideshow_cycle][advanced_options_entry]']").val();
if (typeof advancedOptions[option] == 'undefined') {
viewsSlideshowCycleAdvancedOptionsAddRow(option);
viewsSlideshowCycleAdvancedOptionsRemoveEvent()
}
advancedOptions[option] = value;
viewsSlideshowCycleAdvancedOptionsSave();
}
return false;
});
}
function viewsSlideshowCycleAdvancedOptionsAddRow(option) {
$("#edit-style-options-views-slideshow-cycle-advanced-options-table").append(
'<tr id="views-slideshow-cycle-advanced-options-table-row-' + option + '">' +
'<td>' + option + '</td>' +
'<td style="width: 20px;">' +
'<a style="margin-top: 6px" title="Remove ' + option + '" alt="Remove ' + option + '" class="views-hidden views-button-remove views-slideshow-cycle-advanced-options-table-remove" id="views-slideshow-cycle-advanced-options-table-remove-' + option + '" href="#"><span>Remove</span></a>' +
'</td>' +
'</tr>'
);
}
function viewsSlideshowCycleAdvancedOptionsRemoveEvent() {
$('.views-slideshow-cycle-advanced-options-table-remove').unbind().click(function() {
var itemID = $(this).attr('id');
var uniqueID = itemID.replace('views-slideshow-cycle-advanced-options-table-remove-', '');
delete advancedOptions[uniqueID];
$('#views-slideshow-cycle-advanced-options-table-row-' + uniqueID).remove();
viewsSlideshowCycleAdvancedOptionsSave();
return false;
});
}
function viewsSlideshowCycleAdvancedOptionsSave() {
var advancedOptionsString = JSON.stringify(advancedOptions);
$(":input[name='style_options[views_slideshow_cycle][advanced_options]']").val(advancedOptionsString);
}
}
}
})(jQuery);
| JavaScript |
/**
* @file
* A simple jQuery Cycle Div Slideshow Rotator.
*/
/**
* This will set our initial behavior, by starting up each individual slideshow.
*/
(function ($) {
Drupal.behaviors.viewsSlideshowCycle = {
attach: function (context) {
$('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function() {
var fullId = '#' + $(this).attr('id');
var settings = Drupal.settings.viewsSlideshowCycle[fullId];
settings.targetId = '#' + $(fullId + " :first").attr('id');
settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', '');
settings.loaded = false;
settings.opts = {
speed:settings.speed,
timeout:settings.timeout,
delay:settings.delay,
sync:settings.sync,
random:settings.random,
nowrap:settings.nowrap,
after:function(curr, next, opts) {
// Need to do some special handling on first load.
var slideNum = opts.currSlide;
if (typeof settings.processedAfter == 'undefined' || !settings.processedAfter) {
settings.processedAfter = 1;
slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide;
}
Drupal.viewsSlideshow.action({ "action": 'transitionEnd', "slideshowID": settings.slideshowId, "slideNum": slideNum });
},
before:function(curr, next, opts) {
// Remember last slide.
if (settings.remember_slide) {
createCookie(settings.vss_id, opts.currSlide + 1, settings.remember_slide_days);
}
// Make variable height.
if (!settings.fixed_height) {
//get the height of the current slide
var $ht = $(this).height();
//set the container's height to that of the current slide
$(this).parent().animate({height: $ht});
}
// Need to do some special handling on first load.
var slideNum = opts.nextSlide;
if (typeof settings.processedBefore == 'undefined' || !settings.processedBefore) {
settings.processedBefore = 1;
slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide;
}
Drupal.viewsSlideshow.action({ "action": 'transitionBegin', "slideshowID": settings.slideshowId, "slideNum": slideNum });
},
cleartype:(settings.cleartype)? true : false,
cleartypeNoBg:(settings.cleartypenobg)? true : false
}
// Set the starting slide if we are supposed to remember the slide
if (settings.remember_slide) {
var startSlide = readCookie(settings.vss_id);
if (startSlide == null) {
startSlide = 0;
}
settings.opts.startingSlide = startSlide;
}
if (settings.effect == 'none') {
settings.opts.speed = 1;
}
else {
settings.opts.fx = settings.effect;
}
// Take starting item from fragment.
var hash = location.hash;
if (hash) {
var hash = hash.replace('#', '');
var aHash = hash.split(';');
var aHashLen = aHash.length;
// Loop through all the possible starting points.
for (var i = 0; i < aHashLen; i++) {
// Split the hash into two parts. One part is the slideshow id the
// other is the slide number.
var initialInfo = aHash[i].split(':');
// The id in the hash should match our slideshow.
// The slide number chosen shouldn't be larger than the number of
// slides we have.
if (settings.slideshowId == initialInfo[0] && settings.num_divs > initialInfo[1]) {
settings.opts.startingSlide = parseInt(initialInfo[1]);
}
}
}
// Pause on hover.
if (settings.pause) {
var mouseIn = function() {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
}
var mouseOut = function() {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
}
if (jQuery.fn.hoverIntent) {
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut);
}
else {
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut);
}
}
// Pause on clicking of the slide.
if (settings.pause_on_click) {
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
});
}
if (typeof JSON != 'undefined') {
var advancedOptions = JSON.parse(settings.advanced_options);
for (var option in advancedOptions) {
switch(option) {
// Standard Options
case "activePagerClass":
case "allowPagerClickBubble":
case "autostop":
case "autostopCount":
case "backwards":
case "bounce":
case "cleartype":
case "cleartypeNoBg":
case "containerResize":
case "continuous":
case "delay":
case "easeIn":
case "easeOut":
case "easing":
case "fastOnEvent":
case "fit":
case "fx":
case "height":
case "manualTrump":
case "metaAttr":
case "next":
case "nowrap":
case "pager":
case "pagerEvent":
case "pause":
case "pauseOnPagerHover":
case "prev":
case "prevNextEvent":
case "random":
case "randomizeEffects":
case "requeueOnImageNotLoaded":
case "requeueTimeout":
case "rev":
case "slideExpr":
case "slideResize":
case "speed":
case "speedIn":
case "speedOut":
case "startingSlide":
case "sync":
case "timeout":
case "width":
var optionValue = advancedOptions[option];
optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
settings.opts[option] = optionValue;
break;
// These process options that look like {top:50, bottom:20}
case "animIn":
case "animOut":
case "cssBefore":
case "cssAfter":
case "shuffle":
var cssValue = advancedOptions[option];
cssValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(cssValue);
settings.opts[option] = eval('(' + cssValue + ')');
break;
// These options have their own functions.
case "after":
var afterValue = advancedOptions[option];
afterValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(afterValue);
// transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
eval(afterValue);
}
break;
case "before":
var beforeValue = advancedOptions[option];
beforeValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(beforeValue);
// transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
eval(beforeValue);
}
break;
case "end":
var endValue = advancedOptions[option];
endValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(endValue);
// callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
settings.opts[option] = function(options) {
eval(endValue);
}
break;
case "fxFn":
var fxFnValue = advancedOptions[option];
fxFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(fxFnValue);
// function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
settings.opts[option] = function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) {
eval(fxFnValue);
}
break;
case "onPagerEvent":
var onPagerEventValue = advancedOptions[option];
onPagerEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPagerEventValue);
settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
eval(onPagerEventValue);
}
break;
case "onPrevNextEvent":
var onPrevNextEventValue = advancedOptions[option];
onPrevNextEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPrevNextEventValue);
settings.opts[option] = function(isNext, zeroBasedSlideIndex, slideElement) {
eval(onPrevNextEventValue);
}
break;
case "pagerAnchorBuilder":
var pagerAnchorBuilderValue = advancedOptions[option];
pagerAnchorBuilderValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerAnchorBuilderValue);
// callback fn for building anchor links: function(index, DOMelement)
settings.opts[option] = function(index, DOMelement) {
var returnVal = '';
eval(pagerAnchorBuilderValue);
return returnVal;
}
break;
case "pagerClick":
var pagerClickValue = advancedOptions[option];
pagerClickValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerClickValue);
// callback fn for pager clicks: function(zeroBasedSlideIndex, slideElement)
settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
eval(pagerClickValue);
}
break;
case "paused":
var pausedValue = advancedOptions[option];
pausedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pausedValue);
// undocumented callback when slideshow is paused: function(cont, opts, byHover)
settings.opts[option] = function(cont, opts, byHover) {
eval(pausedValue);
}
break;
case "resumed":
var resumedValue = advancedOptions[option];
resumedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(resumedValue);
// undocumented callback when slideshow is resumed: function(cont, opts, byHover)
settings.opts[option] = function(cont, opts, byHover) {
eval(resumedValue);
}
break;
case "timeoutFn":
var timeoutFnValue = advancedOptions[option];
timeoutFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(timeoutFnValue);
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
eval(timeoutFnValue);
}
break;
case "updateActivePagerLink":
var updateActivePagerLinkValue = advancedOptions[option];
updateActivePagerLinkValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(updateActivePagerLinkValue);
// callback fn invoked to update the active pager link (adds/removes activePagerClass style)
settings.opts[option] = function(pager, currSlideIndex) {
eval(updateActivePagerLinkValue);
}
break;
}
}
}
// If selected wait for the images to be loaded.
// otherwise just load the slideshow.
if (settings.wait_for_image_load) {
// For IE/Chrome/Opera we if there are images then we need to make
// sure the images are loaded before starting the slideshow.
settings.totalImages = $(settings.targetId + ' img').length;
if (settings.totalImages) {
settings.loadedImages = 0;
// Add a load event for each image.
$(settings.targetId + ' img').each(function() {
var $imageElement = $(this);
$imageElement.bind('load', function () {
Drupal.viewsSlideshowCycle.imageWait(fullId);
});
// Removing the source and adding it again will fire the load event.
var imgSrc = $imageElement.attr('src');
$imageElement.attr('src', '');
$imageElement.attr('src', imgSrc);
});
// We need to set a timeout so that the slideshow doesn't wait
// indefinitely for all images to load.
setTimeout("Drupal.viewsSlideshowCycle.load('" + fullId + "')", settings.wait_for_image_load_timeout);
}
else {
Drupal.viewsSlideshowCycle.load(fullId);
}
}
else {
Drupal.viewsSlideshowCycle.load(fullId);
}
});
}
};
Drupal.viewsSlideshowCycle = Drupal.viewsSlideshowCycle || {};
// Cleanup the values of advanced options.
Drupal.viewsSlideshowCycle.advancedOptionCleanup = function(value) {
value = $.trim(value);
value = value.replace(/\n/g, '');
if (!isNaN(parseInt(value))) {
value = parseInt(value);
}
else if (value.toLowerCase() == 'true') {
value = true;
}
else if (value.toLowerCase() == 'false') {
value = false;
}
return value;
}
// This checks to see if all the images have been loaded.
// If they have then it starts the slideshow.
Drupal.viewsSlideshowCycle.imageWait = function(fullId) {
if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages) {
Drupal.viewsSlideshowCycle.load(fullId);
}
};
// Start the slideshow.
Drupal.viewsSlideshowCycle.load = function (fullId) {
var settings = Drupal.settings.viewsSlideshowCycle[fullId];
// Make sure the slideshow isn't already loaded.
if (!settings.loaded) {
$(settings.targetId).cycle(settings.opts);
settings.loaded = true;
// Start Paused
if (settings.start_paused) {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
}
// Pause if hidden.
if (settings.pause_when_hidden) {
var checkPause = function(settings) {
// If the slideshow is visible and it is paused then resume.
// otherwise if the slideshow is not visible and it is not paused then
// pause it.
var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible);
if (visible) {
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
}
else {
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
}
}
// Check when scrolled.
$(window).scroll(function() {
checkPause(settings);
});
// Check when the window is resized.
$(window).resize(function() {
checkPause(settings);
});
}
}
};
Drupal.viewsSlideshowCycle.pause = function (options) {
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('pause');
};
Drupal.viewsSlideshowCycle.play = function (options) {
Drupal.settings.viewsSlideshowCycle['#views_slideshow_cycle_main_' + options.slideshowID].paused = false;
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('resume');
};
Drupal.viewsSlideshowCycle.previousSlide = function (options) {
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('prev');
};
Drupal.viewsSlideshowCycle.nextSlide = function (options) {
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('next');
};
Drupal.viewsSlideshowCycle.goToSlide = function (options) {
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle(options.slideNum);
};
// Verify that the value is a number.
function IsNumeric(sText) {
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (var i=0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
/**
* Cookie Handling Functions
*/
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else {
var expires = "";
}
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
/**
* Checks to see if the slide is visible enough.
* elem = element to check.
* type = The way to calculate how much is visible.
* amountVisible = amount that should be visible. Either in percent or px. If
* it's not defined then all of the slide must be visible.
*
* Returns true or false
*/
function viewsSlideshowCycleIsVisible(elem, type, amountVisible) {
// Get the top and bottom of the window;
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var docViewLeft = $(window).scrollLeft();
var docViewRight = docViewLeft + $(window).width();
// Get the top, bottom, and height of the slide;
var elemTop = $(elem).offset().top;
var elemHeight = $(elem).height();
var elemBottom = elemTop + elemHeight;
var elemLeft = $(elem).offset().left;
var elemWidth = $(elem).width();
var elemRight = elemLeft + elemWidth;
var elemArea = elemHeight * elemWidth;
// Calculate what's hiding in the slide.
var missingLeft = 0;
var missingRight = 0;
var missingTop = 0;
var missingBottom = 0;
// Find out how much of the slide is missing from the left.
if (elemLeft < docViewLeft) {
missingLeft = docViewLeft - elemLeft;
}
// Find out how much of the slide is missing from the right.
if (elemRight > docViewRight) {
missingRight = elemRight - docViewRight;
}
// Find out how much of the slide is missing from the top.
if (elemTop < docViewTop) {
missingTop = docViewTop - elemTop;
}
// Find out how much of the slide is missing from the bottom.
if (elemBottom > docViewBottom) {
missingBottom = elemBottom - docViewBottom;
}
// If there is no amountVisible defined then check to see if the whole slide
// is visible.
if (type == 'full') {
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
&& (elemBottom <= docViewBottom) && (elemTop >= docViewTop)
&& (elemLeft >= docViewLeft) && (elemRight <= docViewRight)
&& (elemLeft <= docViewRight) && (elemRight >= docViewLeft));
}
else if(type == 'vertical') {
var verticalShowing = elemHeight - missingTop - missingBottom;
// If user specified a percentage then find out if the current shown percent
// is larger than the allowed percent.
// Otherwise check to see if the amount of px shown is larger than the
// allotted amount.
if (amountVisible.indexOf('%')) {
return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible));
}
else {
return (verticalShowing >= parseInt(amountVisible));
}
}
else if(type == 'horizontal') {
var horizontalShowing = elemWidth - missingLeft - missingRight;
// If user specified a percentage then find out if the current shown percent
// is larger than the allowed percent.
// Otherwise check to see if the amount of px shown is larger than the
// allotted amount.
if (amountVisible.indexOf('%')) {
return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible));
}
else {
return (horizontalShowing >= parseInt(amountVisible));
}
}
else if(type == 'area') {
var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom);
// If user specified a percentage then find out if the current shown percent
// is larger than the allowed percent.
// Otherwise check to see if the amount of px shown is larger than the
// allotted amount.
if (amountVisible.indexOf('%')) {
return (((areaShowing/elemArea)*100) >= parseInt(amountVisible));
}
else {
return (areaShowing >= parseInt(amountVisible));
}
}
}
})(jQuery);
| JavaScript |
//This pack implemets: keyboard shortcuts, file sorting, resize bars, and inline thumbnail preview.
(function($) {
// add scale calculator for resizing.
imce.hooks.load.push(function () {
$('#edit-width, #edit-height').focus(function () {
var fid, r, w, isW, val;
if (fid = imce.vars.prvfid) {
isW = this.id == 'edit-width', val = imce.el(isW ? 'edit-height' : 'edit-width').value*1;
if (val && (w = imce.isImage(fid)) && (r = imce.fids[fid].cells[3].innerHTML*1 / w))
this.value = Math.round(isW ? val/r : val*r);
}
});
});
// Shortcuts
var F = null;
imce.initiateShortcuts = function () {
$(imce.NW).attr('tabindex', '0').keydown(function (e) {
if (F = imce.dirKeys['k'+ e.keyCode]) return F(e);
});
$(imce.FLW).attr('tabindex', '0').keydown(function (e) {
if (F = imce.fileKeys['k'+ e.keyCode]) return F(e);
}).focus();
};
//shortcut key-function pairs for directories
imce.dirKeys = {
k35: function (e) {//end-home. select first or last dir
var L = imce.tree['.'].li;
if (e.keyCode == 35) while (imce.hasC(L, 'expanded')) L = L.lastChild.lastChild;
$(L.childNodes[1]).click().focus();
},
k37: function (e) {//left-right. collapse-expand directories.(right may also move focus on files)
var L, B = imce.tree[imce.conf.dir], right = e.keyCode == 39;
if (B.ul && (right ^ imce.hasC(L = B.li, 'expanded')) ) $(L.firstChild).click();
else if (right) $(imce.FLW).focus();
},
k38: function (e) {//up. select the previous directory
var B = imce.tree[imce.conf.dir];
if (L = B.li.previousSibling) {
while (imce.hasC(L, 'expanded')) L = L.lastChild.lastChild;
$(L.childNodes[1]).click().focus();
}
else if ((L = B.li.parentNode.parentNode) && L.tagName == 'LI') $(L.childNodes[1]).click().focus();
},
k40: function (e) {//down. select the next directory
var B = imce.tree[imce.conf.dir], L = B.li, U = B.ul;
if (U && imce.hasC(L, 'expanded')) $(U.firstChild.childNodes[1]).click().focus();
else do {if (L.nextSibling) return $(L.nextSibling.childNodes[1]).click().focus();
}while ((L = L.parentNode.parentNode).tagName == 'LI');
}
};
//add equal keys
imce.dirKeys.k36 = imce.dirKeys.k35;
imce.dirKeys.k39 = imce.dirKeys.k37;
//shortcut key-function pairs for files
imce.fileKeys = {
k38: function (e) {//up-down. select previous-next row
var fid = imce.lastFid(), i = fid ? imce.fids[fid].rowIndex+e.keyCode-39 : 0;
imce.fileClick(imce.findex[i], e.ctrlKey, e.shiftKey);
},
k35: function (e) {//end-home. select first or last row
imce.fileClick(imce.findex[e.keyCode == 35 ? imce.findex.length-1 : 0], e.ctrlKey, e.shiftKey);
},
k13: function (e) {//enter-insert. send file to external app.
imce.send(imce.vars.prvfid);
return false;
},
k37: function (e) {//left. focus on directories
$(imce.tree[imce.conf.dir].a).focus();
},
k65: function (e) {//ctrl+A to select all
if (e.ctrlKey && imce.findex.length) {
var fid = imce.findex[0].id;
imce.selected[fid] ? (imce.vars.lastfid = fid) : imce.fileClick(fid);//select first row
imce.fileClick(imce.findex[imce.findex.length-1], false, true);//shift+click last row
return false;
}
}
};
//add equal keys
imce.fileKeys.k40 = imce.fileKeys.k38;
imce.fileKeys.k36 = imce.fileKeys.k35;
imce.fileKeys.k45 = imce.fileKeys.k13;
//add default operation keys. delete, R(esize), T(humbnails), U(pload)
$.each({k46: 'delete', k82: 'resize', k84: 'thumb', k85: 'upload'}, function (k, op) {
imce.fileKeys[k] = function (e) {
if (imce.ops[op] && !imce.ops[op].disabled) imce.opClick(op);
};
});
//prepare column sorting
imce.initiateSorting = function() {
//add cache hook. cache the old directory's sort settings before the new one replaces it.
imce.hooks.cache.push(function (cache, newdir) {
cache.cid = imce.vars.cid, cache.dsc = imce.vars.dsc;
});
//add navigation hook. refresh sorting after the new directory content is loaded.
imce.hooks.navigate.push(function (data, olddir, cached) {
cached ? imce.updateSortState(data.cid, data.dsc) : imce.firstSort();
});
imce.vars.cid = imce.cookie('imcecid') * 1;
imce.vars.dsc = imce.cookie('imcedsc') * 1;
imce.cols = imce.el('file-header').rows[0].cells;
$(imce.cols).click(function () {imce.columnSort(this.cellIndex, imce.hasC(this, 'asc'));});
imce.firstSort();
};
//sort the list for the first time
imce.firstSort = function() {
imce.columnSort(imce.vars.cid, imce.vars.dsc);
};
//sort file list according to column index.
imce.columnSort = function(cid, dsc) {
if (imce.findex.length < 2) return;
var func = 'sort'+ (cid == 0 ? 'Str' : 'Num') + (dsc ? 'Dsc' : 'Asc');
var prop = cid == 2 || cid == 3 ? 'innerHTML' : 'id';
//sort rows
imce.findex.sort(cid ? function(r1, r2) {return imce[func](r1.cells[cid][prop], r2.cells[cid][prop])} : function(r1, r2) {return imce[func](r1.id, r2.id)});
//insert sorted rows
for (var row, i=0; row = imce.findex[i]; i++) {
imce.tbody.appendChild(row);
}
imce.updateSortState(cid, dsc);
};
//update column states
imce.updateSortState = function(cid, dsc) {
$(imce.cols[imce.vars.cid]).removeClass(imce.vars.dsc ? 'desc' : 'asc');
$(imce.cols[cid]).addClass(dsc ? 'desc' : 'asc');
imce.vars.cid != cid && imce.cookie('imcecid', imce.vars.cid = cid);
imce.vars.dsc != dsc && imce.cookie('imcedsc', (imce.vars.dsc = dsc) ? 1 : 0);
};
//sorters
imce.sortStrAsc = function(a, b) {return a.toLowerCase() < b.toLowerCase() ? -1 : 1;};
imce.sortStrDsc = function(a, b) {return imce.sortStrAsc(b, a);};
imce.sortNumAsc = function(a, b) {return a-b;};
imce.sortNumDsc = function(a, b) {return b-a};
//set resizers for resizable areas and recall previous dimensions
imce.initiateResizeBars = function () {
imce.setResizer('#navigation-resizer', 'X', imce.NW, null, 1, function(p1, p2, m) {
p1 != p2 && imce.cookie('imcenww', p2);
});
imce.setResizer('#browse-resizer', 'Y', imce.BW, imce.PW, 50, function(p1, p2, m) {
p1 != p2 && imce.cookie('imcebwh', p2);
});
imce.recallDimensions();
};
//set a resize bar
imce.setResizer = function (resizer, axis, area1, area2, Min, callback) {
var opt = axis == 'X' ? {pos: 'pageX', func: 'width'} : {pos: 'pageY', func: 'height'};
var Min = Min || 0;
var $area1 = $(area1), $area2 = area2 ? $(area2) : null, $doc = $(document);
$(resizer).mousedown(function(e) {
var pos = e[opt.pos];
var end = start = $area1[opt.func]();
var Max = $area2 ? start + $area2[opt.func]() : 1200;
var drag = function(e) {
end = Math.min(Max - Min, Math.max(start + e[opt.pos] - pos, Min));
$area1[opt.func](end);
$area2 && $area2[opt.func](Max - end);
return false;
};
var undrag = function(e) {
$doc.unbind('mousemove', drag).unbind('mouseup', undrag);
callback && callback(start, end, Max);
};
$doc.mousemove(drag).mouseup(undrag);
return false;
});
};
//get&set area dimensions of the last session from the cookie
imce.recallDimensions = function() {
var $body = $(document.body);
if (!$body.is('.imce')) return;
//row heights
imce.recallHeights(imce.cookie('imcebwh') * 1);
$(window).resize(function(){imce.recallHeights()});
//navigation wrapper
var nwOldWidth = imce.cookie('imcenww') * 1;
nwOldWidth && $(imce.NW).width(Math.min(nwOldWidth, $body.width() - 10));
};
//set row heights with respect to window height
imce.recallHeights = function(bwFixedHeight) {
//window & body dimensions
var winHeight = $.browser.opera ? window.innerHeight : $(window).height();
var bodyHeight = $(document.body).outerHeight(true);
var diff = winHeight - bodyHeight;
var bwHeight = $(imce.BW).height(), pwHeight = $(imce.PW).height();
if (bwFixedHeight) {
//row heights
diff -= bwFixedHeight - bwHeight;
bwHeight = bwFixedHeight;
pwHeight += diff;
}
else {
diff = parseInt(diff/2);
bwHeight += diff;
pwHeight += diff;
}
$(imce.BW).height(bwHeight);
$(imce.PW).height(pwHeight);
};
//cookie get & set
imce.cookie = function (name, value) {
if (typeof(value) == 'undefined') {//get
return unescape((document.cookie.match(new RegExp('(^|;) *'+ name +'=([^;]*)(;|$)')) || ['', '', ''])[2]);
}
document.cookie = name +'='+ escape(value) +'; expires='+ (new Date(new Date() * 1 + 15 * 86400000)).toGMTString() +'; path=' + Drupal.settings.basePath + 'imce';//set
};
//view thumbnails(smaller than tMaxW x tMaxH) inside the rows.
//Large images can also be previewed by setting imce.vars.prvstyle to a valid image style(imagecache preset)
imce.thumbRow = function (row) {
var w = row.cells[2].innerHTML * 1;
if (!w) return;
var h = row.cells[3].innerHTML * 1;
if (imce.vars.tMaxW < w || imce.vars.tMaxH < h) {
if (!imce.vars.prvstyle || imce.conf.dir.indexOf('styles') == 0) return;
var img = new Image();
img.src = imce.imagestyleURL(imce.getURL(row.id), imce.vars.prvstyle);
img.className = 'imagestyle-' + imce.vars.prvstyle;
}
else {
var prvH = h, prvW = w;
if (imce.vars.prvW < w || imce.vars.prvH < h) {
if (h < w) {
prvW = imce.vars.prvW;
prvH = prvW*h/w;
}
else {
prvH = imce.vars.prvH;
prvW = prvH*w/h;
}
}
var img = new Image(prvW, prvH);
img.src = imce.getURL(row.id);
}
var cell = row.cells[0];
cell.insertBefore(img, cell.firstChild);
};
//convert a file URL returned by imce.getURL() to an image style(imagecache preset) URL
imce.imagestyleURL = function (url, stylename) {
var len = imce.conf.furl.length - 1;
return url.substr(0, len) + '/styles/' + stylename + '/' + imce.conf.scheme + url.substr(len);
};
// replace table view with box view for file list
imce.boxView = function () {
var w = imce.vars.boxW, h = imce.vars.boxH;
if (!w || !h || $.browser.msie && parseFloat($.browser.version) < 8) return;
var $body = $(document.body);
var toggle = function() {
$body.toggleClass('box-view');
// refresh dom. required by all except FF.
!$.browser.mozilla && $('#file-list').appendTo(imce.FW).appendTo(imce.FLW);
};
$body.append('<style type="text/css">.box-view #file-list td.name {width: ' + w + 'px;height: ' + h + 'px;} .box-view #file-list td.name span {width: ' + w + 'px;word-wrap: normal;text-overflow: ellipsis;}</style>');
imce.hooks.load.push(function() {
toggle();
imce.SBW.scrollTop = 0;
imce.opAdd({name: 'changeview', title: Drupal.t('Change view'), func: toggle});
});
imce.hooks.list.push(imce.boxViewRow);
};
// process a row for box view. include all data in box title.
imce.boxViewRow = function (row) {
var s = ' | ', w = row.cells[2].innerHTML * 1, dim = w ? s + w + 'x' + row.cells[3].innerHTML * 1 : '';
row.cells[0].title = imce.decode(row.id) + s + row.cells[1].innerHTML + (dim) + s + row.cells[4].innerHTML;
};
})(jQuery); | JavaScript |
/*
* IMCE Integration by URL
* Ex-1: http://example.com/imce?app=XEditor|url@urlFieldId|width@widthFieldId|height@heightFieldId
* Creates "Insert file" operation tab, which fills the specified fields with url, width, height properties
* of the selected file in the parent window
* Ex-2: http://example.com/imce?app=XEditor|sendto@functionName
* "Insert file" operation calls parent window's functionName(file, imceWindow)
* Ex-3: http://example.com/imce?app=XEditor|imceload@functionName
* Parent window's functionName(imceWindow) is called as soon as IMCE UI is ready. Send to operation
* needs to be set manually. See imce.setSendTo() method in imce.js
*/
(function($) {
var appFields = {}, appWindow = (top.appiFrm||window).opener || parent;
// Execute when imce loads.
imce.hooks.load.push(function(win) {
var index = location.href.lastIndexOf('app=');
if (index == -1) return;
var data = decodeURIComponent(location.href.substr(index + 4)).split('|');
var arr, prop, str, func, appName = data.shift();
// Extract fields
for (var i = 0, len = data.length; i < len; i++) {
str = data[i];
if (!str.length) continue;
if (str.indexOf('&') != -1) str = str.split('&')[0];
arr = str.split('@');
if (arr.length > 1) {
prop = arr.shift();
appFields[prop] = arr.join('@');
}
}
// Run custom onload function if available
if (appFields.imceload && (func = isFunc(appFields.imceload))) {
func(win);
delete appFields.imceload;
}
// Set custom sendto function. appFinish is the default.
var sendtoFunc = appFields.url ? appFinish : false;
//check sendto@funcName syntax in URL
if (appFields.sendto && (func = isFunc(appFields.sendto))) {
sendtoFunc = func;
delete appFields.sendto;
}
// Check old method windowname+ImceFinish.
else if (win.name && (func = isFunc(win.name +'ImceFinish'))) {
sendtoFunc = func;
}
// Highlight file
if (appFields.url) {
// Support multiple url fields url@field1,field2..
if (appFields.url.indexOf(',') > -1) {
var arr = appFields.url.split(',');
for (var i in arr) {
if ($('#'+ arr[i], appWindow.document).size()) {
appFields.url = arr[i];
break;
}
}
}
var filename = $('#'+ appFields.url, appWindow.document).val() || '';
imce.highlight(filename.substr(filename.lastIndexOf('/')+1));
}
// Set send to
sendtoFunc && imce.setSendTo(Drupal.t('Insert file'), sendtoFunc);
});
// Default sendTo function
var appFinish = function(file, win) {
var $doc = $(appWindow.document);
for (var i in appFields) {
$doc.find('#'+ appFields[i]).val(file[i]);
}
if (appFields.url) {
try{
$doc.find('#'+ appFields.url).blur().change().focus();
}catch(e){
try{
$doc.find('#'+ appFields.url).trigger('onblur').trigger('onchange').trigger('onfocus');//inline events for IE
}catch(e){}
}
}
appWindow.focus();
win.close();
};
// Checks if a string is a function name in the given scope.
// Returns function reference. Supports x.y.z notation.
var isFunc = function(str, scope) {
var obj = scope || appWindow;
var parts = str.split('.'), len = parts.length;
for (var i = 0; i < len && (obj = obj[parts[i]]); i++);
return obj && i == len && (typeof obj == 'function' || typeof obj != 'string' && !obj.nodeName && obj.constructor != Array && /^[\s[]?function/.test(obj.toString())) ? obj : false;
}
})(jQuery); | JavaScript |
(function($) {
var ii = window.imceInline = {};
// Drupal behavior
Drupal.behaviors.imceInline = {attach: function(context, settings) {
$('div.imce-inline-wrapper', context).not('.processed').addClass('processed').show().find('a').click(function() {
var i = this.name.indexOf('-IMCE-');
ii.activeTextarea = $('#'+ this.name.substr(0, i)).get(0);
ii.activeType = this.name.substr(i+6);
if (typeof ii.pop == 'undefined' || ii.pop.closed) {
ii.pop = window.open(this.href + (this.href.indexOf('?') < 0 ? '?' : '&') +'app=nomatter|imceload@imceInline.load', '', 'width='+ 760 +',height='+ 560 +',resizable=1');
}
ii.pop.focus();
return false;
});
}};
//function to be executed when imce loads.
ii.load = function(win) {
win.imce.setSendTo(Drupal.t('Insert file'), ii.insert);
$(window).unload(function() {
if (ii.pop && !ii.pop.closed) ii.pop.close();
});
};
//insert html at cursor position
ii.insertAtCursor = function (field, txt, type) {
field.focus();
if ('undefined' != typeof(field.selectionStart)) {
if (type == 'link' && (field.selectionEnd-field.selectionStart)) {
txt = txt.split('">')[0] +'">'+ field.value.substring(field.selectionStart, field.selectionEnd) +'</a>';
}
field.value = field.value.substring(0, field.selectionStart) + txt + field.value.substring(field.selectionEnd, field.value.length);
}
else if (document.selection) {
if (type == 'link' && document.selection.createRange().text.length) {
txt = txt.split('">')[0] +'">'+ document.selection.createRange().text +'</a>';
}
document.selection.createRange().text = txt;
}
else {
field.value += txt;
}
};
//sendTo function
ii.insert = function (file, win) {
var type = ii.activeType == 'link' ? 'link' : (file.width ? 'image' : 'link');
var html = type == 'image' ? ('<img src="'+ file.url +'" width="'+ file.width +'" height="'+ file.height +'" alt="'+ file.name +'" />') : ('<a href="'+ file.url +'">'+ file.name +' ('+ file.size +')</a>');
ii.activeType = null;
win.blur();
ii.insertAtCursor(ii.activeTextarea, html, type);
};
})(jQuery); | JavaScript |
(function($) {
//Global container.
window.imce = {tree: {}, findex: [], fids: {}, selected: {}, selcount: 0, ops: {}, cache: {}, urlId: {},
vars: {previewImages: 1, cache: 1},
hooks: {load: [], list: [], navigate: [], cache: []},
//initiate imce.
initiate: function() {
imce.conf = Drupal.settings.imce || {};
if (imce.conf.error != false) return;
imce.FLW = imce.el('file-list-wrapper'), imce.SBW = imce.el('sub-browse-wrapper');
imce.NW = imce.el('navigation-wrapper'), imce.BW = imce.el('browse-wrapper');
imce.PW = imce.el('preview-wrapper'), imce.FW = imce.el('forms-wrapper');
imce.updateUI();
imce.prepareMsgs();//process initial status messages
imce.initiateTree();//build directory tree
imce.hooks.list.unshift(imce.processRow);//set the default list-hook.
imce.initiateList();//process file list
imce.initiateOps();//prepare operation tabs
imce.refreshOps();
imce.invoke('load', window);//run functions set by external applications.
},
//process navigation tree
initiateTree: function() {
$('#navigation-tree li').each(function(i) {
var a = this.firstChild, txt = a.firstChild;
txt && (txt.data = imce.decode(txt.data));
var branch = imce.tree[a.title] = {'a': a, li: this, ul: this.lastChild.tagName == 'UL' ? this.lastChild : null};
if (a.href) imce.dirClickable(branch);
imce.dirCollapsible(branch);
});
},
//Add a dir to the tree under parent
dirAdd: function(dir, parent, clickable) {
if (imce.tree[dir]) return clickable ? imce.dirClickable(imce.tree[dir]) : imce.tree[dir];
var parent = parent || imce.tree['.'];
parent.ul = parent.ul ? parent.ul : parent.li.appendChild(imce.newEl('ul'));
var branch = imce.dirCreate(dir, imce.decode(dir.substr(dir.lastIndexOf('/')+1)), clickable);
parent.ul.appendChild(branch.li);
return branch;
},
//create list item for navigation tree
dirCreate: function(dir, text, clickable) {
if (imce.tree[dir]) return imce.tree[dir];
var branch = imce.tree[dir] = {li: imce.newEl('li'), a: imce.newEl('a')};
$(branch.a).addClass('folder').text(text).attr('title', dir).appendTo(branch.li);
imce.dirCollapsible(branch);
return clickable ? imce.dirClickable(branch) : branch;
},
//change currently active directory
dirActivate: function(dir) {
if (dir != imce.conf.dir) {
if (imce.tree[imce.conf.dir]){
$(imce.tree[imce.conf.dir].a).removeClass('active');
}
$(imce.tree[dir].a).addClass('active');
imce.conf.dir = dir;
}
return imce.tree[imce.conf.dir];
},
//make a dir accessible
dirClickable: function(branch) {
if (branch.clkbl) return branch;
$(branch.a).attr('href', '#').removeClass('disabled').click(function() {imce.navigate(this.title); return false;});
branch.clkbl = true;
return branch;
},
//sub-directories expand-collapse ability
dirCollapsible: function (branch) {
if (branch.clpsbl) return branch;
$(imce.newEl('span')).addClass('expander').html(' ').click(function() {
if (branch.ul) {
$(branch.ul).toggle();
$(branch.li).toggleClass('expanded');
$.browser.msie && $('#navigation-header').css('top', imce.NW.scrollTop);
}
else if (branch.clkbl){
$(branch.a).click();
}
}).prependTo(branch.li);
branch.clpsbl = true;
return branch;
},
//update navigation tree after getting subdirectories.
dirSubdirs: function(dir, subdirs) {
var branch = imce.tree[dir];
if (subdirs && subdirs.length) {
var prefix = dir == '.' ? '' : dir +'/';
for (var i in subdirs) {//add subdirectories
imce.dirAdd(prefix + subdirs[i], branch, true);
}
$(branch.li).removeClass('leaf').addClass('expanded');
$(branch.ul).show();
}
else if (!branch.ul){//no subdirs->leaf
$(branch.li).removeClass('expanded').addClass('leaf');
}
},
//process file list
initiateList: function(cached) {
var L = imce.hooks.list, dir = imce.conf.dir, token = {'%dir': dir == '.' ? $(imce.tree['.'].a).text() : imce.decode(dir)}
imce.findex = [], imce.fids = {}, imce.selected = {}, imce.selcount = 0, imce.vars.lastfid = null;
imce.tbody = imce.el('file-list').tBodies[0];
if (imce.tbody.rows.length) {
for (var row, i = 0; row = imce.tbody.rows[i]; i++) {
var fid = row.id;
imce.findex[i] = imce.fids[fid] = row;
if (cached) {
if (imce.hasC(row, 'selected')) {
imce.selected[imce.vars.lastfid = fid] = row;
imce.selcount++;
}
}
else {
for (var func, j = 0; func = L[j]; j++) func(row);//invoke list-hook
}
}
}
if (!imce.conf.perm.browse) {
imce.setMessage(Drupal.t('File browsing is disabled in directory %dir.', token), 'error');
}
},
//add a file to the list. (having properties name,size,formatted size,width,height,date,formatted date)
fileAdd: function(file) {
var row, fid = file.name, i = imce.findex.length, attr = ['name', 'size', 'width', 'height', 'date'];
if (!(row = imce.fids[fid])) {
row = imce.findex[i] = imce.fids[fid] = imce.tbody.insertRow(i);
for (var i in attr) row.insertCell(i).className = attr[i];
}
row.cells[0].innerHTML = row.id = fid;
row.cells[1].innerHTML = file.fsize; row.cells[1].id = file.size;
row.cells[2].innerHTML = file.width;
row.cells[3].innerHTML = file.height;
row.cells[4].innerHTML = file.fdate; row.cells[4].id = file.date;
imce.invoke('list', row);
if (imce.vars.prvfid == fid) imce.setPreview(fid);
if (file.id) imce.urlId[imce.getURL(fid)] = file.id;
},
//remove a file from the list
fileRemove: function(fid) {
if (!(row = imce.fids[fid])) return;
imce.fileDeSelect(fid);
imce.findex.splice(row.rowIndex, 1);
$(row).remove();
delete imce.fids[fid];
if (imce.vars.prvfid == fid) imce.setPreview();
},
//return a file object containing all properties.
fileGet: function (fid) {
var row = imce.fids[fid];
var url = imce.getURL(fid);
return row ? {
name: imce.decode(fid),
url: url,
size: row.cells[1].innerHTML,
bytes: row.cells[1].id * 1,
width: row.cells[2].innerHTML * 1,
height: row.cells[3].innerHTML * 1,
date: row.cells[4].innerHTML,
time: row.cells[4].id * 1,
id: imce.urlId[url] || 0, //file id for newly uploaded files
relpath: (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid //rawurlencoded path relative to file directory path.
} : null;
},
//simulate row click. selection-highlighting
fileClick: function(row, ctrl, shft) {
if (!row) return;
var fid = typeof(row) == 'string' ? row : row.id;
if (ctrl || fid == imce.vars.prvfid) {
imce.fileToggleSelect(fid);
}
else if (shft) {
var last = imce.lastFid();
var start = last ? imce.fids[last].rowIndex : -1;
var end = imce.fids[fid].rowIndex;
var step = start > end ? -1 : 1;
while (start != end) {
start += step;
imce.fileSelect(imce.findex[start].id);
}
}
else {
for (var fname in imce.selected) {
imce.fileDeSelect(fname);
}
imce.fileSelect(fid);
}
//set preview
imce.setPreview(imce.selcount == 1 ? imce.lastFid() : null);
},
//file select/deselect functions
fileSelect: function (fid) {
if (imce.selected[fid] || !imce.fids[fid]) return;
imce.selected[fid] = imce.fids[imce.vars.lastfid=fid];
$(imce.selected[fid]).addClass('selected');
imce.selcount++;
},
fileDeSelect: function (fid) {
if (!imce.selected[fid] || !imce.fids[fid]) return;
if (imce.vars.lastfid == fid) imce.vars.lastfid = null;
$(imce.selected[fid]).removeClass('selected');
delete imce.selected[fid];
imce.selcount--;
},
fileToggleSelect: function (fid) {
imce['file'+ (imce.selected[fid] ? 'De' : '') +'Select'](fid);
},
//process file operation form and create operation tabs.
initiateOps: function() {
imce.setHtmlOps();
imce.setUploadOp();//upload
imce.setFileOps();//thumb, delete, resize
},
//process existing html ops.
setHtmlOps: function () {
$(imce.el('ops-list')).children('li').each(function() {
if (!this.firstChild) return $(this).remove();
var name = this.id.substr(8);
var Op = imce.ops[name] = {div: imce.el('op-content-'+ name), li: imce.el('op-item-'+ name)};
Op.a = Op.li.firstChild;
Op.title = Op.a.innerHTML;
$(Op.a).click(function() {imce.opClick(name); return false;});
});
},
//convert upload form to an op.
setUploadOp: function () {
var form = imce.el('imce-upload-form');
if (!form) return;
$(form).ajaxForm(imce.uploadSettings()).find('fieldset').each(function() {//clean up fieldsets
this.removeChild(this.firstChild);
$(this).after(this.childNodes);
}).remove();
imce.opAdd({name: 'upload', title: Drupal.t('Upload'), content: form});//add op
},
//convert fileop form submit buttons to ops.
setFileOps: function () {
var form = imce.el('imce-fileop-form');
if (!form) return;
$(form.elements.filenames).parent().remove();
$(form).find('fieldset').each(function() {//remove fieldsets
var $sbmt = $('input:submit', this);
if (!$sbmt.size()) return;
var Op = {name: $sbmt.attr('id').substr(5)};
var func = function() {imce.fopSubmit(Op.name); return false;};
$sbmt.click(func);
Op.title = $(this).children('legend').remove().text() || $sbmt.val();
Op.name == 'delete' ? (Op.func = func) : (Op.content = this.childNodes);
imce.opAdd(Op);
}).remove();
imce.vars.opform = $(form).serialize();//serialize remaining parts.
},
//refresh ops states. enable/disable
refreshOps: function() {
for (var p in imce.conf.perm) {
if (imce.conf.perm[p]) imce.opEnable(p);
else imce.opDisable(p);
}
},
//add a new file operation
opAdd: function (op) {
var oplist = imce.el('ops-list'), opcons = imce.el('op-contents');
var name = op.name || ('op-'+ $(oplist).children('li').size());
var title = op.title || 'Untitled';
var Op = imce.ops[name] = {title: title};
if (op.content) {
Op.div = imce.newEl('div');
$(Op.div).attr({id: 'op-content-'+ name, 'class': 'op-content'}).appendTo(opcons).append(op.content);
}
Op.a = imce.newEl('a');
Op.li = imce.newEl('li');
$(Op.a).attr({href: '#', name: name, title: title}).html('<span>' + title +'</span>').click(imce.opClickEvent);
$(Op.li).attr('id', 'op-item-'+ name).append(Op.a).appendTo(oplist);
Op.func = op.func || imce.opVoid;
return Op;
},
//click event for file operations
opClickEvent: function(e) {
imce.opClick(this.name);
return false;
},
//void operation function
opVoid: function() {},
//perform op click
opClick: function(name) {
var Op = imce.ops[name], oldop = imce.vars.op;
if (!Op || Op.disabled) {
return imce.setMessage(Drupal.t('You can not perform this operation.'), 'error');
}
if (Op.div) {
if (oldop) {
var toggle = oldop == name;
imce.opShrink(oldop, toggle ? 'fadeOut' : 'hide');
if (toggle) return false;
}
var left = Op.li.offsetLeft;
var $opcon = $('#op-contents').css({left: 0});
$(Op.div).fadeIn('normal', function() {
setTimeout(function() {
if (imce.vars.op) {
var $inputs = $('input', imce.ops[imce.vars.op].div);
$inputs.eq(0).focus();
//form inputs become invisible in IE. Solution is as stupid as the behavior.
$('html').is('.ie') && $inputs.addClass('dummyie').removeClass('dummyie');
}
});
});
var diff = left + $opcon.width() - $('#imce-content').width();
$opcon.css({left: diff > 0 ? left - diff - 1 : left});
$(Op.li).addClass('active');
$(imce.opCloseLink).fadeIn(300);
imce.vars.op = name;
}
Op.func(true);
return true;
},
//enable a file operation
opEnable: function(name) {
var Op = imce.ops[name];
if (Op && Op.disabled) {
Op.disabled = false;
$(Op.li).show();
}
},
//disable a file operation
opDisable: function(name) {
var Op = imce.ops[name];
if (Op && !Op.disabled) {
Op.div && imce.opShrink(name);
$(Op.li).hide();
Op.disabled = true;
}
},
//hide contents of a file operation
opShrink: function(name, effect) {
if (imce.vars.op != name) return;
var Op = imce.ops[name];
$(Op.div).stop(true, true)[effect || 'hide']();
$(Op.li).removeClass('active');
$(imce.opCloseLink).hide();
Op.func(false);
imce.vars.op = null;
},
//navigate to dir
navigate: function(dir) {
if (imce.vars.navbusy || (dir == imce.conf.dir && !confirm(Drupal.t('Do you want to refresh the current directory?')))) return;
var cache = imce.vars.cache && dir != imce.conf.dir;
var set = imce.navSet(dir, cache);
if (cache && imce.cache[dir]) {//load from the cache
set.success({data: imce.cache[dir]});
set.complete();
}
else $.ajax(set);//live load
},
//ajax navigation settings
navSet: function (dir, cache) {
$(imce.tree[dir].li).addClass('loading');
imce.vars.navbusy = dir;
return {url: imce.ajaxURL('navigate', dir),
type: 'GET',
dataType: 'json',
success: function(response) {
if (response.data && !response.data.error) {
if (cache) imce.navCache(imce.conf.dir, dir);//cache the current dir
imce.navUpdate(response.data, dir);
}
imce.processResponse(response);
},
complete: function () {
$(imce.tree[dir].li).removeClass('loading');
imce.vars.navbusy = null;
}
};
},
//update directory using the given data
navUpdate: function(data, dir) {
var cached = data == imce.cache[dir], olddir = imce.conf.dir;
if (cached) data.files.id = 'file-list';
$(imce.FLW).html(data.files);
imce.dirActivate(dir);
imce.dirSubdirs(dir, data.subdirectories);
$.extend(imce.conf.perm, data.perm);
imce.refreshOps();
imce.initiateList(cached);
imce.setPreview(imce.selcount == 1 ? imce.lastFid() : null);
imce.SBW.scrollTop = 0;
imce.invoke('navigate', data, olddir, cached);
},
//set cache
navCache: function (dir, newdir) {
var C = imce.cache[dir] = {'dir': dir, files: imce.el('file-list'), dirsize: imce.el('dir-size').innerHTML, perm: $.extend({}, imce.conf.perm)};
C.files.id = 'cached-list-'+ dir;
imce.FW.appendChild(C.files);
imce.invoke('cache', C, newdir);
},
//validate upload form
uploadValidate: function (data, form, options) {
var path = $('#edit-imce').val();
if (!path) return false;
if (imce.conf.extensions != '*') {
var ext = path.substr(path.lastIndexOf('.') + 1);
if ((' '+ imce.conf.extensions +' ').indexOf(' '+ ext.toLowerCase() +' ') == -1) {
return imce.setMessage(Drupal.t('Only files with the following extensions are allowed: %files-allowed.', {'%files-allowed': imce.conf.extensions}), 'error');
}
}
var sep = path.indexOf('/') == -1 ? '\\' : '/';
options.url = imce.ajaxURL('upload');//make url contain current dir.
imce.fopLoading('upload', true);
return true;
},
//settings for upload
uploadSettings: function () {
return {beforeSubmit: imce.uploadValidate, success: function (response) {imce.processResponse($.parseJSON(response));}, complete: function () {imce.fopLoading('upload', false);}, resetForm: true};
},
//validate default ops(delete, thumb, resize)
fopValidate: function(fop) {
if (!imce.validateSelCount(1, imce.conf.filenum)) return false;
switch (fop) {
case 'delete':
return confirm(Drupal.t('Delete selected files?'));
case 'thumb':
if (!$('input:checked', imce.ops['thumb'].div).size()) {
return imce.setMessage(Drupal.t('Please select a thumbnail.'), 'error');
}
return imce.validateImage();
case 'resize':
var w = imce.el('edit-width').value, h = imce.el('edit-height').value;
var maxDim = imce.conf.dimensions.split('x');
var maxW = maxDim[0]*1, maxH = maxW ? maxDim[1]*1 : 0;
if (!(/^[1-9][0-9]*$/).test(w) || !(/^[1-9][0-9]*$/).test(h) || (maxW && (maxW < w*1 || maxH < h*1))) {
return imce.setMessage(Drupal.t('Please specify dimensions within the allowed range that is from 1x1 to @dimensions.', {'@dimensions': maxW ? imce.conf.dimensions : Drupal.t('unlimited')}), 'error');
}
return imce.validateImage();
}
var func = fop +'OpValidate';
if (imce[func]) return imce[func](fop);
return true;
},
//submit wrapper for default ops
fopSubmit: function(fop) {
switch (fop) {
case 'thumb': case 'delete': case 'resize': return imce.commonSubmit(fop);
}
var func = fop +'OpSubmit';
if (imce[func]) return imce[func](fop);
},
//common submit function shared by default ops
commonSubmit: function(fop) {
if (!imce.fopValidate(fop)) return false;
imce.fopLoading(fop, true);
$.ajax(imce.fopSettings(fop));
},
//settings for default file operations
fopSettings: function (fop) {
return {url: imce.ajaxURL(fop), type: 'POST', dataType: 'json', success: imce.processResponse, complete: function (response) {imce.fopLoading(fop, false);}, data: imce.vars.opform +'&filenames='+ imce.serialNames() +'&jsop='+ fop + (imce.ops[fop].div ? '&'+ $('input, select, textarea', imce.ops[fop].div).serialize() : '')};
},
//toggle loading state
fopLoading: function(fop, state) {
var el = imce.el('edit-'+ fop), func = state ? 'addClass' : 'removeClass';
if (el) {
$(el)[func]('loading').attr('disabled', state);
}
else {
$(imce.ops[fop].li)[func]('loading');
imce.ops[fop].disabled = state;
}
},
//preview a file.
setPreview: function (fid) {
var row, html = '';
imce.vars.prvfid = fid;
if (fid && (row = imce.fids[fid])) {
var width = row.cells[2].innerHTML * 1;
html = imce.vars.previewImages && width ? imce.imgHtml(fid, width, row.cells[3].innerHTML) : imce.decodePlain(fid);
html = '<a href="#" onclick="imce.send(\''+ fid +'\'); return false;" title="'+ (imce.vars.prvtitle||'') +'">'+ html +'</a>';
}
imce.el('file-preview').innerHTML = html;
},
//default file send function. sends the file to the new window.
send: function (fid) {
fid && window.open(imce.getURL(fid));
},
//add an operation for an external application to which the files are send.
setSendTo: function (title, func) {
imce.send = function (fid) { fid && func(imce.fileGet(fid), window);};
var opFunc = function () {
if (imce.selcount != 1) return imce.setMessage(Drupal.t('Please select a file.'), 'error');
imce.send(imce.vars.prvfid);
};
imce.vars.prvtitle = title;
return imce.opAdd({name: 'sendto', title: title, func: opFunc});
},
//move initial page messages into log
prepareMsgs: function () {
var msgs;
if (msgs = imce.el('imce-messages')) {
$('>div', msgs).each(function (){
var type = this.className.split(' ')[1];
var li = $('>ul li', this);
if (li.size()) li.each(function () {imce.setMessage(this.innerHTML, type);});
else imce.setMessage(this.innerHTML, type);
});
$(msgs).remove();
}
},
//insert log message
setMessage: function (msg, type) {
var $box = $(imce.msgBox);
var logs = imce.el('log-messages') || $(imce.newEl('div')).appendTo('#help-box-content').before('<h4>'+ Drupal.t('Log messages') +':</h4>').attr('id', 'log-messages')[0];
var msg = '<div class="message '+ (type || 'status') +'">'+ msg +'</div>';
$box.queue(function() {
$box.css({opacity: 0, display: 'block'}).html(msg);
$box.dequeue();
});
var q = $box.queue().length, t = imce.vars.msgT || 1000;
q = q < 2 ? 1 : q < 3 ? 0.8 : q < 4 ? 0.7 : 0.4;//adjust speed with respect to queue length
$box.fadeTo(600 * q, 1).fadeTo(t * q, 1).fadeOut(400 * q);
$(logs).append(msg);
return false;
},
//invoke hooks
invoke: function (hook) {
var i, args, func, funcs;
if ((funcs = imce.hooks[hook]) && funcs.length) {
(args = $.makeArray(arguments)).shift();
for (i = 0; func = funcs[i]; i++) func.apply(this, args);
}
},
//process response
processResponse: function (response) {
if (response.data) imce.resData(response.data);
if (response.messages) imce.resMsgs(response.messages);
},
//process response data
resData: function (data) {
var i, added, removed;
if (added = data.added) {
var cnt = imce.findex.length;
for (i in added) {//add new files or update existing
imce.fileAdd(added[i]);
}
if (added.length == 1) {//if it is a single file operation
imce.highlight(added[0].name);//highlight
}
if (imce.findex.length != cnt) {//if new files added, scroll to bottom.
$(imce.SBW).animate({scrollTop: imce.SBW.scrollHeight}).focus();
}
}
if (removed = data.removed) for (i in removed) {
imce.fileRemove(removed[i]);
}
imce.conf.dirsize = data.dirsize;
imce.updateStat();
},
//set response messages
resMsgs: function (msgs) {
for (var type in msgs) for (var i in msgs[type]) {
imce.setMessage(msgs[type][i], type);
}
},
//return img markup
imgHtml: function (fid, width, height) {
return '<img src="'+ imce.getURL(fid) +'" width="'+ width +'" height="'+ height +'" alt="'+ imce.decodePlain(fid) +'">';
},
//check if the file is an image
isImage: function (fid) {
return imce.fids[fid].cells[2].innerHTML * 1;
},
//find the first non-image in the selection
getNonImage: function (selected) {
for (var fid in selected) {
if (!imce.isImage(fid)) return fid;
}
return false;
},
//validate current selection for images
validateImage: function () {
var nonImg = imce.getNonImage(imce.selected);
return nonImg ? imce.setMessage(Drupal.t('%filename is not an image.', {'%filename': imce.decode(nonImg)}), 'error') : true;
},
//validate number of selected files
validateSelCount: function (Min, Max) {
if (Min && imce.selcount < Min) {
return imce.setMessage(Min == 1 ? Drupal.t('Please select a file.') : Drupal.t('You must select at least %num files.', {'%num': Min}), 'error');
}
if (Max && Max < imce.selcount) {
return imce.setMessage(Drupal.t('You are not allowed to operate on more than %num files.', {'%num': Max}), 'error');
}
return true;
},
//update file count and dir size
updateStat: function () {
imce.el('file-count').innerHTML = imce.findex.length;
imce.el('dir-size').innerHTML = imce.conf.dirsize;
},
//serialize selected files. return fids with a colon between them
serialNames: function () {
var str = '';
for (var fid in imce.selected) {
str += ':'+ fid;
}
return str.substr(1);
},
//get file url. re-encode & and # for mod rewrite
getURL: function (fid) {
var path = (imce.conf.dir == '.' ? '' : imce.conf.dir +'/') + fid;
return imce.conf.furl + (imce.conf.modfix ? path.replace(/%(23|26)/g, '%25$1') : path);
},
//el. by id
el: function (id) {
return document.getElementById(id);
},
//find the latest selected fid
lastFid: function () {
if (imce.vars.lastfid) return imce.vars.lastfid;
for (var fid in imce.selected);
return fid;
},
//create ajax url
ajaxURL: function (op, dir) {
return imce.conf.url + (imce.conf.clean ? '?' :'&') +'jsop='+ op +'&dir='+ (dir||imce.conf.dir);
},
//fast class check
hasC: function (el, name) {
return el.className && (' '+ el.className +' ').indexOf(' '+ name +' ') != -1;
},
//highlight a single file
highlight: function (fid) {
if (imce.vars.prvfid) imce.fileClick(imce.vars.prvfid);
imce.fileClick(fid);
},
//process a row
processRow: function (row) {
row.cells[0].innerHTML = '<span>' + imce.decodePlain(row.id) + '</span>';
row.onmousedown = function(e) {
var e = e||window.event;
imce.fileClick(this, e.ctrlKey, e.shiftKey);
return !(e.ctrlKey || e.shiftKey);
};
row.ondblclick = function(e) {
imce.send(this.id);
return false;
};
},
//decode urls. uses unescape. can be overridden to use decodeURIComponent
decode: function (str) {
return unescape(str);
},
//decode and convert to plain text
decodePlain: function (str) {
return Drupal.checkPlain(imce.decode(str));
},
//global ajax error function
ajaxError: function (e, response, settings, thrown) {
imce.setMessage(Drupal.ajaxError(response, settings.url).replace(/\n/g, '<br />'), 'error');
},
//convert button elements to standard input buttons
convertButtons: function(form) {
$('button:submit', form).each(function(){
$(this).replaceWith('<input type="submit" value="'+ $(this).text() +'" name="'+ this.name +'" class="form-submit" id="'+ this.id +'" />');
});
},
//create element
newEl: function(name) {
return document.createElement(name);
},
//scroll syncronization for section headers
syncScroll: function(scrlEl, fixEl, bottom) {
var $fixEl = $(fixEl);
var prop = bottom ? 'bottom' : 'top';
var factor = bottom ? -1 : 1;
var syncScrl = function(el) {
$fixEl.css(prop, factor * el.scrollTop);
}
$(scrlEl).scroll(function() {
var el = this;
syncScrl(el);
setTimeout(function() {
syncScrl(el);
});
});
},
//get UI ready. provide backward compatibility.
updateUI: function() {
//file urls.
var furl = imce.conf.furl, isabs = furl.indexOf('://') > -1;
var absurls = imce.conf.absurls = imce.vars.absurls || imce.conf.absurls;
var host = location.host;
var baseurl = location.protocol + '//' + host;
if (furl.charAt(furl.length - 1) != '/') {
furl = imce.conf.furl = furl + '/';
}
imce.conf.modfix = imce.conf.clean && furl.indexOf(host + '/system/') > -1;
if (absurls && !isabs) {
imce.conf.furl = baseurl + furl;
}
else if (!absurls && isabs && furl.indexOf(baseurl) == 0) {
imce.conf.furl = furl.substr(baseurl.length);
}
//convert button elements to input elements.
imce.convertButtons(imce.FW);
//ops-list
$('#ops-list').removeClass('tabs secondary').addClass('clear-block clearfix');
imce.opCloseLink = $(imce.newEl('a')).attr({id: 'op-close-link', href: '#', title: Drupal.t('Close')}).click(function() {
imce.vars.op && imce.opClick(imce.vars.op);
return false;
}).appendTo('#op-contents')[0];
//navigation-header
if (!$('#navigation-header').size()) {
$(imce.NW).children('.navigation-text').attr('id', 'navigation-header').wrapInner('<span></span>');
}
//log
$('#log-prv-wrapper').before($('#log-prv-wrapper > #preview-wrapper')).remove();
$('#log-clearer').remove();
//content resizer
$('#content-resizer').remove();
//message-box
imce.msgBox = imce.el('message-box') || $(imce.newEl('div')).attr('id', 'message-box').prependTo('#imce-content')[0];
//create help tab
var $hbox = $('#help-box');
$hbox.is('a') && $hbox.replaceWith($(imce.newEl('div')).attr('id', 'help-box').append($hbox.children()));
imce.hooks.load.push(function() {
imce.opAdd({name: 'help', title: $('#help-box-title').remove().text(), content: $('#help-box').show()});
});
//add ie classes
$.browser.msie && $('html').addClass('ie') && parseFloat($.browser.version) < 8 && $('html').addClass('ie-7');
// enable box view for file list
imce.vars.boxW && imce.boxView();
//scrolling file list
imce.syncScroll(imce.SBW, '#file-header-wrapper');
imce.syncScroll(imce.SBW, '#dir-stat', true);
//scrolling directory tree
imce.syncScroll(imce.NW, '#navigation-header');
}
};
//initiate
$(document).ready(imce.initiate).ajaxError(imce.ajaxError);
})(jQuery); | JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','cy',{placeholder:{title:"Priodweddau'r Daliwr Geiriau",toolbar:'Creu Daliwr Geiriau',text:'Testun y Daliwr Geiriau',edit:"Golygu'r Dailwr Geiriau",textMissing:"Mae'n rhaid i'r daliwr geiriau gynnwys testun."}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','tr',{placeholder:{title:'Yer tutucu özellikleri',toolbar:'Yer tutucu oluşturun',text:'Yer tutucu metini',edit:'Yer tutucuyu düzenle',textMissing:'Yer tutucu metin içermelidir.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','nb',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','fr',{placeholder:{title:"Propriétés de l'Espace réservé",toolbar:"Créer l'Espace réservé",text:"Texte de l'Espace réservé",edit:"Modifier l'Espace réservé",textMissing:"L'Espace réservé doit contenir du texte."}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'placeholder', 'fa',
{
placeholder :
{
title : 'ویژگیهای محل نگهداری',
toolbar : 'ایجاد یک محل نگهداری',
text : 'متن محل نگهداری',
edit : 'ویرایش محل نگهداری',
textMissing : 'محل نگهداری باید محتوی متن باشد.'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','eo',{placeholder:{title:'Atributoj de la rezervita spaco',toolbar:'Krei la rezervitan spacon',text:'Texto de la rezervita spaco',edit:'Modifi la rezervitan spacon',textMissing:'La rezervita spaco devas enteni tekston.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','uk',{placeholder:{title:'Налаштування Заповнювача',toolbar:'Створити Заповнювач',text:'Текст Заповнювача',edit:'Редагувати Заповнювач',textMissing:'Заповнювач повинен містити текст.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','he',{placeholder:{title:'מאפייני שומר מקום',toolbar:'צור שומר מקום',text:'תוכן שומר המקום',edit:'ערוך שומר מקום',textMissing:'שומר המקום חייב להכיל טקסט.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','de',{placeholder:{title:'Platzhalter Einstellungen',toolbar:'Platzhalter erstellen',text:'Platzhalter Text',edit:'Platzhalter bearbeiten',textMissing:'Der Platzhalter muss einen Text beinhalten.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'placeholder', 'ku',
{
placeholder :
{
title : 'خاسیهتی شوێن ههڵگر',
toolbar : 'درووستکردنی شوێن ههڵگر',
text : 'دهق بۆ شوێن ههڵگڕ',
edit : 'چاکسازی شوێن ههڵگڕ',
textMissing : 'شوێن ههڵگڕ دهبێت لهدهق پێکهاتبێت.'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','no',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','el',{placeholder:{title:'Ιδιότητες Υποκατάστατου Κειμένου',toolbar:'Δημιουργία Υποκατάσταστου Κειμένου',text:'Υποκαθιστόμενο Κείμενο',edit:'Επεξεργασία Υποκατάσταστου Κειμένου',textMissing:'Πρέπει να υπάρχει υποκαθιστόμενο κείμενο.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','vi',{placeholder:{title:'Thuộc tính đặt chỗ',toolbar:'Tạo đặt chỗ',text:'Văn bản đặt chỗ',edit:'Chỉnh sửa ',textMissing:'The placeholder must contain text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','it',{placeholder:{title:'Proprietà segnaposto',toolbar:'Crea segnaposto',text:'Testo segnaposto',edit:'Modifica segnaposto',textMissing:'Il segnaposto deve contenere del testo.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','sk',{placeholder:{title:'Vlastnosti placeholdera',toolbar:'Vytvoriť placeholder',text:'Text placeholdera',edit:'Upraviť placeholder',textMissing:'Placeholder musí obsahovať text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','nl',{placeholder:{title:'Eigenschappen placeholder',toolbar:'Placeholder aanmaken',text:'Placeholder tekst',edit:'Placeholder wijzigen',textMissing:'De placeholder moet tekst bevatten.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','da',{placeholder:{title:'Egenskaber for pladsholder',toolbar:'Opret pladsholder',text:'Tekst til pladsholder',edit:'Redigér pladsholder',textMissing:'Pladsholder skal indeholde tekst'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','et',{placeholder:{title:'Kohahoidja omadused',toolbar:'Kohahoidja loomine',text:'Kohahoidja tekst',edit:'Kohahoidja muutmine',textMissing:'Kohahoidja peab sisaldama teksti.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','pt-br',{placeholder:{title:'Propriedades do Espaço Reservado',toolbar:'Criar Espaço Reservado',text:'Texto do Espaço Reservado',edit:'Editar Espaço Reservado',textMissing:'O espaço reservado deve conter texto.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','pl',{placeholder:{title:'Właściwości wypełniacza',toolbar:'Utwórz wypełniacz',text:'Tekst wypełnienia',edit:'Edytuj wypełnienie',textMissing:'Wypełnienie musi posiadać jakiś tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','cs',{placeholder:{title:'Vlastnosti vyhrazeného prostoru',toolbar:'Vytvořit vyhrazený prostor',text:'Vyhrazený text',edit:'Upravit vyhrazený prostor',textMissing:'Vyhrazený prostor musí obsahovat text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','hr',{placeholder:{title:'Svojstva rezerviranog mjesta',toolbar:'Napravi rezervirano mjesto',text:'Tekst rezerviranog mjesta',edit:'Uredi rezervirano mjesto',textMissing:'Rezervirano mjesto mora sadržavati tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','fi',{placeholder:{title:'Paikkamerkin ominaisuudet',toolbar:'Luo paikkamerkki',text:'Paikkamerkin teksti',edit:'Muokkaa paikkamerkkiä',textMissing:'Paikkamerkin täytyy sisältää tekstiä'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','ug',{placeholder:{title:'ئورۇن بەلگە خاسلىقى',toolbar:'ئورۇن بەلگە قۇر',text:'ئورۇن بەلگە تېكىستى',edit:'ئورۇن بەلگە تەھرىر',textMissing:'ئورۇن بەلگىسىدە چوقۇم تېكىست بولۇشى لازىم'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','zh-cn',{placeholder:{title:'占位符属性',toolbar:'创建占位符',text:'占位符文字',edit:'编辑占位符',textMissing:'占位符必须包含文字。'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','bg',{placeholder:{title:'Настройки на контейнера',toolbar:'Нов контейнер',text:'Текст за контейнера',edit:'Промяна на контейнер',textMissing:'Контейнера трябва да съдържа текст.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','en',{placeholder:{title:'Placeholder Properties',toolbar:'Create Placeholder',text:'Placeholder Text',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'fa',
{
euro: 'نشان یورو',
lsquo: 'علامت نقل قول تکی چپ',
rsquo: 'علامت نقل قول تکی راست',
ldquo: 'علامت دوتایی نقل قول چپ',
rdquo: 'علامت دوتایی نقل قول راست',
ndash: 'En dash', // MISSING
mdash: 'Em dash', // MISSING
iexcl: 'علامت گذاری به عنوان علامت تعجب وارونه',
cent: 'نشان سنت',
pound: 'نشان پوند',
curren: 'نشان ارز',
yen: 'نشان ین',
brvbar: 'نوار شکسته',
sect: 'نشان بخش',
uml: 'Diaeresis', // MISSING
copy: 'نشان کپی رایت',
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'Left-pointing double angle quotation mark', // MISSING
not: 'علامت ثبت نشده',
reg: 'علامت ثبت شده',
macr: 'Macron', // MISSING
deg: 'نشان درجه',
sup2: 'بالانویس دو',
sup3: 'بالانویس سه',
acute: 'لهجه غلیظ',
micro: 'نشان مایکرو',
para: 'Pilcrow sign', // MISSING
middot: 'نقطه میانی',
cedil: 'Cedilla', // MISSING
sup1: 'Superscript one', // MISSING
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'نشان زاویهدار دوتایی نقل قول راست چین',
frac14: 'Vulgar fraction one quarter', // MISSING
frac12: 'Vulgar fraction one half', // MISSING
frac34: 'Vulgar fraction three quarters', // MISSING
iquest: 'Inverted question mark', // MISSING
Agrave: 'Latin capital letter A with grave accent', // MISSING
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Latin capital letter A with tilde', // MISSING
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'Latin capital letter O with grave accent', // MISSING
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Latin capital letter O with diaeresis', // MISSING
times: 'Multiplication sign', // MISSING
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Latin capital letter U with circumflex', // MISSING
Uuml: 'Latin capital letter U with diaeresis', // MISSING
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Latin small letter sharp s', // MISSING
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Latin small letter a with circumflex', // MISSING
atilde: 'Latin small letter a with tilde', // MISSING
auml: 'Latin small letter a with diaeresis', // MISSING
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'Latin small letter n with tilde', // MISSING
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Division sign', // MISSING
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Trade mark sign', // MISSING
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'Rightwards arrow', // MISSING
rArr: 'Rightwards double arrow', // MISSING
hArr: 'جهتنمای دوتایی چپ به راست',
diams: 'Black diamond suit', // MISSING
asymp: 'تقریبا برابر با'
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'ku',
{
euro: 'نیشانهی یۆرۆ',
lsquo: 'نیشانهی فاریزهی سهرووژێری تاکی چهپ',
rsquo: 'نیشانهی فاریزهی سهرووژێری تاکی ڕاست',
ldquo: 'نیشانهی فاریزهی سهرووژێری دووهێندهی چهپ',
rdquo: 'نیشانهی فاریزهی سهرووژێری دووهێندهی ڕاست',
ndash: 'تهقهڵی کورت',
mdash: 'تهقهڵی درێژ',
iexcl: 'نیشانهی ههڵهوگێڕی سهرسوڕمێنهر',
cent: 'نیشانهی سهنت',
pound: 'نیشانهی پاوهند',
curren: 'نیشانهی دراو',
yen: 'نیشانهی یهنی ژاپۆنی',
brvbar: 'شریتی ئهستوونی پچڕاو',
sect: 'نیشانهی دوو s لهسهریهك',
uml: 'خاڵ',
copy: 'نیشانهی مافی چاپ',
ordf: 'هێڵ لهسهر پیتی a',
laquo: 'دوو تیری بهدووایهکی چهپ',
not: 'نیشانهی نهخێر',
reg: 'نیشانهی R لهناو بازنهدا',
macr: 'ماکڕوون',
deg: 'نیشانهی پله',
sup2: 'سهرنووسی دوو',
sup3: 'سهرنووسی سێ',
acute: 'لاری تیژ',
micro: 'نیشانهی u لق درێژی چهپی خواروو',
para: 'نیشانهیپهڕهگراف',
middot: 'ناوهڕاستی خاڵ',
cedil: 'نیشانهی c ژێر چووکره',
sup1: 'سهرنووسی یهك',
ordm: 'هێڵ لهژێر پیتی o',
raquo: 'دوو تیری بهدووایهکی ڕاست',
frac14: 'یهك لهسهر چووار',
frac12: 'یهك لهسهر دوو',
frac34: 'سێ لهسهر چووار',
iquest: 'هێمای ههڵهوگێری پرسیار',
Agrave: 'پیتی لاتینی A-ی گهوره لهگهڵ ڕوومهتداری لار',
Aacute: 'پیتی لاتینی A-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Acirc: 'پیتی لاتینی A-ی گهوره لهگهڵ نیشانه لهسهری',
Atilde: 'پیتی لاتینی A-ی گهوره لهگهڵ زهڕه',
Auml: 'پیتی لاتینی A-ی گهوره لهگهڵ نیشانه لهسهری',
Aring: 'پیتی لاتینی گهورهی Å',
AElig: 'پیتی لاتینی گهورهی Æ',
Ccedil: 'پیتی لاتینی C-ی گهوره لهگهڵ ژێر چووکره',
Egrave: 'پیتی لاتینی E-ی گهوره لهگهڵ ڕوومهتداری لار',
Eacute: 'پیتی لاتینی E-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ecirc: 'پیتی لاتینی E-ی گهوره لهگهڵ نیشانه لهسهری',
Euml: 'پیتی لاتینی E-ی گهوره لهگهڵ نیشانه لهسهری',
Igrave: 'پیتی لاتینی I-ی گهوره لهگهڵ ڕوومهتداری لار',
Iacute: 'پیتی لاتینی I-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Icirc: 'پیتی لاتینی I-ی گهوره لهگهڵ نیشانه لهسهری',
Iuml: 'پیتی لاتینی I-ی گهوره لهگهڵ نیشانه لهسهری',
ETH: 'پیتی لاتینی E-ی گهورهی',
Ntilde: 'پیتی لاتینی N-ی گهوره لهگهڵ زهڕه',
Ograve: 'پیتی لاتینی O-ی گهوره لهگهڵ ڕوومهتداری لار',
Oacute: 'پیتی لاتینی O-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ocirc: 'پیتی لاتینی O-ی گهوره لهگهڵ نیشانه لهسهری',
Otilde: 'پیتی لاتینی O-ی گهوره لهگهڵ زهڕه',
Ouml: 'پیتی لاتینی O-ی گهوره لهگهڵ نیشانه لهسهری',
times: 'نیشانهی لێکدان',
Oslash: 'پیتی لاتینی گهورهی Ø لهگهڵ هێمای دڵ وهستان',
Ugrave: 'پیتی لاتینی U-ی گهوره لهگهڵ ڕوومهتداری لار',
Uacute: 'پیتی لاتینی U-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ucirc: 'پیتی لاتینی U-ی گهوره لهگهڵ نیشانه لهسهری',
Uuml: 'پیتی لاتینی U-ی گهوره لهگهڵ نیشانه لهسهری',
Yacute: 'پیتی لاتینی Y-ی گهوره لهگهڵ ڕوومهتداری تیژ',
THORN: 'پیتی لاتینی دڕکی گهوره',
szlig: 'پیتی لاتنی نووك تیژی s',
agrave: 'پیتی لاتینی a-ی بچووك لهگهڵ ڕوومهتداری لار',
aacute: 'پیتی لاتینی a-ی بچووك لهگهڵ ڕوومهتداری تیژ',
acirc: 'پیتی لاتینی a-ی بچووك لهگهڵ نیشانه لهسهری',
atilde: 'پیتی لاتینی a-ی بچووك لهگهڵ زهڕه',
auml: 'پیتی لاتینی a-ی بچووك لهگهڵ نیشانه لهسهری',
aring: 'پیتی لاتینی å-ی بچووك',
aelig: 'پیتی لاتینی æ-ی بچووك',
ccedil: 'پیتی لاتینی c-ی بچووك لهگهڵ ژێر چووکره',
egrave: 'پیتی لاتینی e-ی بچووك لهگهڵ ڕوومهتداری لار',
eacute: 'پیتی لاتینی e-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ecirc: 'پیتی لاتینی e-ی بچووك لهگهڵ نیشانه لهسهری',
euml: 'پیتی لاتینی e-ی بچووك لهگهڵ نیشانه لهسهری',
igrave: 'پیتی لاتینی i-ی بچووك لهگهڵ ڕوومهتداری لار',
iacute: 'پیتی لاتینی i-ی بچووك لهگهڵ ڕوومهتداری تیژ',
icirc: 'پیتی لاتینی i-ی بچووك لهگهڵ نیشانه لهسهری',
iuml: 'پیتی لاتینی i-ی بچووك لهگهڵ نیشانه لهسهری',
eth: 'پیتی لاتینی e-ی بچووك',
ntilde: 'پیتی لاتینی n-ی بچووك لهگهڵ زهڕه',
ograve: 'پیتی لاتینی o-ی بچووك لهگهڵ ڕوومهتداری لار',
oacute: 'پیتی لاتینی o-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ocirc: 'پیتی لاتینی o-ی بچووك لهگهڵ نیشانه لهسهری',
otilde: 'پیتی لاتینی o-ی بچووك لهگهڵ زهڕه',
ouml: 'پیتی لاتینی o-ی بچووك لهگهڵ نیشانه لهسهری',
divide: 'نیشانهی دابهش',
oslash: 'پیتی لاتینی گهورهی ø لهگهڵ هێمای دڵ وهستان',
ugrave: 'پیتی لاتینی u-ی بچووك لهگهڵ ڕوومهتداری لار',
uacute: 'پیتی لاتینی u-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ucirc: 'پیتی لاتینی u-ی بچووك لهگهڵ نیشانه لهسهری',
uuml: 'پیتی لاتینی u-ی بچووك لهگهڵ نیشانه لهسهری',
yacute: 'پیتی لاتینی y-ی بچووك لهگهڵ ڕوومهتداری تیژ',
thorn: 'پیتی لاتینی دڕکی بچووك',
yuml: 'پیتی لاتینی y-ی بچووك لهگهڵ نیشانه لهسهری',
OElig: 'پیتی لاتینی گهورهی پێکهوهنووسراوی OE',
oelig: 'پیتی لاتینی بچووکی پێکهوهنووسراوی oe',
'372': 'پیتی لاتینی W-ی گهوره لهگهڵ نیشانه لهسهری',
'374': 'پیتی لاتینی Y-ی گهوره لهگهڵ نیشانه لهسهری',
'373': 'پیتی لاتینی w-ی بچووکی لهگهڵ نیشانه لهسهری',
'375': 'پیتی لاتینی y-ی بچووکی لهگهڵ نیشانه لهسهری',
sbquo: 'نیشانهی فاریزهی نزم',
'8219': 'نیشانهی فاریزهی بهرزی پێچهوانه',
bdquo: 'دوو فاریزهی تهنیش یهك',
hellip: 'ئاسۆیی بازنه',
trade: 'نیشانهی بازرگانی',
'9658': 'ئاراستهی ڕهشی دهستی ڕاست',
bull: 'فیشهك',
rarr: 'تیری دهستی ڕاست',
rArr: 'دووتیری دهستی ڕاست',
hArr: 'دوو تیری ڕاست و چهپ',
diams: 'ڕهشی پاقڵاوهیی',
asymp: 'نیشانهی یهکسانه'
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add('docprops',{init:function(a){var b=new CKEDITOR.dialogCommand('docProps');b.modes={wysiwyg:a.config.fullPage};a.addCommand('docProps',b);CKEDITOR.dialog.add('docProps',this.path+'dialogs/docprops.js');a.ui.addButton('DocProps',{label:a.lang.docprops.label,command:'docProps'});}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'fa',
{
accessibilityHelp :
{
title : 'دستورالعملهای دسترسی',
contents : 'راهنمای فهرست مطالب. برای بستن این کادر محاورهای ESC را فشار دهید.',
legend :
[
{
name : 'عمومی',
items :
[
{
name : 'نوار ابزار ویرایشگر',
legend:
'${toolbarFocus} را برای باز کردن نوار ابزار بفشارید. با کلید Tab و Shif-Tab در مجموعه نوار ابزار بعدی و قبلی حرکت کنید. برای حرکت در کلید نوار ابزار قبلی و بعدی با کلید جهتنمای راست و چپ جابجا شوید. کلید Space یا Enter را برای فعال کردن کلید نوار ابزار بفشارید.'
},
{
name : 'پنجره محاورهای ویرایشگر',
legend :
'در داخل یک پنجره محاورهای، کلید Tab را بفشارید تا به پنجرهی بعدی بروید، Shift+Tab برای حرکت به فیلد قبلی، فشردن Enter برای ثبت اطلاعات پنجره، فشردن Esc برای لغو پنجره محاورهای و برای پنجرههایی که چندین برگه دارند، فشردن Alt+F10 جهت رفتن به Tab-List. در نهایت حرکت به برگه بعدی با Tab یا کلید جهتنمای راست. حرکت به برگه قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک برگه.'
},
{
name : 'منوی متنی ویرایشگر',
legend :
'${contextMenu} یا کلید برنامههای کاربردی را برای باز کردن منوی متن را بفشارید. سپس میتوانید برای حرکت به گزینه بعدی منو با کلید Tab و یا کلید جهتنمای پایین جابجا شوید. حرکت به گزینه قبلی با Shift+Tab یا کلید جهتنمای بالا. فشردن Space یا Enter برای انتخاب یک گزینه از منو. باز کردن زیر شاخه گزینه منو جاری با کلید Space یا Enter و یا کلید جهتنمای راست و چپ. بازگشت به منوی والد با کلید Esc یا کلید جهتنمای چپ. بستن منوی متن با Esc.'
},
{
name : 'جعبه فهرست ویرایشگر',
legend :
'در داخل جعبه لیست، قلم دوم از اقلام لیست بعدی را با TAB و یا Arrow Down حرکت دهید. انتقال به قلم دوم از اقلام لیست قبلی را با SHIFT + TAB یا UP ARROW. کلید Space یا ENTER را برای انتخاب گزینه لیست بفشارید. کلید ESC را برای بستن جعبه لیست بفشارید.'
},
{
name : 'ویرایشگر عنصر نوار راه',
legend :
'برای رفتن به مسیر عناصر ${elementsPathFocus} را بفشارید. حرکت به کلید عنصر بعدی با کلید Tab یا کلید جهتنمای راست. برگشت به کلید قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک عنصر در ویرایشگر.'
}
]
},
{
name : 'فرمانها',
items :
[
{
name : 'بازگشت فرمان',
legend : 'فشردن ${undo}'
},
{
name : 'انجام مجدد فرمان',
legend : 'فشردن ${redo}'
},
{
name : 'فرمان متن درشت',
legend : 'فشردن ${bold}'
},
{
name : 'فرمان متن کج',
legend : 'فشردن ${italic}'
},
{
name : 'فرمان متن زیرخطدار',
legend : 'فشردن ${underline}'
},
{
name : 'فرمان پیوند',
legend : 'فشردن ${link}'
},
{
name : 'بستن نوار ابزار فرمان',
legend : 'فشردن ${toolbarCollapse}'
},
{
name : 'راهنمای دسترسی',
legend : 'فشردن ${a11yHelp}'
}
]
}
]
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'ku',
{
accessibilityHelp :
{
title : 'ڕێنمای لەبەردەستدابوون',
contents : 'پێکهاتەی یارمەتی. کلیك ESC بۆ داخستنی ئەم دیالۆگه.',
legend :
[
{
name : 'گشتی',
items :
[
{
name : 'تووڵامرازی دهستكاریكهر',
legend:
'کلیك ${toolbarFocus} بۆ ڕابەری تووڵامراز. بۆ گواستنەوەی پێشوو داهاتووی گرووپی تووڵامرازی داگرتنی کلیلی TAB لهگهڵ SHIFT-TAB. بۆ گواستنەوەی پێشوو داهاتووی دووگمەی تووڵامرازی لەڕێی کلیلی تیری دەستی ڕاست یان کلیلی تیری دەستی چەپ. کلیکی کلیلی SPACE یان ENTER بۆ چالاککردنی دووگمەی تووڵامراز.'
},
{
name : 'دیالۆگی دهستكاریكهر',
legend :
'لەهەمانکاتدا کەتۆ لەدیالۆگی, کلیکی کلیلی TAB بۆ ڕابەری خانەی دیالۆگێکی تر, داگرتنی کلیلی SHIFT + TAB بۆ گواستنەوەی بۆ خانەی پێشووتر, کلیكی کلیلی ENTER بۆ ڕازیکردنی دیالۆگەکە, کلیكی کلیلی ESC بۆ هەڵوەشاندنەوەی دیالۆگەکە. بۆ دیالۆگی لەبازدەری (تابی) زیاتر, کلیكی کلیلی ALT + F10 بۆ ڕابهری لیستی بازدهرهکان. بۆ چوونه بازدهری تابی داهاتوو کلیكی کلیلی TAB یان کلیلی تیری دهستی ڕاست. بۆچوونه بازدهری تابی پێشوو داگرتنی کلیلی SHIFT + TAB یان کلیلی تیری دهستی چهپ. کلیی کلیلی SPACE یان ENTER بۆ ههڵبژاردنی بازدهر (تاب).'
},
{
name : 'پێڕستی سهرنووسهر',
legend :
'کلیك ${contextMenu} یان دوگمهی لیسته(Menu) بۆ کردنهوهی لیستهی دهق. بۆ چوونه ههڵبژاردهیهکی تر له لیسته کلیکی کلیلی TAB یان کلیلی تیری ڕوو لهخوارهوه بۆ چوون بۆ ههڵبژاردهی پێشوو کلیکی کلیلی SHIFT+TAB یان کلیلی تیری ڕوو له سهرهوه. داگرتنی کلیلی SPACE یان ENTER بۆ ههڵبژاردنی ههڵبژاردهی لیسته. بۆ کردنهوهی لقی ژێر لیسته لهههڵبژاردهی لیسته کلیکی کلیلی SPACE یان ENTER یان کلیلی تیری دهستی ڕاست. بۆ گهڕانهوه بۆ سهرهوهی لیسته کلیکی کلیلی ESC یان کلیلی تیری دهستی چهپ. بۆ داخستنی لیسته کلیكی کلیلی ESC بکه.'
},
{
name : 'لیستی سنووقی سهرنووسهر',
legend :
'لهناو سنوقی لیست, چۆن بۆ ههڵنبژاردهی لیستێکی تر کلیکی کلیلی TAB یان کلیلی تیری ڕوو لهخوار. چوون بۆ ههڵبژاردهی لیستی پێشوو کلیکی کلیلی SHIFT + TAB یان کلیلی تیری ڕوو لهسهرهوه. کلیکی کلیلی SPACE یان ENTER بۆ دیاریکردنی ههڵبژاردهی لیست. کلیکی کلیلی ESC بۆ داخستنی سنوقی لیست.'
},
{
name : 'تووڵامرازی توخم',
legend :
'کلیك ${elementsPathFocus} بۆ ڕابهری تووڵامرازی توخمهکان. چوون بۆ دوگمهی توخمێکی تر کلیکی کلیلی TAB یان کلیلی تیری دهستی ڕاست. چوون بۆ دوگمهی توخمی پێشوو کلیلی SHIFT+TAB یان کلیکی کلیلی تیری دهستی چهپ. داگرتنی کلیلی SPACE یان ENTER بۆ دیاریکردنی توخمهکه لهسهرنووسه.'
}
]
},
{
name : 'فهرمانهکان',
items :
[
{
name : 'فهرمانی پووچکردنهوه',
legend : 'کلیك ${undo}'
},
{
name : 'فهرمانی ههڵگهڕانهوه',
legend : 'کلیك ${redo}'
},
{
name : 'فهرمانی دهقی قهڵهو',
legend : 'کلیك ${bold}'
},
{
name : 'فهرمانی دهقی لار',
legend : 'کلیك ${italic}'
},
{
name : 'فهرمانی ژێرهێڵ',
legend : 'کلیك ${underline}'
},
{
name : 'فهرمانی بهستهر',
legend : 'کلیك ${link}'
},
{
name : 'شاردهنهوهی تووڵامراز',
legend : 'کلیك ${toolbarCollapse}'
},
{
name : 'دهستپێگهیشتنی یارمهتی',
legend : 'کلیك ${a11yHelp}'
}
]
}
]
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','cy',{uicolor:{title:"Dewisydd Lliwiau'r UI",preview:'Rhagolwg Byw',config:"Gludwch y llinyn hwn i'ch ffeil config.js",predefined:"Setiau lliw wedi'u cyn-ddiffinio"}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','tr',{uicolor:{title:'UI Renk Seçicisi',preview:'Canlı önizleme',config:'Bu dizeyi config.js dosyasının içine yapıştırın',predefined:'Önceden tanımlanmış renk kümeleri'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','nb',{uicolor:{title:'Fargevelger for brukergrensesnitt',preview:'Forhåndsvisning i sanntid',config:'Lim inn følgende tekst i din config.js-fil',predefined:'Forhåndsdefinerte fargesett'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','fr',{uicolor:{title:'UI Sélecteur de couleur',preview:'Aperçu',config:'Collez cette chaîne de caractères dans votre fichier config.js',predefined:'Palettes de couleurs prédéfinies'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'fa',
{
uicolor :
{
title : 'انتخاب رنگ UI',
preview : 'پیشنمایش زنده',
config : 'این رشته را در فایل config.js خود بچسبانید.',
predefined : 'مجموعه رنگ از پیش تعریف شده'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','eo',{uicolor:{title:'UI Kolorselektilo',preview:'Vidigi la aspekton',config:'Gluu tiun signoĉenon en vian dosieron config.js',predefined:'Antaŭdifinita koloraro'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','uk',{uicolor:{title:'Color Picker Інтерфейс',preview:'Перегляд наживо',config:'Вставте цей рядок у файл config.js',predefined:'Стандартний набір кольорів'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','he',{uicolor:{title:'בחירת צבע ממשק משתמש',preview:'תצוגה מקדימה',config:'הדבק את הטקסט הבא לתוך הקובץ config.js',predefined:'קבוצות צבעים מוגדרות מראש'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','de',{uicolor:{title:'UI Pipette',preview:'Live-Vorschau',config:"Fügen Sie diese Zeichenfolge in die 'config.js' Datei.",predefined:'Vordefinierte Farbsätze'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'uicolor', 'ku',
{
uicolor :
{
title : 'ههڵگری ڕهنگ بۆ ڕووکاری بهکارهێنهر',
preview : 'پێشبینین به زیندوویی',
config : 'ئهم دهقانه بلکێنه به پهڕگهی config.js-fil',
predefined : 'کۆمهڵه ڕهنگه دیاریکراوهکانی پێشوو'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','no',{uicolor:{title:'Fargevelger for brukergrensesnitt',preview:'Forhåndsvisning i sanntid',config:'Lim inn følgende tekst i din config.js-fil',predefined:'Forhåndsdefinerte fargesett'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','el',{uicolor:{title:'Διεπαφή Επιλογέα Χρωμάτων',preview:'Ζωντανή Προεπισκόπηση',config:'Επικολλήστε αυτό το κείμενο στο αρχείο config.js',predefined:'Προκαθορισμένα σύνολα χρωμάτων'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','vi',{uicolor:{title:'Giao diện người dùng Color Picker',preview:'Xem trước trực tiếp',config:'Dán chuỗi này vào tập tin config.js của bạn',predefined:'Tập màu định nghĩa sẵn'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','mk',{uicolor:{title:'Палета со бои',preview:'Преглед',config:'Залепи го овој текст во config.js датотеката',predefined:'Предефинирани множества на бои'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','it',{uicolor:{title:'Selettore Colore UI',preview:'Anteprima Live',config:'Incolla questa stringa nel tuo file config.js',predefined:'Set di colori predefiniti'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','sk',{uicolor:{title:'UI výber farby',preview:'Živý náhľad',config:'Vložte tento reťazec do vášho config.js súboru',predefined:'Preddefinované sady farieb'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','nl',{uicolor:{title:'UI Kleurenkiezer',preview:'Live voorbeeld',config:'Plak deze tekst in jouw config.js bestand',predefined:'Voorgedefinieerde kleurensets'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','da',{uicolor:{title:'Brugerflade på farvevælger',preview:'Vis liveeksempel',config:'Indsæt denne streng i din config.js fil',predefined:'Prædefinerede farveskemaer'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','et',{uicolor:{title:'Värvivalija kasutajaliides',preview:'Automaatne eelvaade',config:'Aseta see sõne oma config.js faili.',predefined:'Eelmääratud värvikomplektid'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','pt-br',{uicolor:{title:'Paleta de Cores',preview:'Visualização ao vivo',config:'Cole o texto no seu arquivo config.js',predefined:'Conjuntos de cores predefinidos'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','pl',{uicolor:{title:'Wybór koloru interfejsu',preview:'Podgląd na żywo',config:'Wklej poniższy łańcuch znaków do pliku config.js:',predefined:'Predefiniowane zestawy kolorów'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','cs',{uicolor:{title:'Výběr barvy rozhraní',preview:'Živý náhled',config:'Vložte tento řetězec do Vašeho souboru config.js',predefined:'Přednastavené sady barev'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','hr',{uicolor:{title:'UI odabir boja',preview:'Pregled uživo',config:'Zalijepite ovaj tekst u Vašu config.js datoteku.',predefined:'Već postavljeni setovi boja'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','fi',{uicolor:{title:'Käyttöliittymän värivalitsin',preview:'Esikatsele',config:'Liitä tämä merkkijono config.js tiedostoosi',predefined:'Esimääritellyt värijoukot'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','ug',{uicolor:{title:'ئىشلەتكۈچى ئارايۈزى رەڭ تاللىغۇچ',preview:'شۇئان ئالدىن كۆزىتىش',config:'بۇ ھەرپ تىزىقىنى config.js ھۆججەتكە چاپلايدۇ',predefined:'ئالدىن بەلگىلەنگەن رەڭلەر'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','zh-cn',{uicolor:{title:'用户界面颜色选择器',preview:'即时预览',config:'粘贴此字符串到您的 config.js 文件',predefined:'预定义颜色集'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','bg',{uicolor:{title:'ПИ избор на цвят',preview:'Преглед',config:'Вмъкнете този низ във Вашия config.js fajl',predefined:'Предефинирани цветови палитри'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('devtools','cy',{devTools:{title:'Gwybodaeth am yr Elfen',dialogName:'Enw ffenestr y deialog',tabName:"Enw'r tab",elementId:'ID yr Elfen',elementType:'Math yr elfen'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('devtools','tr',{devTools:{title:'Eleman Bilgisi',dialogName:'İletişim pencere ismi',tabName:'Sekme adı',elementId:'Eleman ID',elementType:'Eleman türü'}});
| JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.