Third pass at adding key files
177
site/forum.slowtwitch.com/www/static/admin/dashboard.js
Normal file
@ -0,0 +1,177 @@
|
||||
// Object to create a separate name space for GForum javascript functions
|
||||
function GForumAdmin() {}
|
||||
|
||||
// Initialize the GForum object
|
||||
$(document).ready(function() {
|
||||
GForumAdmin = new GForumAdmin();
|
||||
});
|
||||
|
||||
GForumAdmin.prototype.ajax_url = 'admin.cgi';
|
||||
|
||||
/**
|
||||
* Initializes the drag and drop functionality for the dashboard
|
||||
*/
|
||||
GForumAdmin.prototype.initDashboard = function () {
|
||||
// Init the column sortables
|
||||
$('.widget_column').sortable(
|
||||
{
|
||||
items: '.widget',
|
||||
handle: '.widget_heading',
|
||||
opacity: 0.3,
|
||||
delay: 100,
|
||||
placeholder: 'widget_hover',
|
||||
connectWith: ['#dashboard_column0', '#dashboard_column1'],
|
||||
stop: function () { GForumAdmin.saveWidgetPositions(); }
|
||||
}
|
||||
);
|
||||
|
||||
// Init the row sortables
|
||||
$('.widget_row').sortable(
|
||||
{
|
||||
items: '.widget',
|
||||
handle: '.widget_heading',
|
||||
opacity: 0.3,
|
||||
delay: 100,
|
||||
placeholder: 'widget_hover',
|
||||
connectWith: ['#dashboard_row0', '#dashboard_row1'],
|
||||
stop: function () { GForumAdmin.saveWidgetPositions(); }
|
||||
}
|
||||
);
|
||||
|
||||
GForumAdmin.initToolbarButtons();
|
||||
|
||||
// Init the widget add buttons
|
||||
$('.widget_add').click(function () {
|
||||
GForumAdmin.addWidget($(this).attr('id').substr(4));
|
||||
return false;
|
||||
});
|
||||
|
||||
// Init the widget configuration page buttons
|
||||
$('.widget_list_toggle').click(function () {
|
||||
$('#widget_list').slideToggle('slow', function () {
|
||||
var old_text = $('.widget_toggle_text').text();
|
||||
var new_text = $('.widget_toggle_text_exchange').text();
|
||||
$('.widget_toggle_text').text(new_text);
|
||||
$('.widget_toggle_text_exchange').text(old_text);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Binds the click functions to the widget toolbar buttons
|
||||
*/
|
||||
GForumAdmin.prototype.initToolbarButtons = function () {
|
||||
$('.widget_close').unbind();
|
||||
$('.widget_minimize').unbind();
|
||||
|
||||
// Init the widget close buttons
|
||||
$('.widget_close').click(function () {
|
||||
$(this).parents('.widget').fadeOut('slow', function () {
|
||||
$(this).remove();
|
||||
GForumAdmin.saveWidgetPositions();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Init the widget minimize buttons
|
||||
$('.widget_minimize').click(function () {
|
||||
$(this).parents('.widget').children('.box_content').slideToggle();
|
||||
$(this).parents('.widget').find('.widget_minimize').toggleClass('hidden');
|
||||
GForumAdmin.toggleWidgetMaximizationState($(this).parents('.widget').attr('id'));
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Ajax function to save the current widget positions
|
||||
*/
|
||||
GForumAdmin.prototype.saveWidgetPositions = function () {
|
||||
$.post(GForumAdmin.ajax_url, {
|
||||
'do': 'json_save_widget_positions',
|
||||
'column0': $('#dashboard_column0').sortable('serialize'),
|
||||
'column1': $('#dashboard_column1').sortable('serialize'),
|
||||
'row0': $('#dashboard_row0').sortable('serialize'),
|
||||
'row1': $('#dashboard_row1').sortable('serialize')
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax function to toggle the maximization state of a widget
|
||||
*/
|
||||
GForumAdmin.prototype.toggleWidgetMaximizationState = function (widget_id) {
|
||||
$.post(GForumAdmin.ajax_url, {
|
||||
'do': 'json_toggle_widget_maximization_state',
|
||||
'widget_id': widget_id
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax function to add a widget to the dashboard
|
||||
*/
|
||||
GForumAdmin.prototype.addWidget = function (widget_id) {
|
||||
$.post( GForumAdmin.ajax_url, { 'do': 'json_add_widget', 'widget_id': widget_id }, function(data) {
|
||||
if (data.success) {
|
||||
|
||||
var container;
|
||||
if (data.data.widget_config.container == 'column') {
|
||||
container = '#dashboard_column' + data.data.widget_config.column;
|
||||
}
|
||||
else {
|
||||
container = '#dashboard_row0';
|
||||
}
|
||||
|
||||
$(container).prepend(data.data.widget_html);
|
||||
GForumAdmin.initToolbarButtons();
|
||||
}
|
||||
}, "json");
|
||||
};
|
||||
|
||||
/**
|
||||
* Ajax function to fetch the update information and reset the numbers in the DOM
|
||||
*/
|
||||
GForumAdmin.prototype.fetchUpdates = function (widget_id) {
|
||||
$.post( GForumAdmin.ajax_url, { 'do': 'json_fetch_updates' }, function(data) {
|
||||
if (data.success) {
|
||||
var updates = data.data.updates;
|
||||
|
||||
// Loop trough the update types
|
||||
for (var type in updates) {
|
||||
if (typeof type == 'string') {
|
||||
eval('var current = updates.' + type);
|
||||
|
||||
// Reset the number of updates
|
||||
$('#updates_list').find('.' + type).text(current);
|
||||
|
||||
// Highlight critical updates
|
||||
if (current > 0 && type == 'critical') {
|
||||
$('#updates_list').find('.' + type).parent().addClass('important');
|
||||
}
|
||||
|
||||
// Singular/plural replacements
|
||||
if (current != 1) {
|
||||
$('#updates_list').find('.' + type + '_plural').show();
|
||||
$('#updates_list').find('.' + type + '_singular').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show the link to the updates page in case we got some updates
|
||||
if (updates.total) {
|
||||
$('#updates_link').show();
|
||||
}
|
||||
|
||||
// Show the list
|
||||
$('#updates_list').slideDown("slow");
|
||||
} else {
|
||||
$('#updates_error').text(data.message);
|
||||
$('#updates_error').show();
|
||||
}
|
||||
|
||||
$('#updates_spinner').remove();
|
||||
}, "json");
|
||||
};
|
||||
|
||||
|
904
site/forum.slowtwitch.com/www/static/editor.old/editor.js
Normal file
@ -0,0 +1,904 @@
|
||||
/*
|
||||
* =================================================================
|
||||
* HTML Editor - A WYSIWYG web based editor for IE5.5+ and Mozilla v1.4+
|
||||
*
|
||||
* Website : http://gossamer-threads.com/
|
||||
* Support : http://gossamer-threads.com/scripts/support/
|
||||
* Revision : $Id: editor.js,v 1.12 2009/05/09 05:52:50 brewt Exp $
|
||||
*
|
||||
* Copyright (c) 2005 Gossamer Threads Inc. All Rights Reserved.
|
||||
* Redistribution in part or in whole strictly prohibited. Please
|
||||
* see LICENSE file for full details.
|
||||
* =================================================================
|
||||
*/
|
||||
|
||||
var dialogWindow = {};
|
||||
|
||||
function advancedEditor() {
|
||||
this.config = {
|
||||
imageURL : 'images',
|
||||
imageDialogURL : '',
|
||||
defaultFont : 'Arial',
|
||||
defaultFontSize : '3',
|
||||
defaultForeground : '#000000',
|
||||
defaultBackground : '#FFFFFF',
|
||||
focusOnload : false
|
||||
};
|
||||
|
||||
this.id = {
|
||||
editorFrame : 'editor_iframe',
|
||||
toolbarArea : 'toolbar_area',
|
||||
editableFrame : 'editable_iframe',
|
||||
editableContent : 'editable_content',
|
||||
editableSource : 'editable_source',
|
||||
form : '',
|
||||
content : ''
|
||||
};
|
||||
|
||||
// command, image, title, updateType(0 = don't update, 1 = queryCommandState, 2 = queryCommandEnabled, 3 = customQueryCommandState, 4 = customQueryCommandEnabled), customCommand, customStateCommand, useCSS (mozilla)
|
||||
this.toolbar = [
|
||||
{
|
||||
buttons : {
|
||||
copy : ['Copy', 'copy.gif', 'Copy', 2],
|
||||
cut : ['Cut', 'cut.gif', 'Cut', 2],
|
||||
paste : ['Paste', 'paste.gif', 'Paste', 2]
|
||||
},
|
||||
num_buttons : 3,
|
||||
hidden : isIE ? 0 : 1
|
||||
},
|
||||
// The undo/redo buttons don't work too reliably and the buffer is lost after
|
||||
// doing things like resizing (changing any properties of the contenteditable
|
||||
// area will wipe it), or custom commands.
|
||||
/*
|
||||
{
|
||||
buttons : {
|
||||
undo : ['Undo', 'undo.gif', 'Undo', 2],
|
||||
redo : ['Redo', 'redo.gif', 'Redo', 2]
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
*/
|
||||
{
|
||||
buttons : {
|
||||
bold : ['Bold', 'bold.gif', 'Bold', 1],
|
||||
italic : ['Italic', 'italic.gif', 'Italic', 1],
|
||||
underline : ['Underline', 'underline.gif', 'Underline', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
quote : ['', 'quote.gif', 'Quote', 0, 'this.insertQuote()']
|
||||
/*
|
||||
reply : ['', 'reply.gif', 'Reply', 0, 'this.insertReply()'],
|
||||
code : ['', 'code.gif', 'Code', 0, 'this.insertCode()']
|
||||
*/
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
alignleft : ['JustifyLeft', 'alignleft.gif', 'Align Left', 1],
|
||||
center : ['JustifyCenter', 'center.gif', 'Center', 1],
|
||||
alignright : ['JustifyRight', 'alignright.gif', 'Align Right', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
numlist : ['InsertOrderedList', 'numlist.gif', 'Numbering', 1],
|
||||
bullist : ['InsertUnorderedList', 'bullist.gif', 'Bullets', 1],
|
||||
outdent : ['Outdent', 'outdent.gif', 'Decrease Indent', 0],
|
||||
indent : ['Indent', 'indent.gif', 'Increase Indent', 0]
|
||||
},
|
||||
num_buttons : 4
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
font : ['FontName', 'font.gif', 'Font', 0, 'this.fontDialog()'],
|
||||
color : ['', 'color.gif', 'Color', 0, 'this.colorDialog("foreground")']
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
hr : ['InsertHorizontalRule', 'hr.gif', 'Horizontal Rule', 0],
|
||||
image : ['', 'image.gif', 'Insert Image', 0, 'this.imageDialog()'],
|
||||
link : ['', 'link.gif', 'Create Link', 4, 'this.linkDialog()', 'this.selectionMade()']
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
source : ['', 'source.gif', 'Toggle HTML Source', 3, 'this.toggleSource()', 'this.sourceMode']
|
||||
},
|
||||
num_buttons : 1
|
||||
}
|
||||
];
|
||||
this.toolbarMapping = {};
|
||||
this.toolbarQueryCommandState = {};
|
||||
this.toolbarQueryCommandEnabled = {};
|
||||
|
||||
this.objects = {};
|
||||
this.loadingInterval = 0;
|
||||
this.initCount = 0;
|
||||
this.toolbarInterval = 0;
|
||||
this.selection = null;
|
||||
this.loaded = false;
|
||||
this.sourceMode = false;
|
||||
|
||||
// TODO remove this and get values from currentStyle
|
||||
// Dimensions of various objects
|
||||
// *Extra are padding/border/margin widths that need to be added to properly
|
||||
// calculate object total widths
|
||||
this.editorFrameExtra = 2;
|
||||
this.editableContentExtra = 10;
|
||||
this.toolbarExtra = 2;
|
||||
this.toolbarHeight = 26;
|
||||
this.buttonWidth = 25;
|
||||
this.separatorWidth = 8;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.load = function (form, content) {
|
||||
var self = this;
|
||||
if (form)
|
||||
this.id.form = form;
|
||||
if (content)
|
||||
this.id.content = content;
|
||||
this.loadingInterval = setInterval(function () { self.init() }, 100);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.init = function () {
|
||||
if (this.initCount++ > 100) {
|
||||
clearInterval(this.loadingInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.objects.editorFrame = document.getElementById(this.id.editorFrame);
|
||||
if (!this.objects.editorFrame)
|
||||
return;
|
||||
|
||||
this.objects.editorFrameDoc = this.objects.editorFrame.contentWindow.document;
|
||||
this.objects.editableSource = this.objects.editorFrameDoc.getElementById(this.id.editableSource);
|
||||
this.objects.editableFrame = this.objects.editorFrameDoc.getElementById(this.id.editableFrame);
|
||||
if (!this.objects.editableFrame)
|
||||
return;
|
||||
if (!this.objects.editableSource)
|
||||
this.deleteButton('source');
|
||||
|
||||
this.objects.editableFrameDoc = this.objects.editableFrame.contentWindow.document;
|
||||
this.objects.editableContent = this.objects.editableFrameDoc.getElementById(this.id.editableContent);
|
||||
if (!this.objects.editableContent)
|
||||
return;
|
||||
|
||||
this.objects.toolbarArea = this.objects.editorFrameDoc.getElementById(this.id.toolbarArea);
|
||||
if (!this.objects.toolbarArea)
|
||||
return;
|
||||
|
||||
clearInterval(this.loadingInterval);
|
||||
|
||||
this.objects.form = document.getElementById(this.id.form);
|
||||
this.objects.content = document.getElementById(this.id.content);
|
||||
this.objects.editableContent.innerHTML = this.objects.content.value;
|
||||
registerEvent(this.objects.form, 'submit', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
// Before leaving the page, make sure the content is put back into the input so that the content isn't lost if the user goes back to the page
|
||||
registerEvent(window, 'beforeunload', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
|
||||
// Tabbing from the subject takes you to the iframe in IE, but the document in Mozilla
|
||||
registerEvent(this.objects.editorFrame, 'focus', function () { self.focus() });
|
||||
registerEvent(this.objects.editorFrameDoc, 'focus', function () { self.focus() });
|
||||
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var toolbar;
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
if (this.toolbar[i].hidden || this.toolbar[i].num_buttons <= 0)
|
||||
continue;
|
||||
|
||||
var group = this.objects.editorFrameDoc.createElement('div');
|
||||
group.aewidth = this.buttonWidth * this.toolbar[i].num_buttons;
|
||||
|
||||
if (!toolbar || toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth > width)
|
||||
toolbar = this.addToolbar();
|
||||
else
|
||||
this.addSeparator(toolbar);
|
||||
|
||||
this.addButtonGroup(toolbar, group);
|
||||
|
||||
for (var item in this.toolbar[i].buttons) {
|
||||
var button = this.objects.editorFrameDoc.createElement('div');
|
||||
group.appendChild(button);
|
||||
|
||||
button.id = item;
|
||||
button.enabled = true;
|
||||
button.className = 'button';
|
||||
button.style.backgroundImage = 'url(' + this.config.imageURL + '/' + this.toolbar[i].buttons[item][1] + ')';
|
||||
button.title = this.toolbar[i].buttons[item][2];
|
||||
button.setAttribute('unselectable', 'on');
|
||||
registerEvent(button, 'mouseover', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mouseout', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mousedown', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'click', function (e) { self.mouseHandler(e) });
|
||||
|
||||
this.toolbarMapping[item] = i;
|
||||
if (this.toolbar[i].buttons[item][3] == 1 || this.toolbar[i].buttons[item][3] == 3)
|
||||
this.toolbarQueryCommandState[item] = i;
|
||||
else if (this.toolbar[i].buttons[item][3] == 2 || this.toolbar[i].buttons[item][3] == 4)
|
||||
this.toolbarQueryCommandEnabled[item] = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.objects.editableContent.style.fontFamily = this.config.defaultFont;
|
||||
var fontsize = {
|
||||
1 : 'xx-small',
|
||||
2 : 'x-small',
|
||||
3 : 'small',
|
||||
4 : 'medium',
|
||||
5 : 'large',
|
||||
6 : 'x-large',
|
||||
7 : 'xx-large'
|
||||
};
|
||||
this.objects.editableContent.style.fontSize = fontsize[parseInt(this.config.defaultFontSize) + (isIE ? 0 : 1)];
|
||||
this.objects.editableContent.style.backgroundColor = this.config.defaultBackground;
|
||||
|
||||
this.objects.editableFrameDoc.body.contentEditable = true;
|
||||
if (!isIE)
|
||||
this.objects.editableFrameDoc.designMode = 'on';
|
||||
|
||||
// This actually turns *off* the usage of css
|
||||
if (isMozilla)
|
||||
this.execCommand("useCSS", true);
|
||||
|
||||
this.toolbarInterval = setInterval(function () { self.updateButtonStatus(); }, 250);
|
||||
|
||||
registerEvent(this.objects.editableContent, 'dblclick', function (e) {
|
||||
if (!e) e = self.objects.editableFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
if (target.tagName == 'IMG')
|
||||
self.imageDialog();
|
||||
});
|
||||
|
||||
registerEvent(self.objects.editorFrame.contentWindow, 'resize', function () { self.resize(); });
|
||||
|
||||
if (this.config.focusOnload)
|
||||
this.focus();
|
||||
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.getContent = function (bodyOnly) {
|
||||
var content = this.objects.editableContent.innerHTML;
|
||||
if (content) {
|
||||
// Perform some clean up on the editor generated HTML
|
||||
if (isIE)
|
||||
content = content.replace(/<P>/g, '').replace(/<\/P>/g, '<BR>').replace(/\r?\n/g, '');
|
||||
else
|
||||
content = content.replace(/<br><(ol|ul)>/g, "<$1>");
|
||||
if (content.match(/^(?: )?<br>\n*$/i))
|
||||
content = '';
|
||||
if (bodyOnly)
|
||||
return content;
|
||||
else {
|
||||
var bgcolor = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor);
|
||||
var html = '<html><body';
|
||||
if (bgcolor)
|
||||
html += ' bgcolor="' + bgcolor + '"';
|
||||
html += '>' + content + '</body></html>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setContent = function (html) {
|
||||
this.objects.editableContent.innerHTML = html;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.enable = function () {
|
||||
this.changeButtonState(true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.disable = function () {
|
||||
this.changeButtonState(false);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.deleteButton = function () {
|
||||
var args = advancedEditor.prototype.deleteButton.arguments;
|
||||
if (this.loaded || !args.length) {
|
||||
alert("Can't call deleteButton() after the editor has loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
var del = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
del[args[i]] = 1;
|
||||
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
for (var button in this.toolbar[i].buttons) {
|
||||
if (del[button]) {
|
||||
delete this.toolbar[i].buttons[button];
|
||||
delete del[button];
|
||||
this.toolbar[i].num_buttons--;
|
||||
if (!del) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.changeButtonState = function (enabled) {
|
||||
var args = advancedEditor.prototype.changeButtonState.arguments;
|
||||
|
||||
var leave = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
leave[args[i]] = 1;
|
||||
|
||||
for (var id in this.toolbarMapping) {
|
||||
if (leave[id])
|
||||
continue;
|
||||
|
||||
var button = this.objects.editorFrameDoc.getElementById(id);
|
||||
if (enabled) {
|
||||
button.enabled = button.previousState;
|
||||
button.className = button.previousClass;
|
||||
button.noUpdates = false;
|
||||
}
|
||||
else {
|
||||
button.noUpdates = true;
|
||||
button.previousState = button.enabled;
|
||||
button.enabled = false;
|
||||
button.previousClass = button.className;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addToolbar = function () {
|
||||
var toolbar = this.objects.editorFrameDoc.createElement('div');
|
||||
this.objects.toolbarArea.appendChild(toolbar);
|
||||
toolbar.aewidth = 0;
|
||||
toolbar.className = 'toolbar';
|
||||
toolbar.setAttribute('unselectable', 'on');
|
||||
|
||||
this.objects.editableFrame.style.height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra - this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addButtonGroup = function (toolbar, group, beforeElement) {
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(group, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(group);
|
||||
toolbar.aewidth += group.aewidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addSeparator = function (toolbar, beforeElement) {
|
||||
var separator = this.objects.editorFrameDoc.createElement('div');
|
||||
separator.className = 'separator';
|
||||
separator.setAttribute('unselectable', 'on');
|
||||
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(separator, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(separator);
|
||||
toolbar.aewidth += this.separatorWidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.updateButtonStatus = function () {
|
||||
for (var item in this.toolbarQueryCommandState) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandState[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.mousedown || button.noUpdates)
|
||||
continue;
|
||||
var previousState = button.pressed;
|
||||
if (buttonConfig[3] == 3)
|
||||
button.pressed = eval(buttonConfig[5]);
|
||||
else
|
||||
button.pressed = this.objects.editableFrameDoc.queryCommandState(command);
|
||||
|
||||
if (previousState == button.pressed)
|
||||
continue;
|
||||
|
||||
if (button.pressed)
|
||||
button.className = 'button button-pressed' + (button.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
button.className = 'button' + (button.mouseover ? ' button-mouse-over' : '');
|
||||
}
|
||||
|
||||
for (var item in this.toolbarQueryCommandEnabled) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandEnabled[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.noUpdates)
|
||||
continue;
|
||||
var enable;
|
||||
if (buttonConfig[3] == 4)
|
||||
enable = eval(buttonConfig[5]);
|
||||
else
|
||||
enable = this.objects.editableFrameDoc.queryCommandEnabled(command);
|
||||
|
||||
if (button.enabled == enable)
|
||||
continue;
|
||||
|
||||
if (enable) {
|
||||
button.enabled = true;
|
||||
// mozilla bug loses mouseout event after changing applying the alpha transparency
|
||||
button.className = 'button' + (button.mouseover && !isMozilla ? ' button-mouse-over' : '');
|
||||
}
|
||||
else {
|
||||
button.enabled = false;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.mouseHandler = function (e) {
|
||||
if (!e) e = this.objects.editorFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
target.mouseover = true;
|
||||
break;
|
||||
case 'mouseout':
|
||||
target.mouseover = false;
|
||||
break;
|
||||
case 'mousedown':
|
||||
target.mousedown = true;
|
||||
break;
|
||||
case 'click':
|
||||
target.mousedown = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target.enabled)
|
||||
return;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
else
|
||||
target.className = 'button button-mouse-over';
|
||||
break;
|
||||
case 'mouseout':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed';
|
||||
else
|
||||
target.className = 'button';
|
||||
break;
|
||||
case 'mousedown':
|
||||
if (!target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
break;
|
||||
case 'click':
|
||||
// Only do something on a left click
|
||||
if ((e.which && e.which != 1) || (e.button && e.button != 1))
|
||||
return;
|
||||
|
||||
var button = this.toolbar[this.toolbarMapping[target.id]].buttons[target.id];
|
||||
if (button[4])
|
||||
eval(button[4]);
|
||||
else
|
||||
this.execCommand(button[0], null, button[6]);
|
||||
|
||||
if (button[3] == 1)
|
||||
target.pressed = this.objects.editableFrameDoc.queryCommandState(button[0]);
|
||||
else if (button[3] == 3)
|
||||
target.pressed = eval(button[5]);
|
||||
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed' + (target.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
target.className = 'button' + (target.mouseover ? ' button-mouse-over' : '');
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.resize = function () {
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra;
|
||||
var toolbarCount = this.objects.toolbarArea.childNodes.length;
|
||||
|
||||
for (var i = 0; i < this.objects.toolbarArea.childNodes.length; i++) {
|
||||
var toolbar = this.objects.toolbarArea.childNodes[i];
|
||||
// Window has shrunk, move overflowing buttons down to next toolbar
|
||||
while (toolbar.aewidth + this.toolbarExtra > width && toolbar.childNodes.length > 2) {
|
||||
var group = toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.aewidth -= group.aewidth + this.separatorWidth;
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
this.addSeparator(nextToolbar, nextToolbar.firstChild);
|
||||
this.addButtonGroup(nextToolbar, group, nextToolbar.firstChild);
|
||||
}
|
||||
else
|
||||
this.addButtonGroup(this.addToolbar(), group);
|
||||
}
|
||||
|
||||
// Window has grown, fill up empty space
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
var group = nextToolbar.firstChild;
|
||||
while (nextToolbar && group && toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth <= width) {
|
||||
nextToolbar.removeChild(group);
|
||||
nextToolbar.aewidth -= group.aewidth;
|
||||
if (nextToolbar.hasChildNodes()) {
|
||||
nextToolbar.removeChild(nextToolbar.firstChild);
|
||||
nextToolbar.aewidth -= this.separatorWidth;
|
||||
}
|
||||
else {
|
||||
this.objects.toolbarArea.removeChild(nextToolbar);
|
||||
nextToolbar = toolbar.nextSibling;
|
||||
}
|
||||
this.addSeparator(toolbar);
|
||||
this.addButtonGroup(toolbar, group);
|
||||
group = nextToolbar ? nextToolbar.firstChild : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toolbarCount != this.objects.toolbarArea.childNodes.length) {
|
||||
var contentHeight = height - this.toolbarHeight * this.objects.toolbarArea.childNodes.length;
|
||||
if (this.sourceMode) {
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = contentHeight + 'px';
|
||||
// Reset height back to 0px, since addToolbar() sets it
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
}
|
||||
else
|
||||
this.objects.editableFrame.style.height = contentHeight + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Set focus on the editor content area
|
||||
advancedEditor.prototype.focus = function (focusWindow) {
|
||||
if (focusWindow)
|
||||
window.focus();
|
||||
this.objects.editableFrame.contentWindow.focus();
|
||||
}
|
||||
|
||||
advancedEditor.prototype.execCommand = function (cmd, value, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
// For some commands (eg. indent, lists), without focusing it ends up running the
|
||||
// command in the toolbar area. If you comment out the focus code, then in IE
|
||||
// click in the editor, click outside the editor, then click indent, you'll see
|
||||
// the problem.
|
||||
if (isIE || isWebkit)
|
||||
this.focus();
|
||||
|
||||
var res;
|
||||
try {
|
||||
res = this.objects.editableFrameDoc.execCommand(cmd, false, value);
|
||||
}
|
||||
catch (err) {
|
||||
// debug("execCommand failed (" + cmd + " => " + value + ")" + err);
|
||||
}
|
||||
// debug("execCommand(" + cmd + ", " + value + ") => " + res + (useCSS ? ' (css)' : ''));
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.queryCommandValue = function (cmd, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
var value = this.objects.editableFrameDoc.queryCommandValue(cmd);
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
// debug("queryCommandValue(" + cmd + ") => " + value + (useCSS ? ' (css)' : ''));
|
||||
|
||||
cmd = cmd.toLowerCase();
|
||||
if (cmd == 'forecolor' || cmd == 'backcolor' || cmd == 'hilitecolor')
|
||||
return advancedEditor.getHexColor(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setColor = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values._type == 'foreground')
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
else if (dialogWindow.values._type == 'background')
|
||||
this.objects.editableContent.style.backgroundColor = dialogWindow.values.hexcolor;
|
||||
else if (dialogWindow.values._type == 'highlight')
|
||||
this.execCommand(isIE ? 'BackColor' : 'HiliteColor', dialogWindow.values.hexcolor, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setFont = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.size)
|
||||
this.execCommand('FontSize', dialogWindow.values.size);
|
||||
if (dialogWindow.values.font)
|
||||
this.execCommand('FontName', dialogWindow.values.font);
|
||||
if (dialogWindow.values.hexcolor)
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
if ((dialogWindow.values.style.indexOf('b') != -1) != dialogWindow.values._bold)
|
||||
this.execCommand('Bold');
|
||||
if ((dialogWindow.values.style.indexOf('i') != -1) != dialogWindow.values._italic)
|
||||
this.execCommand('Italic');
|
||||
if ((dialogWindow.values.underline == 'on') != dialogWindow.values._underline)
|
||||
this.execCommand('Underline');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertImage = function () {
|
||||
this.focus(1);
|
||||
var img = this.objects.editableFrameDoc.createElement('img');
|
||||
|
||||
var values = dialogWindow.values;
|
||||
img.src = values['src-url-input'];
|
||||
|
||||
if (values['src-inline'])
|
||||
img.setAttribute('gforuminline', values['src-inline-input']);
|
||||
|
||||
var currentSelection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
currentSelection.replaceSelection(img);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertLink = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.url)
|
||||
this.execCommand('CreateLink', dialogWindow.values.url);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.colorDialog = function (type) {
|
||||
var values = {
|
||||
hexcolor : null,
|
||||
_type : type,
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
|
||||
if (type == 'foreground')
|
||||
values.hexcolor = values._foreground;
|
||||
else if (type == 'background')
|
||||
values.hexcolor = values._background;
|
||||
else if (type == 'highlight')
|
||||
values.hexcolor = values._highlight;
|
||||
|
||||
this.showDialog('editor_color.html', isSafari ? 375 : 358, 200, values, 'opener.dialogWindow.editor.setColor()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.fontDialog = function () {
|
||||
var values = {
|
||||
font : null,
|
||||
style : null,
|
||||
size : null,
|
||||
underline : null,
|
||||
hexcolor : null,
|
||||
_type : 'foreground',
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values.font = this.queryCommandValue('FontName') || this.config.defaultFont;
|
||||
values.size = this.queryCommandValue('FontSize') || this.config.defaultFontSize;
|
||||
values.underline = this.objects.editableFrameDoc.queryCommandState('Underline');
|
||||
values._underline = values.underline;
|
||||
values._bold = this.objects.editableFrameDoc.queryCommandState('Bold');
|
||||
values._italic = this.objects.editableFrameDoc.queryCommandState('Italic');
|
||||
values.style = (values._bold && values._italic ? 'bi' : values._bold ? 'b' : values._italic ? 'i' : 'r');
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
values.hexcolor = values._foreground;
|
||||
|
||||
this.showDialog('editor_font.html', 447, 250, values, 'opener.dialogWindow.editor.setFont()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.imageDialog = function () {
|
||||
var values = {
|
||||
'src-inline' : null,
|
||||
'src-inline-input' : null,
|
||||
'src-url-input' : null
|
||||
};
|
||||
var url = 'editor_image.html';
|
||||
if (this.config.imageDialogURL && this.config.imageDialogURL.match(/^https?:/i))
|
||||
url = this.config.imageDialogURL;
|
||||
else
|
||||
url = parent.location.protocol + '//' + parent.location.host +
|
||||
parent.location.pathname.substr(0, parent.location.pathname.lastIndexOf('/') + 1) +
|
||||
this.config.imageDialogURL;
|
||||
this.showDialog(url, 430, 500, values, 'opener.dialogWindow.editor.insertImage()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.linkDialog = function () {
|
||||
var values = {
|
||||
protocol : null,
|
||||
url : null,
|
||||
title : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
if (selectionObjects.length == 1 && selectionObjects[0].tagName == 'A') {
|
||||
values.url = selectionObjects[0].href;
|
||||
values.protocol = values.url.replace(/^(\w+:(?:\/\/)?).*$/, "$1");
|
||||
values.title = selectionObjects[0].title;
|
||||
}
|
||||
|
||||
this.showDialog('editor_link.html', 390, 100, values, 'opener.dialogWindow.editor.insertLink()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.showDialog = function (url, width, height, values, returnCall) {
|
||||
if (dialogWindow.win && !dialogWindow.win.closed)
|
||||
dialogWindow.win.close();
|
||||
|
||||
if (url.match(/^https?:/i))
|
||||
dialogWindow.url = url;
|
||||
else
|
||||
dialogWindow.url = this.objects.editorFrame.contentWindow.location.href.replace(/editor_iframe\.html$/, '') + url;
|
||||
dialogWindow.width = width;
|
||||
dialogWindow.height = height;
|
||||
dialogWindow.name = Math.random().toString().replace(/\./, "");
|
||||
|
||||
dialogWindow.left = (screen.width - width) / 2;
|
||||
dialogWindow.top = (screen.height - height) / 2;
|
||||
dialogWindow.attribs = 'left=' + dialogWindow.left + ',top=' + dialogWindow.top +
|
||||
'location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,width=' + dialogWindow.width +
|
||||
',height=' + dialogWindow.height;
|
||||
|
||||
dialogWindow.editor = this;
|
||||
dialogWindow.values = values;
|
||||
dialogWindow.returnCall = returnCall;
|
||||
try {
|
||||
dialogWindow.win = window.open(dialogWindow.url, dialogWindow.name, dialogWindow.attribs);
|
||||
dialogWindow.win.focus();
|
||||
}
|
||||
catch (e) {
|
||||
// FIXME should we alert?
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.toggleSource = function () {
|
||||
if (!this.objects.editableSource)
|
||||
return;
|
||||
|
||||
this.sourceMode = !this.sourceMode;
|
||||
if (this.sourceMode) {
|
||||
this.changeButtonState(false, 'source');
|
||||
this.objects.editableSource.value = this.getContent();
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = this.objects.editableFrame.offsetHeight + 'px';
|
||||
this.objects.editableSource.style.visibility = 'visible';
|
||||
this.objects.editableFrame.style.visibility = 'hidden';
|
||||
// Without setting this to 0px, mozilla loses the cursor in the source textarea
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
this.objects.editableSource.focus();
|
||||
}
|
||||
else {
|
||||
this.changeButtonState(true, 'source');
|
||||
this.objects.editableContent.innerHTML = this.objects.editableSource.value;
|
||||
this.objects.editableSource.style.visibility = 'hidden';
|
||||
this.objects.editableFrame.style.height = this.objects.editableSource.style.height;
|
||||
this.objects.editableFrame.style.visibility = 'visible';
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.selectionMade = function () {
|
||||
if (this.objects.editableFrameDoc.selection)
|
||||
return this.objects.editableFrameDoc.selection.type != 'None';
|
||||
// Don't use advancedEditorSelection because in Gecko, range.cloneContents()
|
||||
// tries to re-fetch broken images, and since this gets called on a timer,
|
||||
// floods the server with requests.
|
||||
if (this.objects.editableFrame.contentWindow.getSelection)
|
||||
return this.objects.editableFrame.contentWindow.getSelection().toString().length > 0;
|
||||
}
|
||||
|
||||
advancedEditor.getHexColor = function (color) {
|
||||
function intToHex(i) {
|
||||
i = parseInt(i);
|
||||
return (i < 16 ? '0' : '') + i.toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
if (typeof(color) == 'number')
|
||||
return '#' + intToHex(color & 0xff) + intToHex((color >> 8) & 0xff) + intToHex((color >> 16) & 0xff);
|
||||
else if (typeof(color) != 'string')
|
||||
return;
|
||||
|
||||
if (color.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i))
|
||||
return '#' + intToHex(RegExp.$1) + intToHex(RegExp.$2) + intToHex(RegExp.$3);
|
||||
|
||||
if (color == 'transparent')
|
||||
return;
|
||||
|
||||
return color.toUpperCase();
|
||||
}
|
||||
|
||||
function advancedEditorSelection(documentWindow) {
|
||||
if (documentWindow.selection)
|
||||
this.document = documentWindow;
|
||||
else
|
||||
this.window = documentWindow;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelection = function () {
|
||||
if (this.document) {
|
||||
this.document.parentWindow.focus();
|
||||
this.selection = this.document.selection;
|
||||
this.range = this.selection.createRange();
|
||||
this.nodes = [];
|
||||
if (this.selection.type == 'Control') {
|
||||
for (var i = 0; i < this.range.length; i++)
|
||||
this.nodes[i] = this.range(i);
|
||||
}
|
||||
else if (this.selection.type == 'Text') {
|
||||
this.nodesContainer = this.document.createElement('span');
|
||||
this.nodesContainer.innerHTML = this.range.htmlText;
|
||||
this.nodes = this.nodesContainer.childNodes;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.selection = this.window.getSelection();
|
||||
this.nodes = [];
|
||||
if (this.selection && this.selection.getRangeAt) {
|
||||
// Safari triggers an exception when there's nothing selected
|
||||
try {
|
||||
this.range = this.selection.getRangeAt(0);
|
||||
this.documentFragment = this.range.cloneContents();
|
||||
this.nodes = this.documentFragment.childNodes;
|
||||
if (this.nodes.length == 1 && this.nodes[0].nodeType == 3 && this.nodes[0].nodeValue == '')
|
||||
this.nodes = [];
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelectionHTML = function () {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document)
|
||||
return this.range.htmlText;
|
||||
else {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(this.documentFragment);
|
||||
return div.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.replaceSelection = function (node) {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document) {
|
||||
if (this.selection.type == 'Control') {
|
||||
this.selection.clear();
|
||||
this.range = this.selection.createRange();
|
||||
}
|
||||
this.range.pasteHTML(node.outerHTML);
|
||||
}
|
||||
else {
|
||||
this.range.deleteContents();
|
||||
this.range.insertNode(node);
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* =================================================================
|
||||
* HTML Editor - A WYSIWYG web based editor for IE5.5+ and Mozilla v1.4+
|
||||
*
|
||||
* Website : http://gossamer-threads.com/
|
||||
* Support : http://gossamer-threads.com/scripts/support/
|
||||
* Revision : $Id: editor_dialog.js,v 1.2 2009/04/08 20:13:20 brewt Exp $
|
||||
*
|
||||
* Copyright (c) 2005 Gossamer Threads Inc. All Rights Reserved.
|
||||
* Redistribution in part or in whole strictly prohibited. Please
|
||||
* see LICENSE file for full details.
|
||||
* =================================================================
|
||||
*/
|
||||
|
||||
function initForm() {
|
||||
for (var item in opener.dialogWindow.values) {
|
||||
if (opener.dialogWindow.values[item] == null)
|
||||
continue;
|
||||
var obj;
|
||||
if (obj = document.getElementById(item)) {
|
||||
if (obj.type == 'radio' || obj.type == 'checkbox')
|
||||
obj.checked = opener.dialogWindow.values[item];
|
||||
else {
|
||||
obj.value = opener.dialogWindow.values[item];
|
||||
if (isWebkit && item == 'font') {
|
||||
obj.value = opener.dialogWindow.values[item].replace(/'/g, '');
|
||||
}
|
||||
if (isWebkit && item == 'size') {
|
||||
var fontsize = {
|
||||
'8px' : 0, // not used
|
||||
'10px' : 1,
|
||||
'13px' : 2,
|
||||
'16px' : 3,
|
||||
'18px' : 4,
|
||||
'24px' : 5,
|
||||
'32px' : 6,
|
||||
'48px' : 7
|
||||
};
|
||||
obj.value = fontsize[opener.dialogWindow.values[item]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
for (var item in opener.dialogWindow.values) {
|
||||
var obj;
|
||||
if (obj = document.getElementById(item))
|
||||
opener.dialogWindow.values[item] = (obj.type == 'radio' || obj.type == 'checkbox') ? obj.checked : obj.value;
|
||||
}
|
||||
if (typeof(opener.dialogWindow.returnCall) == 'function')
|
||||
opener.dialogWindow.returnCall();
|
||||
else if (opener.dialogWindow.returnCall)
|
||||
eval(opener.dialogWindow.returnCall);
|
||||
window.close();
|
||||
}
|
904
site/forum.slowtwitch.com/www/static/editor.old/editor_v166.js
Normal file
@ -0,0 +1,904 @@
|
||||
/*
|
||||
* =================================================================
|
||||
* HTML Editor - A WYSIWYG web based editor for IE5.5+ and Mozilla v1.4+
|
||||
*
|
||||
* Website : http://gossamer-threads.com/
|
||||
* Support : http://gossamer-threads.com/scripts/support/
|
||||
* Revision : $Id: editor.js,v 1.12 2009/05/09 05:52:50 brewt Exp $
|
||||
*
|
||||
* Copyright (c) 2005 Gossamer Threads Inc. All Rights Reserved.
|
||||
* Redistribution in part or in whole strictly prohibited. Please
|
||||
* see LICENSE file for full details.
|
||||
* =================================================================
|
||||
*/
|
||||
|
||||
var dialogWindow = {};
|
||||
|
||||
function advancedEditor() {
|
||||
this.config = {
|
||||
imageURL : 'images',
|
||||
imageDialogURL : '',
|
||||
defaultFont : 'Arial',
|
||||
defaultFontSize : '3',
|
||||
defaultForeground : '#000000',
|
||||
defaultBackground : '#FFFFFF',
|
||||
focusOnload : false
|
||||
};
|
||||
|
||||
this.id = {
|
||||
editorFrame : 'editor_iframe',
|
||||
toolbarArea : 'toolbar_area',
|
||||
editableFrame : 'editable_iframe',
|
||||
editableContent : 'editable_content',
|
||||
editableSource : 'editable_source',
|
||||
form : '',
|
||||
content : ''
|
||||
};
|
||||
|
||||
// command, image, title, updateType(0 = don't update, 1 = queryCommandState, 2 = queryCommandEnabled, 3 = customQueryCommandState, 4 = customQueryCommandEnabled), customCommand, customStateCommand, useCSS (mozilla)
|
||||
this.toolbar = [
|
||||
{
|
||||
buttons : {
|
||||
copy : ['Copy', 'copy.gif', 'Copy', 2],
|
||||
cut : ['Cut', 'cut.gif', 'Cut', 2],
|
||||
paste : ['Paste', 'paste.gif', 'Paste', 2]
|
||||
},
|
||||
num_buttons : 3,
|
||||
hidden : isIE ? 0 : 1
|
||||
},
|
||||
// The undo/redo buttons don't work too reliably and the buffer is lost after
|
||||
// doing things like resizing (changing any properties of the contenteditable
|
||||
// area will wipe it), or custom commands.
|
||||
/*
|
||||
{
|
||||
buttons : {
|
||||
undo : ['Undo', 'undo.gif', 'Undo', 2],
|
||||
redo : ['Redo', 'redo.gif', 'Redo', 2]
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
*/
|
||||
{
|
||||
buttons : {
|
||||
bold : ['Bold', 'bold.gif', 'Bold', 1],
|
||||
italic : ['Italic', 'italic.gif', 'Italic', 1],
|
||||
underline : ['Underline', 'underline.gif', 'Underline', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
quote : ['', 'quote.gif', 'Quote', 0, 'this.insertQuote()']
|
||||
/*
|
||||
reply : ['', 'reply.gif', 'Reply', 0, 'this.insertReply()'],
|
||||
code : ['', 'code.gif', 'Code', 0, 'this.insertCode()']
|
||||
*/
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
alignleft : ['JustifyLeft', 'alignleft.gif', 'Align Left', 1],
|
||||
center : ['JustifyCenter', 'center.gif', 'Center', 1],
|
||||
alignright : ['JustifyRight', 'alignright.gif', 'Align Right', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
numlist : ['InsertOrderedList', 'numlist.gif', 'Numbering', 1],
|
||||
bullist : ['InsertUnorderedList', 'bullist.gif', 'Bullets', 1],
|
||||
outdent : ['Outdent', 'outdent.gif', 'Decrease Indent', 0],
|
||||
indent : ['Indent', 'indent.gif', 'Increase Indent', 0]
|
||||
},
|
||||
num_buttons : 4
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
font : ['FontName', 'font.gif', 'Font', 0, 'this.fontDialog()'],
|
||||
color : ['', 'color.gif', 'Color', 0, 'this.colorDialog("foreground")']
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
hr : ['InsertHorizontalRule', 'hr.gif', 'Horizontal Rule', 0],
|
||||
image : ['', 'image.gif', 'Insert Image', 0, 'this.imageDialog()'],
|
||||
link : ['', 'link.gif', 'Create Link', 4, 'this.linkDialog()', 'this.selectionMade()']
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
source : ['', 'source.gif', 'Toggle HTML Source', 3, 'this.toggleSource()', 'this.sourceMode']
|
||||
},
|
||||
num_buttons : 1
|
||||
}
|
||||
];
|
||||
this.toolbarMapping = {};
|
||||
this.toolbarQueryCommandState = {};
|
||||
this.toolbarQueryCommandEnabled = {};
|
||||
|
||||
this.objects = {};
|
||||
this.loadingInterval = 0;
|
||||
this.initCount = 0;
|
||||
this.toolbarInterval = 0;
|
||||
this.selection = null;
|
||||
this.loaded = false;
|
||||
this.sourceMode = false;
|
||||
|
||||
// TODO remove this and get values from currentStyle
|
||||
// Dimensions of various objects
|
||||
// *Extra are padding/border/margin widths that need to be added to properly
|
||||
// calculate object total widths
|
||||
this.editorFrameExtra = 2;
|
||||
this.editableContentExtra = 10;
|
||||
this.toolbarExtra = 2;
|
||||
this.toolbarHeight = 26;
|
||||
this.buttonWidth = 25;
|
||||
this.separatorWidth = 8;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.load = function (form, content) {
|
||||
var self = this;
|
||||
if (form)
|
||||
this.id.form = form;
|
||||
if (content)
|
||||
this.id.content = content;
|
||||
this.loadingInterval = setInterval(function () { self.init() }, 100);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.init = function () {
|
||||
if (this.initCount++ > 100) {
|
||||
clearInterval(this.loadingInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.objects.editorFrame = document.getElementById(this.id.editorFrame);
|
||||
if (!this.objects.editorFrame)
|
||||
return;
|
||||
|
||||
this.objects.editorFrameDoc = this.objects.editorFrame.contentWindow.document;
|
||||
this.objects.editableSource = this.objects.editorFrameDoc.getElementById(this.id.editableSource);
|
||||
this.objects.editableFrame = this.objects.editorFrameDoc.getElementById(this.id.editableFrame);
|
||||
if (!this.objects.editableFrame)
|
||||
return;
|
||||
if (!this.objects.editableSource)
|
||||
this.deleteButton('source');
|
||||
|
||||
this.objects.editableFrameDoc = this.objects.editableFrame.contentWindow.document;
|
||||
this.objects.editableContent = this.objects.editableFrameDoc.getElementById(this.id.editableContent);
|
||||
if (!this.objects.editableContent)
|
||||
return;
|
||||
|
||||
this.objects.toolbarArea = this.objects.editorFrameDoc.getElementById(this.id.toolbarArea);
|
||||
if (!this.objects.toolbarArea)
|
||||
return;
|
||||
|
||||
clearInterval(this.loadingInterval);
|
||||
|
||||
this.objects.form = document.getElementById(this.id.form);
|
||||
this.objects.content = document.getElementById(this.id.content);
|
||||
this.objects.editableContent.innerHTML = this.objects.content.value;
|
||||
registerEvent(this.objects.form, 'submit', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
// Before leaving the page, make sure the content is put back into the input so that the content isn't lost if the user goes back to the page
|
||||
registerEvent(window, 'beforeunload', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
|
||||
// Tabbing from the subject takes you to the iframe in IE, but the document in Mozilla
|
||||
registerEvent(this.objects.editorFrame, 'focus', function () { self.focus() });
|
||||
registerEvent(this.objects.editorFrameDoc, 'focus', function () { self.focus() });
|
||||
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var toolbar;
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
if (this.toolbar[i].hidden || this.toolbar[i].num_buttons <= 0)
|
||||
continue;
|
||||
|
||||
var group = this.objects.editorFrameDoc.createElement('div');
|
||||
group.aewidth = this.buttonWidth * this.toolbar[i].num_buttons;
|
||||
|
||||
if (!toolbar || toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth > width)
|
||||
toolbar = this.addToolbar();
|
||||
else
|
||||
this.addSeparator(toolbar);
|
||||
|
||||
this.addButtonGroup(toolbar, group);
|
||||
|
||||
for (var item in this.toolbar[i].buttons) {
|
||||
var button = this.objects.editorFrameDoc.createElement('div');
|
||||
group.appendChild(button);
|
||||
|
||||
button.id = item;
|
||||
button.enabled = true;
|
||||
button.className = 'button';
|
||||
button.style.backgroundImage = 'url(' + this.config.imageURL + '/' + this.toolbar[i].buttons[item][1] + ')';
|
||||
button.title = this.toolbar[i].buttons[item][2];
|
||||
button.setAttribute('unselectable', 'on');
|
||||
registerEvent(button, 'mouseover', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mouseout', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mousedown', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'click', function (e) { self.mouseHandler(e) });
|
||||
|
||||
this.toolbarMapping[item] = i;
|
||||
if (this.toolbar[i].buttons[item][3] == 1 || this.toolbar[i].buttons[item][3] == 3)
|
||||
this.toolbarQueryCommandState[item] = i;
|
||||
else if (this.toolbar[i].buttons[item][3] == 2 || this.toolbar[i].buttons[item][3] == 4)
|
||||
this.toolbarQueryCommandEnabled[item] = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.objects.editableContent.style.fontFamily = this.config.defaultFont;
|
||||
var fontsize = {
|
||||
1 : 'xx-small',
|
||||
2 : 'x-small',
|
||||
3 : 'small',
|
||||
4 : 'medium',
|
||||
5 : 'large',
|
||||
6 : 'x-large',
|
||||
7 : 'xx-large'
|
||||
};
|
||||
this.objects.editableContent.style.fontSize = fontsize[parseInt(this.config.defaultFontSize) + (isIE ? 0 : 1)];
|
||||
this.objects.editableContent.style.backgroundColor = this.config.defaultBackground;
|
||||
|
||||
this.objects.editableFrameDoc.body.contentEditable = true;
|
||||
if (!isIE)
|
||||
this.objects.editableFrameDoc.designMode = 'on';
|
||||
|
||||
// This actually turns *off* the usage of css
|
||||
if (isMozilla)
|
||||
this.execCommand("useCSS", true);
|
||||
|
||||
this.toolbarInterval = setInterval(function () { self.updateButtonStatus(); }, 250);
|
||||
|
||||
registerEvent(this.objects.editableContent, 'dblclick', function (e) {
|
||||
if (!e) e = self.objects.editableFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
if (target.tagName == 'IMG')
|
||||
self.imageDialog();
|
||||
});
|
||||
|
||||
registerEvent(self.objects.editorFrame.contentWindow, 'resize', function () { self.resize(); });
|
||||
|
||||
if (this.config.focusOnload)
|
||||
this.focus();
|
||||
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.getContent = function (bodyOnly) {
|
||||
var content = this.objects.editableContent.innerHTML;
|
||||
if (content) {
|
||||
// Perform some clean up on the editor generated HTML
|
||||
if (isIE)
|
||||
content = content.replace(/<P>/g, '').replace(/<\/P>/g, '<BR>').replace(/\r?\n/g, '');
|
||||
else
|
||||
content = content.replace(/<br><(ol|ul)>/g, "<$1>");
|
||||
if (content.match(/^(?: )?<br>\n*$/i))
|
||||
content = '';
|
||||
if (bodyOnly)
|
||||
return content;
|
||||
else {
|
||||
var bgcolor = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor);
|
||||
var html = '<html><body';
|
||||
if (bgcolor)
|
||||
html += ' bgcolor="' + bgcolor + '"';
|
||||
html += '>' + content + '</body></html>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setContent = function (html) {
|
||||
this.objects.editableContent.innerHTML = html;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.enable = function () {
|
||||
this.changeButtonState(true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.disable = function () {
|
||||
this.changeButtonState(false);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.deleteButton = function () {
|
||||
var args = advancedEditor.prototype.deleteButton.arguments;
|
||||
if (this.loaded || !args.length) {
|
||||
alert("Can't call deleteButton() after the editor has loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
var del = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
del[args[i]] = 1;
|
||||
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
for (var button in this.toolbar[i].buttons) {
|
||||
if (del[button]) {
|
||||
delete this.toolbar[i].buttons[button];
|
||||
delete del[button];
|
||||
this.toolbar[i].num_buttons--;
|
||||
if (!del) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.changeButtonState = function (enabled) {
|
||||
var args = advancedEditor.prototype.changeButtonState.arguments;
|
||||
|
||||
var leave = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
leave[args[i]] = 1;
|
||||
|
||||
for (var id in this.toolbarMapping) {
|
||||
if (leave[id])
|
||||
continue;
|
||||
|
||||
var button = this.objects.editorFrameDoc.getElementById(id);
|
||||
if (enabled) {
|
||||
button.enabled = button.previousState;
|
||||
button.className = button.previousClass;
|
||||
button.noUpdates = false;
|
||||
}
|
||||
else {
|
||||
button.noUpdates = true;
|
||||
button.previousState = button.enabled;
|
||||
button.enabled = false;
|
||||
button.previousClass = button.className;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addToolbar = function () {
|
||||
var toolbar = this.objects.editorFrameDoc.createElement('div');
|
||||
this.objects.toolbarArea.appendChild(toolbar);
|
||||
toolbar.aewidth = 0;
|
||||
toolbar.className = 'toolbar';
|
||||
toolbar.setAttribute('unselectable', 'on');
|
||||
|
||||
this.objects.editableFrame.style.height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra - this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addButtonGroup = function (toolbar, group, beforeElement) {
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(group, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(group);
|
||||
toolbar.aewidth += group.aewidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addSeparator = function (toolbar, beforeElement) {
|
||||
var separator = this.objects.editorFrameDoc.createElement('div');
|
||||
separator.className = 'separator';
|
||||
separator.setAttribute('unselectable', 'on');
|
||||
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(separator, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(separator);
|
||||
toolbar.aewidth += this.separatorWidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.updateButtonStatus = function () {
|
||||
for (var item in this.toolbarQueryCommandState) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandState[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.mousedown || button.noUpdates)
|
||||
continue;
|
||||
var previousState = button.pressed;
|
||||
if (buttonConfig[3] == 3)
|
||||
button.pressed = eval(buttonConfig[5]);
|
||||
else
|
||||
button.pressed = this.objects.editableFrameDoc.queryCommandState(command);
|
||||
|
||||
if (previousState == button.pressed)
|
||||
continue;
|
||||
|
||||
if (button.pressed)
|
||||
button.className = 'button button-pressed' + (button.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
button.className = 'button' + (button.mouseover ? ' button-mouse-over' : '');
|
||||
}
|
||||
|
||||
for (var item in this.toolbarQueryCommandEnabled) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandEnabled[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.noUpdates)
|
||||
continue;
|
||||
var enable;
|
||||
if (buttonConfig[3] == 4)
|
||||
enable = eval(buttonConfig[5]);
|
||||
else
|
||||
enable = this.objects.editableFrameDoc.queryCommandEnabled(command);
|
||||
|
||||
if (button.enabled == enable)
|
||||
continue;
|
||||
|
||||
if (enable) {
|
||||
button.enabled = true;
|
||||
// mozilla bug loses mouseout event after changing applying the alpha transparency
|
||||
button.className = 'button' + (button.mouseover && !isMozilla ? ' button-mouse-over' : '');
|
||||
}
|
||||
else {
|
||||
button.enabled = false;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.mouseHandler = function (e) {
|
||||
if (!e) e = this.objects.editorFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
target.mouseover = true;
|
||||
break;
|
||||
case 'mouseout':
|
||||
target.mouseover = false;
|
||||
break;
|
||||
case 'mousedown':
|
||||
target.mousedown = true;
|
||||
break;
|
||||
case 'click':
|
||||
target.mousedown = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target.enabled)
|
||||
return;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
else
|
||||
target.className = 'button button-mouse-over';
|
||||
break;
|
||||
case 'mouseout':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed';
|
||||
else
|
||||
target.className = 'button';
|
||||
break;
|
||||
case 'mousedown':
|
||||
if (!target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
break;
|
||||
case 'click':
|
||||
// Only do something on a left click
|
||||
if ((e.which && e.which != 1) || (e.button && e.button != 1))
|
||||
return;
|
||||
|
||||
var button = this.toolbar[this.toolbarMapping[target.id]].buttons[target.id];
|
||||
if (button[4])
|
||||
eval(button[4]);
|
||||
else
|
||||
this.execCommand(button[0], null, button[6]);
|
||||
|
||||
if (button[3] == 1)
|
||||
target.pressed = this.objects.editableFrameDoc.queryCommandState(button[0]);
|
||||
else if (button[3] == 3)
|
||||
target.pressed = eval(button[5]);
|
||||
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed' + (target.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
target.className = 'button' + (target.mouseover ? ' button-mouse-over' : '');
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.resize = function () {
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra;
|
||||
var toolbarCount = this.objects.toolbarArea.childNodes.length;
|
||||
|
||||
for (var i = 0; i < this.objects.toolbarArea.childNodes.length; i++) {
|
||||
var toolbar = this.objects.toolbarArea.childNodes[i];
|
||||
// Window has shrunk, move overflowing buttons down to next toolbar
|
||||
while (toolbar.aewidth + this.toolbarExtra > width && toolbar.childNodes.length > 2) {
|
||||
var group = toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.aewidth -= group.aewidth + this.separatorWidth;
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
this.addSeparator(nextToolbar, nextToolbar.firstChild);
|
||||
this.addButtonGroup(nextToolbar, group, nextToolbar.firstChild);
|
||||
}
|
||||
else
|
||||
this.addButtonGroup(this.addToolbar(), group);
|
||||
}
|
||||
|
||||
// Window has grown, fill up empty space
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
var group = nextToolbar.firstChild;
|
||||
while (nextToolbar && group && toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth <= width) {
|
||||
nextToolbar.removeChild(group);
|
||||
nextToolbar.aewidth -= group.aewidth;
|
||||
if (nextToolbar.hasChildNodes()) {
|
||||
nextToolbar.removeChild(nextToolbar.firstChild);
|
||||
nextToolbar.aewidth -= this.separatorWidth;
|
||||
}
|
||||
else {
|
||||
this.objects.toolbarArea.removeChild(nextToolbar);
|
||||
nextToolbar = toolbar.nextSibling;
|
||||
}
|
||||
this.addSeparator(toolbar);
|
||||
this.addButtonGroup(toolbar, group);
|
||||
group = nextToolbar ? nextToolbar.firstChild : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toolbarCount != this.objects.toolbarArea.childNodes.length) {
|
||||
var contentHeight = height - this.toolbarHeight * this.objects.toolbarArea.childNodes.length;
|
||||
if (this.sourceMode) {
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = contentHeight + 'px';
|
||||
// Reset height back to 0px, since addToolbar() sets it
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
}
|
||||
else
|
||||
this.objects.editableFrame.style.height = contentHeight + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Set focus on the editor content area
|
||||
advancedEditor.prototype.focus = function (focusWindow) {
|
||||
if (focusWindow)
|
||||
window.focus();
|
||||
this.objects.editableFrame.contentWindow.focus();
|
||||
}
|
||||
|
||||
advancedEditor.prototype.execCommand = function (cmd, value, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
// For some commands (eg. indent, lists), without focusing it ends up running the
|
||||
// command in the toolbar area. If you comment out the focus code, then in IE
|
||||
// click in the editor, click outside the editor, then click indent, you'll see
|
||||
// the problem.
|
||||
if (isIE || isWebkit)
|
||||
this.focus();
|
||||
|
||||
var res;
|
||||
try {
|
||||
res = this.objects.editableFrameDoc.execCommand(cmd, false, value);
|
||||
}
|
||||
catch (err) {
|
||||
// debug("execCommand failed (" + cmd + " => " + value + ")" + err);
|
||||
}
|
||||
// debug("execCommand(" + cmd + ", " + value + ") => " + res + (useCSS ? ' (css)' : ''));
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.queryCommandValue = function (cmd, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
var value = this.objects.editableFrameDoc.queryCommandValue(cmd);
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
// debug("queryCommandValue(" + cmd + ") => " + value + (useCSS ? ' (css)' : ''));
|
||||
|
||||
cmd = cmd.toLowerCase();
|
||||
if (cmd == 'forecolor' || cmd == 'backcolor' || cmd == 'hilitecolor')
|
||||
return advancedEditor.getHexColor(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setColor = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values._type == 'foreground')
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
else if (dialogWindow.values._type == 'background')
|
||||
this.objects.editableContent.style.backgroundColor = dialogWindow.values.hexcolor;
|
||||
else if (dialogWindow.values._type == 'highlight')
|
||||
this.execCommand(isIE ? 'BackColor' : 'HiliteColor', dialogWindow.values.hexcolor, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setFont = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.size)
|
||||
this.execCommand('FontSize', dialogWindow.values.size);
|
||||
if (dialogWindow.values.font)
|
||||
this.execCommand('FontName', dialogWindow.values.font);
|
||||
if (dialogWindow.values.hexcolor)
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
if ((dialogWindow.values.style.indexOf('b') != -1) != dialogWindow.values._bold)
|
||||
this.execCommand('Bold');
|
||||
if ((dialogWindow.values.style.indexOf('i') != -1) != dialogWindow.values._italic)
|
||||
this.execCommand('Italic');
|
||||
if ((dialogWindow.values.underline == 'on') != dialogWindow.values._underline)
|
||||
this.execCommand('Underline');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertImage = function () {
|
||||
this.focus(1);
|
||||
var img = this.objects.editableFrameDoc.createElement('img');
|
||||
|
||||
var values = dialogWindow.values;
|
||||
img.src = values['src-url-input'];
|
||||
|
||||
if (values['src-inline'])
|
||||
img.setAttribute('gforuminline', values['src-inline-input']);
|
||||
|
||||
var currentSelection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
currentSelection.replaceSelection(img);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertLink = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.url)
|
||||
this.execCommand('CreateLink', dialogWindow.values.url);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.colorDialog = function (type) {
|
||||
var values = {
|
||||
hexcolor : null,
|
||||
_type : type,
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
|
||||
if (type == 'foreground')
|
||||
values.hexcolor = values._foreground;
|
||||
else if (type == 'background')
|
||||
values.hexcolor = values._background;
|
||||
else if (type == 'highlight')
|
||||
values.hexcolor = values._highlight;
|
||||
|
||||
this.showDialog('editor_color.html', isSafari ? 375 : 358, 200, values, 'opener.dialogWindow.editor.setColor()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.fontDialog = function () {
|
||||
var values = {
|
||||
font : null,
|
||||
style : null,
|
||||
size : null,
|
||||
underline : null,
|
||||
hexcolor : null,
|
||||
_type : 'foreground',
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values.font = this.queryCommandValue('FontName') || this.config.defaultFont;
|
||||
values.size = this.queryCommandValue('FontSize') || this.config.defaultFontSize;
|
||||
values.underline = this.objects.editableFrameDoc.queryCommandState('Underline');
|
||||
values._underline = values.underline;
|
||||
values._bold = this.objects.editableFrameDoc.queryCommandState('Bold');
|
||||
values._italic = this.objects.editableFrameDoc.queryCommandState('Italic');
|
||||
values.style = (values._bold && values._italic ? 'bi' : values._bold ? 'b' : values._italic ? 'i' : 'r');
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
values.hexcolor = values._foreground;
|
||||
|
||||
this.showDialog('editor_font.html', 447, 250, values, 'opener.dialogWindow.editor.setFont()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.imageDialog = function () {
|
||||
var values = {
|
||||
'src-inline' : null,
|
||||
'src-inline-input' : null,
|
||||
'src-url-input' : null
|
||||
};
|
||||
var url = 'editor_image.html';
|
||||
if (this.config.imageDialogURL && this.config.imageDialogURL.match(/^https?:/i))
|
||||
url = this.config.imageDialogURL;
|
||||
else
|
||||
url = parent.location.protocol + '//' + parent.location.host +
|
||||
parent.location.pathname.substr(0, parent.location.pathname.lastIndexOf('/') + 1) +
|
||||
this.config.imageDialogURL;
|
||||
this.showDialog(url, 430, 500, values, 'opener.dialogWindow.editor.insertImage()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.linkDialog = function () {
|
||||
var values = {
|
||||
protocol : null,
|
||||
url : null,
|
||||
title : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
if (selectionObjects.length == 1 && selectionObjects[0].tagName == 'A') {
|
||||
values.url = selectionObjects[0].href;
|
||||
values.protocol = values.url.replace(/^(\w+:(?:\/\/)?).*$/, "$1");
|
||||
values.title = selectionObjects[0].title;
|
||||
}
|
||||
|
||||
this.showDialog('editor_link.html', 390, 100, values, 'opener.dialogWindow.editor.insertLink()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.showDialog = function (url, width, height, values, returnCall) {
|
||||
if (dialogWindow.win && !dialogWindow.win.closed)
|
||||
dialogWindow.win.close();
|
||||
|
||||
if (url.match(/^https?:/i))
|
||||
dialogWindow.url = url;
|
||||
else
|
||||
dialogWindow.url = this.objects.editorFrame.contentWindow.location.href.replace(/editor_iframe\.html$/, '') + url;
|
||||
dialogWindow.width = width;
|
||||
dialogWindow.height = height;
|
||||
dialogWindow.name = Math.random().toString().replace(/\./, "");
|
||||
|
||||
dialogWindow.left = (screen.width - width) / 2;
|
||||
dialogWindow.top = (screen.height - height) / 2;
|
||||
dialogWindow.attribs = 'left=' + dialogWindow.left + ',top=' + dialogWindow.top +
|
||||
'location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,width=' + dialogWindow.width +
|
||||
',height=' + dialogWindow.height;
|
||||
|
||||
dialogWindow.editor = this;
|
||||
dialogWindow.values = values;
|
||||
dialogWindow.returnCall = returnCall;
|
||||
try {
|
||||
dialogWindow.win = window.open(dialogWindow.url, dialogWindow.name, dialogWindow.attribs);
|
||||
dialogWindow.win.focus();
|
||||
}
|
||||
catch (e) {
|
||||
// FIXME should we alert?
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.toggleSource = function () {
|
||||
if (!this.objects.editableSource)
|
||||
return;
|
||||
|
||||
this.sourceMode = !this.sourceMode;
|
||||
if (this.sourceMode) {
|
||||
this.changeButtonState(false, 'source');
|
||||
this.objects.editableSource.value = this.getContent();
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = this.objects.editableFrame.offsetHeight + 'px';
|
||||
this.objects.editableSource.style.visibility = 'visible';
|
||||
this.objects.editableFrame.style.visibility = 'hidden';
|
||||
// Without setting this to 0px, mozilla loses the cursor in the source textarea
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
this.objects.editableSource.focus();
|
||||
}
|
||||
else {
|
||||
this.changeButtonState(true, 'source');
|
||||
this.objects.editableContent.innerHTML = this.objects.editableSource.value;
|
||||
this.objects.editableSource.style.visibility = 'hidden';
|
||||
this.objects.editableFrame.style.height = this.objects.editableSource.style.height;
|
||||
this.objects.editableFrame.style.visibility = 'visible';
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.selectionMade = function () {
|
||||
if (this.objects.editableFrameDoc.selection)
|
||||
return this.objects.editableFrameDoc.selection.type != 'None';
|
||||
|
||||
if (this.objects.editableFrame.contentWindow.getSelection) {
|
||||
var _selection = new advancedEditorSelection(this.objects.editableFrame.contentWindow);
|
||||
return _selection.getSelectionHTML().length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.getHexColor = function (color) {
|
||||
function intToHex(i) {
|
||||
i = parseInt(i);
|
||||
return (i < 16 ? '0' : '') + i.toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
if (typeof(color) == 'number')
|
||||
return '#' + intToHex(color & 0xff) + intToHex((color >> 8) & 0xff) + intToHex((color >> 16) & 0xff);
|
||||
else if (typeof(color) != 'string')
|
||||
return;
|
||||
|
||||
if (color.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i))
|
||||
return '#' + intToHex(RegExp.$1) + intToHex(RegExp.$2) + intToHex(RegExp.$3);
|
||||
|
||||
if (color == 'transparent')
|
||||
return;
|
||||
|
||||
return color.toUpperCase();
|
||||
}
|
||||
|
||||
function advancedEditorSelection(documentWindow) {
|
||||
if (documentWindow.selection)
|
||||
this.document = documentWindow;
|
||||
else
|
||||
this.window = documentWindow;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelection = function () {
|
||||
if (this.document) {
|
||||
this.document.parentWindow.focus();
|
||||
this.selection = this.document.selection;
|
||||
this.range = this.selection.createRange();
|
||||
this.nodes = [];
|
||||
if (this.selection.type == 'Control') {
|
||||
for (var i = 0; i < this.range.length; i++)
|
||||
this.nodes[i] = this.range(i);
|
||||
}
|
||||
else if (this.selection.type == 'Text') {
|
||||
this.nodesContainer = this.document.createElement('span');
|
||||
this.nodesContainer.innerHTML = this.range.htmlText;
|
||||
this.nodes = this.nodesContainer.childNodes;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.selection = this.window.getSelection();
|
||||
this.nodes = [];
|
||||
if (this.selection && this.selection.getRangeAt) {
|
||||
// Safari triggers an exception when there's nothing selected
|
||||
try {
|
||||
this.range = this.selection.getRangeAt(0);
|
||||
this.documentFragment = this.range.cloneContents();
|
||||
this.nodes = this.documentFragment.childNodes;
|
||||
if (this.nodes.length == 1 && this.nodes[0].nodeType == 3 && this.nodes[0].nodeValue == '')
|
||||
this.nodes = [];
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelectionHTML = function () {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document)
|
||||
return this.range.htmlText;
|
||||
else {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(this.documentFragment);
|
||||
return div.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.replaceSelection = function (node) {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document) {
|
||||
if (this.selection.type == 'Control') {
|
||||
this.selection.clear();
|
||||
this.range = this.selection.createRange();
|
||||
}
|
||||
this.range.pasteHTML(node.outerHTML);
|
||||
}
|
||||
else {
|
||||
this.range.deleteContents();
|
||||
this.range.insertNode(node);
|
||||
}
|
||||
}
|
916
site/forum.slowtwitch.com/www/static/editor/editor.js
Normal file
@ -0,0 +1,916 @@
|
||||
/*
|
||||
* =================================================================
|
||||
* HTML Editor - A WYSIWYG web based editor for IE5.5+ and Mozilla v1.4+
|
||||
*
|
||||
* Website : http://gossamer-threads.com/
|
||||
* Support : http://gossamer-threads.com/scripts/support/
|
||||
* Revision : $Id: editor.js,v 1.12 2009/05/09 05:52:50 brewt Exp $
|
||||
*
|
||||
* Copyright (c) 2005 Gossamer Threads Inc. All Rights Reserved.
|
||||
* Redistribution in part or in whole strictly prohibited. Please
|
||||
* see LICENSE file for full details.
|
||||
* =================================================================
|
||||
*/
|
||||
|
||||
var dialogWindow = {};
|
||||
|
||||
function advancedEditor() {
|
||||
this.config = {
|
||||
imageURL : 'images',
|
||||
imageDialogURL : '',
|
||||
defaultFont : 'Arial',
|
||||
defaultFontSize : '3',
|
||||
defaultForeground : '#000000',
|
||||
defaultBackground : '#FFFFFF',
|
||||
focusOnload : false
|
||||
};
|
||||
|
||||
this.id = {
|
||||
editorFrame : 'editor_iframe',
|
||||
toolbarArea : 'toolbar_area',
|
||||
editableFrame : 'editable_iframe',
|
||||
editableContent : 'editable_content',
|
||||
editableSource : 'editable_source',
|
||||
form : '',
|
||||
content : ''
|
||||
};
|
||||
|
||||
// command, image, title, updateType(0 = don't update, 1 = queryCommandState, 2 = queryCommandEnabled, 3 = customQueryCommandState, 4 = customQueryCommandEnabled), customCommand, customStateCommand, useCSS (mozilla)
|
||||
this.toolbar = [
|
||||
{
|
||||
buttons : {
|
||||
copy : ['Copy', 'copy.gif', 'Copy', 2],
|
||||
cut : ['Cut', 'cut.gif', 'Cut', 2],
|
||||
paste : ['Paste', 'paste.gif', 'Paste', 2]
|
||||
},
|
||||
num_buttons : 3,
|
||||
hidden : isIE ? 0 : 1
|
||||
},
|
||||
// The undo/redo buttons don't work too reliably and the buffer is lost after
|
||||
// doing things like resizing (changing any properties of the contenteditable
|
||||
// area will wipe it), or custom commands.
|
||||
/*
|
||||
{
|
||||
buttons : {
|
||||
undo : ['Undo', 'undo.gif', 'Undo', 2],
|
||||
redo : ['Redo', 'redo.gif', 'Redo', 2]
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
*/
|
||||
{
|
||||
buttons : {
|
||||
bold : ['Bold', 'bold.gif', 'Bold', 1],
|
||||
italic : ['Italic', 'italic.gif', 'Italic', 1],
|
||||
underline : ['Underline', 'underline.gif', 'Underline', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
quote : ['', 'quote.gif', 'Quote', 0, 'this.insertQuote()']
|
||||
/*
|
||||
reply : ['', 'reply.gif', 'Reply', 0, 'this.insertReply()'],
|
||||
code : ['', 'code.gif', 'Code', 0, 'this.insertCode()']
|
||||
*/
|
||||
},
|
||||
num_buttons : 1
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
alignleft : ['JustifyLeft', 'alignleft.gif', 'Align Left', 1],
|
||||
center : ['JustifyCenter', 'center.gif', 'Center', 1],
|
||||
alignright : ['JustifyRight', 'alignright.gif', 'Align Right', 1]
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
numlist : ['InsertOrderedList', 'numlist.gif', 'Numbering', 1],
|
||||
bullist : ['InsertUnorderedList', 'bullist.gif', 'Bullets', 1],
|
||||
outdent : ['Outdent', 'outdent.gif', 'Decrease Indent', 0],
|
||||
indent : ['Indent', 'indent.gif', 'Increase Indent', 0]
|
||||
},
|
||||
num_buttons : 4
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
font : ['FontName', 'font.gif', 'Font', 0, 'this.fontDialog()'],
|
||||
color : ['', 'color.gif', 'Color', 0, 'this.colorDialog("foreground")']
|
||||
},
|
||||
num_buttons : 2
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
hr : ['InsertHorizontalRule', 'hr.gif', 'Horizontal Rule', 0],
|
||||
image : ['', 'image.gif', 'Insert Image', 0, 'this.imageDialog()'],
|
||||
link : ['', 'link.gif', 'Create Link', 4, 'this.linkDialog()', 'this.selectionMade()']
|
||||
},
|
||||
num_buttons : 3
|
||||
},
|
||||
{
|
||||
buttons : {
|
||||
source : ['', 'source.gif', 'Toggle HTML Source', 3, 'this.toggleSource()', 'this.sourceMode']
|
||||
},
|
||||
num_buttons : 1
|
||||
}
|
||||
];
|
||||
|
||||
/* not allowed to have upload image for some forum */
|
||||
if (!this.canAttach()) {
|
||||
this.toolbar[6] = {
|
||||
buttons : {
|
||||
hr : ['InsertHorizontalRule', 'hr.gif', 'Horizontal Rule', 0],
|
||||
link : ['', 'link.gif', 'Create Link', 4, 'this.linkDialog()', 'this.selectionMade()']
|
||||
},
|
||||
num_buttons : 2
|
||||
};
|
||||
}
|
||||
|
||||
this.toolbarMapping = {};
|
||||
this.toolbarQueryCommandState = {};
|
||||
this.toolbarQueryCommandEnabled = {};
|
||||
|
||||
this.objects = {};
|
||||
this.loadingInterval = 0;
|
||||
this.initCount = 0;
|
||||
this.toolbarInterval = 0;
|
||||
this.selection = null;
|
||||
this.loaded = false;
|
||||
this.sourceMode = false;
|
||||
|
||||
// TODO remove this and get values from currentStyle
|
||||
// Dimensions of various objects
|
||||
// *Extra are padding/border/margin widths that need to be added to properly
|
||||
// calculate object total widths
|
||||
this.editorFrameExtra = 2;
|
||||
this.editableContentExtra = 10;
|
||||
this.toolbarExtra = 2;
|
||||
this.toolbarHeight = 26;
|
||||
this.buttonWidth = 25;
|
||||
this.separatorWidth = 8;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.load = function (form, content) {
|
||||
var self = this;
|
||||
if (form)
|
||||
this.id.form = form;
|
||||
if (content)
|
||||
this.id.content = content;
|
||||
this.loadingInterval = setInterval(function () { self.init() }, 100);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.init = function () {
|
||||
if (this.initCount++ > 100) {
|
||||
clearInterval(this.loadingInterval);
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
this.objects.editorFrame = document.getElementById(this.id.editorFrame);
|
||||
if (!this.objects.editorFrame)
|
||||
return;
|
||||
|
||||
this.objects.editorFrameDoc = this.objects.editorFrame.contentWindow.document;
|
||||
this.objects.editableSource = this.objects.editorFrameDoc.getElementById(this.id.editableSource);
|
||||
this.objects.editableFrame = this.objects.editorFrameDoc.getElementById(this.id.editableFrame);
|
||||
if (!this.objects.editableFrame)
|
||||
return;
|
||||
if (!this.objects.editableSource)
|
||||
this.deleteButton('source');
|
||||
|
||||
this.objects.editableFrameDoc = this.objects.editableFrame.contentWindow.document;
|
||||
this.objects.editableContent = this.objects.editableFrameDoc.getElementById(this.id.editableContent);
|
||||
if (!this.objects.editableContent)
|
||||
return;
|
||||
|
||||
this.objects.toolbarArea = this.objects.editorFrameDoc.getElementById(this.id.toolbarArea);
|
||||
if (!this.objects.toolbarArea)
|
||||
return;
|
||||
|
||||
clearInterval(this.loadingInterval);
|
||||
|
||||
this.objects.form = document.getElementById(this.id.form);
|
||||
this.objects.content = document.getElementById(this.id.content);
|
||||
this.objects.editableContent.innerHTML = this.objects.content.value;
|
||||
registerEvent(this.objects.form, 'submit', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
// Before leaving the page, make sure the content is put back into the input so that the content isn't lost if the user goes back to the page
|
||||
registerEvent(window, 'beforeunload', function () {
|
||||
self.objects.content.value = self.getContent();
|
||||
});
|
||||
|
||||
// Tabbing from the subject takes you to the iframe in IE, but the document in Mozilla
|
||||
registerEvent(this.objects.editorFrame, 'focus', function () { self.focus() });
|
||||
registerEvent(this.objects.editorFrameDoc, 'focus', function () { self.focus() });
|
||||
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var toolbar;
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
if (this.toolbar[i].hidden || this.toolbar[i].num_buttons <= 0)
|
||||
continue;
|
||||
|
||||
var group = this.objects.editorFrameDoc.createElement('div');
|
||||
group.aewidth = this.buttonWidth * this.toolbar[i].num_buttons;
|
||||
|
||||
if (!toolbar || toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth > width)
|
||||
toolbar = this.addToolbar();
|
||||
else
|
||||
this.addSeparator(toolbar);
|
||||
|
||||
this.addButtonGroup(toolbar, group);
|
||||
|
||||
for (var item in this.toolbar[i].buttons) {
|
||||
var button = this.objects.editorFrameDoc.createElement('div');
|
||||
group.appendChild(button);
|
||||
|
||||
button.id = item;
|
||||
button.enabled = true;
|
||||
button.className = 'button';
|
||||
button.style.backgroundImage = 'url(' + this.config.imageURL + '/' + this.toolbar[i].buttons[item][1] + ')';
|
||||
button.title = this.toolbar[i].buttons[item][2];
|
||||
button.setAttribute('unselectable', 'on');
|
||||
registerEvent(button, 'mouseover', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mouseout', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'mousedown', function (e) { self.mouseHandler(e) });
|
||||
registerEvent(button, 'click', function (e) { self.mouseHandler(e) });
|
||||
|
||||
this.toolbarMapping[item] = i;
|
||||
if (this.toolbar[i].buttons[item][3] == 1 || this.toolbar[i].buttons[item][3] == 3)
|
||||
this.toolbarQueryCommandState[item] = i;
|
||||
else if (this.toolbar[i].buttons[item][3] == 2 || this.toolbar[i].buttons[item][3] == 4)
|
||||
this.toolbarQueryCommandEnabled[item] = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.objects.editableContent.style.fontFamily = this.config.defaultFont;
|
||||
var fontsize = {
|
||||
1 : 'xx-small',
|
||||
2 : 'x-small',
|
||||
3 : 'small',
|
||||
4 : 'medium',
|
||||
5 : 'large',
|
||||
6 : 'x-large',
|
||||
7 : 'xx-large'
|
||||
};
|
||||
this.objects.editableContent.style.fontSize = fontsize[parseInt(this.config.defaultFontSize) + (isIE ? 0 : 1)];
|
||||
this.objects.editableContent.style.backgroundColor = this.config.defaultBackground;
|
||||
|
||||
this.objects.editableFrameDoc.body.contentEditable = true;
|
||||
if (!isIE)
|
||||
this.objects.editableFrameDoc.designMode = 'on';
|
||||
|
||||
// This actually turns *off* the usage of css
|
||||
if (isMozilla)
|
||||
this.execCommand("useCSS", true);
|
||||
|
||||
this.toolbarInterval = setInterval(function () { self.updateButtonStatus(); }, 250);
|
||||
|
||||
registerEvent(this.objects.editableContent, 'dblclick', function (e) {
|
||||
if (!e) e = self.objects.editableFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
if (target.tagName == 'IMG')
|
||||
self.imageDialog();
|
||||
});
|
||||
|
||||
registerEvent(self.objects.editorFrame.contentWindow, 'resize', function () { self.resize(); });
|
||||
|
||||
if (this.config.focusOnload)
|
||||
this.focus();
|
||||
|
||||
this.loaded = true;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.getContent = function (bodyOnly) {
|
||||
var content = this.objects.editableContent.innerHTML;
|
||||
if (content) {
|
||||
// Perform some clean up on the editor generated HTML
|
||||
if (isIE)
|
||||
content = content.replace(/<P>/g, '').replace(/<\/P>/g, '<BR>').replace(/\r?\n/g, '');
|
||||
else
|
||||
content = content.replace(/<br><(ol|ul)>/g, "<$1>");
|
||||
if (content.match(/^(?: )?<br>\n*$/i))
|
||||
content = '';
|
||||
if (bodyOnly)
|
||||
return content;
|
||||
else {
|
||||
var bgcolor = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor);
|
||||
var html = '<html><body';
|
||||
if (bgcolor)
|
||||
html += ' bgcolor="' + bgcolor + '"';
|
||||
html += '>' + content + '</body></html>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setContent = function (html) {
|
||||
this.objects.editableContent.innerHTML = html;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.enable = function () {
|
||||
this.changeButtonState(true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.disable = function () {
|
||||
this.changeButtonState(false);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.deleteButton = function () {
|
||||
var args = advancedEditor.prototype.deleteButton.arguments;
|
||||
if (this.loaded || !args.length) {
|
||||
alert("Can't call deleteButton() after the editor has loaded!");
|
||||
return;
|
||||
}
|
||||
|
||||
var del = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
del[args[i]] = 1;
|
||||
|
||||
for (var i = 0; i < this.toolbar.length; i++) {
|
||||
for (var button in this.toolbar[i].buttons) {
|
||||
if (del[button]) {
|
||||
delete this.toolbar[i].buttons[button];
|
||||
delete del[button];
|
||||
this.toolbar[i].num_buttons--;
|
||||
if (!del) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.changeButtonState = function (enabled) {
|
||||
var args = advancedEditor.prototype.changeButtonState.arguments;
|
||||
|
||||
var leave = {};
|
||||
for (var i = 0; i < args.length; i++)
|
||||
leave[args[i]] = 1;
|
||||
|
||||
for (var id in this.toolbarMapping) {
|
||||
if (leave[id])
|
||||
continue;
|
||||
|
||||
var button = this.objects.editorFrameDoc.getElementById(id);
|
||||
if (enabled) {
|
||||
button.enabled = button.previousState;
|
||||
button.className = button.previousClass;
|
||||
button.noUpdates = false;
|
||||
}
|
||||
else {
|
||||
button.noUpdates = true;
|
||||
button.previousState = button.enabled;
|
||||
button.enabled = false;
|
||||
button.previousClass = button.className;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addToolbar = function () {
|
||||
var toolbar = this.objects.editorFrameDoc.createElement('div');
|
||||
this.objects.toolbarArea.appendChild(toolbar);
|
||||
toolbar.aewidth = 0;
|
||||
toolbar.className = 'toolbar';
|
||||
toolbar.setAttribute('unselectable', 'on');
|
||||
|
||||
this.objects.editableFrame.style.height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra - this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addButtonGroup = function (toolbar, group, beforeElement) {
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(group, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(group);
|
||||
toolbar.aewidth += group.aewidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.addSeparator = function (toolbar, beforeElement) {
|
||||
var separator = this.objects.editorFrameDoc.createElement('div');
|
||||
separator.className = 'separator';
|
||||
separator.setAttribute('unselectable', 'on');
|
||||
|
||||
if (beforeElement)
|
||||
toolbar.insertBefore(separator, beforeElement);
|
||||
else
|
||||
toolbar.appendChild(separator);
|
||||
toolbar.aewidth += this.separatorWidth;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.updateButtonStatus = function () {
|
||||
for (var item in this.toolbarQueryCommandState) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandState[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.mousedown || button.noUpdates)
|
||||
continue;
|
||||
var previousState = button.pressed;
|
||||
if (buttonConfig[3] == 3)
|
||||
button.pressed = eval(buttonConfig[5]);
|
||||
else
|
||||
button.pressed = this.objects.editableFrameDoc.queryCommandState(command);
|
||||
|
||||
if (previousState == button.pressed)
|
||||
continue;
|
||||
|
||||
if (button.pressed)
|
||||
button.className = 'button button-pressed' + (button.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
button.className = 'button' + (button.mouseover ? ' button-mouse-over' : '');
|
||||
}
|
||||
|
||||
for (var item in this.toolbarQueryCommandEnabled) {
|
||||
var buttonConfig = this.toolbar[this.toolbarQueryCommandEnabled[item]].buttons[item];
|
||||
var command = buttonConfig[0];
|
||||
var button = this.objects.editorFrameDoc.getElementById(item);
|
||||
|
||||
if (button.noUpdates)
|
||||
continue;
|
||||
var enable;
|
||||
if (buttonConfig[3] == 4)
|
||||
enable = eval(buttonConfig[5]);
|
||||
else
|
||||
enable = this.objects.editableFrameDoc.queryCommandEnabled(command);
|
||||
|
||||
if (button.enabled == enable)
|
||||
continue;
|
||||
|
||||
if (enable) {
|
||||
button.enabled = true;
|
||||
// mozilla bug loses mouseout event after changing applying the alpha transparency
|
||||
button.className = 'button' + (button.mouseover && !isMozilla ? ' button-mouse-over' : '');
|
||||
}
|
||||
else {
|
||||
button.enabled = false;
|
||||
button.className = 'button button-disabled';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.mouseHandler = function (e) {
|
||||
if (!e) e = this.objects.editorFrame.contentWindow.event;
|
||||
var target = e.target ? e.target : e.srcElement;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
target.mouseover = true;
|
||||
break;
|
||||
case 'mouseout':
|
||||
target.mouseover = false;
|
||||
break;
|
||||
case 'mousedown':
|
||||
target.mousedown = true;
|
||||
break;
|
||||
case 'click':
|
||||
target.mousedown = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!target.enabled)
|
||||
return;
|
||||
|
||||
switch (e.type) {
|
||||
case 'mouseover':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
else
|
||||
target.className = 'button button-mouse-over';
|
||||
break;
|
||||
case 'mouseout':
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed';
|
||||
else
|
||||
target.className = 'button';
|
||||
break;
|
||||
case 'mousedown':
|
||||
if (!target.pressed)
|
||||
target.className = 'button button-pressed button-pressed-mouse-over';
|
||||
break;
|
||||
case 'click':
|
||||
// Only do something on a left click
|
||||
if ((e.which && e.which != 1) || (e.button && e.button != 1))
|
||||
return;
|
||||
|
||||
var button = this.toolbar[this.toolbarMapping[target.id]].buttons[target.id];
|
||||
if (button[4])
|
||||
eval(button[4]);
|
||||
else
|
||||
this.execCommand(button[0], null, button[6]);
|
||||
|
||||
if (button[3] == 1)
|
||||
target.pressed = this.objects.editableFrameDoc.queryCommandState(button[0]);
|
||||
else if (button[3] == 3)
|
||||
target.pressed = eval(button[5]);
|
||||
|
||||
if (target.pressed)
|
||||
target.className = 'button button-pressed' + (target.mouseover ? ' button-pressed-mouse-over' : '');
|
||||
else
|
||||
target.className = 'button' + (target.mouseover ? ' button-mouse-over' : '');
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.resize = function () {
|
||||
var width = this.objects.editorFrame.offsetWidth - this.editorFrameExtra;
|
||||
var height = this.objects.editorFrame.offsetHeight - this.editorFrameExtra;
|
||||
var toolbarCount = this.objects.toolbarArea.childNodes.length;
|
||||
|
||||
for (var i = 0; i < this.objects.toolbarArea.childNodes.length; i++) {
|
||||
var toolbar = this.objects.toolbarArea.childNodes[i];
|
||||
// Window has shrunk, move overflowing buttons down to next toolbar
|
||||
while (toolbar.aewidth + this.toolbarExtra > width && toolbar.childNodes.length > 2) {
|
||||
var group = toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.removeChild(toolbar.lastChild);
|
||||
toolbar.aewidth -= group.aewidth + this.separatorWidth;
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
this.addSeparator(nextToolbar, nextToolbar.firstChild);
|
||||
this.addButtonGroup(nextToolbar, group, nextToolbar.firstChild);
|
||||
}
|
||||
else
|
||||
this.addButtonGroup(this.addToolbar(), group);
|
||||
}
|
||||
|
||||
// Window has grown, fill up empty space
|
||||
var nextToolbar;
|
||||
if (nextToolbar = toolbar.nextSibling) {
|
||||
var group = nextToolbar.firstChild;
|
||||
while (nextToolbar && group && toolbar.aewidth + this.toolbarExtra + this.separatorWidth + group.aewidth <= width) {
|
||||
nextToolbar.removeChild(group);
|
||||
nextToolbar.aewidth -= group.aewidth;
|
||||
if (nextToolbar.hasChildNodes()) {
|
||||
nextToolbar.removeChild(nextToolbar.firstChild);
|
||||
nextToolbar.aewidth -= this.separatorWidth;
|
||||
}
|
||||
else {
|
||||
this.objects.toolbarArea.removeChild(nextToolbar);
|
||||
nextToolbar = toolbar.nextSibling;
|
||||
}
|
||||
this.addSeparator(toolbar);
|
||||
this.addButtonGroup(toolbar, group);
|
||||
group = nextToolbar ? nextToolbar.firstChild : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toolbarCount != this.objects.toolbarArea.childNodes.length) {
|
||||
var contentHeight = height - this.toolbarHeight * this.objects.toolbarArea.childNodes.length;
|
||||
if (this.sourceMode) {
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = contentHeight + 'px';
|
||||
// Reset height back to 0px, since addToolbar() sets it
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
}
|
||||
else
|
||||
this.objects.editableFrame.style.height = contentHeight + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Set focus on the editor content area
|
||||
advancedEditor.prototype.focus = function (focusWindow) {
|
||||
if (focusWindow)
|
||||
window.focus();
|
||||
this.objects.editableFrame.contentWindow.focus();
|
||||
}
|
||||
|
||||
advancedEditor.prototype.execCommand = function (cmd, value, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
// For some commands (eg. indent, lists), without focusing it ends up running the
|
||||
// command in the toolbar area. If you comment out the focus code, then in IE
|
||||
// click in the editor, click outside the editor, then click indent, you'll see
|
||||
// the problem.
|
||||
if (isIE || isWebkit)
|
||||
this.focus();
|
||||
|
||||
var res;
|
||||
try {
|
||||
res = this.objects.editableFrameDoc.execCommand(cmd, false, value);
|
||||
}
|
||||
catch (err) {
|
||||
// debug("execCommand failed (" + cmd + " => " + value + ")" + err);
|
||||
}
|
||||
// debug("execCommand(" + cmd + ", " + value + ") => " + res + (useCSS ? ' (css)' : ''));
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.queryCommandValue = function (cmd, useCSS) {
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, false);
|
||||
|
||||
var value = this.objects.editableFrameDoc.queryCommandValue(cmd);
|
||||
|
||||
if (isMozilla && useCSS)
|
||||
this.objects.editableFrameDoc.execCommand("useCSS", false, true);
|
||||
// debug("queryCommandValue(" + cmd + ") => " + value + (useCSS ? ' (css)' : ''));
|
||||
|
||||
cmd = cmd.toLowerCase();
|
||||
if (cmd == 'forecolor' || cmd == 'backcolor' || cmd == 'hilitecolor')
|
||||
return advancedEditor.getHexColor(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setColor = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values._type == 'foreground')
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
else if (dialogWindow.values._type == 'background')
|
||||
this.objects.editableContent.style.backgroundColor = dialogWindow.values.hexcolor;
|
||||
else if (dialogWindow.values._type == 'highlight')
|
||||
this.execCommand(isIE ? 'BackColor' : 'HiliteColor', dialogWindow.values.hexcolor, true);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.setFont = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.size)
|
||||
this.execCommand('FontSize', dialogWindow.values.size);
|
||||
if (dialogWindow.values.font)
|
||||
this.execCommand('FontName', dialogWindow.values.font);
|
||||
if (dialogWindow.values.hexcolor)
|
||||
this.execCommand('ForeColor', dialogWindow.values.hexcolor);
|
||||
if ((dialogWindow.values.style.indexOf('b') != -1) != dialogWindow.values._bold)
|
||||
this.execCommand('Bold');
|
||||
if ((dialogWindow.values.style.indexOf('i') != -1) != dialogWindow.values._italic)
|
||||
this.execCommand('Italic');
|
||||
if ((dialogWindow.values.underline == 'on') != dialogWindow.values._underline)
|
||||
this.execCommand('Underline');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertImage = function () {
|
||||
this.focus(1);
|
||||
var img = this.objects.editableFrameDoc.createElement('img');
|
||||
|
||||
var values = dialogWindow.values;
|
||||
img.src = values['src-url-input'];
|
||||
|
||||
if (values['src-inline'])
|
||||
img.setAttribute('gforuminline', values['src-inline-input']);
|
||||
|
||||
var currentSelection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
currentSelection.replaceSelection(img);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.insertLink = function () {
|
||||
this.focus(1);
|
||||
if (dialogWindow.values.url)
|
||||
this.execCommand('CreateLink', dialogWindow.values.url);
|
||||
}
|
||||
|
||||
advancedEditor.prototype.colorDialog = function (type) {
|
||||
var values = {
|
||||
hexcolor : null,
|
||||
_type : type,
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
|
||||
if (type == 'foreground')
|
||||
values.hexcolor = values._foreground;
|
||||
else if (type == 'background')
|
||||
values.hexcolor = values._background;
|
||||
else if (type == 'highlight')
|
||||
values.hexcolor = values._highlight;
|
||||
|
||||
this.showDialog('editor_color.html', isSafari ? 375 : 358, 200, values, 'opener.dialogWindow.editor.setColor()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.fontDialog = function () {
|
||||
var values = {
|
||||
font : null,
|
||||
style : null,
|
||||
size : null,
|
||||
underline : null,
|
||||
hexcolor : null,
|
||||
_type : 'foreground',
|
||||
_foreground : null,
|
||||
_background : null,
|
||||
_highlight : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
|
||||
values.font = this.queryCommandValue('FontName') || this.config.defaultFont;
|
||||
values.size = this.queryCommandValue('FontSize') || this.config.defaultFontSize;
|
||||
values.underline = this.objects.editableFrameDoc.queryCommandState('Underline');
|
||||
values._underline = values.underline;
|
||||
values._bold = this.objects.editableFrameDoc.queryCommandState('Bold');
|
||||
values._italic = this.objects.editableFrameDoc.queryCommandState('Italic');
|
||||
values.style = (values._bold && values._italic ? 'bi' : values._bold ? 'b' : values._italic ? 'i' : 'r');
|
||||
|
||||
values._foreground = this.queryCommandValue('ForeColor') || this.config.defaultForeground;
|
||||
values._background = advancedEditor.getHexColor(this.objects.editableContent.style.backgroundColor) || this.config.defaultBackground;
|
||||
values._highlight = this.queryCommandValue(isIE ? 'BackColor' : 'HiliteColor', true);
|
||||
values.hexcolor = values._foreground;
|
||||
|
||||
this.showDialog('editor_font.html', 447, 250, values, 'opener.dialogWindow.editor.setFont()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.imageDialog = function () {
|
||||
var values = {
|
||||
'src-inline' : null,
|
||||
'src-inline-input' : null,
|
||||
'src-url-input' : null
|
||||
};
|
||||
var url = 'editor_image.html';
|
||||
if (this.config.imageDialogURL && this.config.imageDialogURL.match(/^https?:/i))
|
||||
url = this.config.imageDialogURL;
|
||||
else
|
||||
url = parent.location.protocol + '//' + parent.location.host +
|
||||
parent.location.pathname.substr(0, parent.location.pathname.lastIndexOf('/') + 1) +
|
||||
this.config.imageDialogURL;
|
||||
this.showDialog(url, 550, 800, values, 'opener.dialogWindow.editor.insertImage()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.linkDialog = function () {
|
||||
var values = {
|
||||
protocol : null,
|
||||
url : null,
|
||||
title : null
|
||||
};
|
||||
|
||||
values._selection = new advancedEditorSelection(isIE ? this.objects.editableFrameDoc : this.objects.editableFrame.contentWindow);
|
||||
var selectionObjects = values._selection.getSelection();
|
||||
if (selectionObjects.length == 1 && selectionObjects[0].tagName == 'A') {
|
||||
values.url = selectionObjects[0].href;
|
||||
values.protocol = values.url.replace(/^(\w+:(?:\/\/)?).*$/, "$1");
|
||||
values.title = selectionObjects[0].title;
|
||||
}
|
||||
|
||||
this.showDialog('editor_link.html', 390, 100, values, 'opener.dialogWindow.editor.insertLink()');
|
||||
}
|
||||
|
||||
advancedEditor.prototype.showDialog = function (url, width, height, values, returnCall) {
|
||||
if (dialogWindow.win && !dialogWindow.win.closed)
|
||||
dialogWindow.win.close();
|
||||
|
||||
if (url.match(/^https?:/i))
|
||||
dialogWindow.url = url;
|
||||
else
|
||||
dialogWindow.url = this.objects.editorFrame.contentWindow.location.href.replace(/editor_iframe\.html$/, '') + url;
|
||||
dialogWindow.width = width;
|
||||
dialogWindow.height = height;
|
||||
dialogWindow.name = Math.random().toString().replace(/\./, "");
|
||||
|
||||
dialogWindow.left = (screen.width - width) / 2;
|
||||
dialogWindow.top = (screen.height - height) / 2;
|
||||
dialogWindow.attribs = 'popup=1,left=' + dialogWindow.left + ',top=' + dialogWindow.top +
|
||||
'location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,width=' + dialogWindow.width +
|
||||
',height=' + dialogWindow.height;
|
||||
|
||||
dialogWindow.editor = this;
|
||||
dialogWindow.values = values;
|
||||
dialogWindow.returnCall = returnCall;
|
||||
try {
|
||||
dialogWindow.win = window.open(dialogWindow.url, dialogWindow.name, dialogWindow.attribs);
|
||||
dialogWindow.win.focus();
|
||||
}
|
||||
catch (e) {
|
||||
// FIXME should we alert?
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.toggleSource = function () {
|
||||
if (!this.objects.editableSource)
|
||||
return;
|
||||
|
||||
this.sourceMode = !this.sourceMode;
|
||||
if (this.sourceMode) {
|
||||
this.changeButtonState(false, 'source');
|
||||
this.objects.editableSource.value = this.getContent();
|
||||
this.objects.editableSource.style.top = this.toolbarHeight * this.objects.toolbarArea.childNodes.length + 'px';
|
||||
this.objects.editableSource.style.height = this.objects.editableFrame.offsetHeight + 'px';
|
||||
this.objects.editableSource.style.visibility = 'visible';
|
||||
this.objects.editableFrame.style.visibility = 'hidden';
|
||||
// Without setting this to 0px, mozilla loses the cursor in the source textarea
|
||||
this.objects.editableFrame.style.height = '0px';
|
||||
this.objects.editableSource.focus();
|
||||
}
|
||||
else {
|
||||
this.changeButtonState(true, 'source');
|
||||
this.objects.editableContent.innerHTML = this.objects.editableSource.value;
|
||||
this.objects.editableSource.style.visibility = 'hidden';
|
||||
this.objects.editableFrame.style.height = this.objects.editableSource.style.height;
|
||||
this.objects.editableFrame.style.visibility = 'visible';
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditor.prototype.selectionMade = function () {
|
||||
if (this.objects.editableFrameDoc.selection)
|
||||
return this.objects.editableFrameDoc.selection.type != 'None';
|
||||
// Don't use advancedEditorSelection because in Gecko, range.cloneContents()
|
||||
// tries to re-fetch broken images, and since this gets called on a timer,
|
||||
// floods the server with requests.
|
||||
if (this.objects.editableFrame.contentWindow.getSelection)
|
||||
return this.objects.editableFrame.contentWindow.getSelection().toString().length > 0;
|
||||
}
|
||||
|
||||
advancedEditor.getHexColor = function (color) {
|
||||
function intToHex(i) {
|
||||
i = parseInt(i);
|
||||
return (i < 16 ? '0' : '') + i.toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
if (typeof(color) == 'number')
|
||||
return '#' + intToHex(color & 0xff) + intToHex((color >> 8) & 0xff) + intToHex((color >> 16) & 0xff);
|
||||
else if (typeof(color) != 'string')
|
||||
return;
|
||||
|
||||
if (color.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i))
|
||||
return '#' + intToHex(RegExp.$1) + intToHex(RegExp.$2) + intToHex(RegExp.$3);
|
||||
|
||||
if (color == 'transparent')
|
||||
return;
|
||||
|
||||
return color.toUpperCase();
|
||||
}
|
||||
|
||||
function advancedEditorSelection(documentWindow) {
|
||||
if (documentWindow.selection)
|
||||
this.document = documentWindow;
|
||||
else
|
||||
this.window = documentWindow;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelection = function () {
|
||||
if (this.document) {
|
||||
this.document.parentWindow.focus();
|
||||
this.selection = this.document.selection;
|
||||
this.range = this.selection.createRange();
|
||||
this.nodes = [];
|
||||
if (this.selection.type == 'Control') {
|
||||
for (var i = 0; i < this.range.length; i++)
|
||||
this.nodes[i] = this.range(i);
|
||||
}
|
||||
else if (this.selection.type == 'Text') {
|
||||
this.nodesContainer = this.document.createElement('span');
|
||||
this.nodesContainer.innerHTML = this.range.htmlText;
|
||||
this.nodes = this.nodesContainer.childNodes;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.selection = this.window.getSelection();
|
||||
this.nodes = [];
|
||||
if (this.selection && this.selection.getRangeAt) {
|
||||
// Safari triggers an exception when there's nothing selected
|
||||
try {
|
||||
this.range = this.selection.getRangeAt(0);
|
||||
this.documentFragment = this.range.cloneContents();
|
||||
this.nodes = this.documentFragment.childNodes;
|
||||
if (this.nodes.length == 1 && this.nodes[0].nodeType == 3 && this.nodes[0].nodeValue == '')
|
||||
this.nodes = [];
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
return this.nodes;
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.getSelectionHTML = function () {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document)
|
||||
return this.range.htmlText;
|
||||
else {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(this.documentFragment);
|
||||
return div.innerHTML;
|
||||
}
|
||||
}
|
||||
|
||||
advancedEditorSelection.prototype.replaceSelection = function (node) {
|
||||
if (!this.selection)
|
||||
this.getSelection();
|
||||
|
||||
if (this.document) {
|
||||
if (this.selection.type == 'Control') {
|
||||
this.selection.clear();
|
||||
this.range = this.selection.createRange();
|
||||
}
|
||||
this.range.pasteHTML(node.outerHTML);
|
||||
}
|
||||
else {
|
||||
this.range.deleteContents();
|
||||
this.range.insertNode(node);
|
||||
}
|
||||
}
|
57
site/forum.slowtwitch.com/www/static/editor/editor_dialog.js
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* =================================================================
|
||||
* HTML Editor - A WYSIWYG web based editor for IE5.5+ and Mozilla v1.4+
|
||||
*
|
||||
* Website : http://gossamer-threads.com/
|
||||
* Support : http://gossamer-threads.com/scripts/support/
|
||||
* Revision : $Id: editor_dialog.js,v 1.2 2009/04/08 20:13:20 brewt Exp $
|
||||
*
|
||||
* Copyright (c) 2005 Gossamer Threads Inc. All Rights Reserved.
|
||||
* Redistribution in part or in whole strictly prohibited. Please
|
||||
* see LICENSE file for full details.
|
||||
* =================================================================
|
||||
*/
|
||||
|
||||
function initForm() {
|
||||
for (var item in opener.dialogWindow.values) {
|
||||
if (opener.dialogWindow.values[item] == null)
|
||||
continue;
|
||||
var obj;
|
||||
if (obj = document.getElementById(item)) {
|
||||
if (obj.type == 'radio' || obj.type == 'checkbox')
|
||||
obj.checked = opener.dialogWindow.values[item];
|
||||
else {
|
||||
obj.value = opener.dialogWindow.values[item];
|
||||
if (isWebkit && item == 'font') {
|
||||
obj.value = opener.dialogWindow.values[item].replace(/'/g, '');
|
||||
}
|
||||
if (isWebkit && item == 'size') {
|
||||
var fontsize = {
|
||||
'8px' : 0, // not used
|
||||
'10px' : 1,
|
||||
'13px' : 2,
|
||||
'16px' : 3,
|
||||
'18px' : 4,
|
||||
'24px' : 5,
|
||||
'32px' : 6,
|
||||
'48px' : 7
|
||||
};
|
||||
obj.value = fontsize[opener.dialogWindow.values[item]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
for (var item in opener.dialogWindow.values) {
|
||||
var obj;
|
||||
if (obj = document.getElementById(item))
|
||||
opener.dialogWindow.values[item] = (obj.type == 'radio' || obj.type == 'checkbox') ? obj.checked : obj.value;
|
||||
}
|
||||
if (typeof(opener.dialogWindow.returnCall) == 'function')
|
||||
opener.dialogWindow.returnCall();
|
||||
else if (opener.dialogWindow.returnCall)
|
||||
eval(opener.dialogWindow.returnCall);
|
||||
window.close();
|
||||
}
|
BIN
site/forum.slowtwitch.com/www/static/fileman/help/actions.gif
Normal file
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 15 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/command.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/fig2.gif
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/fig3.gif
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/fig6.gif
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/fig7.gif
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/newfile.gif
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/newfolder.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/protect.gif
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/replace.gif
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/search.gif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/toolbar.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/tools.gif
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
site/forum.slowtwitch.com/www/static/fileman/help/upload.gif
Normal file
After Width: | Height: | Size: 29 KiB |
467
site/forum.slowtwitch.com/www/static/fileman/js/date.js
Normal file
@ -0,0 +1,467 @@
|
||||
/*
|
||||
* Date prototype extensions. Doesn't depend on any
|
||||
* other code. Doens't overwrite existing methods.
|
||||
*
|
||||
* Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
|
||||
* isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
|
||||
* setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
|
||||
*
|
||||
* Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
|
||||
*
|
||||
* Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
|
||||
* I've added my name to these methods so you know who to blame if they are broken!
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* An Array of day names starting with Sunday.
|
||||
*
|
||||
* @example dayNames[0]
|
||||
* @result 'Sunday'
|
||||
*
|
||||
* @name dayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated day names starting with Sun.
|
||||
*
|
||||
* @example abbrDayNames[0]
|
||||
* @result 'Sun'
|
||||
*
|
||||
* @name abbrDayNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
|
||||
/**
|
||||
* An Array of month names starting with Janurary.
|
||||
*
|
||||
* @example monthNames[0]
|
||||
* @result 'January'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
|
||||
/**
|
||||
* An Array of abbreviated month names starting with Jan.
|
||||
*
|
||||
* @example abbrMonthNames[0]
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @name monthNames
|
||||
* @type Array
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
/**
|
||||
* The first day of the week for this locale.
|
||||
*
|
||||
* @name firstDayOfWeek
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.firstDayOfWeek = 1;
|
||||
|
||||
/**
|
||||
* The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.format = 'dd/mm/yyyy';
|
||||
//Date.format = 'mm/dd/yyyy';
|
||||
//Date.format = 'yyyy-mm-dd';
|
||||
//Date.format = 'dd mmm yy';
|
||||
|
||||
/**
|
||||
* The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
|
||||
* only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
|
||||
*
|
||||
* @name format
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fullYearStart = '20';
|
||||
|
||||
(function() {
|
||||
|
||||
/**
|
||||
* Adds a given method under the given name
|
||||
* to the Date prototype if it doesn't
|
||||
* currently exist.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function add(name, method) {
|
||||
if( !Date.prototype[name] ) {
|
||||
Date.prototype[name] = method;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the year is a leap year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isLeapYear();
|
||||
* @result true
|
||||
*
|
||||
* @name isLeapYear
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isLeapYear", function() {
|
||||
var y = this.getFullYear();
|
||||
return (y%4==0 && y%100!=0) || y%400==0;
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks if the day is a weekend day (Sat or Sun).
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekend();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekend
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekend", function() {
|
||||
return this.getDay()==0 || this.getDay()==6;
|
||||
});
|
||||
|
||||
/**
|
||||
* Check if the day is a day of the week (Mon-Fri)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.isWeekDay();
|
||||
* @result false
|
||||
*
|
||||
* @name isWeekDay
|
||||
* @type Boolean
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("isWeekDay", function() {
|
||||
return !this.isWeekend();
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the number of days in the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDaysInMonth();
|
||||
* @result 31
|
||||
*
|
||||
* @name getDaysInMonth
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDaysInMonth", function() {
|
||||
return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the day.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName();
|
||||
* @result 'Saturday'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayName(true);
|
||||
* @result 'Sat'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the name of the month.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName();
|
||||
* @result 'Janurary'
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getMonthName(true);
|
||||
* @result 'Jan'
|
||||
*
|
||||
* @param abbreviated Boolean When set to true the name will be abbreviated.
|
||||
* @name getDayName
|
||||
* @type String
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getMonthName", function(abbreviated) {
|
||||
return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getDayOfYear();
|
||||
* @result 11
|
||||
*
|
||||
* @name getDayOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getDayOfYear", function() {
|
||||
var tmpdtm = new Date("1/1/" + this.getFullYear());
|
||||
return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
|
||||
});
|
||||
|
||||
/**
|
||||
* Get the number of the week of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.getWeekOfYear();
|
||||
* @result 2
|
||||
*
|
||||
* @name getWeekOfYear
|
||||
* @type Number
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("getWeekOfYear", function() {
|
||||
return Math.ceil(this.getDayOfYear() / 7);
|
||||
});
|
||||
|
||||
/**
|
||||
* Set the day of the year.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.setDayOfYear(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Jan 01 2008 00:00:00'
|
||||
*
|
||||
* @name setDayOfYear
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("setDayOfYear", function(day) {
|
||||
this.setMonth(0);
|
||||
this.setDate(day);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of years to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addYears(1);
|
||||
* dtm.toString();
|
||||
* @result 'Mon Jan 12 2009 00:00:00'
|
||||
*
|
||||
* @name addYears
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addYears", function(num) {
|
||||
this.setFullYear(this.getFullYear() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of months to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMonths(1);
|
||||
* dtm.toString();
|
||||
* @result 'Tue Feb 12 2008 00:00:00'
|
||||
*
|
||||
* @name addMonths
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMonths", function(num) {
|
||||
var tmpdtm = this.getDate();
|
||||
|
||||
this.setMonth(this.getMonth() + num);
|
||||
|
||||
if (tmpdtm > this.getDate())
|
||||
this.addDays(-this.getDate());
|
||||
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of days to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addDays(1);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addDays
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addDays", function(num) {
|
||||
this.setDate(this.getDate() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of hours to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addHours(24);
|
||||
* dtm.toString();
|
||||
* @result 'Sun Jan 13 2008 00:00:00'
|
||||
*
|
||||
* @name addHours
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addHours", function(num) {
|
||||
this.setHours(this.getHours() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of minutes to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addMinutes(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 01:00:00'
|
||||
*
|
||||
* @name addMinutes
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addMinutes", function(num) {
|
||||
this.setMinutes(this.getMinutes() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Add a number of seconds to the date object.
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.addSeconds(60);
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name addSeconds
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
*/
|
||||
add("addSeconds", function(num) {
|
||||
this.setSeconds(this.getSeconds() + num);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
|
||||
*
|
||||
* @example var dtm = new Date();
|
||||
* dtm.zeroTime();
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:01:00'
|
||||
*
|
||||
* @name zeroTime
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("zeroTime", function() {
|
||||
this.setMilliseconds(0);
|
||||
this.setSeconds(0);
|
||||
this.setMinutes(0);
|
||||
this.setHours(0);
|
||||
return this;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a string representation of the date object according to Date.format.
|
||||
* (Date.toString may be used in other places so I purposefully didn't overwrite it)
|
||||
*
|
||||
* @example var dtm = new Date("01/12/2008");
|
||||
* dtm.asString();
|
||||
* @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name asString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
add("asString", function() {
|
||||
var r = Date.format;
|
||||
return r
|
||||
.split('yyyy').join(this.getFullYear())
|
||||
.split('yy').join((this.getFullYear() + '').substring(2))
|
||||
.split('mmm').join(this.getMonthName(true))
|
||||
.split('mm').join(_zeroPad(this.getMonth()+1))
|
||||
.split('dd').join(_zeroPad(this.getDate()));
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
|
||||
* (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
|
||||
*
|
||||
* @example var dtm = Date.fromString("12/01/2008");
|
||||
* dtm.toString();
|
||||
* @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
|
||||
*
|
||||
* @name fromString
|
||||
* @type Date
|
||||
* @cat Plugins/Methods/Date
|
||||
* @author Kelvin Luck
|
||||
*/
|
||||
Date.fromString = function(s)
|
||||
{
|
||||
var f = Date.format;
|
||||
var d = new Date('01/01/1977');
|
||||
var iY = f.indexOf('yyyy');
|
||||
if (iY > -1) {
|
||||
d.setFullYear(Number(s.substr(iY, 4)));
|
||||
} else {
|
||||
// TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
|
||||
d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
|
||||
}
|
||||
var iM = f.indexOf('mmm');
|
||||
if (iM > -1) {
|
||||
var mStr = s.substr(iM, 3);
|
||||
for (var i=0; i<Date.abbrMonthNames.length; i++) {
|
||||
if (Date.abbrMonthNames[i] == mStr) break;
|
||||
}
|
||||
d.setMonth(i);
|
||||
} else {
|
||||
d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
|
||||
}
|
||||
d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
|
||||
if (isNaN(d.getTime())) {
|
||||
return false;
|
||||
}
|
||||
return d;
|
||||
};
|
||||
|
||||
// utility method
|
||||
var _zeroPad = function(num) {
|
||||
var s = '0'+num;
|
||||
return s.substring(s.length-2)
|
||||
//return ('0'+num).substring(-2); // doesn't work on IE :(
|
||||
};
|
||||
|
||||
})();
|
3605
site/forum.slowtwitch.com/www/static/fileman/js/fileman.js
Normal file
@ -0,0 +1,543 @@
|
||||
/*
|
||||
* jQuery clueTip plugin
|
||||
* Version 0.9.8 (05/22/2008)
|
||||
* @requires jQuery v1.1.4+
|
||||
* @requires Dimensions plugin (for jQuery versions < 1.2.5)
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
;(function($) {
|
||||
/*
|
||||
* @name clueTip
|
||||
* @type jQuery
|
||||
* @cat Plugins/tooltip
|
||||
* @return jQuery
|
||||
* @author Karl Swedberg
|
||||
*
|
||||
* @credit Inspired by Cody Lindley's jTip (http://www.codylindley.com)
|
||||
* @credit Thanks to the following people for their many and varied contributions:
|
||||
Shelane Enos, Glen Lipka, Hector Santos, Torben Schreiter, Dan G. Switzer, Jörn Zaefferer
|
||||
* @credit Thanks to Jonathan Chaffer, as always, for help with the hard parts. :-)
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Displays a highly customizable tooltip when the user hovers (default) or clicks (optional) the matched element.
|
||||
* By default, the clueTip plugin loads a page indicated by the "rel" attribute via ajax and displays its contents.
|
||||
* If a "title" attribute is specified, its value is used as the clueTip's heading.
|
||||
* The attribute to be used for both the body and the heading of the clueTip is user-configurable.
|
||||
* Optionally, the clueTip's body can display content from an element on the same page.
|
||||
* * Just indicate the element's id (e.g. "#some-id") in the rel attribute.
|
||||
* Optionally, the clueTip's body can display content from the title attribute, when a delimiter is indicated.
|
||||
* * The string before the first instance of the delimiter is set as the clueTip's heading.
|
||||
* * All subsequent strings are wrapped in separate DIVs and placed in the clueTip's body.
|
||||
* The clueTip plugin allows for many, many more options. Pleasee see the examples and the option descriptions below...
|
||||
*
|
||||
*
|
||||
* @example $('#tip).cluetip();
|
||||
* @desc This is the most basic clueTip. It displays a 275px-wide clueTip on mouseover of the element with an ID of "tip." On mouseout of the element, the clueTip is hidden.
|
||||
*
|
||||
*
|
||||
* @example $('a.clue').cluetip({
|
||||
* hoverClass: 'highlight',
|
||||
* sticky: true,
|
||||
* closePosition: 'bottom',
|
||||
* closeText: '<img src="cross.png" alt="close" />',
|
||||
* truncate: 60,
|
||||
* ajaxSettings: {
|
||||
* type: 'POST'
|
||||
* }
|
||||
* });
|
||||
* @desc Displays a clueTip on mouseover of all <a> elements with class="clue". The hovered element gets a class of "highlight" added to it (so that it can be styled appropriately. This is esp. useful for non-anchor elements.). The clueTip is "sticky," which means that it will not be hidden until the user either clicks on its "close" text/graphic or displays another clueTip. The "close" text/graphic is set to diplay at the bottom of the clueTip (default is top) and display an image rather than the default "Close" text. Moreover, the body of the clueTip is truncated to the first 60 characters, which are followed by an ellipsis (...). Finally, the clueTip retrieves the content using POST rather than the $.ajax method's default "GET."
|
||||
*
|
||||
* More examples can be found at http://plugins.learningjquery.com/cluetip/demo/
|
||||
*
|
||||
* Full list of options/settings can be found at the bottom of this file and at http://plugins.learningjquery.com/cluetip/
|
||||
*/
|
||||
|
||||
var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount;
|
||||
$.fn.cluetip = function(js, options) {
|
||||
if (typeof js == 'object') {
|
||||
options = js;
|
||||
js = null;
|
||||
}
|
||||
return this.each(function(index) {
|
||||
var $this = $(this);
|
||||
|
||||
// support metadata plugin (v1.0 and 2.0)
|
||||
var opts = $.extend(false, {}, $.fn.cluetip.defaults, options || {}, $.metadata ? $this.metadata() : $.meta ? $this.data() : {});
|
||||
|
||||
// start out with no contents (for ajax activation)
|
||||
var cluetipContents = false;
|
||||
var cluezIndex = parseInt(opts.cluezIndex, 10)-1;
|
||||
var isActive = false, closeOnDelay = 0;
|
||||
|
||||
// create the cluetip divs
|
||||
if (!$('#cluetip').length) {
|
||||
$cluetipInner = $('<div id="cluetip-inner"></div>');
|
||||
$cluetipTitle = $('<h3 id="cluetip-title"></h3>');
|
||||
$cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
|
||||
$cluetip = $('<div id="cluetip"></div>').css({zIndex: opts.cluezIndex})
|
||||
.append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
|
||||
$('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
|
||||
.insertBefore('#cluetip').hide();
|
||||
$cluetip.css({position: 'absolute', zIndex: cluezIndex});
|
||||
$cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
|
||||
$cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip');
|
||||
}
|
||||
var dropShadowSteps = (opts.dropShadow) ? +opts.dropShadowSteps : 0;
|
||||
if (!$dropShadow) {
|
||||
$dropShadow = $([]);
|
||||
for (var i=0; i < dropShadowSteps; i++) {
|
||||
$dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i}));
|
||||
};
|
||||
$dropShadow.css({position: 'absolute', backgroundColor: '#000'})
|
||||
.prependTo($cluetip);
|
||||
}
|
||||
var tipAttribute = $this.attr(opts.attribute), ctClass = opts.cluetipClass;
|
||||
if (!tipAttribute && !opts.splitTitle && !js) return true;
|
||||
// if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
|
||||
if (opts.local && opts.hideLocal) { $(tipAttribute + ':first').hide(); }
|
||||
var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
|
||||
// vertical measurement variables
|
||||
var tipHeight, wHeight;
|
||||
var defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
|
||||
var sTop, linkTop, posY, tipY, mouseY, baseline;
|
||||
// horizontal measurement variables
|
||||
var tipInnerWidth = isNaN(parseInt(opts.width, 10)) ? 275 : parseInt(opts.width, 10);
|
||||
var tipWidth = tipInnerWidth + (parseInt($cluetip.css('paddingLeft'))||0) + (parseInt($cluetip.css('paddingRight'))||0) + dropShadowSteps;
|
||||
var linkWidth = this.offsetWidth;
|
||||
var linkLeft, posX, tipX, mouseX, winWidth;
|
||||
|
||||
// parse the title
|
||||
var tipParts;
|
||||
var tipTitle = (opts.attribute != 'title') ? $this.attr(opts.titleAttribute) : '';
|
||||
if (opts.splitTitle) {
|
||||
if(tipTitle == undefined) {tipTitle = '';}
|
||||
tipParts = tipTitle.split(opts.splitTitle);
|
||||
tipTitle = tipParts.shift();
|
||||
}
|
||||
var localContent;
|
||||
|
||||
/***************************************
|
||||
* ACTIVATION
|
||||
****************************************/
|
||||
|
||||
//activate clueTip
|
||||
var activate = function(event) {
|
||||
if (!opts.onActivate($this)) {
|
||||
return false;
|
||||
}
|
||||
isActive = true;
|
||||
$cluetip.removeClass().css({width: tipInnerWidth});
|
||||
if (tipAttribute == $this.attr('href')) {
|
||||
$this.css('cursor', opts.cursor);
|
||||
}
|
||||
$this.attr('title','');
|
||||
if (opts.hoverClass) {
|
||||
$this.addClass(opts.hoverClass);
|
||||
}
|
||||
linkTop = posY = $this.offset().top;
|
||||
linkLeft = $this.offset().left;
|
||||
mouseX = event.pageX;
|
||||
mouseY = event.pageY;
|
||||
if ($this[0].tagName.toLowerCase() != 'area') {
|
||||
sTop = $(document).scrollTop();
|
||||
winWidth = $(window).width();
|
||||
}
|
||||
// position clueTip horizontally
|
||||
if (opts.positionBy == 'fixed') {
|
||||
posX = linkWidth + linkLeft + lOffset;
|
||||
$cluetip.css({left: posX});
|
||||
} else {
|
||||
posX = (linkWidth > linkLeft && linkLeft > tipWidth)
|
||||
|| linkLeft + linkWidth + tipWidth + lOffset > winWidth
|
||||
? linkLeft - tipWidth - lOffset
|
||||
: linkWidth + linkLeft + lOffset;
|
||||
if ($this[0].tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
|
||||
if (mouseX + 20 + tipWidth > winWidth) {
|
||||
$cluetip.addClass(' cluetip-' + ctClass);
|
||||
posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) : mouseX - (tipWidth/2);
|
||||
} else {
|
||||
posX = mouseX + lOffset;
|
||||
}
|
||||
}
|
||||
var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
|
||||
$cluetip.css({left: (posX > 0 && opts.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)});
|
||||
}
|
||||
wHeight = $(window).height();
|
||||
|
||||
/***************************************
|
||||
* load a string from cluetip method's first argument
|
||||
***************************************/
|
||||
if (js) {
|
||||
$cluetipInner.html(js);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
/***************************************
|
||||
* load the title attribute only (or user-selected attribute).
|
||||
* clueTip title is the string before the first delimiter
|
||||
* subsequent delimiters place clueTip body text on separate lines
|
||||
***************************************/
|
||||
|
||||
else if (tipParts) {
|
||||
var tpl = tipParts.length;
|
||||
for (var i=0; i < tpl; i++){
|
||||
if (i == 0) {
|
||||
$cluetipInner.html(tipParts[i]);
|
||||
} else {
|
||||
$cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
|
||||
}
|
||||
};
|
||||
cluetipShow(pY);
|
||||
}
|
||||
/***************************************
|
||||
* load external file via ajax
|
||||
***************************************/
|
||||
|
||||
else if (!opts.local && tipAttribute.indexOf('#') != 0) {
|
||||
if (cluetipContents && opts.ajaxCache) {
|
||||
$cluetipInner.html(cluetipContents);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
else {
|
||||
var ajaxSettings = opts.ajaxSettings;
|
||||
ajaxSettings.url = tipAttribute;
|
||||
ajaxSettings.beforeSend = function() {
|
||||
$cluetipOuter.children().empty();
|
||||
if (opts.waitImage) {
|
||||
$('#cluetip-waitimage')
|
||||
.css({top: mouseY+20, left: mouseX+20})
|
||||
.show();
|
||||
}
|
||||
};
|
||||
ajaxSettings.error = function() {
|
||||
if (isActive) {
|
||||
$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
|
||||
}
|
||||
};
|
||||
ajaxSettings.success = function(data) {
|
||||
cluetipContents = opts.ajaxProcess(data);
|
||||
if (isActive) {
|
||||
$cluetipInner.html(cluetipContents);
|
||||
}
|
||||
};
|
||||
ajaxSettings.complete = function() {
|
||||
imgCount = $('#cluetip-inner img').length;
|
||||
if (imgCount && !$.browser.opera) {
|
||||
$('#cluetip-inner img').load(function() {
|
||||
imgCount--;
|
||||
if (imgCount<1) {
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (isActive) cluetipShow(pY);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (isActive) cluetipShow(pY);
|
||||
}
|
||||
};
|
||||
$.ajax(ajaxSettings);
|
||||
}
|
||||
|
||||
/***************************************
|
||||
* load an element from the same page
|
||||
***************************************/
|
||||
} else if (opts.local){
|
||||
var $localContent = $(tipAttribute + ':first');
|
||||
var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html();
|
||||
$.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip);
|
||||
cluetipShow(pY);
|
||||
}
|
||||
};
|
||||
|
||||
// get dimensions and options for cluetip and prepare it to be shown
|
||||
var cluetipShow = function(bpY) {
|
||||
$cluetip.addClass('cluetip-' + ctClass);
|
||||
|
||||
if (opts.truncate) {
|
||||
var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
|
||||
$cluetipInner.html($truncloaded);
|
||||
}
|
||||
function doNothing() {}; //empty function
|
||||
tipTitle ? $cluetipTitle.show().html(tipTitle) : (opts.showTitle) ? $cluetipTitle.show().html(' ') : $cluetipTitle.hide();
|
||||
if (opts.sticky) {
|
||||
var $closeLink = $('<div id="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
|
||||
(opts.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (opts.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
|
||||
$closeLink.click(function() {
|
||||
cluetipClose();
|
||||
return false;
|
||||
});
|
||||
if (opts.mouseOutClose) {
|
||||
if ($.fn.hoverIntent && opts.hoverIntent) {
|
||||
$cluetip.hoverIntent({
|
||||
over: doNothing,
|
||||
timeout: opts.hoverIntent.timeout,
|
||||
out: function() { $closeLink.trigger('click'); }
|
||||
});
|
||||
} else {
|
||||
$cluetip.hover(doNothing,
|
||||
function() {$closeLink.trigger('click'); });
|
||||
}
|
||||
} else {
|
||||
$cluetip.unbind('mouseout');
|
||||
}
|
||||
}
|
||||
// now that content is loaded, finish the positioning
|
||||
var direction = '';
|
||||
$cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
|
||||
tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10);
|
||||
tipY = posY;
|
||||
baseline = sTop + wHeight;
|
||||
if (opts.positionBy == 'fixed') {
|
||||
tipY = posY - opts.dropShadowSteps + tOffset;
|
||||
} else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || opts.positionBy == 'bottomTop') {
|
||||
if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) {
|
||||
tipY = mouseY - tipHeight - tOffset;
|
||||
direction = 'top';
|
||||
} else {
|
||||
tipY = mouseY + tOffset;
|
||||
direction = 'bottom';
|
||||
}
|
||||
} else if ( posY + tipHeight + tOffset > baseline ) {
|
||||
tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
|
||||
} else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
|
||||
tipY = bpY - tOffset;
|
||||
} else {
|
||||
tipY = posY - opts.dropShadowSteps;
|
||||
}
|
||||
if (direction == '') {
|
||||
posX < linkLeft ? direction = 'left' : direction = 'right';
|
||||
}
|
||||
$cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass);
|
||||
if (opts.arrows) { // set up arrow positioning to align with element
|
||||
var bgY = (posY - tipY - opts.dropShadowSteps);
|
||||
$cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show();
|
||||
} else {
|
||||
$cluetipArrows.hide();
|
||||
}
|
||||
|
||||
// (first hide, then) ***SHOW THE CLUETIP***
|
||||
$dropShadow.hide();
|
||||
$cluetip.hide()[opts.fx.open](opts.fx.open != 'show' && opts.fx.openSpeed);
|
||||
if (opts.dropShadow) $dropShadow.css({height: tipHeight, width: tipInnerWidth}).show();
|
||||
if ($.fn.bgiframe) { $cluetip.bgiframe(); }
|
||||
// trigger the optional onShow function
|
||||
if (opts.delayedClose > 0) {
|
||||
closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
|
||||
}
|
||||
opts.onShow($cluetip, $cluetipInner);
|
||||
|
||||
};
|
||||
|
||||
/***************************************
|
||||
=INACTIVATION
|
||||
-------------------------------------- */
|
||||
var inactivate = function() {
|
||||
isActive = false;
|
||||
$('#cluetip-waitimage').hide();
|
||||
if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
|
||||
cluetipClose();
|
||||
clearTimeout(closeOnDelay);
|
||||
};
|
||||
if (opts.hoverClass) {
|
||||
$this.removeClass(opts.hoverClass);
|
||||
}
|
||||
$('.cluetip-clicked').removeClass('cluetip-clicked');
|
||||
};
|
||||
// close cluetip and reset some things
|
||||
var cluetipClose = function() {
|
||||
$cluetipOuter
|
||||
.parent().hide().removeClass().end()
|
||||
.children().empty();
|
||||
if (tipTitle) {
|
||||
$this.attr(opts.titleAttribute, tipTitle);
|
||||
}
|
||||
$this.css('cursor','');
|
||||
if (opts.arrows) $cluetipArrows.css({top: ''});
|
||||
};
|
||||
|
||||
/***************************************
|
||||
=BIND EVENTS
|
||||
-------------------------------------- */
|
||||
// activate by click
|
||||
if ( (/click|toggle/).test(opts.activation) ) {
|
||||
$this.click(function(event) {
|
||||
if ($cluetip.is(':hidden') || !$this.is('.cluetip-clicked')) {
|
||||
activate(event);
|
||||
$('.cluetip-clicked').removeClass('cluetip-clicked');
|
||||
$this.addClass('cluetip-clicked');
|
||||
|
||||
} else {
|
||||
inactivate(event);
|
||||
|
||||
}
|
||||
this.blur();
|
||||
return false;
|
||||
});
|
||||
// activate by focus; inactivate by blur
|
||||
} else if (opts.activation == 'focus') {
|
||||
$this.focus(function(event) {
|
||||
activate(event);
|
||||
});
|
||||
$this.blur(function(event) {
|
||||
inactivate(event);
|
||||
});
|
||||
// activate by hover
|
||||
// clicking is returned false if cluetip url is same as href url
|
||||
} else {
|
||||
$this.click(function() {
|
||||
if ($this.attr('href') && $this.attr('href') == tipAttribute && !opts.clickThrough) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//set up mouse tracking
|
||||
var mouseTracks = function(evt) {
|
||||
if (opts.tracking == true) {
|
||||
var trackX = posX - evt.pageX;
|
||||
var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
|
||||
$this.mousemove(function(evt) {
|
||||
$cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
|
||||
});
|
||||
}
|
||||
};
|
||||
if ($.fn.hoverIntent && opts.hoverIntent) {
|
||||
$this.mouseover(function() {$this.attr('title',''); })
|
||||
.hoverIntent({
|
||||
sensitivity: opts.hoverIntent.sensitivity,
|
||||
interval: opts.hoverIntent.interval,
|
||||
over: function(event) {
|
||||
activate(event);
|
||||
mouseTracks(event);
|
||||
},
|
||||
timeout: opts.hoverIntent.timeout,
|
||||
out: function(event) {inactivate(event); $this.unbind('mousemove');}
|
||||
});
|
||||
} else {
|
||||
$this.hover(function(event) {
|
||||
activate(event);
|
||||
mouseTracks(event);
|
||||
}, function(event) {
|
||||
inactivate(event);
|
||||
$this.unbind('mousemove');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* options for clueTip
|
||||
*
|
||||
* each one can be explicitly overridden by changing its value.
|
||||
* for example: $.fn.cluetip.defaults.width = 200;
|
||||
* would change the default width for all clueTips to 200.
|
||||
*
|
||||
* each one can also be overridden by passing an options map to the cluetip method.
|
||||
* for example: $('a.example').cluetip({width: 200});
|
||||
* would change the default width to 200 for clueTips invoked by a link with class of "example"
|
||||
*
|
||||
*/
|
||||
|
||||
$.fn.cluetip.defaults = { // set up default options
|
||||
width: 275, // The width of the clueTip
|
||||
height: 'auto', // The height of the clueTip
|
||||
cluezIndex: 97, // Sets the z-index style property of the clueTip
|
||||
positionBy: 'auto', // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'fixed'
|
||||
topOffset: 15, // Number of px to offset clueTip from top of invoking element
|
||||
leftOffset: 15, // Number of px to offset clueTip from left of invoking element
|
||||
local: false, // Whether to use content from the same page for the clueTip's body
|
||||
hideLocal: true, // If local option is set to true, this determines whether local content
|
||||
// to be shown in clueTip should be hidden at its original location
|
||||
attribute: 'rel', // the attribute to be used for fetching the clueTip's body content
|
||||
titleAttribute: 'title', // the attribute to be used for fetching the clueTip's title
|
||||
splitTitle: '', // A character used to split the title attribute into the clueTip title and divs
|
||||
// within the clueTip body. more info below [6]
|
||||
showTitle: true, // show title bar of the clueTip, even if title attribute not set
|
||||
cluetipClass: 'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
|
||||
hoverClass: '', // class applied to the invoking element onmouseover and removed onmouseout
|
||||
waitImage: true, // whether to show a "loading" img, which is set in jquery.cluetip.css
|
||||
cursor: 'help',
|
||||
arrows: false, // if true, displays arrow on appropriate side of clueTip
|
||||
dropShadow: true, // set to false if you don't want the drop-shadow effect on the clueTip
|
||||
dropShadowSteps: 6, // adjusts the size of the drop shadow
|
||||
sticky: false, // keep visible until manually closed
|
||||
mouseOutClose: false, // close when clueTip is moused out
|
||||
activation: 'hover', // set to 'click' to force user to click to show clueTip
|
||||
// set to 'focus' to show on focus of a form element and hide on blur
|
||||
clickThrough: false, // if true, and activation is not 'click', then clicking on link will take user to the link's href,
|
||||
// even if href and tipAttribute are equal
|
||||
tracking: false, // if true, clueTip will track mouse movement (experimental)
|
||||
delayedClose: 0, // close clueTip on a timed delay (experimental)
|
||||
closePosition: 'top', // location of close text for sticky cluetips; can be 'top' or 'bottom' or 'title'
|
||||
closeText: 'Close', // text (or HTML) to to be clicked to close sticky clueTips
|
||||
truncate: 0, // number of characters to truncate clueTip's contents. if 0, no truncation occurs
|
||||
|
||||
// effect and speed for opening clueTips
|
||||
fx: {
|
||||
open: 'show', // can be 'show' or 'slideDown' or 'fadeIn'
|
||||
openSpeed: ''
|
||||
},
|
||||
|
||||
// settings for when hoverIntent plugin is used
|
||||
hoverIntent: {
|
||||
sensitivity: 3,
|
||||
interval: 50,
|
||||
timeout: 0
|
||||
},
|
||||
|
||||
// function to run just before clueTip is shown.
|
||||
onActivate: function(e) {return true;},
|
||||
|
||||
// function to run just after clueTip is shown.
|
||||
onShow: function(ct, c){},
|
||||
|
||||
// whether to cache results of ajax request to avoid unnecessary hits to server
|
||||
ajaxCache: true,
|
||||
|
||||
// process data retrieved via xhr before it's displayed
|
||||
ajaxProcess: function(data) {
|
||||
data = data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g, '').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');
|
||||
return data;
|
||||
},
|
||||
|
||||
// can pass in standard $.ajax() parameters, not including error, complete, success, and url
|
||||
ajaxSettings: {
|
||||
dataType: 'html'
|
||||
},
|
||||
debug: false
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Global defaults for clueTips. Apply to all calls to the clueTip plugin.
|
||||
*
|
||||
* @example $.cluetip.setup({
|
||||
* insertionType: 'prependTo',
|
||||
* insertionElement: '#container'
|
||||
* });
|
||||
*
|
||||
* @property
|
||||
* @name $.cluetip.setup
|
||||
* @type Map
|
||||
* @cat Plugins/tooltip
|
||||
* @option String insertionType: Default is 'appendTo'. Determines the method to be used for inserting the clueTip into the DOM. Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter'
|
||||
* @option String insertionElement: Default is 'body'. Determines which element in the DOM the plugin will reference when inserting the clueTip.
|
||||
*
|
||||
*/
|
||||
|
||||
var insertionType = 'appendTo', insertionElement = 'body';
|
||||
$.cluetip = {};
|
||||
$.cluetip.setup = function(options) {
|
||||
if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
|
||||
insertionType = options.insertionType;
|
||||
}
|
||||
if (options && options.insertionElement) {
|
||||
insertionElement = options.insertionElement;
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
1056
site/forum.slowtwitch.com/www/static/fileman/js/jquery.datePicker.js
Normal file
869
site/forum.slowtwitch.com/www/static/fileman/js/jquery.form.js
Normal file
@ -0,0 +1,869 @@
|
||||
/*
|
||||
* jQuery Form Plugin
|
||||
* version: 2.07 (03/04/2008)
|
||||
* @requires jQuery v1.2.2 or later
|
||||
*
|
||||
* Examples at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.form.js,v 1.1 2008/07/21 22:54:09 bao Exp $
|
||||
*/
|
||||
(function($) {
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
|
||||
*
|
||||
* ajaxSubmit accepts a single argument which can be either a success callback function
|
||||
* or an options Object. If a function is provided it will be invoked upon successful
|
||||
* completion of the submit and will be passed the response from the server.
|
||||
* If an options Object is provided, the following attributes are supported:
|
||||
*
|
||||
* target: Identifies the element(s) in the page to be updated with the server response.
|
||||
* This value may be specified as a jQuery selection string, a jQuery object,
|
||||
* or a DOM element.
|
||||
* default value: null
|
||||
*
|
||||
* url: URL to which the form data will be submitted.
|
||||
* default value: value of form's 'action' attribute
|
||||
*
|
||||
* type: The method in which the form data should be submitted, 'GET' or 'POST'.
|
||||
* default value: value of form's 'method' attribute (or 'GET' if none found)
|
||||
*
|
||||
* data: Additional data to add to the request, specified as key/value pairs (see $.ajax).
|
||||
*
|
||||
* beforeSubmit: Callback method to be invoked before the form is submitted.
|
||||
* default value: null
|
||||
*
|
||||
* success: Callback method to be invoked after the form has been successfully submitted
|
||||
* and the response has been returned from the server
|
||||
* default value: null
|
||||
*
|
||||
* dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json'
|
||||
* default value: null
|
||||
*
|
||||
* semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
|
||||
* default value: false
|
||||
*
|
||||
* resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
|
||||
*
|
||||
* clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
|
||||
*
|
||||
*
|
||||
* The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
|
||||
* validating the form data. If the 'beforeSubmit' callback returns false then the form will
|
||||
* not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
|
||||
* in array format, the jQuery object, and the options object passed into ajaxSubmit.
|
||||
* The form data array takes the following form:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* If a 'success' callback method is provided it is invoked after the response has been returned
|
||||
* from the server. It is passed the responseText or responseXML value (depending on dataType).
|
||||
* See jQuery.ajax for further details.
|
||||
*
|
||||
*
|
||||
* The dataType option provides a means for specifying how the server response should be handled.
|
||||
* This maps directly to the jQuery.httpData method. The following values are supported:
|
||||
*
|
||||
* 'xml': if dataType == 'xml' the server response is treated as XML and the 'success'
|
||||
* callback method, if specified, will be passed the responseXML value
|
||||
* 'json': if dataType == 'json' the server response will be evaluted and passed to
|
||||
* the 'success' callback, if specified
|
||||
* 'script': if dataType == 'script' the server response is evaluated in the global context
|
||||
*
|
||||
*
|
||||
* Note that it does not make sense to use both the 'target' and 'dataType' options. If both
|
||||
* are provided the target will be ignored.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
*
|
||||
* When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
|
||||
*
|
||||
* $("#form-id").submit(function() {
|
||||
* $(this).ajaxSubmit(options);
|
||||
* return false; // cancel conventional submit
|
||||
* });
|
||||
*
|
||||
* When using ajaxForm(), however, this is done for you.
|
||||
*
|
||||
* @example
|
||||
* $('#myForm').ajaxSubmit(function(data) {
|
||||
* alert('Form submit succeeded! Server returned: ' + data);
|
||||
* });
|
||||
* @desc Submit form and alert server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and update page element with server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Submit form and alert the server response
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Pre-submit validation which aborts the submit operation if form data is empty
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myJsonUrl.php,
|
||||
* dataType: 'json',
|
||||
* success: function(data) {
|
||||
* // 'data' is an object representing the the evaluated json data
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc json data returned and evaluated
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* url: myXmlUrl.php,
|
||||
* dataType: 'xml',
|
||||
* success: function(responseXML) {
|
||||
* // responseXML is XML document object
|
||||
* var data = $('myElement', responseXML).text();
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc XML data returned from server
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* resetForm: true
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc submit form and reset it if successful
|
||||
*
|
||||
* @example
|
||||
* $('#myForm).submit(function() {
|
||||
* $(this).ajaxSubmit();
|
||||
* return false;
|
||||
* });
|
||||
* @desc Bind form's submit event to use ajaxSubmit
|
||||
*
|
||||
*
|
||||
* @name ajaxSubmit
|
||||
* @type jQuery
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @cat Plugins/Form
|
||||
* @return jQuery
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
if (typeof options == 'function')
|
||||
options = { success: options };
|
||||
|
||||
options = $.extend({
|
||||
url: this.attr('action') || window.location.toString(),
|
||||
type: this.attr('method') || 'GET'
|
||||
}, options || {});
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) return this;
|
||||
|
||||
var a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (var n in options.data)
|
||||
a.push( { name: n, value: options.data[n] } );
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) return this;
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else
|
||||
options.data = q; // data is the query string for 'post'
|
||||
|
||||
var $form = this, callbacks = [];
|
||||
if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
|
||||
if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
$(options.target).html(data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success)
|
||||
callbacks.push(options.success);
|
||||
|
||||
options.success = function(data, status) {
|
||||
for (var i=0, max=callbacks.length; i < max; i++)
|
||||
callbacks[i](data, status, $form);
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var files = $('input:file', this).fieldValue();
|
||||
var found = false;
|
||||
for (var j=0; j < files.length; j++)
|
||||
if (files[j])
|
||||
found = true;
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
if (options.iframe || found) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if ($.browser.safari && options.closeKeepAlive)
|
||||
$.get(options.closeKeepAlive, fileUpload);
|
||||
else
|
||||
fileUpload();
|
||||
}
|
||||
else
|
||||
$.ajax(options);
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload() {
|
||||
var form = $form[0];
|
||||
var opts = $.extend({}, $.ajaxSettings, options);
|
||||
|
||||
var id = 'jqFormIO' + (new Date().getTime());
|
||||
var $io = $('<iframe id="' + id + '" name="' + id + '" />');
|
||||
var io = $io[0];
|
||||
var op8 = $.browser.opera && window.opera.version() < 9;
|
||||
if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
|
||||
var xhr = { // mock object
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {}
|
||||
};
|
||||
|
||||
var g = opts.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) $.event.trigger("ajaxStart");
|
||||
if (g) $.event.trigger("ajaxSend", [xhr, opts]);
|
||||
|
||||
var cbInvoked = 0;
|
||||
var timedOut = 0;
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
setTimeout(function() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
$form.attr({
|
||||
target: id,
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data',
|
||||
method: 'POST',
|
||||
action: opts.url
|
||||
});
|
||||
|
||||
// support timout
|
||||
if (opts.timeout)
|
||||
setTimeout(function() { timedOut = true; cb(); }, opts.timeout);
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (options.extraData)
|
||||
for (var n in options.extraData)
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
|
||||
.appendTo(form)[0]);
|
||||
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
$form.attr('action', a);
|
||||
t ? $form.attr('target', t) : $form.removeAttr('target');
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}, 10);
|
||||
|
||||
function cb() {
|
||||
if (cbInvoked++) return;
|
||||
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var ok = true;
|
||||
try {
|
||||
if (timedOut) throw 'timeout';
|
||||
// extract the server response from the iframe
|
||||
var data, doc;
|
||||
doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
||||
xhr.responseText = doc.body ? doc.body.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': opts.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
|
||||
if (opts.dataType == 'json' || opts.dataType == 'script') {
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
xhr.responseText = ta ? ta.value : xhr.responseText;
|
||||
}
|
||||
else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
data = $.httpData(xhr, opts.dataType);
|
||||
}
|
||||
catch(e){
|
||||
ok = false;
|
||||
$.handleError(opts, xhr, 'error', e);
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (ok) {
|
||||
opts.success(data, 'success');
|
||||
if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
|
||||
}
|
||||
if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
|
||||
if (g && ! --$.active) $.event.trigger("ajaxStop");
|
||||
if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
function toXml(s, doc) {
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* Note that for accurate x/y coordinates of image submit elements in all browsers
|
||||
* you need to also use the "dimensions" plugin (this method will auto-detect its presence).
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself. See ajaxSubmit for a full description of the options argument.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* target: '#myTargetDiv'
|
||||
* };
|
||||
* $('#myForm').ajaxSForm(options);
|
||||
* @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
|
||||
* when the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* success: function(responseText) {
|
||||
* alert(responseText);
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that server response is alerted after the form is submitted.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var options = {
|
||||
* beforeSubmit: function(formArray, jqForm) {
|
||||
* if (formArray.length == 0) {
|
||||
* alert('Please enter data.');
|
||||
* return false;
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
* $('#myForm').ajaxSubmit(options);
|
||||
* @desc Bind form's submit event so that pre-submit callback is invoked before the form
|
||||
* is submitted.
|
||||
*
|
||||
*
|
||||
* @name ajaxForm
|
||||
* @param options object literal containing options which control the form submission process
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
}).each(function() {
|
||||
// store options in hash
|
||||
$(":submit,input:image", this).bind('click.form-plugin',function(e) {
|
||||
var $form = this.form;
|
||||
$form.clk = this;
|
||||
if (this.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
$form.clk_x = e.offsetX;
|
||||
$form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $(this).offset();
|
||||
$form.clk_x = e.pageX - offset.left;
|
||||
$form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
$form.clk_x = e.pageX - this.offsetLeft;
|
||||
$form.clk_y = e.pageY - this.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { $form.clk = $form.clk_x = $form.clk_y = null; }, 10);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
*
|
||||
* @name ajaxFormUnbind
|
||||
* @return jQuery
|
||||
* @cat Plugins/Form
|
||||
* @type jQuery
|
||||
*/
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
this.unbind('submit.form-plugin');
|
||||
return this.each(function() {
|
||||
$(":submit,input:image", this).unbind('click.form-plugin');
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* This is normally true anyway, unless the form contains input elements of type='image'.
|
||||
* If your form must be submitted with name/value pairs in semantic order and your form
|
||||
* contains an input of type='image" then pass true for this arg, otherwise pass false
|
||||
* (or nothing) to avoid the overhead for this logic.
|
||||
*
|
||||
* @example var data = $("#myForm").formToArray();
|
||||
* $.post( "myscript.cgi", data );
|
||||
* @desc Collect all the data from a form and submit it to the server.
|
||||
*
|
||||
* @name formToArray
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type Array<Object>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length == 0) return a;
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
continue;
|
||||
}
|
||||
|
||||
var v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle them here
|
||||
var inputs = form.getElementsByTagName("input");
|
||||
for(var i=0, max=inputs.length; i < max; i++) {
|
||||
var input = inputs[i];
|
||||
var n = input.name;
|
||||
if(n && !input.disabled && input.type == "image" && form.clk == input)
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The semantic argument can be used to force form serialization in semantic order.
|
||||
* If your form must be submitted with name/value pairs in semantic order then pass
|
||||
* true for this arg, otherwise pass false (or nothing) to avoid the overhead for
|
||||
* this logic (which can be significant for very large forms).
|
||||
*
|
||||
* @example var data = $("#myForm").formSerialize();
|
||||
* $.ajax('POST', "myscript.cgi", data);
|
||||
* @desc Collect all the data from a form into a single string
|
||||
*
|
||||
* @name formSerialize
|
||||
* @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*
|
||||
* The successful argument controls whether or not serialization is limited to
|
||||
* 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true.
|
||||
*
|
||||
* @example var data = $("input").fieldSerialize();
|
||||
* @desc Collect the data from all successful input elements into a query string
|
||||
*
|
||||
* @example var data = $(":radio").fieldSerialize();
|
||||
* @desc Collect the data from all successful radio input elements into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldSerialize();
|
||||
* @desc Collect the data from all successful checkbox input elements in myForm into a query string
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldSerialize(false);
|
||||
* @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
|
||||
*
|
||||
* @example var data = $(":input").fieldSerialize();
|
||||
* @desc Collect the data from all successful input, select, textarea and button elements into a query string
|
||||
*
|
||||
* @name fieldSerialize
|
||||
* @param successful true if only successful controls should be serialized (default is true)
|
||||
* @type String
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) return;
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++)
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
a.push({name: this.name, value: v});
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*
|
||||
* @example var data = $("#myPasswordElement").fieldValue();
|
||||
* alert(data[0]);
|
||||
* @desc Alerts the current value of the myPasswordElement element
|
||||
*
|
||||
* @example var data = $("#myForm :input").fieldValue();
|
||||
* @desc Get the value(s) of the form elements in myForm
|
||||
*
|
||||
* @example var data = $("#myForm :checkbox").fieldValue();
|
||||
* @desc Get the value(s) for the successful checkbox element(s) in the jQuery object.
|
||||
*
|
||||
* @example var data = $("#mySingleSelect").fieldValue();
|
||||
* @desc Get the value(s) of the select control
|
||||
*
|
||||
* @example var data = $(':text').fieldValue();
|
||||
* @desc Get the value(s) of the text input or textarea elements
|
||||
*
|
||||
* @example var data = $("#myMultiSelect").fieldValue();
|
||||
* @desc Get the values for the select-multiple control
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Boolean successful true if only the values for successful controls should be returned (default is true)
|
||||
* @type Array<String>
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
|
||||
continue;
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If the given element is not
|
||||
* successful and the successful arg is not false then the returned value will be null.
|
||||
*
|
||||
* Note: If the successful flag is true (default) but the element is not successful, the return will be null
|
||||
* Note: The value returned for a successful select-multiple element will always be an array.
|
||||
* Note: If the element has no value the return value will be undefined.
|
||||
*
|
||||
* @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
|
||||
* @desc Gets the current value of the myPasswordElement element
|
||||
*
|
||||
* @name fieldValue
|
||||
* @param Element el The DOM element for which the value will be returned
|
||||
* @param Boolean successful true if value returned must be for a successful controls (default is true)
|
||||
* @type String or Array<String> or null or undefined
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
// extra pain for IE...
|
||||
var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('form').clearForm();
|
||||
* @desc Clears all forms on the page.
|
||||
*
|
||||
* @name clearForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements. Takes the following actions on the matched elements:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*
|
||||
* @example $('.myInputs').clearFields();
|
||||
* @desc Clears all inputs with class myInputs
|
||||
*
|
||||
* @name clearFields
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (t == 'text' || t == 'password' || tag == 'textarea')
|
||||
this.value = '';
|
||||
else if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = false;
|
||||
else if (tag == 'select')
|
||||
this.selectedIndex = -1;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*
|
||||
* @example $('form').resetForm();
|
||||
* @desc Resets all forms on the page.
|
||||
*
|
||||
* @name resetForm
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
|
||||
this.reset();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*
|
||||
* @example $(':radio').enabled(false);
|
||||
* @desc Disables all radio buttons
|
||||
*
|
||||
* @name select
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b == undefined) b = true;
|
||||
return this.each(function() {
|
||||
this.disabled = !b
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*
|
||||
* @example $(':checkbox').select();
|
||||
* @desc Checks all checkboxes
|
||||
*
|
||||
* @name select
|
||||
* @type jQuery
|
||||
* @cat Plugins/Form
|
||||
*/
|
||||
$.fn.select = function(select) {
|
||||
if (select == undefined) select = true;
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio')
|
||||
this.checked = select;
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').select(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* hoverIntent is similar to jQuery's built-in "hover" function except that
|
||||
* instead of firing the onMouseOver event immediately, hoverIntent checks
|
||||
* to see if the user's mouse has slowed down (beneath the sensitivity
|
||||
* threshold) before firing the onMouseOver event.
|
||||
*
|
||||
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2
|
||||
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
|
||||
*
|
||||
* hoverIntent is currently available for use in all personal or commercial
|
||||
* projects under both MIT and GPL licenses. This means that you can choose
|
||||
* the license that best suits your project, and use it accordingly.
|
||||
*
|
||||
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
|
||||
* $("ul li").hoverIntent( showNav , hideNav );
|
||||
*
|
||||
* // advanced usage receives configuration object only
|
||||
* $("ul li").hoverIntent({
|
||||
* sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
|
||||
* interval: 50, // number = milliseconds of polling interval
|
||||
* over: showNav, // function = onMouseOver callback (required)
|
||||
* timeout: 100, // number = milliseconds delay before onMouseOut function call
|
||||
* out: hideNav // function = onMouseOut callback (required)
|
||||
* });
|
||||
*
|
||||
* @param f onMouseOver function || An object with configuration options
|
||||
* @param g onMouseOut function || Nothing (use configuration options object)
|
||||
* @return The object (aka "this") that called hoverIntent, and the event object
|
||||
* @author Brian Cherne <brian@cherne.net>
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.hoverIntent = function(f,g) {
|
||||
// default configuration options
|
||||
var cfg = {
|
||||
sensitivity: 7,
|
||||
interval: 100,
|
||||
timeout: 0
|
||||
};
|
||||
// override configuration options with user supplied object
|
||||
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
||||
|
||||
// instantiate variables
|
||||
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
||||
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
||||
var cX, cY, pX, pY;
|
||||
|
||||
// A private function for getting mouse position
|
||||
var track = function(ev) {
|
||||
cX = ev.pageX;
|
||||
cY = ev.pageY;
|
||||
};
|
||||
|
||||
// A private function for comparing current and previous mouse position
|
||||
var compare = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
// compare mouse positions to see if they've crossed the threshold
|
||||
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
||||
$(ob).unbind("mousemove",track);
|
||||
// set hoverIntent state to true (so mouseOut can be called)
|
||||
ob.hoverIntent_s = 1;
|
||||
return cfg.over.apply(ob,[ev]);
|
||||
} else {
|
||||
// set previous coordinates for next time
|
||||
pX = cX; pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
||||
}
|
||||
};
|
||||
|
||||
// A private function for delaying the mouseOut function
|
||||
var delay = function(ev,ob) {
|
||||
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
||||
ob.hoverIntent_s = 0;
|
||||
return cfg.out.apply(ob,[ev]);
|
||||
};
|
||||
|
||||
// A private function for handling mouse 'hovering'
|
||||
var handleHover = function(e) {
|
||||
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
||||
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
||||
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
||||
if ( p == this ) { return false; }
|
||||
|
||||
// copy objects to be passed into t (required for event object to be passed in IE)
|
||||
var ev = jQuery.extend({},e);
|
||||
var ob = this;
|
||||
|
||||
// cancel hoverIntent timer if it exists
|
||||
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
||||
|
||||
// else e.type == "onmouseover"
|
||||
if (e.type == "mouseover") {
|
||||
// set "previous" X and Y position based on initial entry point
|
||||
pX = ev.pageX; pY = ev.pageY;
|
||||
// update "current" X and Y position based on mousemove
|
||||
$(ob).bind("mousemove",track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
||||
|
||||
// else e.type == "onmouseout"
|
||||
} else {
|
||||
// unbind expensive mousemove event
|
||||
$(ob).unbind("mousemove",track);
|
||||
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
||||
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
||||
}
|
||||
};
|
||||
|
||||
// bind the function to the two event listeners
|
||||
return this.mouseover(handleHover).mouseout(handleHover);
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* jqModal - Minimalist Modaling with jQuery
|
||||
*
|
||||
* Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* $Version: 2007.08.17 +r11
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.jqm=function(o){
|
||||
var _o = {
|
||||
zIndex: 3000,
|
||||
overlay: 50,
|
||||
overlayClass: 'jqmOverlay',
|
||||
closeClass: 'jqmClose',
|
||||
trigger: '.jqModal',
|
||||
ajax: false,
|
||||
target: false,
|
||||
modal: false,
|
||||
toTop: false,
|
||||
onShow: false,
|
||||
onHide: false,
|
||||
onLoad: false
|
||||
};
|
||||
return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
|
||||
H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
|
||||
if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
|
||||
});};
|
||||
|
||||
$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
|
||||
$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
|
||||
$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
|
||||
$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};
|
||||
|
||||
$.jqm = {
|
||||
hash:{},
|
||||
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
|
||||
if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
|
||||
else if(c.overlay > 0)h.w.jqmAddClose(o);
|
||||
else o=false;
|
||||
|
||||
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
|
||||
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
|
||||
|
||||
if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
|
||||
r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
|
||||
else if(cc)h.w.jqmAddClose($(cc,h.w));
|
||||
|
||||
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
|
||||
(c.onShow)?c.onShow(h):h.w.show();e(h);return false;
|
||||
},
|
||||
close:function(s){var h=H[s];h.a=false;
|
||||
if(A[0]){A.pop();if(!A[0])F('unbind');}
|
||||
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
|
||||
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
|
||||
}};
|
||||
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
|
||||
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
|
||||
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
|
||||
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
|
||||
F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
|
||||
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
|
||||
hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
|
||||
$(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
|
||||
})(jQuery);
|
32
site/forum.slowtwitch.com/www/static/fileman/js/jquery.min.js
vendored
Normal file
144
site/forum.slowtwitch.com/www/static/fileman/js/jquery.timers.js
Normal file
@ -0,0 +1,144 @@
|
||||
/* http://jquery.offput.ca/every/ */
|
||||
|
||||
jQuery.fn.extend({
|
||||
everyTime: function(interval, label, fn, times, belay) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.add(this, interval, label, fn, times, belay);
|
||||
});
|
||||
},
|
||||
oneTime: function(interval, label, fn) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.add(this, interval, label, fn, 1);
|
||||
});
|
||||
},
|
||||
stopTime: function(label, fn) {
|
||||
return this.each(function() {
|
||||
jQuery.timer.remove(this, label, fn);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.extend({
|
||||
timer: {
|
||||
guid: 1,
|
||||
global: {},
|
||||
regex: /^([0-9]+)\s*(.*s)?$/,
|
||||
powers: {
|
||||
// Yeah this is major overkill...
|
||||
'ms': 1,
|
||||
'cs': 10,
|
||||
'ds': 100,
|
||||
's': 1000,
|
||||
'das': 10000,
|
||||
'hs': 100000,
|
||||
'ks': 1000000
|
||||
},
|
||||
timeParse: function(value) {
|
||||
if (value == undefined || value == null)
|
||||
return null;
|
||||
var result = this.regex.exec(jQuery.trim(value.toString()));
|
||||
if (result[2]) {
|
||||
var num = parseInt(result[1], 10);
|
||||
var mult = this.powers[result[2]] || 1;
|
||||
return num * mult;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
add: function(element, interval, label, fn, times, belay) {
|
||||
var counter = 0;
|
||||
|
||||
if (jQuery.isFunction(label)) {
|
||||
if (!times)
|
||||
times = fn;
|
||||
fn = label;
|
||||
label = interval;
|
||||
}
|
||||
|
||||
interval = jQuery.timer.timeParse(interval);
|
||||
|
||||
if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
|
||||
return;
|
||||
|
||||
if (times && times.constructor != Number) {
|
||||
belay = !!times;
|
||||
times = 0;
|
||||
}
|
||||
|
||||
times = times || 0;
|
||||
belay = belay || false;
|
||||
|
||||
if (!element.$timers)
|
||||
element.$timers = {};
|
||||
|
||||
if (!element.$timers[label])
|
||||
element.$timers[label] = {};
|
||||
|
||||
fn.$timerID = fn.$timerID || this.guid++;
|
||||
|
||||
var handler = function() {
|
||||
if (belay && this.inProgress)
|
||||
return;
|
||||
this.inProgress = true;
|
||||
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
|
||||
jQuery.timer.remove(element, label, fn);
|
||||
this.inProgress = false;
|
||||
};
|
||||
|
||||
handler.$timerID = fn.$timerID;
|
||||
|
||||
if (!element.$timers[label][fn.$timerID])
|
||||
element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
|
||||
|
||||
if ( !this.global[label] )
|
||||
this.global[label] = [];
|
||||
this.global[label].push( element );
|
||||
|
||||
},
|
||||
remove: function(element, label, fn) {
|
||||
var timers = element.$timers, ret;
|
||||
|
||||
if ( timers ) {
|
||||
|
||||
if (!label) {
|
||||
for ( label in timers )
|
||||
this.remove(element, label, fn);
|
||||
} else if ( timers[label] ) {
|
||||
if ( fn ) {
|
||||
if ( fn.$timerID ) {
|
||||
window.clearInterval(timers[label][fn.$timerID]);
|
||||
delete timers[label][fn.$timerID];
|
||||
}
|
||||
} else {
|
||||
for ( var fn in timers[label] ) {
|
||||
window.clearInterval(timers[label][fn]);
|
||||
delete timers[label][fn];
|
||||
}
|
||||
}
|
||||
|
||||
for ( ret in timers[label] ) break;
|
||||
if ( !ret ) {
|
||||
ret = null;
|
||||
delete timers[label];
|
||||
}
|
||||
}
|
||||
|
||||
for ( ret in timers ) break;
|
||||
if ( !ret )
|
||||
element.$timers = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (jQuery.browser.msie)
|
||||
jQuery(window).one("unload", function() {
|
||||
var global = jQuery.timer.global;
|
||||
for ( var label in global ) {
|
||||
var els = global[label], i = els.length;
|
||||
while ( --i )
|
||||
jQuery.timer.remove(els[i], label);
|
||||
}
|
||||
});
|
||||
|
||||
|
154
site/forum.slowtwitch.com/www/static/fileman/tinymce/langs/en.js
Normal file
@ -0,0 +1,154 @@
|
||||
tinyMCE.addI18n({en:{
|
||||
common:{
|
||||
edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
|
||||
apply:"Apply",
|
||||
insert:"Insert",
|
||||
update:"Update",
|
||||
cancel:"Cancel",
|
||||
close:"Close",
|
||||
browse:"Browse",
|
||||
class_name:"Class",
|
||||
not_set:"-- Not set --",
|
||||
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
|
||||
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
|
||||
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
|
||||
invalid_data:"Error: Invalid values entered, these are marked in red.",
|
||||
more_colors:"More colors"
|
||||
},
|
||||
contextmenu:{
|
||||
align:"Alignment",
|
||||
left:"Left",
|
||||
center:"Center",
|
||||
right:"Right",
|
||||
full:"Full"
|
||||
},
|
||||
insertdatetime:{
|
||||
date_fmt:"%Y-%m-%d",
|
||||
time_fmt:"%H:%M:%S",
|
||||
insertdate_desc:"Insert date",
|
||||
inserttime_desc:"Insert time",
|
||||
months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
|
||||
months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
|
||||
day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
|
||||
day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
|
||||
},
|
||||
print:{
|
||||
print_desc:"Print"
|
||||
},
|
||||
preview:{
|
||||
preview_desc:"Preview"
|
||||
},
|
||||
directionality:{
|
||||
ltr_desc:"Direction left to right",
|
||||
rtl_desc:"Direction right to left"
|
||||
},
|
||||
layer:{
|
||||
insertlayer_desc:"Insert new layer",
|
||||
forward_desc:"Move forward",
|
||||
backward_desc:"Move backward",
|
||||
absolute_desc:"Toggle absolute positioning",
|
||||
content:"New layer..."
|
||||
},
|
||||
save:{
|
||||
save_desc:"Save",
|
||||
cancel_desc:"Cancel all changes"
|
||||
},
|
||||
nonbreaking:{
|
||||
nonbreaking_desc:"Insert non-breaking space character"
|
||||
},
|
||||
iespell:{
|
||||
iespell_desc:"Run spell checking",
|
||||
download:"ieSpell not detected. Do you want to install it now?"
|
||||
},
|
||||
advhr:{
|
||||
advhr_desc:"Horizontal rule"
|
||||
},
|
||||
emotions:{
|
||||
emotions_desc:"Emotions"
|
||||
},
|
||||
searchreplace:{
|
||||
search_desc:"Find",
|
||||
replace_desc:"Find/Replace"
|
||||
},
|
||||
advimage:{
|
||||
image_desc:"Insert/edit image"
|
||||
},
|
||||
advlink:{
|
||||
link_desc:"Insert/edit link"
|
||||
},
|
||||
xhtmlxtras:{
|
||||
cite_desc:"Citation",
|
||||
abbr_desc:"Abbreviation",
|
||||
acronym_desc:"Acronym",
|
||||
del_desc:"Deletion",
|
||||
ins_desc:"Insertion",
|
||||
attribs_desc:"Insert/Edit Attributes"
|
||||
},
|
||||
style:{
|
||||
desc:"Edit CSS Style"
|
||||
},
|
||||
paste:{
|
||||
paste_text_desc:"Paste as Plain Text",
|
||||
paste_word_desc:"Paste from Word",
|
||||
selectall_desc:"Select All"
|
||||
},
|
||||
paste_dlg:{
|
||||
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
|
||||
text_linebreaks:"Keep linebreaks",
|
||||
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
|
||||
},
|
||||
table:{
|
||||
desc:"Inserts a new table",
|
||||
row_before_desc:"Insert row before",
|
||||
row_after_desc:"Insert row after",
|
||||
delete_row_desc:"Delete row",
|
||||
col_before_desc:"Insert column before",
|
||||
col_after_desc:"Insert column after",
|
||||
delete_col_desc:"Remove column",
|
||||
split_cells_desc:"Split merged table cells",
|
||||
merge_cells_desc:"Merge table cells",
|
||||
row_desc:"Table row properties",
|
||||
cell_desc:"Table cell properties",
|
||||
props_desc:"Table properties",
|
||||
paste_row_before_desc:"Paste table row before",
|
||||
paste_row_after_desc:"Paste table row after",
|
||||
cut_row_desc:"Cut table row",
|
||||
copy_row_desc:"Copy table row",
|
||||
del:"Delete table",
|
||||
row:"Row",
|
||||
col:"Column",
|
||||
cell:"Cell"
|
||||
},
|
||||
autosave:{
|
||||
unload_msg:"The changes you made will be lost if you navigate away from this page."
|
||||
},
|
||||
fullscreen:{
|
||||
desc:"Toggle fullscreen mode"
|
||||
},
|
||||
media:{
|
||||
desc:"Insert / edit embedded media",
|
||||
edit:"Edit embedded media"
|
||||
},
|
||||
fullpage:{
|
||||
desc:"Document properties"
|
||||
},
|
||||
template:{
|
||||
desc:"Insert predefined template content"
|
||||
},
|
||||
visualchars:{
|
||||
desc:"Visual control characters on/off."
|
||||
},
|
||||
spellchecker:{
|
||||
desc:"Toggle spellchecker",
|
||||
menu:"Spellchecker settings",
|
||||
ignore_word:"Ignore word",
|
||||
ignore_words:"Ignore all",
|
||||
langs:"Languages",
|
||||
wait:"Please wait...",
|
||||
sug:"Suggestions",
|
||||
no_sug:"No suggestions",
|
||||
no_mpell:"No misspellings found."
|
||||
},
|
||||
pagebreak:{
|
||||
desc:"Insert page break."
|
||||
}}});
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.AdvancedHRPlugin',{init:function(ed,url){ed.addCommand('mceAdvancedHr',function(){ed.windowManager.open({file:url+'/rule.htm',width:250+parseInt(ed.getLang('advhr.delta_width',0)),height:160+parseInt(ed.getLang('advhr.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('advhr',{title:'advhr.advhr_desc',cmd:'mceAdvancedHr'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('advhr',n.nodeName=='HR');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='HR')ed.selection.select(e);});},getInfo:function(){return{longname:'Advanced HR',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advhr',tinymce.plugins.AdvancedHRPlugin);})();
|
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedHRPlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvancedHr', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/rule.htm',
|
||||
width : 250 + parseInt(ed.getLang('advhr.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('advhr.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('advhr', {
|
||||
title : 'advhr.advhr_desc',
|
||||
cmd : 'mceAdvancedHr'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('advhr', n.nodeName == 'HR');
|
||||
});
|
||||
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'HR')
|
||||
ed.selection.select(e);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced HR',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advhr',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advhr', tinymce.plugins.AdvancedHRPlugin);
|
||||
})();
|
@ -0,0 +1,43 @@
|
||||
var AdvHRDialog = {
|
||||
init : function(ed) {
|
||||
var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
|
||||
|
||||
w = dom.getAttrib(n, 'width');
|
||||
f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
|
||||
f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
|
||||
f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
|
||||
selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
|
||||
|
||||
h = '<hr';
|
||||
|
||||
if (f.size.value) {
|
||||
h += ' size="' + f.size.value + '"';
|
||||
st += ' height:' + f.size.value + 'px;';
|
||||
}
|
||||
|
||||
if (f.width.value) {
|
||||
h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
|
||||
st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
|
||||
}
|
||||
|
||||
if (f.noshade.checked) {
|
||||
h += ' noshade="noshade"';
|
||||
st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
|
||||
}
|
||||
|
||||
if (ed.settings.inline_styles)
|
||||
h += ' style="' + tinymce.trim(st) + '"';
|
||||
|
||||
h += ' />';
|
||||
|
||||
ed.execCommand("mceInsertContent", false, h);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);
|
@ -0,0 +1,5 @@
|
||||
tinyMCE.addI18n('en.advhr_dlg',{
|
||||
width:"Width",
|
||||
size:"Height",
|
||||
noshade:"No shadow"
|
||||
});
|
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advhr.advhr_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/rule.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<link href="css/advhr.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body>
|
||||
<form onsubmit="AdvHRDialog.update();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advhr.advhr_desc}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="width">{#advhr_dlg.width}</label></td>
|
||||
<td nowrap="nowrap">
|
||||
<input id="width" name="width" type="text" value="" class="mceFocus" />
|
||||
<select name="width2" id="width2">
|
||||
<option value="">px</option>
|
||||
<option value="%">%</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="size">{#advhr_dlg.size}</label></td>
|
||||
<td><select id="size" name="size">
|
||||
<option value="">Normal</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="noshade">{#advhr_dlg.noshade}</label></td>
|
||||
<td><input type="checkbox" name="noshade" id="noshade" class="radio" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.AdvancedImagePlugin',{init:function(ed,url){ed.addCommand('mceAdvImage',function(){if(ed.dom.getAttrib(ed.selection.getNode(),'class').indexOf('mceItem')!=-1)return;ed.windowManager.open({file:url+'/image.htm',width:480+parseInt(ed.getLang('advimage.delta_width',0)),height:385+parseInt(ed.getLang('advimage.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('image',{title:'advimage.image_desc',cmd:'mceAdvImage'});},getInfo:function(){return{longname:'Advanced image',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advimage',tinymce.plugins.AdvancedImagePlugin);})();
|
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedImagePlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvImage', function() {
|
||||
// Internal image object like a flash placeholder
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/image.htm',
|
||||
width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
|
||||
height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('image', {
|
||||
title : 'advimage.image_desc',
|
||||
cmd : 'mceAdvImage'
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced image',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advimage',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advimage', tinymce.plugins.AdvancedImagePlugin);
|
||||
})();
|
@ -0,0 +1,238 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advimage_dlg.dialog_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
||||
<script type="text/javascript" src="js/image.js"></script>
|
||||
<link href="css/advimage.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body id="advimage" style="display: none">
|
||||
<form onsubmit="ImageDialog.insert();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>
|
||||
<li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>
|
||||
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.general}</legend>
|
||||
|
||||
<table class="properties">
|
||||
<tr>
|
||||
<td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>
|
||||
<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" /></td>
|
||||
<td id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="src_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td>
|
||||
<td colspan="2"><input id="alt" name="alt" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td>
|
||||
<td colspan="2"><input id="title" name="title" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="appearance_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.tab_appearance}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td>
|
||||
<td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="baseline">{#advimage_dlg.align_baseline}</option>
|
||||
<option value="top">{#advimage_dlg.align_top}</option>
|
||||
<option value="middle">{#advimage_dlg.align_middle}</option>
|
||||
<option value="bottom">{#advimage_dlg.align_bottom}</option>
|
||||
<option value="text-top">{#advimage_dlg.align_texttop}</option>
|
||||
<option value="text-bottom">{#advimage_dlg.align_textbottom}</option>
|
||||
<option value="left">{#advimage_dlg.align_left}</option>
|
||||
<option value="right">{#advimage_dlg.align_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="6" valign="top">
|
||||
<div class="alignPreview">
|
||||
<img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" />
|
||||
Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
|
||||
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
|
||||
edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
|
||||
erat volutpat.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>
|
||||
<td nowrap="nowrap">
|
||||
<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" /> x
|
||||
<input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" /> px
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
|
||||
<td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td>
|
||||
<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td>
|
||||
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="class_list">{#class_name}</label></td>
|
||||
<td colspan="2"><select id="class_list" name="class_list" class="mceEditableSelect"></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td>
|
||||
<td colspan="2"><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td>
|
||||
<td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
|
||||
</tr> -->
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.swap_image}</legend>
|
||||
|
||||
<input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" />
|
||||
<label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td class="column1"><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td>
|
||||
<td id="onmouseoversrccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="over_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td>
|
||||
<td class="column2"><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td>
|
||||
<td id="onmouseoutsrccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="out_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.misc}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label id="idlabel" for="id">{#advimage_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir" onchange="ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#advimage_dlg.ltr}</option>
|
||||
<option value="rtl">{#advimage_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td>
|
||||
<td>
|
||||
<input id="usemap" name="usemap" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="longdesc" name="longdesc" type="text" value="" /></td>
|
||||
<td id="longdesccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,441 @@
|
||||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_image_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
},
|
||||
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
this.fillClassList('class_list');
|
||||
this.fillFileList('src_list', 'tinyMCEImageList');
|
||||
this.fillFileList('over_list', 'tinyMCEImageList');
|
||||
this.fillFileList('out_list', 'tinyMCEImageList');
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if (n.nodeName == 'IMG') {
|
||||
nl.src.value = dom.getAttrib(n, 'src');
|
||||
nl.width.value = dom.getAttrib(n, 'width');
|
||||
nl.height.value = dom.getAttrib(n, 'height');
|
||||
nl.alt.value = dom.getAttrib(n, 'alt');
|
||||
nl.title.value = dom.getAttrib(n, 'title');
|
||||
nl.vspace.value = this.getAttrib(n, 'vspace');
|
||||
nl.hspace.value = this.getAttrib(n, 'hspace');
|
||||
nl.border.value = this.getAttrib(n, 'border');
|
||||
selectByValue(f, 'align', this.getAttrib(n, 'align'));
|
||||
selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
|
||||
nl.style.value = dom.getAttrib(n, 'style');
|
||||
nl.id.value = dom.getAttrib(n, 'id');
|
||||
nl.dir.value = dom.getAttrib(n, 'dir');
|
||||
nl.lang.value = dom.getAttrib(n, 'lang');
|
||||
nl.usemap.value = dom.getAttrib(n, 'usemap');
|
||||
nl.longdesc.value = dom.getAttrib(n, 'longdesc');
|
||||
nl.insert.value = ed.getLang('update');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
|
||||
nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
|
||||
nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(n, 'align'))
|
||||
this.updateStyle('align');
|
||||
|
||||
if (dom.getAttrib(n, 'hspace'))
|
||||
this.updateStyle('hspace');
|
||||
|
||||
if (dom.getAttrib(n, 'border'))
|
||||
this.updateStyle('border');
|
||||
|
||||
if (dom.getAttrib(n, 'vspace'))
|
||||
this.updateStyle('vspace');
|
||||
}
|
||||
}
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
|
||||
if (isVisible('srcbrowser'))
|
||||
document.getElementById('src').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
|
||||
if (isVisible('overbrowser'))
|
||||
document.getElementById('onmouseoversrc').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
|
||||
if (isVisible('outbrowser'))
|
||||
document.getElementById('onmouseoutsrc').style.width = '260px';
|
||||
|
||||
// If option enabled default contrain proportions to checked
|
||||
if (ed.getParam("advimage_constrain_proportions", true))
|
||||
f.constrain.checked = true;
|
||||
|
||||
// Check swap image if valid data
|
||||
if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
|
||||
this.setSwapImage(true);
|
||||
else
|
||||
this.setSwapImage(false);
|
||||
|
||||
this.changeAppearance();
|
||||
this.showPreviewImage(nl.src.value, 1);
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
|
||||
|
||||
if (f.src.value === '') {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
|
||||
if (!f.alt.value) {
|
||||
tinyMCEPopup.editor.windowManager.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
|
||||
if (s)
|
||||
t.insertAndClose();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
t.insertAndClose();
|
||||
},
|
||||
|
||||
insertAndClose : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit)
|
||||
ed.getWin().focus();
|
||||
|
||||
if (!ed.settings.inline_styles) {
|
||||
args = {
|
||||
vspace : nl.vspace.value,
|
||||
hspace : nl.hspace.value,
|
||||
border : nl.border.value,
|
||||
align : getSelectValue(f, 'align')
|
||||
};
|
||||
} else {
|
||||
// Remove deprecated values
|
||||
args = {
|
||||
vspace : '',
|
||||
hspace : '',
|
||||
border : '',
|
||||
align : ''
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : nl.src.value,
|
||||
width : nl.width.value,
|
||||
height : nl.height.value,
|
||||
alt : nl.alt.value,
|
||||
title : nl.title.value,
|
||||
'class' : getSelectValue(f, 'class_list'),
|
||||
style : nl.style.value,
|
||||
id : nl.id.value,
|
||||
dir : nl.dir.value,
|
||||
lang : nl.lang.value,
|
||||
usemap : nl.usemap.value,
|
||||
longdesc : nl.longdesc.value
|
||||
});
|
||||
|
||||
args.onmouseover = args.onmouseout = '';
|
||||
|
||||
if (f.onmousemovecheck.checked) {
|
||||
if (nl.onmouseoversrc.value)
|
||||
args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
|
||||
|
||||
if (nl.onmouseoutsrc.value)
|
||||
args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
|
||||
}
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
} else {
|
||||
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
|
||||
ed.dom.setAttribs('__mce_tmp', args);
|
||||
ed.dom.setAttrib('__mce_tmp', 'id', '');
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
|
||||
case 'hspace':
|
||||
v = dom.getStyle(e, 'margin-left')
|
||||
v2 = dom.getStyle(e, 'margin-right');
|
||||
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'vspace':
|
||||
v = dom.getStyle(e, 'margin-top')
|
||||
v2 = dom.getStyle(e, 'margin-bottom');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
v = 0;
|
||||
|
||||
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
|
||||
sv = dom.getStyle(e, 'border-' + sv + '-width');
|
||||
|
||||
// False or not the same as prev
|
||||
if (!sv || (sv != v && v !== 0)) {
|
||||
v = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sv)
|
||||
v = sv;
|
||||
});
|
||||
|
||||
if (v)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
setSwapImage : function(st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.onmousemovecheck.checked = st;
|
||||
setBrowserDisabled('overbrowser', !st);
|
||||
setBrowserDisabled('outbrowser', !st);
|
||||
|
||||
if (f.over_list)
|
||||
f.over_list.disabled = !st;
|
||||
|
||||
if (f.out_list)
|
||||
f.out_list.disabled = !st;
|
||||
|
||||
f.onmouseoversrc.disabled = !st;
|
||||
f.onmouseoutsrc.disabled = !st;
|
||||
},
|
||||
|
||||
fillClassList : function(id) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
|
||||
cl = [];
|
||||
|
||||
tinymce.each(v.split(';'), function(v) {
|
||||
var p = v.split('=');
|
||||
|
||||
cl.push({'title' : p[0], 'class' : p[1]});
|
||||
});
|
||||
} else
|
||||
cl = tinyMCEPopup.editor.dom.getClasses();
|
||||
|
||||
if (cl.length > 0) {
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
|
||||
|
||||
tinymce.each(cl, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = window[l];
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
||||
tinymce.each(l, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o[0], o[1]);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.elements.width.value = f.elements.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function(img, st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
if (!st) {
|
||||
f.elements.width.value = img.width;
|
||||
f.elements.height.value = img.height;
|
||||
}
|
||||
|
||||
this.preloadImg = img;
|
||||
},
|
||||
|
||||
changeAppearance : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
|
||||
|
||||
if (img) {
|
||||
if (ed.getParam('inline_styles')) {
|
||||
ed.dom.setAttrib(img, 'style', f.style.value);
|
||||
} else {
|
||||
img.align = f.align.value;
|
||||
img.border = f.border.value;
|
||||
img.hspace = f.hspace.value;
|
||||
img.vspace = f.vspace.value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
|
||||
f.height.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
changeWidth : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
|
||||
f.width.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = getSelectValue(f, 'align');
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = '0';
|
||||
else
|
||||
img.style.border = v + 'px solid black';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
}
|
||||
},
|
||||
|
||||
changeMouseMove : function() {
|
||||
},
|
||||
|
||||
showPreviewImage : function(u, st) {
|
||||
if (!u) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
|
||||
this.resetImageData();
|
||||
|
||||
u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
|
||||
|
||||
if (!st)
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
|
||||
else
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
|
||||
}
|
||||
};
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
@ -0,0 +1,43 @@
|
||||
tinyMCE.addI18n('en.advimage_dlg',{
|
||||
tab_general:"General",
|
||||
tab_appearance:"Appearance",
|
||||
tab_advanced:"Advanced",
|
||||
general:"General",
|
||||
title:"Title",
|
||||
preview:"Preview",
|
||||
constrain_proportions:"Constrain proportions",
|
||||
langdir:"Language direction",
|
||||
langcode:"Language code",
|
||||
long_desc:"Long description link",
|
||||
style:"Style",
|
||||
classes:"Classes",
|
||||
ltr:"Left to right",
|
||||
rtl:"Right to left",
|
||||
id:"Id",
|
||||
map:"Image map",
|
||||
swap_image:"Swap image",
|
||||
alt_image:"Alternative image",
|
||||
mouseover:"for mouse over",
|
||||
mouseout:"for mouse out",
|
||||
misc:"Miscellaneous",
|
||||
example_img:"Appearance preview image",
|
||||
missing_alt:"Are you sure you want to continue without including an Image Description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.",
|
||||
dialog_title:"Insert/edit image",
|
||||
src:"Image URL",
|
||||
alt:"Image description",
|
||||
list:"Image list",
|
||||
border:"Border",
|
||||
dimensions:"Dimensions",
|
||||
vspace:"Vertical space",
|
||||
hspace:"Horizontal space",
|
||||
align:"Alignment",
|
||||
align_baseline:"Baseline",
|
||||
align_top:"Top",
|
||||
align_middle:"Middle",
|
||||
align_bottom:"Bottom",
|
||||
align_texttop:"Text top",
|
||||
align_textbottom:"Text bottom",
|
||||
align_left:"Left",
|
||||
align_right:"Right",
|
||||
image_list:"Image list"
|
||||
});
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.AdvancedLinkPlugin',{init:function(ed,url){this.editor=ed;ed.addCommand('mceAdvLink',function(){var se=ed.selection;if(se.isCollapsed()&&!ed.dom.getParent(se.getNode(),'A'))return;ed.windowManager.open({file:url+'/link.htm',width:480+parseInt(ed.getLang('advlink.delta_width',0)),height:400+parseInt(ed.getLang('advlink.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('link',{title:'advlink.link_desc',cmd:'mceAdvLink'});ed.addShortcut('ctrl+k','advlink.advlink_desc','mceAdvLink');ed.onNodeChange.add(function(ed,cm,n,co){cm.setDisabled('link',co&&n.nodeName!='A');cm.setActive('link',n.nodeName=='A'&&!n.name);});},getInfo:function(){return{longname:'Advanced link',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('advlink',tinymce.plugins.AdvancedLinkPlugin);})();
|
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:25 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
|
||||
init : function(ed, url) {
|
||||
this.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceAdvLink', function() {
|
||||
var se = ed.selection;
|
||||
|
||||
// No selection and not in link
|
||||
if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/link.htm',
|
||||
width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
|
||||
height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('link', {
|
||||
title : 'advlink.link_desc',
|
||||
cmd : 'mceAdvLink'
|
||||
});
|
||||
|
||||
ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n, co) {
|
||||
cm.setDisabled('link', co && n.nodeName != 'A');
|
||||
cm.setActive('link', n.nodeName == 'A' && !n.name);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Advanced link',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
|
||||
})();
|
@ -0,0 +1,528 @@
|
||||
/* Functions for the advlink plugin popup */
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var templates = {
|
||||
"window.open" : "window.open('${url}','${target}','${options}')"
|
||||
};
|
||||
|
||||
function preinit() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_link_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function changeClass() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.classes.value = getSelectValue(f, 'classlist');
|
||||
}
|
||||
|
||||
function init() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
var formObj = document.forms[0];
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var elm = inst.selection.getNode();
|
||||
var action = "insert";
|
||||
var html;
|
||||
|
||||
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
|
||||
document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
|
||||
document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
|
||||
document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
|
||||
document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
|
||||
|
||||
// Link list
|
||||
html = getLinkListHTML('linklisthref','href');
|
||||
if (html == "")
|
||||
document.getElementById("linklisthrefrow").style.display = 'none';
|
||||
else
|
||||
document.getElementById("linklisthrefcontainer").innerHTML = html;
|
||||
|
||||
// Resize some elements
|
||||
if (isVisible('hrefbrowser'))
|
||||
document.getElementById('href').style.width = '260px';
|
||||
|
||||
if (isVisible('popupurlbrowser'))
|
||||
document.getElementById('popupurl').style.width = '180px';
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
if (elm != null && elm.nodeName == "A")
|
||||
action = "update";
|
||||
|
||||
formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
|
||||
|
||||
setPopupControlsDisabled(true);
|
||||
|
||||
if (action == "update") {
|
||||
var href = inst.dom.getAttrib(elm, 'href');
|
||||
var onclick = inst.dom.getAttrib(elm, 'onclick');
|
||||
|
||||
// Setup form data
|
||||
setFormValue('href', href);
|
||||
setFormValue('title', inst.dom.getAttrib(elm, 'title'));
|
||||
setFormValue('id', inst.dom.getAttrib(elm, 'id'));
|
||||
setFormValue('style', inst.dom.getAttrib(elm, "style"));
|
||||
setFormValue('rel', inst.dom.getAttrib(elm, 'rel'));
|
||||
setFormValue('rev', inst.dom.getAttrib(elm, 'rev'));
|
||||
setFormValue('charset', inst.dom.getAttrib(elm, 'charset'));
|
||||
setFormValue('hreflang', inst.dom.getAttrib(elm, 'hreflang'));
|
||||
setFormValue('dir', inst.dom.getAttrib(elm, 'dir'));
|
||||
setFormValue('lang', inst.dom.getAttrib(elm, 'lang'));
|
||||
setFormValue('tabindex', inst.dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
|
||||
setFormValue('accesskey', inst.dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
|
||||
setFormValue('type', inst.dom.getAttrib(elm, 'type'));
|
||||
setFormValue('onfocus', inst.dom.getAttrib(elm, 'onfocus'));
|
||||
setFormValue('onblur', inst.dom.getAttrib(elm, 'onblur'));
|
||||
setFormValue('onclick', onclick);
|
||||
setFormValue('ondblclick', inst.dom.getAttrib(elm, 'ondblclick'));
|
||||
setFormValue('onmousedown', inst.dom.getAttrib(elm, 'onmousedown'));
|
||||
setFormValue('onmouseup', inst.dom.getAttrib(elm, 'onmouseup'));
|
||||
setFormValue('onmouseover', inst.dom.getAttrib(elm, 'onmouseover'));
|
||||
setFormValue('onmousemove', inst.dom.getAttrib(elm, 'onmousemove'));
|
||||
setFormValue('onmouseout', inst.dom.getAttrib(elm, 'onmouseout'));
|
||||
setFormValue('onkeypress', inst.dom.getAttrib(elm, 'onkeypress'));
|
||||
setFormValue('onkeydown', inst.dom.getAttrib(elm, 'onkeydown'));
|
||||
setFormValue('onkeyup', inst.dom.getAttrib(elm, 'onkeyup'));
|
||||
setFormValue('target', inst.dom.getAttrib(elm, 'target'));
|
||||
setFormValue('classes', inst.dom.getAttrib(elm, 'class'));
|
||||
|
||||
// Parse onclick data
|
||||
if (onclick != null && onclick.indexOf('window.open') != -1)
|
||||
parseWindowOpen(onclick);
|
||||
else
|
||||
parseFunction(onclick);
|
||||
|
||||
// Select by the values
|
||||
selectByValue(formObj, 'dir', inst.dom.getAttrib(elm, 'dir'));
|
||||
selectByValue(formObj, 'rel', inst.dom.getAttrib(elm, 'rel'));
|
||||
selectByValue(formObj, 'rev', inst.dom.getAttrib(elm, 'rev'));
|
||||
selectByValue(formObj, 'linklisthref', href);
|
||||
|
||||
if (href.charAt(0) == '#')
|
||||
selectByValue(formObj, 'anchorlist', href);
|
||||
|
||||
addClassesToList('classlist', 'advlink_styles');
|
||||
|
||||
selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);
|
||||
selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
|
||||
} else
|
||||
addClassesToList('classlist', 'advlink_styles');
|
||||
}
|
||||
|
||||
function checkPrefix(n) {
|
||||
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
|
||||
n.value = 'mailto:' + n.value;
|
||||
|
||||
if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
|
||||
n.value = 'http://' + n.value;
|
||||
}
|
||||
|
||||
function setFormValue(name, value) {
|
||||
document.forms[0].elements[name].value = value;
|
||||
}
|
||||
|
||||
function parseWindowOpen(onclick) {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
// Preprocess center code
|
||||
if (onclick.indexOf('return false;') != -1) {
|
||||
formObj.popupreturn.checked = true;
|
||||
onclick = onclick.replace('return false;', '');
|
||||
} else
|
||||
formObj.popupreturn.checked = false;
|
||||
|
||||
var onClickData = parseLink(onclick);
|
||||
|
||||
if (onClickData != null) {
|
||||
formObj.ispopup.checked = true;
|
||||
setPopupControlsDisabled(false);
|
||||
|
||||
var onClickWindowOptions = parseOptions(onClickData['options']);
|
||||
var url = onClickData['url'];
|
||||
|
||||
formObj.popupname.value = onClickData['target'];
|
||||
formObj.popupurl.value = url;
|
||||
formObj.popupwidth.value = getOption(onClickWindowOptions, 'width');
|
||||
formObj.popupheight.value = getOption(onClickWindowOptions, 'height');
|
||||
|
||||
formObj.popupleft.value = getOption(onClickWindowOptions, 'left');
|
||||
formObj.popuptop.value = getOption(onClickWindowOptions, 'top');
|
||||
|
||||
if (formObj.popupleft.value.indexOf('screen') != -1)
|
||||
formObj.popupleft.value = "c";
|
||||
|
||||
if (formObj.popuptop.value.indexOf('screen') != -1)
|
||||
formObj.popuptop.value = "c";
|
||||
|
||||
formObj.popuplocation.checked = getOption(onClickWindowOptions, 'location') == "yes";
|
||||
formObj.popupscrollbars.checked = getOption(onClickWindowOptions, 'scrollbars') == "yes";
|
||||
formObj.popupmenubar.checked = getOption(onClickWindowOptions, 'menubar') == "yes";
|
||||
formObj.popupresizable.checked = getOption(onClickWindowOptions, 'resizable') == "yes";
|
||||
formObj.popuptoolbar.checked = getOption(onClickWindowOptions, 'toolbar') == "yes";
|
||||
formObj.popupstatus.checked = getOption(onClickWindowOptions, 'status') == "yes";
|
||||
formObj.popupdependent.checked = getOption(onClickWindowOptions, 'dependent') == "yes";
|
||||
|
||||
buildOnClick();
|
||||
}
|
||||
}
|
||||
|
||||
function parseFunction(onclick) {
|
||||
var formObj = document.forms[0];
|
||||
var onClickData = parseLink(onclick);
|
||||
|
||||
// TODO: Add stuff here
|
||||
}
|
||||
|
||||
function getOption(opts, name) {
|
||||
return typeof(opts[name]) == "undefined" ? "" : opts[name];
|
||||
}
|
||||
|
||||
function setPopupControlsDisabled(state) {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
formObj.popupname.disabled = state;
|
||||
formObj.popupurl.disabled = state;
|
||||
formObj.popupwidth.disabled = state;
|
||||
formObj.popupheight.disabled = state;
|
||||
formObj.popupleft.disabled = state;
|
||||
formObj.popuptop.disabled = state;
|
||||
formObj.popuplocation.disabled = state;
|
||||
formObj.popupscrollbars.disabled = state;
|
||||
formObj.popupmenubar.disabled = state;
|
||||
formObj.popupresizable.disabled = state;
|
||||
formObj.popuptoolbar.disabled = state;
|
||||
formObj.popupstatus.disabled = state;
|
||||
formObj.popupreturn.disabled = state;
|
||||
formObj.popupdependent.disabled = state;
|
||||
|
||||
setBrowserDisabled('popupurlbrowser', state);
|
||||
}
|
||||
|
||||
function parseLink(link) {
|
||||
link = link.replace(new RegExp(''', 'g'), "'");
|
||||
|
||||
var fnName = link.replace(new RegExp("\\s*([A-Za-z0-9\.]*)\\s*\\(.*", "gi"), "$1");
|
||||
|
||||
// Is function name a template function
|
||||
var template = templates[fnName];
|
||||
if (template) {
|
||||
// Build regexp
|
||||
var variableNames = template.match(new RegExp("'?\\$\\{[A-Za-z0-9\.]*\\}'?", "gi"));
|
||||
var regExp = "\\s*[A-Za-z0-9\.]*\\s*\\(";
|
||||
var replaceStr = "";
|
||||
for (var i=0; i<variableNames.length; i++) {
|
||||
// Is string value
|
||||
if (variableNames[i].indexOf("'${") != -1)
|
||||
regExp += "'(.*)'";
|
||||
else // Number value
|
||||
regExp += "([0-9]*)";
|
||||
|
||||
replaceStr += "$" + (i+1);
|
||||
|
||||
// Cleanup variable name
|
||||
variableNames[i] = variableNames[i].replace(new RegExp("[^A-Za-z0-9]", "gi"), "");
|
||||
|
||||
if (i != variableNames.length-1) {
|
||||
regExp += "\\s*,\\s*";
|
||||
replaceStr += "<delim>";
|
||||
} else
|
||||
regExp += ".*";
|
||||
}
|
||||
|
||||
regExp += "\\);?";
|
||||
|
||||
// Build variable array
|
||||
var variables = [];
|
||||
variables["_function"] = fnName;
|
||||
var variableValues = link.replace(new RegExp(regExp, "gi"), replaceStr).split('<delim>');
|
||||
for (var i=0; i<variableNames.length; i++)
|
||||
variables[variableNames[i]] = variableValues[i];
|
||||
|
||||
return variables;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseOptions(opts) {
|
||||
if (opts == null || opts == "")
|
||||
return [];
|
||||
|
||||
// Cleanup the options
|
||||
opts = opts.toLowerCase();
|
||||
opts = opts.replace(/;/g, ",");
|
||||
opts = opts.replace(/[^0-9a-z=,]/g, "");
|
||||
|
||||
var optionChunks = opts.split(',');
|
||||
var options = [];
|
||||
|
||||
for (var i=0; i<optionChunks.length; i++) {
|
||||
var parts = optionChunks[i].split('=');
|
||||
|
||||
if (parts.length == 2)
|
||||
options[parts[0]] = parts[1];
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function buildOnClick() {
|
||||
var formObj = document.forms[0];
|
||||
|
||||
if (!formObj.ispopup.checked) {
|
||||
formObj.onclick.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
var onclick = "window.open('";
|
||||
var url = formObj.popupurl.value;
|
||||
|
||||
onclick += url + "','";
|
||||
onclick += formObj.popupname.value + "','";
|
||||
|
||||
if (formObj.popuplocation.checked)
|
||||
onclick += "location=yes,";
|
||||
|
||||
if (formObj.popupscrollbars.checked)
|
||||
onclick += "scrollbars=yes,";
|
||||
|
||||
if (formObj.popupmenubar.checked)
|
||||
onclick += "menubar=yes,";
|
||||
|
||||
if (formObj.popupresizable.checked)
|
||||
onclick += "resizable=yes,";
|
||||
|
||||
if (formObj.popuptoolbar.checked)
|
||||
onclick += "toolbar=yes,";
|
||||
|
||||
if (formObj.popupstatus.checked)
|
||||
onclick += "status=yes,";
|
||||
|
||||
if (formObj.popupdependent.checked)
|
||||
onclick += "dependent=yes,";
|
||||
|
||||
if (formObj.popupwidth.value != "")
|
||||
onclick += "width=" + formObj.popupwidth.value + ",";
|
||||
|
||||
if (formObj.popupheight.value != "")
|
||||
onclick += "height=" + formObj.popupheight.value + ",";
|
||||
|
||||
if (formObj.popupleft.value != "") {
|
||||
if (formObj.popupleft.value != "c")
|
||||
onclick += "left=" + formObj.popupleft.value + ",";
|
||||
else
|
||||
onclick += "left='+(screen.availWidth/2-" + (formObj.popupwidth.value/2) + ")+',";
|
||||
}
|
||||
|
||||
if (formObj.popuptop.value != "") {
|
||||
if (formObj.popuptop.value != "c")
|
||||
onclick += "top=" + formObj.popuptop.value + ",";
|
||||
else
|
||||
onclick += "top='+(screen.availHeight/2-" + (formObj.popupheight.value/2) + ")+',";
|
||||
}
|
||||
|
||||
if (onclick.charAt(onclick.length-1) == ',')
|
||||
onclick = onclick.substring(0, onclick.length-1);
|
||||
|
||||
onclick += "');";
|
||||
|
||||
if (formObj.popupreturn.checked)
|
||||
onclick += "return false;";
|
||||
|
||||
// tinyMCE.debug(onclick);
|
||||
|
||||
formObj.onclick.value = onclick;
|
||||
|
||||
if (formObj.href.value == "")
|
||||
formObj.href.value = url;
|
||||
}
|
||||
|
||||
function setAttrib(elm, attrib, value) {
|
||||
var formObj = document.forms[0];
|
||||
var valueElm = formObj.elements[attrib.toLowerCase()];
|
||||
var dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (typeof(value) == "undefined" || value == null) {
|
||||
value = "";
|
||||
|
||||
if (valueElm)
|
||||
value = valueElm.value;
|
||||
}
|
||||
|
||||
// Clean up the style
|
||||
if (attrib == 'style')
|
||||
value = dom.serializeStyle(dom.parseStyle(value));
|
||||
|
||||
dom.setAttrib(elm, attrib, value);
|
||||
}
|
||||
|
||||
function getAnchorListHTML(id, target) {
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i;
|
||||
var html = "";
|
||||
|
||||
html += '<select id="' + id + '" name="' + id + '" class="mceAnchorList" o2nfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;">';
|
||||
html += '<option value="">---</option>';
|
||||
|
||||
for (i=0; i<nodes.length; i++) {
|
||||
if ((name = inst.dom.getAttrib(nodes[i], "name")) != "")
|
||||
html += '<option value="#' + name + '">' + name + '</option>';
|
||||
}
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function insertAction() {
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var elm, elementArray, i;
|
||||
|
||||
elm = inst.selection.getNode();
|
||||
checkPrefix(document.forms[0].href);
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
|
||||
// Remove element if there is no href
|
||||
if (!document.forms[0].href.value) {
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
i = inst.selection.getBookmark();
|
||||
inst.dom.remove(elm, 1);
|
||||
inst.selection.moveToBookmark(i);
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
// Create new anchor elements
|
||||
if (elm == null) {
|
||||
tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
elementArray = tinymce.grep(inst.dom.select("a"), function(n) {return inst.dom.getAttrib(n, 'href') == '#mce_temp_url#';});
|
||||
for (i=0; i<elementArray.length; i++)
|
||||
setAllAttribs(elm = elementArray[i]);
|
||||
} else
|
||||
setAllAttribs(elm);
|
||||
|
||||
// Don't move caret if selection was image
|
||||
if (elm.childNodes.length != 1 || elm.firstChild.nodeName != 'IMG') {
|
||||
inst.focus();
|
||||
inst.selection.select(elm);
|
||||
inst.selection.collapse(0);
|
||||
tinyMCEPopup.storeSelection();
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function setAllAttribs(elm) {
|
||||
var formObj = document.forms[0];
|
||||
var href = formObj.href.value;
|
||||
var target = getSelectValue(formObj, 'targetlist');
|
||||
|
||||
setAttrib(elm, 'href', href);
|
||||
setAttrib(elm, 'mce_href', href);
|
||||
setAttrib(elm, 'title');
|
||||
setAttrib(elm, 'target', target == '_self' ? '' : target);
|
||||
setAttrib(elm, 'id');
|
||||
setAttrib(elm, 'style');
|
||||
setAttrib(elm, 'class', getSelectValue(formObj, 'classlist'));
|
||||
setAttrib(elm, 'rel');
|
||||
setAttrib(elm, 'rev');
|
||||
setAttrib(elm, 'charset');
|
||||
setAttrib(elm, 'hreflang');
|
||||
setAttrib(elm, 'dir');
|
||||
setAttrib(elm, 'lang');
|
||||
setAttrib(elm, 'tabindex');
|
||||
setAttrib(elm, 'accesskey');
|
||||
setAttrib(elm, 'type');
|
||||
setAttrib(elm, 'onfocus');
|
||||
setAttrib(elm, 'onblur');
|
||||
setAttrib(elm, 'onclick');
|
||||
setAttrib(elm, 'ondblclick');
|
||||
setAttrib(elm, 'onmousedown');
|
||||
setAttrib(elm, 'onmouseup');
|
||||
setAttrib(elm, 'onmouseover');
|
||||
setAttrib(elm, 'onmousemove');
|
||||
setAttrib(elm, 'onmouseout');
|
||||
setAttrib(elm, 'onkeypress');
|
||||
setAttrib(elm, 'onkeydown');
|
||||
setAttrib(elm, 'onkeyup');
|
||||
|
||||
// Refresh in old MSIE
|
||||
if (tinyMCE.isMSIE5)
|
||||
elm.outerHTML = elm.outerHTML;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function getLinkListHTML(elm_id, target_form_element, onchange_func) {
|
||||
if (typeof(tinyMCELinkList) == "undefined" || tinyMCELinkList.length == 0)
|
||||
return "";
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '"';
|
||||
html += ' class="mceLinkList" onfoc2us="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;';
|
||||
|
||||
if (typeof(onchange_func) != "undefined")
|
||||
html += onchange_func + '(\'' + target_form_element + '\',this.options[this.selectedIndex].text,this.options[this.selectedIndex].value);';
|
||||
|
||||
html += '"><option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCELinkList.length; i++)
|
||||
html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
|
||||
// tinyMCE.debug('-- image list start --', html, '-- image list end --');
|
||||
}
|
||||
|
||||
function getTargetListHTML(elm_id, target_form_element) {
|
||||
var targets = tinyMCEPopup.getParam('theme_advanced_link_targets', '').split(';');
|
||||
var html = '';
|
||||
|
||||
html += '<select id="' + elm_id + '" name="' + elm_id + '" onf2ocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.' + target_form_element + '.value=';
|
||||
html += 'this.options[this.selectedIndex].value;">';
|
||||
html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';
|
||||
html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';
|
||||
html += '<option value="_parent">' + tinyMCEPopup.getLang('advlink_dlg.target_parent') + ' (_parent)</option>';
|
||||
html += '<option value="_top">' + tinyMCEPopup.getLang('advlink_dlg.target_top') + ' (_top)</option>';
|
||||
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var key, value;
|
||||
|
||||
if (targets[i] == "")
|
||||
continue;
|
||||
|
||||
key = targets[i].split('=')[0];
|
||||
value = targets[i].split('=')[1];
|
||||
|
||||
html += '<option value="' + key + '">' + value + ' (' + key + ')</option>';
|
||||
}
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
// While loading
|
||||
preinit();
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -0,0 +1,52 @@
|
||||
tinyMCE.addI18n('en.advlink_dlg',{
|
||||
title:"Insert/edit link",
|
||||
url:"Link URL",
|
||||
target:"Target",
|
||||
titlefield:"Title",
|
||||
is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
|
||||
is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
|
||||
list:"Link list",
|
||||
general_tab:"General",
|
||||
popup_tab:"Popup",
|
||||
events_tab:"Events",
|
||||
advanced_tab:"Advanced",
|
||||
general_props:"General properties",
|
||||
popup_props:"Popup properties",
|
||||
event_props:"Events",
|
||||
advanced_props:"Advanced properties",
|
||||
popup_opts:"Options",
|
||||
anchor_names:"Anchors",
|
||||
target_same:"Open in this window / frame",
|
||||
target_parent:"Open in parent window / frame",
|
||||
target_top:"Open in top frame (replaces all frames)",
|
||||
target_blank:"Open in new window",
|
||||
popup:"Javascript popup",
|
||||
popup_url:"Popup URL",
|
||||
popup_name:"Window name",
|
||||
popup_return:"Insert 'return false'",
|
||||
popup_scrollbars:"Show scrollbars",
|
||||
popup_statusbar:"Show status bar",
|
||||
popup_toolbar:"Show toolbars",
|
||||
popup_menubar:"Show menu bar",
|
||||
popup_location:"Show location bar",
|
||||
popup_resizable:"Make window resizable",
|
||||
popup_dependent:"Dependent (Mozilla/Firefox only)",
|
||||
popup_size:"Size",
|
||||
popup_position:"Position (X/Y)",
|
||||
id:"Id",
|
||||
style:"Style",
|
||||
classes:"Classes",
|
||||
target_name:"Target name",
|
||||
langdir:"Language direction",
|
||||
target_langcode:"Target language",
|
||||
langcode:"Language code",
|
||||
encoding:"Target character encoding",
|
||||
mime:"Target MIME type",
|
||||
rel:"Relationship page to target",
|
||||
rev:"Relationship target to page",
|
||||
tabindex:"Tabindex",
|
||||
accesskey:"Accesskey",
|
||||
ltr:"Left to right",
|
||||
rtl:"Right to left",
|
||||
link_list:"Link list"
|
||||
});
|
@ -0,0 +1,339 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#advlink_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="js/advlink.js"></script>
|
||||
<link href="css/advlink.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body id="advlink" style="display: none">
|
||||
<form onsubmit="insertAction();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advlink_dlg.general_tab}</a></span></li>
|
||||
<li id="popup_tab"><span><a href="javascript:mcTabs.displayTab('popup_tab','popup_panel');" onmousedown="return false;">{#advlink_dlg.popup_tab}</a></span></li>
|
||||
<li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#advlink_dlg.events_tab}</a></span></li>
|
||||
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advlink_dlg.advanced_tab}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.general_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label id="hreflabel" for="href">{#advlink_dlg.url}</label></td>
|
||||
<td><table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="href" name="href" type="text" class="mceFocus" value="" onchange="selectByValue(this.form,'linklisthref',this.value);" /></td>
|
||||
<td id="hrefbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr id="linklisthrefrow">
|
||||
<td class="column1"><label for="linklisthref">{#advlink_dlg.list}</label></td>
|
||||
<td colspan="2" id="linklisthrefcontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="anchorlist">{#advlink_dlg.anchor_names}</label></td>
|
||||
<td colspan="2" id="anchorlistcontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="targetlistlabel" for="targetlist">{#advlink_dlg.target}</label></td>
|
||||
<td id="targetlistcontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label id="titlelabel" for="title">{#advlink_dlg.titlefield}</label></td>
|
||||
<td><input id="title" name="title" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label id="classlabel" for="classlist">{#class_name}</label></td>
|
||||
<td>
|
||||
<select id="classlist" name="classlist" onchange="changeClass();">
|
||||
<option value="" selected>{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="popup_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.popup_props}</legend>
|
||||
|
||||
<input type="checkbox" id="ispopup" name="ispopup" class="radio" onclick="setPopupControlsDisabled(!this.checked);buildOnClick();" />
|
||||
<label id="ispopuplabel" for="ispopup">{#advlink_dlg.popup}</label>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="popupurl">{#advlink_dlg.popup_url}</label> </td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" name="popupurl" id="popupurl" value="" onchange="buildOnClick();" /></td>
|
||||
<td id="popupurlbrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="popupname">{#advlink_dlg.popup_name}</label> </td>
|
||||
<td><input type="text" name="popupname" id="popupname" value="" onchange="buildOnClick();" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label>{#advlink_dlg.popup_size}</label> </td>
|
||||
<td nowrap="nowrap">
|
||||
<input type="text" id="popupwidth" name="popupwidth" value="" onchange="buildOnClick();" /> x
|
||||
<input type="text" id="popupheight" name="popupheight" value="" onchange="buildOnClick();" /> px
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap" id="labelleft"><label>{#advlink_dlg.popup_position}</label> </td>
|
||||
<td nowrap="nowrap">
|
||||
<input type="text" id="popupleft" name="popupleft" value="" onchange="buildOnClick();" /> /
|
||||
<input type="text" id="popuptop" name="popuptop" value="" onchange="buildOnClick();" /> (c /c = center)
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.popup_opts}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4">
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popuplocation" name="popuplocation" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popuplocationlabel" for="popuplocation">{#advlink_dlg.popup_location}</label></td>
|
||||
<td><input type="checkbox" id="popupscrollbars" name="popupscrollbars" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popupscrollbarslabel" for="popupscrollbars">{#advlink_dlg.popup_scrollbars}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popupmenubar" name="popupmenubar" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popupmenubarlabel" for="popupmenubar">{#advlink_dlg.popup_menubar}</label></td>
|
||||
<td><input type="checkbox" id="popupresizable" name="popupresizable" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popupresizablelabel" for="popupresizable">{#advlink_dlg.popup_resizable}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popuptoolbar" name="popuptoolbar" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popuptoolbarlabel" for="popuptoolbar">{#advlink_dlg.popup_toolbar}</label></td>
|
||||
<td><input type="checkbox" id="popupdependent" name="popupdependent" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popupdependentlabel" for="popupdependent">{#advlink_dlg.popup_dependent}</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="popupstatus" name="popupstatus" class="checkbox" onchange="buildOnClick();" /></td>
|
||||
<td nowrap="nowrap"><label id="popupstatuslabel" for="popupstatus">{#advlink_dlg.popup_statusbar}</label></td>
|
||||
<td><input type="checkbox" id="popupreturn" name="popupreturn" class="checkbox" onchange="buildOnClick();" checked="checked" /></td>
|
||||
<td nowrap="nowrap"><label id="popupreturnlabel" for="popupreturn">{#advlink_dlg.popup_return}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.advanced_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4">
|
||||
<tr>
|
||||
<td class="column1"><label id="idlabel" for="id">{#advlink_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="stylelabel" for="style">{#advlink_dlg.style}</label></td>
|
||||
<td><input type="text" id="style" name="style" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="classeslabel" for="classes">{#advlink_dlg.classes}</label></td>
|
||||
<td><input type="text" id="classes" name="classes" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="targetlabel" for="target">{#advlink_dlg.target_name}</label></td>
|
||||
<td><input type="text" id="target" name="target" value="" onchange="selectByValue(this.form,'targetlist',this.value,true);" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="dirlabel" for="dir">{#advlink_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#advlink_dlg.ltr}</option>
|
||||
<option value="rtl">{#advlink_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="hreflanglabel" for="hreflang">{#advlink_dlg.target_langcode}</label></td>
|
||||
<td><input type="text" id="hreflang" name="hreflang" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label id="langlabel" for="lang">{#advlink_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="charsetlabel" for="charset">{#advlink_dlg.encoding}</label></td>
|
||||
<td><input type="text" id="charset" name="charset" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="typelabel" for="type">{#advlink_dlg.mime}</label></td>
|
||||
<td><input type="text" id="type" name="type" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="rellabel" for="rel">{#advlink_dlg.rel}</label></td>
|
||||
<td><select id="rel" name="rel">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="lightbox">Lightbox</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
<option value="nofollow">No Follow</option>
|
||||
<option value="tag">Tag</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="revlabel" for="rev">{#advlink_dlg.rev}</label></td>
|
||||
<td><select id="rev" name="rev">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="tabindexlabel" for="tabindex">{#advlink_dlg.tabindex}</label></td>
|
||||
<td><input type="text" id="tabindex" name="tabindex" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label id="accesskeylabel" for="accesskey">{#advlink_dlg.accesskey}</label></td>
|
||||
<td><input type="text" id="accesskey" name="accesskey" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="events_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advlink_dlg.event_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="0" cellspacing="4">
|
||||
<tr>
|
||||
<td class="column1"><label for="onfocus">onfocus</label></td>
|
||||
<td><input id="onfocus" name="onfocus" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onblur">onblur</label></td>
|
||||
<td><input id="onblur" name="onblur" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onclick">onclick</label></td>
|
||||
<td><input id="onclick" name="onclick" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="ondblclick">ondblclick</label></td>
|
||||
<td><input id="ondblclick" name="ondblclick" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmousedown">onmousedown</label></td>
|
||||
<td><input id="onmousedown" name="onmousedown" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseup">onmouseup</label></td>
|
||||
<td><input id="onmouseup" name="onmouseup" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseover">onmouseover</label></td>
|
||||
<td><input id="onmouseover" name="onmouseover" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmousemove">onmousemove</label></td>
|
||||
<td><input id="onmousemove" name="onmousemove" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onmouseout">onmouseout</label></td>
|
||||
<td><input id="onmouseout" name="onmouseout" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeypress">onkeypress</label></td>
|
||||
<td><input id="onkeypress" name="onkeypress" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeydown">onkeydown</label></td>
|
||||
<td><input id="onkeydown" name="onkeydown" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="onkeyup">onkeyup</label></td>
|
||||
<td><input id="onkeyup" name="onkeyup" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.FullPagePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceFullPageProperties',function(){ed.windowManager.open({file:url+'/fullpage.htm',width:430+parseInt(ed.getLang('fullpage.delta_width',0)),height:495+parseInt(ed.getLang('fullpage.delta_height',0)),inline:1},{plugin_url:url,head_html:t.head});});ed.addButton('fullpage',{title:'fullpage.desc',cmd:'mceFullPageProperties'});ed.onBeforeSetContent.add(t._setContent,t);ed.onSetContent.add(t._setBodyAttribs,t);ed.onGetContent.add(t._getContent,t);},getInfo:function(){return{longname:'Fullpage',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_setBodyAttribs:function(ed,o){var bdattr,i,len,kv,k,v,t,attr=this.head.match(/body(.*?)>/i);if(attr&&attr[1]){bdattr=attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);for(i=0,len=bdattr.length;i<len;i++){kv=bdattr[i].split('=');k=kv[0].replace(/\s/,'');v=kv[1];if(v){v=v.replace(/^\s+/,'').replace(/\s+$/,'');t=v.match(/^["'](.*)["']$/);if(t)v=t[1];}else v=k;ed.dom.setAttrib(ed.getBody(),'style',v);}}},_createSerializer:function(){return new tinymce.dom.Serializer({dom:this.editor.dom,apply_source_formatting:true});},_setContent:function(ed,o){var t=this,sp,ep,c=o.content,v,st='';c=c.replace(/<(\/?)BODY/gi,'<$1body');sp=c.indexOf('<body');if(sp!=-1){sp=c.indexOf('>',sp);t.head=c.substring(0,sp+1);ep=c.indexOf('</body',sp);if(ep==-1)ep=c.indexOf('</body',ep);o.content=c.substring(sp+1,ep);t.foot=c.substring(ep);function low(s){return s.replace(/<\/?[A-Z]+/g,function(a){return a.toLowerCase();})};t.head=low(t.head);t.foot=low(t.foot);}else{t.head='';if(ed.getParam('fullpage_default_xml_pi'))t.head+='<?xml version="1.0" encoding="'+ed.getParam('fullpage_default_encoding','ISO-8859-1')+'" ?>\n';t.head+=ed.getParam('fullpage_default_doctype','<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');t.head+='\n<html>\n<head>\n<title>'+ed.getParam('fullpage_default_title','Untitled document')+'</title>\n';if(v=ed.getParam('fullpage_default_encoding'))t.head+='<meta http-equiv="Content-Type" content="'+v+'" />\n';if(v=ed.getParam('fullpage_default_font_family'))st+='font-family: '+v+';';if(v=ed.getParam('fullpage_default_font_size'))st+='font-size: '+v+';';if(v=ed.getParam('fullpage_default_text_color'))st+='color: '+v+';';t.head+='</head>\n<body'+(st?' style="'+st+'"':'')+'>\n';t.foot='\n</body>\n</html>';}},_getContent:function(ed,o){var t=this;o.content=tinymce.trim(t.head)+'\n'+tinymce.trim(o.content)+'\n'+tinymce.trim(t.foot);}});tinymce.PluginManager.add('fullpage',tinymce.plugins.FullPagePlugin);})();
|
@ -0,0 +1,140 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:26 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.FullPagePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceFullPageProperties', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/fullpage.htm',
|
||||
width : 430 + parseInt(ed.getLang('fullpage.delta_width', 0)),
|
||||
height : 495 + parseInt(ed.getLang('fullpage.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url,
|
||||
head_html : t.head
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});
|
||||
|
||||
ed.onBeforeSetContent.add(t._setContent, t);
|
||||
ed.onSetContent.add(t._setBodyAttribs, t);
|
||||
ed.onGetContent.add(t._getContent, t);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Fullpage',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private plugin internal methods
|
||||
|
||||
_setBodyAttribs : function(ed, o) {
|
||||
var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i);
|
||||
|
||||
if (attr && attr[1]) {
|
||||
bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);
|
||||
|
||||
for(i = 0, len = bdattr.length; i < len; i++) {
|
||||
kv = bdattr[i].split('=');
|
||||
k = kv[0].replace(/\s/,'');
|
||||
v = kv[1];
|
||||
|
||||
if (v) {
|
||||
v = v.replace(/^\s+/,'').replace(/\s+$/,'');
|
||||
t = v.match(/^["'](.*)["']$/);
|
||||
|
||||
if (t)
|
||||
v = t[1];
|
||||
} else
|
||||
v = k;
|
||||
|
||||
ed.dom.setAttrib(ed.getBody(), 'style', v);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_createSerializer : function() {
|
||||
return new tinymce.dom.Serializer({
|
||||
dom : this.editor.dom,
|
||||
apply_source_formatting : true
|
||||
});
|
||||
},
|
||||
|
||||
_setContent : function(ed, o) {
|
||||
var t = this, sp, ep, c = o.content, v, st = '';
|
||||
|
||||
// Parse out head, body and footer
|
||||
c = c.replace(/<(\/?)BODY/gi, '<$1body');
|
||||
sp = c.indexOf('<body');
|
||||
|
||||
if (sp != -1) {
|
||||
sp = c.indexOf('>', sp);
|
||||
t.head = c.substring(0, sp + 1);
|
||||
|
||||
ep = c.indexOf('</body', sp);
|
||||
if (ep == -1)
|
||||
ep = c.indexOf('</body', ep);
|
||||
|
||||
o.content = c.substring(sp + 1, ep);
|
||||
t.foot = c.substring(ep);
|
||||
|
||||
function low(s) {
|
||||
return s.replace(/<\/?[A-Z]+/g, function(a) {
|
||||
return a.toLowerCase();
|
||||
})
|
||||
};
|
||||
|
||||
t.head = low(t.head);
|
||||
t.foot = low(t.foot);
|
||||
} else {
|
||||
t.head = '';
|
||||
if (ed.getParam('fullpage_default_xml_pi'))
|
||||
t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
|
||||
|
||||
t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
|
||||
t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n';
|
||||
|
||||
if (v = ed.getParam('fullpage_default_encoding'))
|
||||
t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';
|
||||
|
||||
if (v = ed.getParam('fullpage_default_font_family'))
|
||||
st += 'font-family: ' + v + ';';
|
||||
|
||||
if (v = ed.getParam('fullpage_default_font_size'))
|
||||
st += 'font-size: ' + v + ';';
|
||||
|
||||
if (v = ed.getParam('fullpage_default_text_color'))
|
||||
st += 'color: ' + v + ';';
|
||||
|
||||
t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';
|
||||
t.foot = '\n</body>\n</html>';
|
||||
}
|
||||
},
|
||||
|
||||
_getContent : function(ed, o) {
|
||||
var t = this;
|
||||
|
||||
o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot);
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);
|
||||
})();
|
@ -0,0 +1,577 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#fullpage_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="js/fullpage.js"></script>
|
||||
<link href="css/fullpage.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body id="advlink" style="display: none">
|
||||
<form onsubmit="updateAction();return false;" name="fullpage" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>
|
||||
<li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>
|
||||
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_tab}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="meta_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.meta_props}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metatitle">{#fullpage_dlg.meta_title}</label> </td>
|
||||
<td><input type="text" id="metatitle" name="metatitle" value="" class="mceFocus" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metakeywords">{#fullpage_dlg.meta_keywords}</label> </td>
|
||||
<td><textarea id="metakeywords" name="metakeywords" rows="4"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metadescription">{#fullpage_dlg.meta_description}</label> </td>
|
||||
<td><textarea id="metadescription" name="metadescription" rows="4"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metaauthor">{#fullpage_dlg.author}</label> </td>
|
||||
<td><input type="text" id="metaauthor" name="metaauthor" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metacopyright">{#fullpage_dlg.copyright}</label> </td>
|
||||
<td><input type="text" id="metacopyright" name="metacopyright" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="metarobots">{#fullpage_dlg.meta_robots}</label> </td>
|
||||
<td>
|
||||
<select id="metarobots" name="metarobots">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="index,follow">{#fullpage_dlg.meta_index_follow}</option>
|
||||
<option value="index,nofollow">{#fullpage_dlg.meta_index_nofollow}</option>
|
||||
<option value="noindex,follow">{#fullpage_dlg.meta_noindex_follow}</option>
|
||||
<option value="noindex,nofollow">{#fullpage_dlg.meta_noindex_nofollow}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.langprops}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="docencoding">{#fullpage_dlg.encoding}</label></td>
|
||||
<td>
|
||||
<select id="docencoding" name="docencoding">
|
||||
<option value="">{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="doctypes">{#fullpage_dlg.doctypes}</label> </td>
|
||||
<td>
|
||||
<select id="doctypes" name="doctypes">
|
||||
<option value="">{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="langcode">{#fullpage_dlg.langcode}</label> </td>
|
||||
<td><input type="text" id="langcode" name="langcode" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="langdir">{#fullpage_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="langdir" name="langdir">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#fullpage_dlg.ltr}</option>
|
||||
<option value="rtl">{#fullpage_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap"><label for="xml_pi">{#fullpage_dlg.xml_pi}</label> </td>
|
||||
<td><input type="checkbox" id="xml_pi" name="xml_pi" class="checkbox" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="appearance_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.appearance_textprops}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td>
|
||||
<td>
|
||||
<select id="fontface" name="fontface" onchange="changedStyleField(this);">
|
||||
<option value="">{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td>
|
||||
<td>
|
||||
<select id="fontsize" name="fontsize" onchange="changedStyleField(this);">
|
||||
<option value="">{#not_set}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="textcolor">{#fullpage_dlg.textcolor}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td>
|
||||
<td id="textcolor_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.appearance_bgprops}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="bgimage">{#fullpage_dlg.bgimage}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
<td id="bgimage_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="bgcolor">{#fullpage_dlg.bgcolor}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td>
|
||||
<td id="bgcolor_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.appearance_marginprops}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td>
|
||||
<td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
<td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td>
|
||||
<td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td>
|
||||
<td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
<td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td>
|
||||
<td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.appearance_linkprops}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="link_color">{#fullpage_dlg.link_color}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td>
|
||||
<td id="link_color_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td class="column1"><label for="visited_color">{#fullpage_dlg.visited_color}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td>
|
||||
<td id="visited_color_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"><label for="active_color">{#fullpage_dlg.active_color}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td>
|
||||
<td id="active_color_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
|
||||
<!-- <td class="column1"><label for="hover_color">{#fullpage_dlg.hover_color}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td>
|
||||
<td id="hover_color_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td> -->
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.appearance_style}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="stylesheet">{#fullpage_dlg.stylesheet}</label></td>
|
||||
<td><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="stylesheet" name="stylesheet" type="text" value="" /></td>
|
||||
<td id="stylesheet_browsercontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="style">{#fullpage_dlg.style}</label></td>
|
||||
<td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<div id="addmenu">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{#fullpage_dlg.add_title}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{#fullpage_dlg.add_meta}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{#fullpage_dlg.add_script}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{#fullpage_dlg.add_style}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{#fullpage_dlg.add_link}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{#fullpage_dlg.add_base}</span></a></td></tr>
|
||||
<tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{#fullpage_dlg.add_comment}</span></a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#fullpage_dlg.head_elements}</legend>
|
||||
|
||||
<div class="headlistwrapper">
|
||||
<div class="toolbar">
|
||||
<div style="float: left">
|
||||
<a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{#fullpage_dlg.add}"></a>
|
||||
<a href="#" onmousedown="return false;" class="removebutton" title="{#fullpage_dlg.remove}"></a>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<a href="#" onmousedown="return false;" class="moveupbutton" title="{#fullpage_dlg.moveup}"></a>
|
||||
<a href="#" onmousedown="return false;" class="movedownbutton" title="{#fullpage_dlg.movedown}"></a>
|
||||
</div>
|
||||
<br style="clear: both" />
|
||||
</div>
|
||||
<select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);">
|
||||
<option value="title_0"><title>Some title bla bla bla</title></option>
|
||||
<option value="meta_1"><meta name="keywords">Some bla bla bla</meta></option>
|
||||
<option value="meta_2"><meta name="description">Some bla bla bla bla bla bla bla bla bla</meta></option>
|
||||
<option value="script_3"><script language="javascript">...</script></option>
|
||||
<option value="style_4"><style>...</style></option>
|
||||
<option value="base_5"><base href="." /></option>
|
||||
<option value="comment_6"><!-- ... --></option>
|
||||
<option value="link_7"><link href="." /></option>
|
||||
</select>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="meta_element">
|
||||
<legend>{#fullpage_dlg.meta_element}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_meta_type">{#fullpage_dlg.type}</label></td>
|
||||
<td><select id="element_meta_type">
|
||||
<option value="name">name</option>
|
||||
<option value="http-equiv">http-equiv</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_meta_name">{#fullpage_dlg.name}</label></td>
|
||||
<td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_meta_content">{#fullpage_dlg.content}</label></td>
|
||||
<td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="title_element">
|
||||
<legend>{#fullpage_dlg.title_element}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_title">{#fullpage_dlg.meta_title}</label></td>
|
||||
<td><input id="element_title" name="element_title" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="script_element">
|
||||
<legend>{#fullpage_dlg.script_element}</legend>
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
|
||||
<li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="script_props_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_script_type">{#fullpage_dlg.type}</label></td>
|
||||
<td><select id="element_script_type">
|
||||
<option value="text/javascript">text/javascript</option>
|
||||
<option value="text/jscript">text/jscript</option>
|
||||
<option value="text/vbscript">text/vbscript</option>
|
||||
<option value="text/vbs">text/vbs</option>
|
||||
<option value="text/ecmascript">text/ecmascript</option>
|
||||
<option value="text/xml">text/xml</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_script_src">{#fullpage_dlg.src}</label></td>
|
||||
<td><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="element_script_src" name="element_script_src" type="text" value="" /></td>
|
||||
<td id="script_src_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_script_charset">{#fullpage_dlg.charset}</label></td>
|
||||
<td><select id="element_script_charset"><option value="">{#not_set}</option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_script_defer">{#fullpage_dlg.defer}</label></td>
|
||||
<td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="script_value_panel" class="panel">
|
||||
<textarea id="element_script_value"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="style_element">
|
||||
<legend>{#fullpage_dlg.style_element}</legend>
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
|
||||
<li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="style_props_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_style_type">{#fullpage_dlg.type}</label></td>
|
||||
<td><select id="element_style_type">
|
||||
<option value="text/css">text/css</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_style_media">{#fullpage_dlg.media}</label></td>
|
||||
<td><select id="element_style_media"></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="style_value_panel" class="panel">
|
||||
<textarea id="element_style_value"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="base_element">
|
||||
<legend>{#fullpage_dlg.base_element}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_base_href">{#fullpage_dlg.href}</label></td>
|
||||
<td><input id="element_base_href" name="element_base_href" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_base_target">{#fullpage_dlg.target}</label></td>
|
||||
<td><input id="element_base_target" name="element_base_target" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="link_element">
|
||||
<legend>{#fullpage_dlg.link_element}</legend>
|
||||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{#fullpage_dlg.general_props}</a></span></li>
|
||||
<li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_props}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="link_general_panel" class="panel current">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_href">{#fullpage_dlg.href}</label></td>
|
||||
<td><table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="element_link_href" name="element_link_href" type="text" value="" /></td>
|
||||
<td id="link_href_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_title">{#fullpage_dlg.meta_title}</label></td>
|
||||
<td><input id="element_link_title" name="element_link_title" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_type">{#fullpage_dlg.type}</label></td>
|
||||
<td><select id="element_link_type" name="element_link_type">
|
||||
<option value="text/css">text/css</option>
|
||||
<option value="text/javascript">text/javascript</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_media">{#fullpage_dlg.media}</label></td>
|
||||
<td><select id="element_link_media" name="element_link_media"></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="element_style_rel">{#fullpage_dlg.rel}</label></td>
|
||||
<td><select id="element_style_rel" name="element_style_rel">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="link_advanced_panel" class="panel">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_charset">{#fullpage_dlg.charset}</label></td>
|
||||
<td><select id="element_link_charset"><option value="">{#not_set}</option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_hreflang">{#fullpage_dlg.hreflang}</label></td>
|
||||
<td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label for="element_link_target">{#fullpage_dlg.target}</label></td>
|
||||
<td><input id="element_link_target" name="element_link_target" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="element_style_rev">{#fullpage_dlg.rev}</label></td>
|
||||
<td><select id="element_style_rev" name="element_style_rev">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="alternate">Alternate</option>
|
||||
<option value="designates">Designates</option>
|
||||
<option value="stylesheet">Stylesheet</option>
|
||||
<option value="start">Start</option>
|
||||
<option value="next">Next</option>
|
||||
<option value="prev">Prev</option>
|
||||
<option value="contents">Contents</option>
|
||||
<option value="index">Index</option>
|
||||
<option value="glossary">Glossary</option>
|
||||
<option value="copyright">Copyright</option>
|
||||
<option value="chapter">Chapter</option>
|
||||
<option value="subsection">Subsection</option>
|
||||
<option value="appendix">Appendix</option>
|
||||
<option value="help">Help</option>
|
||||
<option value="bookmark">Bookmark</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="comment_element">
|
||||
<legend>{#fullpage_dlg.comment_element}</legend>
|
||||
|
||||
<textarea id="element_comment_value"></textarea>
|
||||
|
||||
<input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="update" value="{#update}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,462 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var doc;
|
||||
|
||||
var defaultDocTypes =
|
||||
'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
|
||||
'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
|
||||
'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
|
||||
'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
|
||||
'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
|
||||
'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
|
||||
'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
|
||||
|
||||
var defaultEncodings =
|
||||
'Western european (iso-8859-1)=iso-8859-1,' +
|
||||
'Central European (iso-8859-2)=iso-8859-2,' +
|
||||
'Unicode (UTF-8)=utf-8,' +
|
||||
'Chinese traditional (Big5)=big5,' +
|
||||
'Cyrillic (iso-8859-5)=iso-8859-5,' +
|
||||
'Japanese (iso-2022-jp)=iso-2022-jp,' +
|
||||
'Greek (iso-8859-7)=iso-8859-7,' +
|
||||
'Korean (iso-2022-kr)=iso-2022-kr,' +
|
||||
'ASCII (us-ascii)=us-ascii';
|
||||
|
||||
var defaultMediaTypes =
|
||||
'all=all,' +
|
||||
'screen=screen,' +
|
||||
'print=print,' +
|
||||
'tty=tty,' +
|
||||
'tv=tv,' +
|
||||
'projection=projection,' +
|
||||
'handheld=handheld,' +
|
||||
'braille=braille,' +
|
||||
'aural=aural';
|
||||
|
||||
var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
|
||||
var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
|
||||
|
||||
function init() {
|
||||
var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style;
|
||||
|
||||
// Setup doctype select box
|
||||
doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(',');
|
||||
for (i=0; i<doctypes.length; i++) {
|
||||
p = doctypes[i].split('=');
|
||||
|
||||
if (p.length > 1)
|
||||
addSelectValue(f, 'doctypes', p[0], p[1]);
|
||||
}
|
||||
|
||||
// Setup fonts select box
|
||||
fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';');
|
||||
for (i=0; i<fonts.length; i++) {
|
||||
p = fonts[i].split('=');
|
||||
|
||||
if (p.length > 1)
|
||||
addSelectValue(f, 'fontface', p[0], p[1]);
|
||||
}
|
||||
|
||||
// Setup fontsize select box
|
||||
fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
|
||||
for (i=0; i<fonts.length; i++)
|
||||
addSelectValue(f, 'fontsize', fonts[i], fonts[i]);
|
||||
|
||||
// Setup mediatype select boxs
|
||||
mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(',');
|
||||
for (i=0; i<mediaTypes.length; i++) {
|
||||
p = mediaTypes[i].split('=');
|
||||
|
||||
if (p.length > 1) {
|
||||
addSelectValue(f, 'element_style_media', p[0], p[1]);
|
||||
addSelectValue(f, 'element_link_media', p[0], p[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup encodings select box
|
||||
encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(',');
|
||||
for (i=0; i<encodings.length; i++) {
|
||||
p = encodings[i].split('=');
|
||||
|
||||
if (p.length > 1) {
|
||||
addSelectValue(f, 'docencoding', p[0], p[1]);
|
||||
addSelectValue(f, 'element_script_charset', p[0], p[1]);
|
||||
addSelectValue(f, 'element_link_charset', p[0], p[1]);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
||||
document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
|
||||
//document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');
|
||||
document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
|
||||
document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
|
||||
document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
|
||||
document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
|
||||
document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');
|
||||
document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');
|
||||
document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
|
||||
|
||||
// Resize some elements
|
||||
if (isVisible('stylesheetbrowser'))
|
||||
document.getElementById('stylesheet').style.width = '220px';
|
||||
|
||||
if (isVisible('link_href_browser'))
|
||||
document.getElementById('element_link_href').style.width = '230px';
|
||||
|
||||
if (isVisible('bgimage_browser'))
|
||||
document.getElementById('bgimage').style.width = '210px';
|
||||
|
||||
// Add iframe
|
||||
dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}});
|
||||
doc = dom.get('documentIframe').contentWindow.document;
|
||||
h = tinyMCEPopup.getWindowArg('head_html');
|
||||
|
||||
// Preprocess the HTML disable scripts and urls
|
||||
h = h.replace(/<script>/gi, '<script type="text/javascript">');
|
||||
h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-');
|
||||
h = h.replace(/(src=|href=)/g, 'mce_$1');
|
||||
|
||||
// Write in the content in the iframe
|
||||
doc.write(h + '</body></html>');
|
||||
doc.close();
|
||||
|
||||
// Parse xml and doctype
|
||||
xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
|
||||
xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
|
||||
docType = getReItem(/<\!DOCTYPE.*?>/gi, h, 0);
|
||||
f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
|
||||
|
||||
// Parse title
|
||||
if (e = doc.getElementsByTagName('title')[0])
|
||||
el.metatitle.value = e.textContent || e.text;
|
||||
|
||||
// Parse meta
|
||||
tinymce.each(doc.getElementsByTagName('meta'), function(n) {
|
||||
var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || '';
|
||||
|
||||
e = el['meta' + na];
|
||||
|
||||
if (na == 'robots') {
|
||||
selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (eq.toLowerCase()) {
|
||||
case "content-type":
|
||||
tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, value, 1);
|
||||
|
||||
// Override XML encoding
|
||||
if (tmp != "")
|
||||
xmlEnc = tmp;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e)
|
||||
e.value = va;
|
||||
});
|
||||
|
||||
selectByValue(f, 'doctypes', docType, true, true);
|
||||
selectByValue(f, 'docencoding', xmlEnc, true, true);
|
||||
selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true);
|
||||
|
||||
if (xmlVer != '')
|
||||
el.xml_pi.checked = true;
|
||||
|
||||
// Parse appearance
|
||||
|
||||
// Parse primary stylesheet
|
||||
tinymce.each(doc.getElementsByTagName("link"), function(l) {
|
||||
var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || '';
|
||||
|
||||
if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") {
|
||||
f.stylesheet.value = l.getAttribute('mce_href', 2) || '';
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Get from style elements
|
||||
tinymce.each(doc.getElementsByTagName("style"), function(st) {
|
||||
var tmp = parseStyleElement(st);
|
||||
|
||||
for (x=0; x<tmp.length; x++) {
|
||||
if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])
|
||||
f.visited_color.value = tmp[x].data['color'];
|
||||
|
||||
if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])
|
||||
f.link_color.value = tmp[x].data['color'];
|
||||
|
||||
if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])
|
||||
f.active_color.value = tmp[x].data['color'];
|
||||
}
|
||||
});
|
||||
|
||||
f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text");
|
||||
f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink");
|
||||
f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link");
|
||||
f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink");
|
||||
f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor");
|
||||
f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background");
|
||||
|
||||
// Get from style info
|
||||
style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style'));
|
||||
|
||||
if (style['font-family'])
|
||||
selectByValue(f, 'fontface', style['font-family'], true, true);
|
||||
else
|
||||
selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true);
|
||||
|
||||
if (style['font-size'])
|
||||
selectByValue(f, 'fontsize', style['font-size'], true, true);
|
||||
else
|
||||
selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true);
|
||||
|
||||
if (style['color'])
|
||||
f.textcolor.value = convertRGBToHex(style['color']);
|
||||
|
||||
if (style['background-image'])
|
||||
f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
|
||||
if (style['background-color'])
|
||||
f.bgcolor.value = style['background-color'];
|
||||
|
||||
if (style['margin']) {
|
||||
tmp = style['margin'].replace(/[^0-9 ]/g, '');
|
||||
tmp = tmp.split(/ +/);
|
||||
f.topmargin.value = tmp.length > 0 ? tmp[0] : '';
|
||||
f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];
|
||||
f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];
|
||||
f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];
|
||||
}
|
||||
|
||||
if (style['margin-left'])
|
||||
f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');
|
||||
|
||||
if (style['margin-right'])
|
||||
f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');
|
||||
|
||||
if (style['margin-top'])
|
||||
f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');
|
||||
|
||||
if (style['margin-bottom'])
|
||||
f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');
|
||||
|
||||
f.style.value = tinyMCEPopup.dom.serializeStyle(style);
|
||||
|
||||
// Update colors
|
||||
updateColor('textcolor_pick', 'textcolor');
|
||||
updateColor('bgcolor_pick', 'bgcolor');
|
||||
updateColor('visited_color_pick', 'visited_color');
|
||||
updateColor('active_color_pick', 'active_color');
|
||||
updateColor('link_color_pick', 'link_color');
|
||||
}
|
||||
|
||||
function getReItem(r, s, i) {
|
||||
var c = r.exec(s);
|
||||
|
||||
if (c && c.length > i)
|
||||
return c[i];
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function updateAction() {
|
||||
var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;
|
||||
|
||||
head = doc.getElementsByTagName('head')[0];
|
||||
|
||||
// Fix scripts without a type
|
||||
nl = doc.getElementsByTagName('script');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (tinyMCEPopup.dom.getAttrib(nl[i], 'mce_type') == '')
|
||||
nl[i].setAttribute('mce_type', 'text/javascript');
|
||||
}
|
||||
|
||||
// Get primary stylesheet
|
||||
nl = doc.getElementsByTagName("link");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
l = nl[i];
|
||||
|
||||
tmp = tinyMCEPopup.dom.getAttrib(l, 'media');
|
||||
|
||||
if (tinyMCEPopup.dom.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") {
|
||||
addlink = false;
|
||||
|
||||
if (f.stylesheet.value == '')
|
||||
l.parentNode.removeChild(l);
|
||||
else
|
||||
l.setAttribute('mce_href', f.stylesheet.value);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add new link
|
||||
if (f.stylesheet.value != '') {
|
||||
l = doc.createElement('link');
|
||||
|
||||
l.setAttribute('type', 'text/css');
|
||||
l.setAttribute('mce_href', f.stylesheet.value);
|
||||
l.setAttribute('rel', 'stylesheet');
|
||||
|
||||
head.appendChild(l);
|
||||
}
|
||||
|
||||
setMeta(head, 'keywords', f.metakeywords.value);
|
||||
setMeta(head, 'description', f.metadescription.value);
|
||||
setMeta(head, 'author', f.metaauthor.value);
|
||||
setMeta(head, 'copyright', f.metacopyright.value);
|
||||
setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
|
||||
setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));
|
||||
|
||||
doc.body.dir = getSelectValue(f, 'langdir');
|
||||
doc.body.style.cssText = f.style.value;
|
||||
|
||||
doc.body.setAttribute('vLink', f.visited_color.value);
|
||||
doc.body.setAttribute('link', f.link_color.value);
|
||||
doc.body.setAttribute('text', f.textcolor.value);
|
||||
doc.body.setAttribute('aLink', f.active_color.value);
|
||||
|
||||
doc.body.style.fontFamily = getSelectValue(f, 'fontface');
|
||||
doc.body.style.fontSize = getSelectValue(f, 'fontsize');
|
||||
doc.body.style.backgroundColor = f.bgcolor.value;
|
||||
|
||||
if (f.leftmargin.value != '')
|
||||
doc.body.style.marginLeft = f.leftmargin.value + 'px';
|
||||
|
||||
if (f.rightmargin.value != '')
|
||||
doc.body.style.marginRight = f.rightmargin.value + 'px';
|
||||
|
||||
if (f.bottommargin.value != '')
|
||||
doc.body.style.marginBottom = f.bottommargin.value + 'px';
|
||||
|
||||
if (f.topmargin.value != '')
|
||||
doc.body.style.marginTop = f.topmargin.value + 'px';
|
||||
|
||||
html = doc.getElementsByTagName('html')[0];
|
||||
html.setAttribute('lang', f.langcode.value);
|
||||
html.setAttribute('xml:lang', f.langcode.value);
|
||||
|
||||
if (f.bgimage.value != '')
|
||||
doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
|
||||
else
|
||||
doc.body.style.backgroundImage = '';
|
||||
|
||||
ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();
|
||||
ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head');
|
||||
|
||||
h = ser.serialize(doc.documentElement);
|
||||
h = h.substring(0, h.lastIndexOf('</body>'));
|
||||
|
||||
if (h.indexOf('<title>') == -1)
|
||||
h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
|
||||
else
|
||||
h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
|
||||
|
||||
if ((v = getSelectValue(f, 'doctypes')) != '')
|
||||
h = v + '\n' + h;
|
||||
|
||||
if (f.xml_pi.checked) {
|
||||
s = '<?xml version="1.0"';
|
||||
|
||||
if ((v = getSelectValue(f, 'docencoding')) != '')
|
||||
s += ' encoding="' + v + '"';
|
||||
|
||||
s += '?>\n';
|
||||
h = s + h;
|
||||
}
|
||||
|
||||
h = h.replace(/type=\"\-mce\-/gi, 'type="');
|
||||
|
||||
tinyMCEPopup.editor.plugins.fullpage.head = h;
|
||||
tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function changedStyleField(field) {
|
||||
//alert(field.id);
|
||||
}
|
||||
|
||||
function setMeta(he, k, v) {
|
||||
var nl, i, m;
|
||||
|
||||
nl = he.getElementsByTagName('meta');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) {
|
||||
if (v == '')
|
||||
nl[i].parentNode.removeChild(nl[i]);
|
||||
else
|
||||
nl[i].setAttribute('content', "text/html; charset=" + v);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {
|
||||
if (v == '')
|
||||
nl[i].parentNode.removeChild(nl[i]);
|
||||
else
|
||||
nl[i].setAttribute('content', v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (v == '')
|
||||
return;
|
||||
|
||||
m = doc.createElement('meta');
|
||||
|
||||
if (k == 'Content-Type')
|
||||
m.httpEquiv = k;
|
||||
else
|
||||
m.setAttribute('name', k);
|
||||
|
||||
m.setAttribute('content', v);
|
||||
he.appendChild(m);
|
||||
}
|
||||
|
||||
function parseStyleElement(e) {
|
||||
var v = e.innerHTML;
|
||||
var p, i, r;
|
||||
|
||||
v = v.replace(/<!--/gi, '');
|
||||
v = v.replace(/-->/gi, '');
|
||||
v = v.replace(/[\n\r]/gi, '');
|
||||
v = v.replace(/\s+/gi, ' ');
|
||||
|
||||
r = [];
|
||||
p = v.split(/{|}/);
|
||||
|
||||
for (i=0; i<p.length; i+=2) {
|
||||
if (p[i] != "")
|
||||
r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])};
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
function serializeStyleElement(d) {
|
||||
var i, s, st;
|
||||
|
||||
s = '<!--\n';
|
||||
|
||||
for (i=0; i<d.length; i++) {
|
||||
s += d[i].rule + ' {\n';
|
||||
|
||||
st = tinyMCE.serializeStyle(d[i].data);
|
||||
|
||||
if (st != '')
|
||||
st += ';';
|
||||
|
||||
s += st.replace(/;/g, ';\n');
|
||||
s += '}\n';
|
||||
|
||||
if (i != d.length - 1)
|
||||
s += '\n';
|
||||
}
|
||||
|
||||
s += '\n-->';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -0,0 +1,85 @@
|
||||
tinyMCE.addI18n('en.fullpage_dlg',{
|
||||
title:"Document properties",
|
||||
meta_tab:"General",
|
||||
appearance_tab:"Appearance",
|
||||
advanced_tab:"Advanced",
|
||||
meta_props:"Meta information",
|
||||
langprops:"Language and encoding",
|
||||
meta_title:"Title",
|
||||
meta_keywords:"Keywords",
|
||||
meta_description:"Description",
|
||||
meta_robots:"Robots",
|
||||
doctypes:"Doctype",
|
||||
langcode:"Language code",
|
||||
langdir:"Language direction",
|
||||
ltr:"Left to right",
|
||||
rtl:"Right to left",
|
||||
xml_pi:"XML declaration",
|
||||
encoding:"Character encoding",
|
||||
appearance_bgprops:"Background properties",
|
||||
appearance_marginprops:"Body margins",
|
||||
appearance_linkprops:"Link colors",
|
||||
appearance_textprops:"Text properties",
|
||||
bgcolor:"Background color",
|
||||
bgimage:"Background image",
|
||||
left_margin:"Left margin",
|
||||
right_margin:"Right margin",
|
||||
top_margin:"Top margin",
|
||||
bottom_margin:"Bottom margin",
|
||||
text_color:"Text color",
|
||||
font_size:"Font size",
|
||||
font_face:"Font face",
|
||||
link_color:"Link color",
|
||||
hover_color:"Hover color",
|
||||
visited_color:"Visited color",
|
||||
active_color:"Active color",
|
||||
textcolor:"Color",
|
||||
fontsize:"Font size",
|
||||
fontface:"Font family",
|
||||
meta_index_follow:"Index and follow the links",
|
||||
meta_index_nofollow:"Index and don't follow the links",
|
||||
meta_noindex_follow:"Do not index but follow the links",
|
||||
meta_noindex_nofollow:"Do not index and don\'t follow the links",
|
||||
appearance_style:"Stylesheet and style properties",
|
||||
stylesheet:"Stylesheet",
|
||||
style:"Style",
|
||||
author:"Author",
|
||||
copyright:"Copyright",
|
||||
add:"Add new element",
|
||||
remove:"Remove selected element",
|
||||
moveup:"Move selected element up",
|
||||
movedown:"Move selected element down",
|
||||
head_elements:"Head elements",
|
||||
info:"Information",
|
||||
add_title:"Title element",
|
||||
add_meta:"Meta element",
|
||||
add_script:"Script element",
|
||||
add_style:"Style element",
|
||||
add_link:"Link element",
|
||||
add_base:"Base element",
|
||||
add_comment:"Comment node",
|
||||
title_element:"Title element",
|
||||
script_element:"Script element",
|
||||
style_element:"Style element",
|
||||
base_element:"Base element",
|
||||
link_element:"Link element",
|
||||
meta_element:"Meta element",
|
||||
comment_element:"Comment",
|
||||
src:"Src",
|
||||
language:"Language",
|
||||
href:"Href",
|
||||
target:"Target",
|
||||
type:"Type",
|
||||
charset:"Charset",
|
||||
defer:"Defer",
|
||||
media:"Media",
|
||||
properties:"Properties",
|
||||
name:"Name",
|
||||
value:"Value",
|
||||
content:"Content",
|
||||
rel:"Rel",
|
||||
rev:"Rev",
|
||||
hreflang:"Href lang",
|
||||
general_props:"General",
|
||||
advanced_props:"Advanced"
|
||||
});
|
@ -0,0 +1,365 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:27 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var each = tinymce.each;
|
||||
|
||||
tinymce.create('tinymce.plugins.MediaPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
t.url = url;
|
||||
|
||||
function isMediaElm(n) {
|
||||
return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);
|
||||
};
|
||||
|
||||
ed.onPreInit.add(function() {
|
||||
// Force in _value parameter this extra parameter is required for older Opera versions
|
||||
ed.serializer.addRules('param[name|value|_value]');
|
||||
});
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceMedia', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/media.htm',
|
||||
width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
|
||||
height : 470 + parseInt(ed.getLang('media.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));
|
||||
});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
var lo = {
|
||||
mceItemFlash : 'flash',
|
||||
mceItemShockWave : 'shockwave',
|
||||
mceItemWindowsMedia : 'windowsmedia',
|
||||
mceItemQuickTime : 'quicktime',
|
||||
mceItemRealMedia : 'realmedia'
|
||||
};
|
||||
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.dom.loadCSS(url + "/css/content.css");
|
||||
|
||||
if (ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(th, o) {
|
||||
if (o.name == 'img') {
|
||||
each(lo, function(v, k) {
|
||||
if (ed.dom.hasClass(o.node, k)) {
|
||||
o.name = v;
|
||||
o.title = ed.dom.getAttrib(o.node, 'title');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (ed && ed.plugins.contextmenu) {
|
||||
ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
|
||||
if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) {
|
||||
m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
var h = o.content;
|
||||
|
||||
h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {
|
||||
var o = t._parse(c);
|
||||
|
||||
return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'
|
||||
});
|
||||
|
||||
h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>');
|
||||
h = h.replace(/<embed([^>]*)\/>/gi, '<span class="mceItemEmbed" $1>');
|
||||
h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>');
|
||||
h = h.replace(/<\/(object|embed)([^>]*)>/gi, '</span>');
|
||||
h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_value=') + ' class="mceItemParam"></span>'});
|
||||
h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>');
|
||||
|
||||
o.content = h;
|
||||
});
|
||||
|
||||
ed.onSetContent.add(function() {
|
||||
t._spansToImgs(ed.getBody());
|
||||
});
|
||||
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
var dom = ed.dom;
|
||||
|
||||
if (o.set) {
|
||||
t._spansToImgs(o.node);
|
||||
|
||||
each(dom.select('IMG', o.node), function(n) {
|
||||
var p;
|
||||
|
||||
if (isMediaElm(n)) {
|
||||
p = t._parse(n.title);
|
||||
dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100));
|
||||
dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (o.get) {
|
||||
each(dom.select('IMG', o.node), function(n) {
|
||||
var ci, cb, mt;
|
||||
|
||||
if (ed.getParam('media_use_script')) {
|
||||
if (isMediaElm(n))
|
||||
n.className = n.className.replace(/mceItem/g, 'mceTemp');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (n.className) {
|
||||
case 'mceItemFlash':
|
||||
ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'application/x-shockwave-flash';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
ci = '166b1bca-3f9c-11cf-8075-444553540000';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
||||
mt = 'application/x-director';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6';
|
||||
cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
||||
mt = 'application/x-mplayer2';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b';
|
||||
cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
||||
mt = 'video/quicktime';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa';
|
||||
cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
mt = 'audio/x-pn-realaudio-plugin';
|
||||
break;
|
||||
}
|
||||
|
||||
if (ci) {
|
||||
dom.replace(t._buildObj({
|
||||
classid : ci,
|
||||
codebase : cb,
|
||||
type : mt
|
||||
}, n), n);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
o.content = o.content.replace(/_value=/g, 'value=');
|
||||
});
|
||||
|
||||
if (ed.getParam('media_use_script')) {
|
||||
function getAttr(s, n) {
|
||||
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
|
||||
|
||||
return n ? ed.dom.decode(n[1]) : '';
|
||||
};
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||
var cl = getAttr(im, 'class');
|
||||
|
||||
if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) {
|
||||
at = t._parse(getAttr(im, 'title'));
|
||||
at.width = getAttr(im, 'width');
|
||||
at.height = getAttr(im, 'height');
|
||||
im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>';
|
||||
}
|
||||
|
||||
return im;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Media',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_buildObj : function(o, n) {
|
||||
var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title);
|
||||
|
||||
p.width = o.width = dom.getAttrib(n, 'width') || 100;
|
||||
p.height = o.height = dom.getAttrib(n, 'height') || 100;
|
||||
|
||||
ob = dom.create('span', {
|
||||
mce_name : 'object',
|
||||
classid : "clsid:" + o.classid,
|
||||
codebase : o.codebase,
|
||||
width : o.width,
|
||||
height : o.height
|
||||
});
|
||||
|
||||
if (p.src)
|
||||
p.src = ed.convertURL(p.src, 'src', n);
|
||||
|
||||
each (p, function(v, k) {
|
||||
if (!/^(width|height|codebase|classid)$/.test(k)) {
|
||||
// Use url instead of src in IE for Windows media
|
||||
if (o.type == 'application/x-mplayer2' && k == 'src')
|
||||
k = 'url';
|
||||
|
||||
dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v});
|
||||
}
|
||||
});
|
||||
|
||||
dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p));
|
||||
|
||||
return ob;
|
||||
},
|
||||
|
||||
_spansToImgs : function(p) {
|
||||
var t = this, dom = t.editor.dom, im, ci;
|
||||
|
||||
each(dom.select('span', p), function(n) {
|
||||
// Convert object into image
|
||||
if (dom.getAttrib(n, 'class') == 'mceItemObject') {
|
||||
ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, '');
|
||||
|
||||
switch (ci) {
|
||||
case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
|
||||
dom.replace(t._createImg('mceItemFlash', n), n);
|
||||
break;
|
||||
|
||||
case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
|
||||
dom.replace(t._createImg('mceItemShockWave', n), n);
|
||||
break;
|
||||
|
||||
case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
|
||||
case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
|
||||
case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
|
||||
dom.replace(t._createImg('mceItemWindowsMedia', n), n);
|
||||
break;
|
||||
|
||||
case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
|
||||
dom.replace(t._createImg('mceItemQuickTime', n), n);
|
||||
break;
|
||||
|
||||
case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
|
||||
dom.replace(t._createImg('mceItemRealMedia', n), n);
|
||||
break;
|
||||
|
||||
default:
|
||||
dom.replace(t._createImg('mceItemFlash', n), n);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert embed into image
|
||||
if (dom.getAttrib(n, 'class') == 'mceItemEmbed') {
|
||||
switch (dom.getAttrib(n, 'type')) {
|
||||
case 'application/x-shockwave-flash':
|
||||
dom.replace(t._createImg('mceItemFlash', n), n);
|
||||
break;
|
||||
|
||||
case 'application/x-director':
|
||||
dom.replace(t._createImg('mceItemShockWave', n), n);
|
||||
break;
|
||||
|
||||
case 'application/x-mplayer2':
|
||||
dom.replace(t._createImg('mceItemWindowsMedia', n), n);
|
||||
break;
|
||||
|
||||
case 'video/quicktime':
|
||||
dom.replace(t._createImg('mceItemQuickTime', n), n);
|
||||
break;
|
||||
|
||||
case 'audio/x-pn-realaudio-plugin':
|
||||
dom.replace(t._createImg('mceItemRealMedia', n), n);
|
||||
break;
|
||||
|
||||
default:
|
||||
dom.replace(t._createImg('mceItemFlash', n), n);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_createImg : function(cl, n) {
|
||||
var im, dom = this.editor.dom, pa = {}, ti = '';
|
||||
|
||||
// Create image
|
||||
im = dom.create('img', {
|
||||
src : this.url + '/img/trans.gif',
|
||||
width : dom.getAttrib(n, 'width') || 100,
|
||||
height : dom.getAttrib(n, 'height') || 100,
|
||||
'class' : cl
|
||||
});
|
||||
|
||||
// Setup base parameters
|
||||
each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) {
|
||||
var v = dom.getAttrib(n, na);
|
||||
|
||||
if (v)
|
||||
pa[na] = v;
|
||||
});
|
||||
|
||||
// Add optional parameters
|
||||
each(dom.select('span', n), function(n) {
|
||||
if (dom.hasClass(n, 'mceItemParam'))
|
||||
pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value');
|
||||
});
|
||||
|
||||
// Use src not movie
|
||||
if (pa.movie) {
|
||||
pa.src = pa.movie;
|
||||
delete pa.movie;
|
||||
}
|
||||
|
||||
delete pa.width;
|
||||
delete pa.height;
|
||||
|
||||
im.title = this._serialize(pa);
|
||||
|
||||
return im;
|
||||
},
|
||||
|
||||
_parse : function(s) {
|
||||
return tinymce.util.JSON.parse('{' + s + '}');
|
||||
},
|
||||
|
||||
_serialize : function(o) {
|
||||
return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
|
||||
})();
|
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 439 B |
After Width: | Height: | Size: 387 B |
After Width: | Height: | Size: 43 B |
After Width: | Height: | Size: 415 B |
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
||||
*/
|
||||
|
||||
function writeFlash(p) {
|
||||
writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeShockWave(p) {
|
||||
writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeQuickTime(p) {
|
||||
writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeRealMedia(p) {
|
||||
writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeWindowsMedia(p) {
|
||||
p.url = p.src;
|
||||
writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeEmbed(cls, cb, mt, p) {
|
||||
var h = '', n;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
document.write(h);
|
||||
}
|
@ -0,0 +1,628 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var oldWidth, oldHeight, ed, url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("media_external_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
|
||||
function init() {
|
||||
var pl = "", f, val;
|
||||
var type = "flash", fe, i;
|
||||
|
||||
ed = tinyMCEPopup.editor;
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
f = document.forms[0]
|
||||
|
||||
fe = ed.selection.getNode();
|
||||
if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
|
||||
pl = fe.title;
|
||||
|
||||
switch (ed.dom.getAttrib(fe, 'class')) {
|
||||
case 'mceItemFlash':
|
||||
type = 'flash';
|
||||
break;
|
||||
|
||||
case 'mceItemFlashVideo':
|
||||
type = 'flv';
|
||||
break;
|
||||
|
||||
case 'mceItemShockWave':
|
||||
type = 'shockwave';
|
||||
break;
|
||||
|
||||
case 'mceItemWindowsMedia':
|
||||
type = 'wmp';
|
||||
break;
|
||||
|
||||
case 'mceItemQuickTime':
|
||||
type = 'qt';
|
||||
break;
|
||||
|
||||
case 'mceItemRealMedia':
|
||||
type = 'rmp';
|
||||
break;
|
||||
}
|
||||
|
||||
document.forms[0].insert.value = ed.getLang('update', 'Insert', true);
|
||||
}
|
||||
|
||||
document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
|
||||
document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
|
||||
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
||||
|
||||
var html = getMediaListHTML('medialist','src','media','media');
|
||||
if (html == "")
|
||||
document.getElementById("linklistrow").style.display = 'none';
|
||||
else
|
||||
document.getElementById("linklistcontainer").innerHTML = html;
|
||||
|
||||
// Resize some elements
|
||||
if (isVisible('filebrowser'))
|
||||
document.getElementById('src').style.width = '230px';
|
||||
|
||||
// Setup form
|
||||
if (pl != "") {
|
||||
pl = tinyMCEPopup.editor.plugins.media._parse(pl);
|
||||
|
||||
switch (type) {
|
||||
case "flash":
|
||||
setBool(pl, 'flash', 'play');
|
||||
setBool(pl, 'flash', 'loop');
|
||||
setBool(pl, 'flash', 'menu');
|
||||
setBool(pl, 'flash', 'swliveconnect');
|
||||
setStr(pl, 'flash', 'quality');
|
||||
setStr(pl, 'flash', 'scale');
|
||||
setStr(pl, 'flash', 'salign');
|
||||
setStr(pl, 'flash', 'wmode');
|
||||
setStr(pl, 'flash', 'base');
|
||||
setStr(pl, 'flash', 'flashvars');
|
||||
break;
|
||||
|
||||
case "qt":
|
||||
setBool(pl, 'qt', 'loop');
|
||||
setBool(pl, 'qt', 'autoplay');
|
||||
setBool(pl, 'qt', 'cache');
|
||||
setBool(pl, 'qt', 'controller');
|
||||
setBool(pl, 'qt', 'correction');
|
||||
setBool(pl, 'qt', 'enablejavascript');
|
||||
setBool(pl, 'qt', 'kioskmode');
|
||||
setBool(pl, 'qt', 'autohref');
|
||||
setBool(pl, 'qt', 'playeveryframe');
|
||||
setBool(pl, 'qt', 'tarsetcache');
|
||||
setStr(pl, 'qt', 'scale');
|
||||
setStr(pl, 'qt', 'starttime');
|
||||
setStr(pl, 'qt', 'endtime');
|
||||
setStr(pl, 'qt', 'tarset');
|
||||
setStr(pl, 'qt', 'qtsrcchokespeed');
|
||||
setStr(pl, 'qt', 'volume');
|
||||
setStr(pl, 'qt', 'qtsrc');
|
||||
break;
|
||||
|
||||
case "shockwave":
|
||||
setBool(pl, 'shockwave', 'sound');
|
||||
setBool(pl, 'shockwave', 'progress');
|
||||
setBool(pl, 'shockwave', 'autostart');
|
||||
setBool(pl, 'shockwave', 'swliveconnect');
|
||||
setStr(pl, 'shockwave', 'swvolume');
|
||||
setStr(pl, 'shockwave', 'swstretchstyle');
|
||||
setStr(pl, 'shockwave', 'swstretchhalign');
|
||||
setStr(pl, 'shockwave', 'swstretchvalign');
|
||||
break;
|
||||
|
||||
case "wmp":
|
||||
setBool(pl, 'wmp', 'autostart');
|
||||
setBool(pl, 'wmp', 'enabled');
|
||||
setBool(pl, 'wmp', 'enablecontextmenu');
|
||||
setBool(pl, 'wmp', 'fullscreen');
|
||||
setBool(pl, 'wmp', 'invokeurls');
|
||||
setBool(pl, 'wmp', 'mute');
|
||||
setBool(pl, 'wmp', 'stretchtofit');
|
||||
setBool(pl, 'wmp', 'windowlessvideo');
|
||||
setStr(pl, 'wmp', 'balance');
|
||||
setStr(pl, 'wmp', 'baseurl');
|
||||
setStr(pl, 'wmp', 'captioningid');
|
||||
setStr(pl, 'wmp', 'currentmarker');
|
||||
setStr(pl, 'wmp', 'currentposition');
|
||||
setStr(pl, 'wmp', 'defaultframe');
|
||||
setStr(pl, 'wmp', 'playcount');
|
||||
setStr(pl, 'wmp', 'rate');
|
||||
setStr(pl, 'wmp', 'uimode');
|
||||
setStr(pl, 'wmp', 'volume');
|
||||
break;
|
||||
|
||||
case "rmp":
|
||||
setBool(pl, 'rmp', 'autostart');
|
||||
setBool(pl, 'rmp', 'loop');
|
||||
setBool(pl, 'rmp', 'autogotourl');
|
||||
setBool(pl, 'rmp', 'center');
|
||||
setBool(pl, 'rmp', 'imagestatus');
|
||||
setBool(pl, 'rmp', 'maintainaspect');
|
||||
setBool(pl, 'rmp', 'nojava');
|
||||
setBool(pl, 'rmp', 'prefetch');
|
||||
setBool(pl, 'rmp', 'shuffle');
|
||||
setStr(pl, 'rmp', 'console');
|
||||
setStr(pl, 'rmp', 'controls');
|
||||
setStr(pl, 'rmp', 'numloop');
|
||||
setStr(pl, 'rmp', 'scriptcallbacks');
|
||||
break;
|
||||
}
|
||||
|
||||
setStr(pl, null, 'src');
|
||||
setStr(pl, null, 'id');
|
||||
setStr(pl, null, 'name');
|
||||
setStr(pl, null, 'vspace');
|
||||
setStr(pl, null, 'hspace');
|
||||
setStr(pl, null, 'bgcolor');
|
||||
setStr(pl, null, 'align');
|
||||
setStr(pl, null, 'width');
|
||||
setStr(pl, null, 'height');
|
||||
|
||||
if ((val = ed.dom.getAttrib(fe, "width")) != "")
|
||||
pl.width = f.width.value = val;
|
||||
|
||||
if ((val = ed.dom.getAttrib(fe, "height")) != "")
|
||||
pl.height = f.height.value = val;
|
||||
|
||||
oldWidth = pl.width ? parseInt(pl.width) : 0;
|
||||
oldHeight = pl.height ? parseInt(pl.height) : 0;
|
||||
} else
|
||||
oldWidth = oldHeight = 0;
|
||||
|
||||
selectByValue(f, 'media_type', type);
|
||||
changedType(type);
|
||||
updateColor('bgcolor_pick', 'bgcolor');
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
generatePreview();
|
||||
}
|
||||
|
||||
function insertMedia() {
|
||||
var fe, f = document.forms[0], h;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
if (!AutoValidator.validate(f)) {
|
||||
alert(ed.getLang('invalid_data'));
|
||||
return false;
|
||||
}
|
||||
|
||||
f.width.value = f.width.value == "" ? 100 : f.width.value;
|
||||
f.height.value = f.height.value == "" ? 100 : f.height.value;
|
||||
|
||||
fe = ed.selection.getNode();
|
||||
if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
|
||||
switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
||||
case "flash":
|
||||
fe.className = "mceItemFlash";
|
||||
break;
|
||||
|
||||
case "flv":
|
||||
fe.className = "mceItemFlashVideo";
|
||||
break;
|
||||
|
||||
case "shockwave":
|
||||
fe.className = "mceItemShockWave";
|
||||
break;
|
||||
|
||||
case "qt":
|
||||
fe.className = "mceItemQuickTime";
|
||||
break;
|
||||
|
||||
case "wmp":
|
||||
fe.className = "mceItemWindowsMedia";
|
||||
break;
|
||||
|
||||
case "rmp":
|
||||
fe.className = "mceItemRealMedia";
|
||||
break;
|
||||
}
|
||||
|
||||
if (fe.width != f.width.value || fe.height != f.height.height)
|
||||
ed.execCommand('mceRepaint');
|
||||
|
||||
fe.title = serializeParameters();
|
||||
fe.width = f.width.value;
|
||||
fe.height = f.height.value;
|
||||
fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
|
||||
fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
|
||||
fe.align = f.align.options[f.align.selectedIndex].value;
|
||||
} else {
|
||||
h = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ;
|
||||
|
||||
switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
||||
case "flash":
|
||||
h += ' class="mceItemFlash"';
|
||||
break;
|
||||
|
||||
case "flv":
|
||||
h += ' class="mceItemFlashVideo"';
|
||||
break;
|
||||
|
||||
case "shockwave":
|
||||
h += ' class="mceItemShockWave"';
|
||||
break;
|
||||
|
||||
case "qt":
|
||||
h += ' class="mceItemQuickTime"';
|
||||
break;
|
||||
|
||||
case "wmp":
|
||||
h += ' class="mceItemWindowsMedia"';
|
||||
break;
|
||||
|
||||
case "rmp":
|
||||
h += ' class="mceItemRealMedia"';
|
||||
break;
|
||||
}
|
||||
|
||||
h += ' title="' + serializeParameters() + '"';
|
||||
h += ' width="' + f.width.value + '"';
|
||||
h += ' height="' + f.height.value + '"';
|
||||
h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
|
||||
|
||||
h += ' />';
|
||||
|
||||
ed.execCommand('mceInsertContent', false, h);
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function updatePreview() {
|
||||
var f = document.forms[0], type;
|
||||
|
||||
f.width.value = f.width.value || '320';
|
||||
f.height.value = f.height.value || '240';
|
||||
|
||||
type = getType(f.src.value);
|
||||
selectByValue(f, 'media_type', type);
|
||||
changedType(type);
|
||||
generatePreview();
|
||||
}
|
||||
|
||||
function getMediaListHTML() {
|
||||
if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
|
||||
var html = "";
|
||||
|
||||
html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';
|
||||
html += '<option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCEMediaList.length; i++)
|
||||
html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function getType(v) {
|
||||
var fo, i, c, el, x, f = document.forms[0];
|
||||
|
||||
fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
|
||||
|
||||
// YouTube
|
||||
if (v.match(/watch\?v=(.+)(.*)/)) {
|
||||
f.width.value = '425';
|
||||
f.height.value = '350';
|
||||
f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
|
||||
return 'flash';
|
||||
}
|
||||
|
||||
// Google video
|
||||
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
|
||||
f.width.value = '425';
|
||||
f.height.value = '326';
|
||||
f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
|
||||
return 'flash';
|
||||
}
|
||||
|
||||
for (i=0; i<fo.length; i++) {
|
||||
c = fo[i].split('=');
|
||||
|
||||
el = c[1].split(',');
|
||||
for (x=0; x<el.length; x++)
|
||||
if (v.indexOf('.' + el[x]) != -1)
|
||||
return c[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function switchType(v) {
|
||||
var t = getType(v), d = document, f = d.forms[0];
|
||||
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
selectByValue(d.forms[0], 'media_type', t);
|
||||
changedType(t);
|
||||
|
||||
// Update qtsrc also
|
||||
if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
|
||||
alert(ed.getLang("media_qt_stream_warn"));
|
||||
|
||||
if (f.qt_qtsrc.value == '')
|
||||
f.qt_qtsrc.value = f.src.value;
|
||||
}
|
||||
}
|
||||
|
||||
function changedType(t) {
|
||||
var d = document;
|
||||
|
||||
d.getElementById('flash_options').style.display = 'none';
|
||||
d.getElementById('flv_options').style.display = 'none';
|
||||
d.getElementById('qt_options').style.display = 'none';
|
||||
d.getElementById('shockwave_options').style.display = 'none';
|
||||
d.getElementById('wmp_options').style.display = 'none';
|
||||
d.getElementById('rmp_options').style.display = 'none';
|
||||
d.getElementById(t + '_options').style.display = 'block';
|
||||
}
|
||||
|
||||
function serializeParameters() {
|
||||
var d = document, f = d.forms[0], s = '';
|
||||
|
||||
switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
||||
case "flash":
|
||||
s += getBool('flash', 'play', true);
|
||||
s += getBool('flash', 'loop', true);
|
||||
s += getBool('flash', 'menu', true);
|
||||
s += getBool('flash', 'swliveconnect', false);
|
||||
s += getStr('flash', 'quality');
|
||||
s += getStr('flash', 'scale');
|
||||
s += getStr('flash', 'salign');
|
||||
s += getStr('flash', 'wmode');
|
||||
s += getStr('flash', 'base');
|
||||
s += getStr('flash', 'flashvars');
|
||||
break;
|
||||
|
||||
case "qt":
|
||||
s += getBool('qt', 'loop', false);
|
||||
s += getBool('qt', 'autoplay', true);
|
||||
s += getBool('qt', 'cache', false);
|
||||
s += getBool('qt', 'controller', true);
|
||||
s += getBool('qt', 'correction', false, 'none', 'full');
|
||||
s += getBool('qt', 'enablejavascript', false);
|
||||
s += getBool('qt', 'kioskmode', false);
|
||||
s += getBool('qt', 'autohref', false);
|
||||
s += getBool('qt', 'playeveryframe', false);
|
||||
s += getBool('qt', 'targetcache', false);
|
||||
s += getStr('qt', 'scale');
|
||||
s += getStr('qt', 'starttime');
|
||||
s += getStr('qt', 'endtime');
|
||||
s += getStr('qt', 'target');
|
||||
s += getStr('qt', 'qtsrcchokespeed');
|
||||
s += getStr('qt', 'volume');
|
||||
s += getStr('qt', 'qtsrc');
|
||||
break;
|
||||
|
||||
case "shockwave":
|
||||
s += getBool('shockwave', 'sound');
|
||||
s += getBool('shockwave', 'progress');
|
||||
s += getBool('shockwave', 'autostart');
|
||||
s += getBool('shockwave', 'swliveconnect');
|
||||
s += getStr('shockwave', 'swvolume');
|
||||
s += getStr('shockwave', 'swstretchstyle');
|
||||
s += getStr('shockwave', 'swstretchhalign');
|
||||
s += getStr('shockwave', 'swstretchvalign');
|
||||
break;
|
||||
|
||||
case "wmp":
|
||||
s += getBool('wmp', 'autostart', true);
|
||||
s += getBool('wmp', 'enabled', false);
|
||||
s += getBool('wmp', 'enablecontextmenu', true);
|
||||
s += getBool('wmp', 'fullscreen', false);
|
||||
s += getBool('wmp', 'invokeurls', true);
|
||||
s += getBool('wmp', 'mute', false);
|
||||
s += getBool('wmp', 'stretchtofit', false);
|
||||
s += getBool('wmp', 'windowlessvideo', false);
|
||||
s += getStr('wmp', 'balance');
|
||||
s += getStr('wmp', 'baseurl');
|
||||
s += getStr('wmp', 'captioningid');
|
||||
s += getStr('wmp', 'currentmarker');
|
||||
s += getStr('wmp', 'currentposition');
|
||||
s += getStr('wmp', 'defaultframe');
|
||||
s += getStr('wmp', 'playcount');
|
||||
s += getStr('wmp', 'rate');
|
||||
s += getStr('wmp', 'uimode');
|
||||
s += getStr('wmp', 'volume');
|
||||
break;
|
||||
|
||||
case "rmp":
|
||||
s += getBool('rmp', 'autostart', false);
|
||||
s += getBool('rmp', 'loop', false);
|
||||
s += getBool('rmp', 'autogotourl', true);
|
||||
s += getBool('rmp', 'center', false);
|
||||
s += getBool('rmp', 'imagestatus', true);
|
||||
s += getBool('rmp', 'maintainaspect', false);
|
||||
s += getBool('rmp', 'nojava', false);
|
||||
s += getBool('rmp', 'prefetch', false);
|
||||
s += getBool('rmp', 'shuffle', false);
|
||||
s += getStr('rmp', 'console');
|
||||
s += getStr('rmp', 'controls');
|
||||
s += getStr('rmp', 'numloop');
|
||||
s += getStr('rmp', 'scriptcallbacks');
|
||||
break;
|
||||
}
|
||||
|
||||
s += getStr(null, 'id');
|
||||
s += getStr(null, 'name');
|
||||
s += getStr(null, 'src');
|
||||
s += getStr(null, 'align');
|
||||
s += getStr(null, 'bgcolor');
|
||||
s += getInt(null, 'vspace');
|
||||
s += getInt(null, 'hspace');
|
||||
s += getStr(null, 'width');
|
||||
s += getStr(null, 'height');
|
||||
|
||||
s = s.length > 0 ? s.substring(0, s.length - 1) : s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function setBool(pl, p, n) {
|
||||
if (typeof(pl[n]) == "undefined")
|
||||
return;
|
||||
|
||||
document.forms[0].elements[p + "_" + n].checked = pl[n];
|
||||
}
|
||||
|
||||
function setStr(pl, p, n) {
|
||||
var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
|
||||
|
||||
if (typeof(pl[n]) == "undefined")
|
||||
return;
|
||||
|
||||
if (e.type == "text")
|
||||
e.value = pl[n];
|
||||
else
|
||||
selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
|
||||
}
|
||||
|
||||
function getBool(p, n, d, tv, fv) {
|
||||
var v = document.forms[0].elements[p + "_" + n].checked;
|
||||
|
||||
tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
|
||||
fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
|
||||
|
||||
return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
|
||||
}
|
||||
|
||||
function getStr(p, n, d) {
|
||||
var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
|
||||
var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
|
||||
|
||||
if (n == 'src')
|
||||
v = tinyMCEPopup.editor.convertURL(v, 'src', null);
|
||||
|
||||
return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
|
||||
}
|
||||
|
||||
function getInt(p, n, d) {
|
||||
var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
|
||||
var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
|
||||
|
||||
return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
|
||||
}
|
||||
|
||||
function jsEncode(s) {
|
||||
s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
|
||||
s = s.replace(new RegExp('"', 'g'), '\\"');
|
||||
s = s.replace(new RegExp("'", 'g'), "\\'");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function generatePreview(c) {
|
||||
var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
|
||||
|
||||
p.innerHTML = '<!-- x --->';
|
||||
|
||||
nw = parseInt(f.width.value);
|
||||
nh = parseInt(f.height.value);
|
||||
|
||||
if (f.width.value != "" && f.height.value != "") {
|
||||
if (f.constrain.checked) {
|
||||
if (c == 'width' && oldWidth != 0) {
|
||||
wp = nw / oldWidth;
|
||||
nh = Math.round(wp * nh);
|
||||
f.height.value = nh;
|
||||
} else if (c == 'height' && oldHeight != 0) {
|
||||
hp = nh / oldHeight;
|
||||
nw = Math.round(hp * nw);
|
||||
f.width.value = nw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (f.width.value != "")
|
||||
oldWidth = nw;
|
||||
|
||||
if (f.height.value != "")
|
||||
oldHeight = nh;
|
||||
|
||||
// After constrain
|
||||
pl = serializeParameters();
|
||||
|
||||
switch (f.media_type.options[f.media_type.selectedIndex].value) {
|
||||
case "flash":
|
||||
cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
|
||||
codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
|
||||
type = 'application/x-shockwave-flash';
|
||||
break;
|
||||
|
||||
case "shockwave":
|
||||
cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
|
||||
codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
|
||||
type = 'application/x-director';
|
||||
break;
|
||||
|
||||
case "qt":
|
||||
cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
|
||||
codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
|
||||
type = 'video/quicktime';
|
||||
break;
|
||||
|
||||
case "wmp":
|
||||
cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
|
||||
codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
||||
type = 'application/x-mplayer2';
|
||||
break;
|
||||
|
||||
case "rmp":
|
||||
cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
|
||||
codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
|
||||
type = 'audio/x-pn-realaudio-plugin';
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl == '') {
|
||||
p.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
pl = tinyMCEPopup.editor.plugins.media._parse(pl);
|
||||
|
||||
if (!pl.src) {
|
||||
p.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);
|
||||
pl.width = !pl.width ? 100 : pl.width;
|
||||
pl.height = !pl.height ? 100 : pl.height;
|
||||
pl.id = !pl.id ? 'obj' : pl.id;
|
||||
pl.name = !pl.name ? 'eobj' : pl.name;
|
||||
pl.align = !pl.align ? '' : pl.align;
|
||||
|
||||
// Avoid annoying warning about insecure items
|
||||
if (!tinymce.isIE || document.location.protocol != 'https:') {
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
|
||||
|
||||
for (n in pl) {
|
||||
h += '<param name="' + n + '" value="' + pl[n] + '">';
|
||||
|
||||
// Add extra url parameter if it's an absolute URL
|
||||
if (n == 'src' && pl[n].indexOf('://') != -1)
|
||||
h += '<param name="url" value="' + pl[n] + '" />';
|
||||
}
|
||||
}
|
||||
|
||||
h += '<embed type="' + type + '" ';
|
||||
|
||||
for (n in pl)
|
||||
h += n + '="' + pl[n] + '" ';
|
||||
|
||||
h += '></embed>';
|
||||
|
||||
// Avoid annoying warning about insecure items
|
||||
if (!tinymce.isIE || document.location.protocol != 'https:')
|
||||
h += '</object>';
|
||||
|
||||
p.innerHTML = "<!-- x --->" + h;
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -0,0 +1,103 @@
|
||||
tinyMCE.addI18n('en.media_dlg',{
|
||||
title:"Insert / edit embedded media",
|
||||
general:"General",
|
||||
advanced:"Advanced",
|
||||
file:"File/URL",
|
||||
list:"List",
|
||||
size:"Dimensions",
|
||||
preview:"Preview",
|
||||
constrain_proportions:"Constrain proportions",
|
||||
type:"Type",
|
||||
id:"Id",
|
||||
name:"Name",
|
||||
class_name:"Class",
|
||||
vspace:"V-Space",
|
||||
hspace:"H-Space",
|
||||
play:"Auto play",
|
||||
loop:"Loop",
|
||||
menu:"Show menu",
|
||||
quality:"Quality",
|
||||
scale:"Scale",
|
||||
align:"Align",
|
||||
salign:"SAlign",
|
||||
wmode:"WMode",
|
||||
bgcolor:"Background",
|
||||
base:"Base",
|
||||
flashvars:"Flashvars",
|
||||
liveconnect:"SWLiveConnect",
|
||||
autohref:"AutoHREF",
|
||||
cache:"Cache",
|
||||
hidden:"Hidden",
|
||||
controller:"Controller",
|
||||
kioskmode:"Kiosk mode",
|
||||
playeveryframe:"Play every frame",
|
||||
targetcache:"Target cache",
|
||||
correction:"No correction",
|
||||
enablejavascript:"Enable JavaScript",
|
||||
starttime:"Start time",
|
||||
endtime:"End time",
|
||||
href:"Href",
|
||||
qtsrcchokespeed:"Choke speed",
|
||||
target:"Target",
|
||||
volume:"Volume",
|
||||
autostart:"Auto start",
|
||||
enabled:"Enabled",
|
||||
fullscreen:"Fullscreen",
|
||||
invokeurls:"Invoke URLs",
|
||||
mute:"Mute",
|
||||
stretchtofit:"Stretch to fit",
|
||||
windowlessvideo:"Windowless video",
|
||||
balance:"Balance",
|
||||
baseurl:"Base URL",
|
||||
captioningid:"Captioning id",
|
||||
currentmarker:"Current marker",
|
||||
currentposition:"Current position",
|
||||
defaultframe:"Default frame",
|
||||
playcount:"Play count",
|
||||
rate:"Rate",
|
||||
uimode:"UI Mode",
|
||||
flash_options:"Flash options",
|
||||
qt_options:"Quicktime options",
|
||||
wmp_options:"Windows media player options",
|
||||
rmp_options:"Real media player options",
|
||||
shockwave_options:"Shockwave options",
|
||||
autogotourl:"Auto goto URL",
|
||||
center:"Center",
|
||||
imagestatus:"Image status",
|
||||
maintainaspect:"Maintain aspect",
|
||||
nojava:"No java",
|
||||
prefetch:"Prefetch",
|
||||
shuffle:"Shuffle",
|
||||
console:"Console",
|
||||
numloop:"Num loops",
|
||||
controls:"Controls",
|
||||
scriptcallbacks:"Script callbacks",
|
||||
swstretchstyle:"Stretch style",
|
||||
swstretchhalign:"Stretch H-Align",
|
||||
swstretchvalign:"Stretch V-Align",
|
||||
sound:"Sound",
|
||||
progress:"Progress",
|
||||
qtsrc:"QT Src",
|
||||
qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..",
|
||||
align_top:"Top",
|
||||
align_right:"Right",
|
||||
align_bottom:"Bottom",
|
||||
align_left:"Left",
|
||||
align_center:"Center",
|
||||
align_top_left:"Top left",
|
||||
align_top_right:"Top right",
|
||||
align_bottom_left:"Bottom left",
|
||||
align_bottom_right:"Bottom right",
|
||||
flv_options:"Flash video options",
|
||||
flv_scalemode:"Scale mode",
|
||||
flv_buffer:"Buffer",
|
||||
flv_startimage:"Start image",
|
||||
flv_starttime:"Start time",
|
||||
flv_defaultvolume:"Default volumne",
|
||||
flv_hiddengui:"Hidden GUI",
|
||||
flv_autostart:"Auto start",
|
||||
flv_loop:"Loop",
|
||||
flv_showscalemodes:"Show scale modes",
|
||||
flv_smoothvideo:"Smooth video",
|
||||
flv_jscallback:"JS Callback"
|
||||
});
|
@ -0,0 +1,824 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#media_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/media.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js"></script>
|
||||
<link href="css/media.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body style="display: none">
|
||||
<form onsubmit="insertMedia();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
|
||||
<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.general}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="media_type">{#media_dlg.type}</label></td>
|
||||
<td>
|
||||
<select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">
|
||||
<option value="flash">Flash</option>
|
||||
<!-- <option value="flv">Flash video (FLV)</option> -->
|
||||
<option value="qt">Quicktime</option>
|
||||
<option value="shockwave">Shockwave</option>
|
||||
<option value="wmp">Windows Media</option>
|
||||
<option value="rmp">Real Media</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="src">{#media_dlg.file}</label></td>
|
||||
<td>
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>
|
||||
<td id="filebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linklistrow">
|
||||
<td><label for="linklist">{#media_dlg.list}</label></td>
|
||||
<td id="linklistcontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="width">{#media_dlg.size}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size" onchange="generatePreview('height');" /></td>
|
||||
<td> <input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
|
||||
<td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.advanced}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td><label for="id">{#media_dlg.id}</label></td>
|
||||
<td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>
|
||||
<td><label for="name">{#media_dlg.name}</label></td>
|
||||
<td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="align">{#media_dlg.align}</label></td>
|
||||
<td>
|
||||
<select id="align" name="align" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="top">{#media_dlg.align_top}</option>
|
||||
<option value="right">{#media_dlg.align_right}</option>
|
||||
<option value="bottom">{#media_dlg.align_bottom}</option>
|
||||
<option value="left">{#media_dlg.align_left}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
|
||||
<td>
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td>
|
||||
<td id="bgcolor_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="vspace">{#media_dlg.vspace}</label></td>
|
||||
<td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>
|
||||
<td><label for="hspace">{#media_dlg.hspace}</label></td>
|
||||
<td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="flash_options">
|
||||
<legend>{#media_dlg.flash_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="flash_quality">{#media_dlg.quality}</label></td>
|
||||
<td>
|
||||
<select id="flash_quality" name="flash_quality" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="high">high</option>
|
||||
<option value="low">low</option>
|
||||
<option value="autolow">autolow</option>
|
||||
<option value="autohigh">autohigh</option>
|
||||
<option value="best">best</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="flash_scale">{#media_dlg.scale}</label></td>
|
||||
<td>
|
||||
<select id="flash_scale" name="flash_scale" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="showall">showall</option>
|
||||
<option value="noborder">noborder</option>
|
||||
<option value="exactfit">exactfit</option>
|
||||
<option value="noscale">noscale</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
|
||||
<td>
|
||||
<select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="window">window</option>
|
||||
<option value="opaque">opaque</option>
|
||||
<option value="transparent">transparent</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="flash_salign">{#media_dlg.salign}</label></td>
|
||||
<td>
|
||||
<select id="flash_salign" name="flash_salign" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="l">{#media_dlg.align_left}</option>
|
||||
<option value="t">{#media_dlg.align_top}</option>
|
||||
<option value="r">{#media_dlg.align_right}</option>
|
||||
<option value="b">{#media_dlg.align_bottom}</option>
|
||||
<option value="tl">{#media_dlg.align_top_left}</option>
|
||||
<option value="tr">{#media_dlg.align_top_right}</option>
|
||||
<option value="bl">{#media_dlg.align_bottom_left}</option>
|
||||
<option value="br">{#media_dlg.align_bottom_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flash_play">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flash_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flash_menu">{#media_dlg.menu}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>
|
||||
<td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="flash_base">{#media_dlg.base}</label></td>
|
||||
<td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
|
||||
<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="flv_options">
|
||||
<legend>{#media_dlg.flv_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td>
|
||||
<td>
|
||||
<select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="none">none</option>
|
||||
<option value="double">double</option>
|
||||
<option value="full">full</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td>
|
||||
<td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td>
|
||||
<td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
|
||||
<td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
|
||||
<td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
|
||||
<td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_loop">{#media_dlg.flv_loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td>
|
||||
<td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="qt_options">
|
||||
<legend>{#media_dlg.qt_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_cache">{#media_dlg.cache}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_controller">{#media_dlg.controller}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_correction">{#media_dlg.correction}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_autohref">{#media_dlg.autohref}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>
|
||||
<td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="qt_scale">{#media_dlg.scale}</label></td>
|
||||
<td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="tofit">tofit</option>
|
||||
<option value="aspect">aspect</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="qt_starttime">{#media_dlg.starttime}</label></td>
|
||||
<td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="qt_endtime">{#media_dlg.endtime}</label></td>
|
||||
<td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="qt_target">{#media_dlg.target}</label></td>
|
||||
<td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="qt_href">{#media_dlg.href}</label></td>
|
||||
<td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
|
||||
<td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="qt_volume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td>
|
||||
<td colspan="4">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td>
|
||||
<td id="qtsrcfilebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="wmp_options">
|
||||
<legend>{#media_dlg.wmp_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_enabled">{#media_dlg.enabled}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_mute">{#media_dlg.mute}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>
|
||||
<td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="wmp_balance">{#media_dlg.balance}</label></td>
|
||||
<td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td>
|
||||
<td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td>
|
||||
<td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td>
|
||||
<td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td>
|
||||
<td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td>
|
||||
<td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="wmp_playcount">{#media_dlg.playcount}</label></td>
|
||||
<td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="wmp_rate">{#media_dlg.rate}</label></td>
|
||||
<td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="wmp_uimode">{#media_dlg.uimode}</label></td>
|
||||
<td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="wmp_volume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="rmp_options">
|
||||
<legend>{#media_dlg.rmp_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_center">{#media_dlg.center}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
|
||||
<td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="rmp_console">{#media_dlg.console}</label></td>
|
||||
<td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="rmp_controls">{#media_dlg.controls}</label></td>
|
||||
<td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="rmp_numloop">{#media_dlg.numloop}</label></td>
|
||||
<td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>
|
||||
|
||||
<td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
|
||||
<td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="shockwave_options">
|
||||
<legend>{#media_dlg.shockwave_options}</legend>
|
||||
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="meet">Meet</option>
|
||||
<option value="fill">Fill</option>
|
||||
<option value="stage">Stage</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="left">{#media_dlg.align_left}</option>
|
||||
<option value="center">{#media_dlg.align_center}</option>
|
||||
<option value="right">{#media_dlg.align_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="meet">Meet</option>
|
||||
<option value="fill">Fill</option>
|
||||
<option value="stage">Stage</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>
|
||||
<td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>
|
||||
<td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
|
||||
<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>
|
||||
<td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>blank_page</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="css/blank.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
<script type="text/javascript">
|
||||
function init() {
|
||||
if (parent.tinymce.isIE)
|
||||
document.body.contentEditable = true;
|
||||
else
|
||||
document.designMode = 'on';
|
||||
|
||||
parent.initIframe(document);
|
||||
window.focus();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,389 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:27 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event;
|
||||
|
||||
tinymce.create('tinymce.plugins.PastePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mcePasteText', function(ui, v) {
|
||||
if (ui) {
|
||||
if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/pastetext.htm',
|
||||
width : 450,
|
||||
height : 400,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
} else
|
||||
t._insertText(clipboardData.getData("Text"), true);
|
||||
} else
|
||||
t._insertText(v.html, v.linebreaks);
|
||||
});
|
||||
|
||||
ed.addCommand('mcePasteWord', function(ui, v) {
|
||||
if (ui) {
|
||||
if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/pasteword.htm',
|
||||
width : 450,
|
||||
height : 400,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
} else
|
||||
t._insertText(t._clipboardHTML());
|
||||
} else
|
||||
t._insertWordContent(v);
|
||||
});
|
||||
|
||||
ed.addCommand('mceSelectAll', function() {
|
||||
ed.execCommand('selectall');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true});
|
||||
ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true});
|
||||
ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'});
|
||||
|
||||
if (ed.getParam("paste_auto_cleanup_on_paste", false)) {
|
||||
ed.onPaste.add(function(ed, e) {
|
||||
return t._handlePasteEvent(e)
|
||||
});
|
||||
}
|
||||
|
||||
if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) {
|
||||
// Force paste dialog if non IE browser
|
||||
ed.onKeyDown.add(function(ed, e) {
|
||||
if (e.ctrlKey && e.keyCode == 86) {
|
||||
window.setTimeout(function() {
|
||||
ed.execCommand("mcePasteText", true);
|
||||
}, 1);
|
||||
|
||||
Event.cancel(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Paste text/word',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_handlePasteEvent : function(e) {
|
||||
var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r;
|
||||
|
||||
// Removes italic, strong etc, the if was needed due to bug #1437114
|
||||
if (ed && (r = sel.getRng()) && r.text.length > 0)
|
||||
ed.execCommand('delete');
|
||||
|
||||
if (html && html.length > 0)
|
||||
ed.execCommand('mcePasteWord', false, html);
|
||||
|
||||
return Event.cancel(e);
|
||||
},
|
||||
|
||||
_insertText : function(content, bLinebreaks) {
|
||||
content = this.editor.dom.encode(content);
|
||||
|
||||
if (content && content.length > 0) {
|
||||
if (bLinebreaks) {
|
||||
// Special paragraph treatment
|
||||
if (this.editor.getParam("paste_create_paragraphs", true)) {
|
||||
var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||
for (var i=0; i<rl.length; i+=2)
|
||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||
|
||||
content = content.replace(/\r\n\r\n/g, '</p><p>');
|
||||
content = content.replace(/\r\r/g, '</p><p>');
|
||||
content = content.replace(/\n\n/g, '</p><p>');
|
||||
|
||||
// Has paragraphs
|
||||
if ((pos = content.indexOf('</p><p>')) != -1) {
|
||||
this.editor.execCommand("Delete");
|
||||
|
||||
var node = this.editor.selection.getNode();
|
||||
|
||||
// Get list of elements to break
|
||||
var breakElms = [];
|
||||
|
||||
do {
|
||||
if (node.nodeType == 1) {
|
||||
// Don't break tables and break at body
|
||||
if (node.nodeName == "TD" || node.nodeName == "BODY")
|
||||
break;
|
||||
|
||||
breakElms[breakElms.length] = node;
|
||||
}
|
||||
} while(node = node.parentNode);
|
||||
|
||||
var before = "", after = "</p>";
|
||||
before += content.substring(0, pos);
|
||||
|
||||
for (var i=0; i<breakElms.length; i++) {
|
||||
before += "</" + breakElms[i].nodeName + ">";
|
||||
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
|
||||
}
|
||||
|
||||
before += "<p>";
|
||||
content = before + content.substring(pos+7) + after;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.editor.getParam("paste_create_linebreaks", true)) {
|
||||
content = content.replace(/\r\n/g, '<br />');
|
||||
content = content.replace(/\r/g, '<br />');
|
||||
content = content.replace(/\n/g, '<br />');
|
||||
}
|
||||
}
|
||||
|
||||
this.editor.execCommand("mceInsertRawHTML", false, content);
|
||||
}
|
||||
},
|
||||
|
||||
_insertWordContent : function(content) {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
if (content && content.length > 0) {
|
||||
// Cleanup Word content
|
||||
var bull = String.fromCharCode(8226);
|
||||
var middot = String.fromCharCode(183);
|
||||
|
||||
if (ed.getParam('paste_insert_word_content_callback'))
|
||||
content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
|
||||
|
||||
var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||
for (var i=0; i<rl.length; i+=2)
|
||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||
|
||||
if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
|
||||
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
|
||||
}
|
||||
|
||||
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
|
||||
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
|
||||
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
|
||||
content = content.replace(/<o:p><\/o:p>/gi, "");
|
||||
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
|
||||
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
|
||||
|
||||
if (this.editor.getParam("paste_remove_spans", true))
|
||||
content = content.replace(/<\/?span[^>]*>/gi, "");
|
||||
|
||||
if (this.editor.getParam("paste_remove_styles", true))
|
||||
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
|
||||
|
||||
content = content.replace(/<\/?font[^>]*>/gi, "");
|
||||
|
||||
// Strips class attributes.
|
||||
switch (this.editor.getParam("paste_strip_class_attributes", "all")) {
|
||||
case "all":
|
||||
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||
break;
|
||||
|
||||
case "mso":
|
||||
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
|
||||
break;
|
||||
}
|
||||
|
||||
content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI());
|
||||
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
|
||||
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
|
||||
content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
|
||||
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
|
||||
|
||||
// content = content.replace(/\/? */gi, "");
|
||||
// content = content.replace(/<p> <\/p>/gi, '');
|
||||
|
||||
if (!this.editor.getParam('force_p_newlines')) {
|
||||
content = content.replace('', '' ,'gi');
|
||||
content = content.replace('</p>', '<br /><br />' ,'gi');
|
||||
}
|
||||
|
||||
if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) {
|
||||
content = content.replace(/<\/?p[^>]*>/gi, "");
|
||||
}
|
||||
|
||||
content = content.replace(/<\/?div[^>]*>/gi, "");
|
||||
|
||||
// Convert all middlot lists to UL lists
|
||||
if (this.editor.getParam("paste_convert_middot_lists", true)) {
|
||||
var div = ed.dom.create("div", null, content);
|
||||
|
||||
// Convert all middot paragraphs to li elements
|
||||
var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList");
|
||||
|
||||
while (this._convertMiddots(div, "--list--")) ; // bull
|
||||
while (this._convertMiddots(div, middot, className)) ; // Middot
|
||||
while (this._convertMiddots(div, bull)) ; // bull
|
||||
|
||||
content = div.innerHTML;
|
||||
}
|
||||
|
||||
// Replace all headers with strong and fix some other issues
|
||||
if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
|
||||
content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
|
||||
content = content.replace(/<h[1-6]>/gi, '<p><b>');
|
||||
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
|
||||
content = content.replace(/<b> <\/b>/gi, '<b> </b>');
|
||||
content = content.replace(/^( )*/gi, '');
|
||||
}
|
||||
|
||||
content = content.replace(/--list--/gi, ""); // Remove --list--
|
||||
|
||||
if (ed.getParam('paste_insert_word_content_callback'))
|
||||
content = ed.execCallback('paste_insert_word_content_callback', 'after', content);
|
||||
|
||||
// Insert cleaned content
|
||||
this.editor.execCommand("mceInsertContent", false, content);
|
||||
|
||||
if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {
|
||||
var ed = this.editor;
|
||||
|
||||
window.setTimeout(function() {
|
||||
ed.execCommand("mceCleanup");
|
||||
}, 1); // Do normal cleanup detached from this thread
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_reEscape : function(s) {
|
||||
var l = "?.\\*[](){}+^$:";
|
||||
var o = "";
|
||||
|
||||
for (var i=0; i<s.length; i++) {
|
||||
var c = s.charAt(i);
|
||||
|
||||
if (l.indexOf(c) != -1)
|
||||
o += '\\' + c;
|
||||
else
|
||||
o += c;
|
||||
}
|
||||
|
||||
return o;
|
||||
},
|
||||
|
||||
_convertMiddots : function(div, search, class_name) {
|
||||
var ed = this.editor, mdot = String.fromCharCode(183), bull = String.fromCharCode(8226);
|
||||
var nodes, prevul, i, p, ul, li, np, cp, li;
|
||||
|
||||
nodes = div.getElementsByTagName("p");
|
||||
for (i=0; i<nodes.length; i++) {
|
||||
p = nodes[i];
|
||||
|
||||
// Is middot
|
||||
if (p.innerHTML.indexOf(search) == 0) {
|
||||
ul = ed.dom.create("ul");
|
||||
|
||||
if (class_name)
|
||||
ul.className = class_name;
|
||||
|
||||
// Add the first one
|
||||
li = ed.dom.create("li");
|
||||
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||
ul.appendChild(li);
|
||||
|
||||
// Add the rest
|
||||
np = p.nextSibling;
|
||||
while (np) {
|
||||
// If the node is whitespace, then
|
||||
// ignore it and continue on.
|
||||
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
|
||||
np = np.nextSibling;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (search == mdot) {
|
||||
if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) {
|
||||
// Second level of nesting
|
||||
if (!prevul) {
|
||||
prevul = ul;
|
||||
ul = ed.dom.create("ul");
|
||||
prevul.appendChild(ul);
|
||||
}
|
||||
np.innerHTML = np.innerHTML.replace(/^o/, '');
|
||||
} else {
|
||||
// Pop the stack if we're going back up to the first level
|
||||
if (prevul) {
|
||||
ul = prevul;
|
||||
prevul = null;
|
||||
}
|
||||
// Not element or middot paragraph
|
||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Not element or middot paragraph
|
||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
cp = np.nextSibling;
|
||||
li = ed.dom.create("li");
|
||||
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||
np.parentNode.removeChild(np);
|
||||
ul.appendChild(li);
|
||||
np = cp;
|
||||
}
|
||||
|
||||
p.parentNode.replaceChild(ul, p);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_clipboardHTML : function() {
|
||||
var div = document.getElementById('_TinyMCE_clipboardHTML');
|
||||
|
||||
if (!div) {
|
||||
var div = document.createElement('DIV');
|
||||
div.id = '_TinyMCE_clipboardHTML';
|
||||
|
||||
with (div.style) {
|
||||
visibility = 'hidden';
|
||||
overflow = 'hidden';
|
||||
position = 'absolute';
|
||||
width = 1;
|
||||
height = 1;
|
||||
}
|
||||
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
div.innerHTML = '';
|
||||
var rng = document.body.createTextRange();
|
||||
rng.moveToElementText(div);
|
||||
rng.execCommand('Paste');
|
||||
var html = div.innerHTML;
|
||||
div.innerHTML = '';
|
||||
return html;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
|
||||
})();
|
@ -0,0 +1,42 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function saveContent() {
|
||||
if (document.forms[0].htmlSource.value == '') {
|
||||
tinyMCEPopup.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand('mcePasteText', false, {
|
||||
html : document.forms[0].htmlSource.value,
|
||||
linebreaks : document.forms[0].linebreaks.checked
|
||||
});
|
||||
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function onLoadInit() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// Remove Gecko spellchecking
|
||||
if (tinymce.isGecko)
|
||||
document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
|
||||
|
||||
resizeInputs();
|
||||
}
|
||||
|
||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||
|
||||
function resizeInputs() {
|
||||
if (!tinymce.isIE) {
|
||||
wHeight = self.innerHeight-80;
|
||||
wWidth = self.innerWidth-17;
|
||||
} else {
|
||||
wHeight = document.body.clientHeight-80;
|
||||
wWidth = document.body.clientWidth-17;
|
||||
}
|
||||
|
||||
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
|
||||
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(onLoadInit);
|
@ -0,0 +1,56 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
function saveContent() {
|
||||
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
|
||||
|
||||
if (html == ''){
|
||||
tinyMCEPopup.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand('mcePasteWord', false, html);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function onLoadInit() {
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
|
||||
// Fix for endless reloading in FF
|
||||
window.setTimeout(createIFrame, 10);
|
||||
}
|
||||
|
||||
function createIFrame() {
|
||||
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
|
||||
}
|
||||
|
||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||
|
||||
function initIframe(doc) {
|
||||
var dir = tinyMCEPopup.editor.settings.directionality;
|
||||
|
||||
doc.body.dir = dir;
|
||||
|
||||
// Remove Gecko spellchecking
|
||||
if (tinymce.isGecko)
|
||||
doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
|
||||
|
||||
resizeInputs();
|
||||
}
|
||||
|
||||
function resizeInputs() {
|
||||
if (!tinymce.isIE) {
|
||||
wHeight = self.innerHeight - 80;
|
||||
wWidth = self.innerWidth - 18;
|
||||
} else {
|
||||
wHeight = document.body.clientHeight - 80;
|
||||
wWidth = document.body.clientWidth - 18;
|
||||
}
|
||||
|
||||
var elm = document.getElementById('frmData');
|
||||
if (elm) {
|
||||
elm.style.height = Math.abs(wHeight) + 'px';
|
||||
elm.style.width = Math.abs(wWidth) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(onLoadInit);
|
@ -0,0 +1,5 @@
|
||||
tinyMCE.addI18n('en.paste_dlg',{
|
||||
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
|
||||
text_linebreaks:"Keep linebreaks",
|
||||
word_title:"Use CTRL+V on your keyboard to paste the text into the window."
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_text_desc}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/pastetext.js"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="saveContent();return false;" action="#">
|
||||
<div style="float: left" class="title">{#paste.paste_text_desc}</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div>{#paste_dlg.text_title}</div>
|
||||
|
||||
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" name="insert" value="{#insert}" id="insert" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,29 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<title>{#paste.paste_word_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/pasteword.js"></script>
|
||||
<link href="css/pasteword.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="saveContent();" action="#">
|
||||
<div class="title">{#paste.paste_word_desc}</div>
|
||||
|
||||
<div>{#paste_dlg.word_title}</div>
|
||||
|
||||
<div id="iframecontainer"></div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="button" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.Preview',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePreview',t._preview,t);ed.addButton('preview',{title:'preview.preview_desc',cmd:'mcePreview'});},getInfo:function(){return{longname:'Preview',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_preview:function(){var ed=this.editor,win,html,c,pos,pos2,css,i,page=ed.getParam("plugin_preview_pageurl",null),w=ed.getParam("plugin_preview_width","550"),h=ed.getParam("plugin_preview_height","600");if(page){ed.windowManager.open({file:ed.getParam("plugin_preview_pageurl",null),width:w,height:h},{resizable:"yes",scrollbars:"yes",inline:1});}else{win=window.open("","mcePreview","menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width="+w+",height="+h);html="";c=ed.getContent();pos=c.indexOf('<body');css=ed.getParam("content_css",'').split(',');tinymce.map(css,function(u){return ed.documentBaseURI.toAbsolute(u);});if(pos!=-1){pos=c.indexOf('>',pos);pos2=c.lastIndexOf('</body>');c=c.substring(pos+1,pos2);}html+=ed.getParam('doctype');html+='<html xmlns="http://www.w3.org/1999/xhtml">';html+='<head>';html+='<title>'+ed.getLang('preview.preview_desc')+'</title>';html+='<base href="'+ed.documentBaseURI.getURI()+'" />';html+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';for(i=0;i<css.length;i++)html+='<link href="'+css[i]+'" rel="stylesheet" type="text/css" />';html+='</head>';html+='<body dir="'+ed.getParam("directionality")+'" onload="window.opener.tinymce.EditorManager.get(\''+ed.id+'\').plugins[\'preview\']._onLoad(window,document);">';html+=c;html+='</body>';html+='</html>';win.document.write(html);win.document.close();}},_onLoad:function(w,d){var t=this,nl,i,el=[],sv,ne;t._doc=d;w.writeFlash=t._writeFlash;w.writeShockWave=t._writeShockWave;w.writeQuickTime=t._writeQuickTime;w.writeRealMedia=t._writeRealMedia;w.writeWindowsMedia=t._writeWindowsMedia;w.writeEmbed=t._writeEmbed;nl=d.getElementsByTagName("script");for(i=0;i<nl.length;i++){sv=tinymce.isIE?nl[i].innerHTML:nl[i].firstChild.nodeValue;if(new RegExp('write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\\(.*','g').test(sv))el[el.length]=nl[i];}for(i=0;i<el.length;i++){ne=d.createElement("div");ne.innerHTML=d._embeds[i];el[i].parentNode.insertBefore(ne.firstChild,el[i]);}},_writeFlash:function(p){p.src=this.editor.documentBaseURI.toAbsolute(p.src);TinyMCE_PreviewPlugin._writeEmbed('D27CDB6E-AE6D-11cf-96B8-444553540000','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0','application/x-shockwave-flash',p);},_writeShockWave:function(p){this.editor.documentBaseURI.toAbsolute(p.src);TinyMCE_PreviewPlugin._writeEmbed('166B1BCA-3F9C-11CF-8075-444553540000','http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0','application/x-director',p);},_writeQuickTime:function(p){this.editor.documentBaseURI.toAbsolute(p.src);TinyMCE_PreviewPlugin._writeEmbed('02BF25D5-8C17-4B23-BC80-D3488ABDDC6B','http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0','video/quicktime',p);},_writeRealMedia:function(p){this.editor.documentBaseURI.toAbsolute(p.src);TinyMCE_PreviewPlugin._writeEmbed('CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0','audio/x-pn-realaudio-plugin',p);},_writeWindowsMedia:function(p){this.editor.documentBaseURI.toAbsolute(p.src);p.url=p.src;TinyMCE_PreviewPlugin._writeEmbed('6BF52A52-394A-11D3-B153-00C04F79FAA6','http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701','application/x-mplayer2',p);},_writeEmbed:function(cls,cb,mt,p){var h='',n,d=t._doc,ne,c;h+='<object classid="clsid:'+cls+'" codebase="'+cb+'"';h+=typeof(p.id)!="undefined"?'id="'+p.id+'"':'';h+=typeof(p.name)!="undefined"?'name="'+p.name+'"':'';h+=typeof(p.width)!="undefined"?'width="'+p.width+'"':'';h+=typeof(p.height)!="undefined"?'height="'+p.height+'"':'';h+=typeof(p.align)!="undefined"?'align="'+p.align+'"':'';h+='>';for(n in p)h+='<param name="'+n+'" value="'+p[n]+'">';h+='<embed type="'+mt+'"';for(n in p)h+=n+'="'+p[n]+'" ';h+='></embed></object>';d._embeds[d._embeds.length]=h;}});tinymce.PluginManager.add('preview',tinymce.plugins.Preview);})();
|
@ -0,0 +1,187 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.Preview', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
ed.addCommand('mcePreview', t._preview, t);
|
||||
ed.addButton('preview', {title : 'preview.preview_desc', cmd : 'mcePreview'});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Preview',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/preview',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_preview : function() {
|
||||
var ed = this.editor, win, html, c, pos, pos2, css, i, page = ed.getParam("plugin_preview_pageurl", null), w = ed.getParam("plugin_preview_width", "550"), h = ed.getParam("plugin_preview_height", "600");
|
||||
|
||||
// Use a custom preview page
|
||||
if (page) {
|
||||
ed.windowManager.open({
|
||||
file : ed.getParam("plugin_preview_pageurl", null),
|
||||
width : w,
|
||||
height : h
|
||||
}, {
|
||||
resizable : "yes",
|
||||
scrollbars : "yes",
|
||||
inline : 1
|
||||
});
|
||||
} else {
|
||||
win = window.open("", "mcePreview", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=20,top=20,width=" + w + ",height=" + h);
|
||||
html = "";
|
||||
c = ed.getContent();
|
||||
pos = c.indexOf('<body');
|
||||
css = ed.getParam("content_css", '').split(',');
|
||||
|
||||
tinymce.map(css, function(u) {
|
||||
return ed.documentBaseURI.toAbsolute(u);
|
||||
});
|
||||
|
||||
if (pos != -1) {
|
||||
pos = c.indexOf('>', pos);
|
||||
pos2 = c.lastIndexOf('</body>');
|
||||
c = c.substring(pos + 1, pos2);
|
||||
}
|
||||
|
||||
html += ed.getParam('doctype');
|
||||
html += '<html xmlns="http://www.w3.org/1999/xhtml">';
|
||||
html += '<head>';
|
||||
html += '<title>' + ed.getLang('preview.preview_desc') + '</title>';
|
||||
html += '<base href="' + ed.documentBaseURI.getURI() + '" />';
|
||||
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
|
||||
|
||||
for (i=0; i<css.length; i++)
|
||||
html += '<link href="' + css[i] + '" rel="stylesheet" type="text/css" />';
|
||||
|
||||
html += '</head>';
|
||||
html += '<body dir="' + ed.getParam("directionality") + '" onload="window.opener.tinymce.EditorManager.get(\'' + ed.id + '\').plugins[\'preview\']._onLoad(window,document);">';
|
||||
html += c;
|
||||
html += '</body>';
|
||||
html += '</html>';
|
||||
|
||||
win.document.write(html);
|
||||
win.document.close();
|
||||
}
|
||||
},
|
||||
|
||||
_onLoad : function(w, d) {
|
||||
var t = this, nl, i, el = [], sv, ne;
|
||||
|
||||
t._doc = d;
|
||||
w.writeFlash = t._writeFlash;
|
||||
w.writeShockWave = t._writeShockWave;
|
||||
w.writeQuickTime = t._writeQuickTime;
|
||||
w.writeRealMedia = t._writeRealMedia;
|
||||
w.writeWindowsMedia = t._writeWindowsMedia;
|
||||
w.writeEmbed = t._writeEmbed;
|
||||
|
||||
nl = d.getElementsByTagName("script");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
sv = tinymce.isIE ? nl[i].innerHTML : nl[i].firstChild.nodeValue;
|
||||
|
||||
if (new RegExp('write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\\(.*', 'g').test(sv))
|
||||
el[el.length] = nl[i];
|
||||
}
|
||||
|
||||
for (i=0; i<el.length; i++) {
|
||||
ne = d.createElement("div");
|
||||
ne.innerHTML = d._embeds[i];
|
||||
el[i].parentNode.insertBefore(ne.firstChild, el[i]);
|
||||
}
|
||||
},
|
||||
|
||||
_writeFlash : function(p) {
|
||||
p.src = this.editor.documentBaseURI.toAbsolute(p.src);
|
||||
TinyMCE_PreviewPlugin._writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
},
|
||||
|
||||
_writeShockWave : function(p) {
|
||||
this.editor.documentBaseURI.toAbsolute(p.src);
|
||||
TinyMCE_PreviewPlugin._writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
},
|
||||
|
||||
_writeQuickTime : function(p) {
|
||||
this.editor.documentBaseURI.toAbsolute(p.src);
|
||||
TinyMCE_PreviewPlugin._writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
},
|
||||
|
||||
_writeRealMedia : function(p) {
|
||||
this.editor.documentBaseURI.toAbsolute(p.src);
|
||||
TinyMCE_PreviewPlugin._writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
},
|
||||
|
||||
_writeWindowsMedia : function(p) {
|
||||
this.editor.documentBaseURI.toAbsolute(p.src);
|
||||
p.url = p.src;
|
||||
TinyMCE_PreviewPlugin._writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
},
|
||||
|
||||
_writeEmbed : function(cls, cb, mt, p) {
|
||||
var h = '', n, d = t._doc, ne, c;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
d._embeds[d._embeds.length] = h;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('preview', tinymce.plugins.Preview);
|
||||
})();
|
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
||||
*/
|
||||
|
||||
function writeFlash(p) {
|
||||
writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeShockWave(p) {
|
||||
writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeQuickTime(p) {
|
||||
writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeRealMedia(p) {
|
||||
writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeWindowsMedia(p) {
|
||||
p.url = p.src;
|
||||
writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeEmbed(cls, cb, mt, p) {
|
||||
var h = '', n;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
document.write(h);
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!-- WebKit -->
|
@ -0,0 +1,460 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit;
|
||||
|
||||
tinymce.create('tinymce.plugins.Safari', {
|
||||
init : function(ed) {
|
||||
var t = this, dom;
|
||||
|
||||
// Ignore on non webkit
|
||||
if (!tinymce.isWebKit)
|
||||
return;
|
||||
|
||||
t.editor = ed;
|
||||
t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
|
||||
t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
|
||||
|
||||
// Safari will crash if the build in createlink command is used
|
||||
/* ed.addCommand('CreateLink', function(u, v) {
|
||||
ed.execCommand("mceInsertContent", false, '<a href="' + dom.encode(v) + '">' + ed.selection.getContent() + '</a>');
|
||||
});*/
|
||||
|
||||
ed.onPaste.add(function(ed, e) {
|
||||
function removeStyles(e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeType == 1) {
|
||||
e.style.cssText = '';
|
||||
|
||||
each(ed.dom.select('*', e), function(e) {
|
||||
e.style.cssText = '';
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles);
|
||||
|
||||
window.setTimeout(function() {
|
||||
Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
var h, b;
|
||||
|
||||
// If backspace or delete key
|
||||
if (e.keyCode == 46 || e.keyCode == 8) {
|
||||
b = ed.getBody();
|
||||
h = b.innerHTML;
|
||||
|
||||
// If there is no text content or images or hr elements then remove everything
|
||||
if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0)
|
||||
ed.setContent('', {format : 'raw'});
|
||||
}
|
||||
});
|
||||
|
||||
// Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004
|
||||
ed.addCommand('FormatBlock', function(u, v) {
|
||||
var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock);
|
||||
|
||||
if (e)
|
||||
dom.replace(dom.create(v), e, 1);
|
||||
else
|
||||
ed.getDoc().execCommand("FormatBlock", false, v);
|
||||
});
|
||||
|
||||
// Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382
|
||||
ed.addCommand('mceInsertContent', function(u, v) {
|
||||
ed.getDoc().execCommand("InsertText", false, 'mce_marker');
|
||||
ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + '<span id="_mce_tmp">XX</span>');
|
||||
ed.selection.select(ed.dom.get('_mce_tmp'));
|
||||
ed.getDoc().execCommand("Delete", false, ' ');
|
||||
});
|
||||
|
||||
// Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
|
||||
ed.onKeyPress.add(function(ed, e) {
|
||||
if (e.keyCode == 13 && (e.shiftKey || ed.settings.force_br_newlines && ed.selection.getNode().nodeName != 'LI')) {
|
||||
t._insertBR(ed);
|
||||
Event.cancel(e);
|
||||
}
|
||||
});
|
||||
|
||||
// Safari returns incorrect values
|
||||
ed.addQueryValueHandler('FontSize', function(u, v) {
|
||||
var e, v;
|
||||
|
||||
// Check for the real font size at the start of selection
|
||||
if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize))
|
||||
return tinymce.inArray(t.namedFontSizes, v) + 1;
|
||||
|
||||
// Check for the real font size at the end of selection
|
||||
if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize))
|
||||
return tinymce.inArray(t.namedFontSizes, v) + 1;
|
||||
|
||||
// Return default value it's better than nothing right!
|
||||
return ed.getDoc().queryCommandValue('FontSize');
|
||||
});
|
||||
|
||||
// Safari returns incorrect values
|
||||
ed.addQueryValueHandler('FontName', function(u, v) {
|
||||
var e, v;
|
||||
|
||||
// Check for the real font name at the start of selection
|
||||
if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily))
|
||||
return v.replace(/, /g, ',');
|
||||
|
||||
// Check for the real font name at the end of selection
|
||||
if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily))
|
||||
return v.replace(/, /g, ',');
|
||||
|
||||
// Return default value it's better than nothing right!
|
||||
return ed.getDoc().queryCommandValue('FontName');
|
||||
});
|
||||
|
||||
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
|
||||
ed.onClick.add(function(ed, e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName == 'IMG') {
|
||||
t.selElm = e;
|
||||
ed.selection.select(e);
|
||||
} else
|
||||
t.selElm = null;
|
||||
});
|
||||
|
||||
/* ed.onBeforeExecCommand.add(function(ed, c, b) {
|
||||
var r = t.bookmarkRng;
|
||||
|
||||
// Restore selection
|
||||
if (r) {
|
||||
ed.selection.setRng(r);
|
||||
t.bookmarkRng = null;
|
||||
//console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset);
|
||||
}
|
||||
});*/
|
||||
|
||||
ed.onInit.add(function() {
|
||||
t._fixWebKitSpans();
|
||||
|
||||
/* ed.windowManager.onOpen.add(function() {
|
||||
var r = ed.selection.getRng();
|
||||
|
||||
// Store selection if valid
|
||||
if (r.startContainer != ed.getDoc()) {
|
||||
t.bookmarkRng = r.cloneRange();
|
||||
//console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset);
|
||||
}
|
||||
});
|
||||
|
||||
ed.windowManager.onClose.add(function() {
|
||||
t.bookmarkRng = null;
|
||||
});*/
|
||||
|
||||
if (isOldWebKit)
|
||||
t._patchSafari2x(ed);
|
||||
});
|
||||
|
||||
ed.onSetContent.add(function() {
|
||||
dom = ed.dom;
|
||||
|
||||
// Convert strong,b,em,u,strike to spans
|
||||
each(['strong','b','em','u','strike','sub','sup','a'], function(v) {
|
||||
each(grep(dom.select(v)).reverse(), function(n) {
|
||||
var nn = n.nodeName.toLowerCase(), st;
|
||||
|
||||
// Convert anchors into images
|
||||
if (nn == 'a') {
|
||||
if (n.name)
|
||||
dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (nn) {
|
||||
case 'b':
|
||||
case 'strong':
|
||||
if (nn == 'b')
|
||||
nn = 'strong';
|
||||
|
||||
st = 'font-weight: bold;';
|
||||
break;
|
||||
|
||||
case 'em':
|
||||
st = 'font-style: italic;';
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
st = 'text-decoration: underline;';
|
||||
break;
|
||||
|
||||
case 'sub':
|
||||
st = 'vertical-align: sub;';
|
||||
break;
|
||||
|
||||
case 'sup':
|
||||
st = 'vertical-align: super;';
|
||||
break;
|
||||
|
||||
case 'strike':
|
||||
st = 'text-decoration: line-through;';
|
||||
break;
|
||||
}
|
||||
|
||||
dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
dom = ed.dom;
|
||||
|
||||
each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) {
|
||||
var v, bg;
|
||||
|
||||
if (o.get) {
|
||||
if (dom.hasClass(n, 'Apple-style-span')) {
|
||||
bg = n.style.backgroundColor;
|
||||
|
||||
switch (dom.getAttrib(n, 'mce_name')) {
|
||||
case 'font':
|
||||
if (!ed.settings.convert_fonts_to_spans)
|
||||
dom.setAttrib(n, 'style', '');
|
||||
break;
|
||||
|
||||
case 'strong':
|
||||
case 'em':
|
||||
case 'sub':
|
||||
case 'sup':
|
||||
dom.setAttrib(n, 'style', '');
|
||||
break;
|
||||
|
||||
case 'strike':
|
||||
case 'u':
|
||||
if (!ed.settings.inline_styles)
|
||||
dom.setAttrib(n, 'style', '');
|
||||
else
|
||||
dom.setAttrib(n, 'mce_name', '');
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!ed.settings.inline_styles)
|
||||
dom.setAttrib(n, 'style', '');
|
||||
}
|
||||
|
||||
|
||||
if (bg)
|
||||
n.style.backgroundColor = bg;
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.hasClass(n, 'mceItemRemoved'))
|
||||
dom.remove(n, 1);
|
||||
});
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
// Safari adds BR at end of all block elements
|
||||
o.content = o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g, '</$1>');
|
||||
|
||||
// Safari adds id="undefined" to HR elements
|
||||
o.content = o.content.replace(/ id=\"undefined\"/g, '');
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Safari compatibility',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Internal methods
|
||||
|
||||
_fixWebKitSpans : function() {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
if (!isOldWebKit) {
|
||||
// Use mutator events on new WebKit
|
||||
Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
|
||||
e = e.target;
|
||||
|
||||
if (e && e.nodeType == 1)
|
||||
t._fixAppleSpan(e);
|
||||
});
|
||||
} else {
|
||||
// Do post command processing in old WebKit since the browser crashes on Mutator events :(
|
||||
ed.onExecCommand.add(function() {
|
||||
each(ed.dom.select('span'), function(n) {
|
||||
t._fixAppleSpan(n);
|
||||
});
|
||||
|
||||
ed.nodeChanged();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_fixAppleSpan : function(e) {
|
||||
var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p;
|
||||
|
||||
if (dom.getAttrib(e, 'mce_fixed'))
|
||||
return;
|
||||
|
||||
// Handle Apple style spans
|
||||
if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') {
|
||||
st = e.style;
|
||||
|
||||
if (!s.convert_fonts_to_spans) {
|
||||
if (st.fontSize) {
|
||||
dom.setAttrib(e, 'mce_name', 'font');
|
||||
dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1);
|
||||
}
|
||||
|
||||
if (st.fontFamily) {
|
||||
dom.setAttrib(e, 'mce_name', 'font');
|
||||
dom.setAttrib(e, 'face', st.fontFamily);
|
||||
}
|
||||
|
||||
if (st.color) {
|
||||
dom.setAttrib(e, 'mce_name', 'font');
|
||||
dom.setAttrib(e, 'color', dom.toHex(st.color));
|
||||
}
|
||||
|
||||
if (st.backgroundColor) {
|
||||
dom.setAttrib(e, 'mce_name', 'font');
|
||||
dom.setStyle(e, 'background-color', st.backgroundColor);
|
||||
}
|
||||
} else {
|
||||
if (st.fontSize)
|
||||
dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]);
|
||||
}
|
||||
|
||||
if (st.fontWeight == 'bold')
|
||||
dom.setAttrib(e, 'mce_name', 'strong');
|
||||
|
||||
if (st.fontStyle == 'italic')
|
||||
dom.setAttrib(e, 'mce_name', 'em');
|
||||
|
||||
if (st.textDecoration == 'underline')
|
||||
dom.setAttrib(e, 'mce_name', 'u');
|
||||
|
||||
if (st.textDecoration == 'line-through')
|
||||
dom.setAttrib(e, 'mce_name', 'strike');
|
||||
|
||||
if (st.verticalAlign == 'super')
|
||||
dom.setAttrib(e, 'mce_name', 'sup');
|
||||
|
||||
if (st.verticalAlign == 'sub')
|
||||
dom.setAttrib(e, 'mce_name', 'sub');
|
||||
|
||||
dom.setAttrib(e, 'mce_fixed', '1');
|
||||
}
|
||||
},
|
||||
|
||||
_patchSafari2x : function(ed) {
|
||||
var t = this, setContent, getNode, dom = ed.dom, lr;
|
||||
|
||||
// Inline dialogs
|
||||
if (ed.windowManager.onBeforeOpen) {
|
||||
ed.windowManager.onBeforeOpen.add(function() {
|
||||
r = ed.selection.getRng();
|
||||
});
|
||||
}
|
||||
|
||||
// Fake select on 2.x
|
||||
ed.selection.select = function(n) {
|
||||
this.getSel().setBaseAndExtent(n, 0, n, 1);
|
||||
};
|
||||
|
||||
getNode = ed.selection.getNode;
|
||||
ed.selection.getNode = function() {
|
||||
return t.selElm || getNode.call(this);
|
||||
};
|
||||
|
||||
// Fake range on Safari 2.x
|
||||
ed.selection.getRng = function() {
|
||||
var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di;
|
||||
|
||||
// Fake range on Safari 2.x
|
||||
if (s.anchorNode) {
|
||||
r = d.createRange();
|
||||
|
||||
try {
|
||||
// Setup before range
|
||||
rb = d.createRange();
|
||||
rb.setStart(s.anchorNode, s.anchorOffset);
|
||||
rb.collapse(1);
|
||||
|
||||
// Setup after range
|
||||
ra = d.createRange();
|
||||
ra.setStart(s.focusNode, s.focusOffset);
|
||||
ra.collapse(1);
|
||||
|
||||
// Setup start/end points by comparing locations
|
||||
di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
|
||||
r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset);
|
||||
r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset);
|
||||
|
||||
lr = r;
|
||||
} catch (ex) {
|
||||
// Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!!
|
||||
}
|
||||
}
|
||||
|
||||
return r || lr;
|
||||
};
|
||||
|
||||
// Fix setContent so it works
|
||||
setContent = ed.selection.setContent;
|
||||
ed.selection.setContent = function(h, s) {
|
||||
var r = this.getRng(), b;
|
||||
|
||||
try {
|
||||
setContent.call(this, h, s);
|
||||
} catch (ex) {
|
||||
// Workaround for Safari 2.x
|
||||
b = dom.create('body');
|
||||
b.innerHTML = h;
|
||||
|
||||
each(b.childNodes, function(n) {
|
||||
r.insertNode(n.cloneNode(true));
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
_insertBR : function(ed) {
|
||||
var dom = ed.dom, s = ed.selection, r = s.getRng(), br;
|
||||
|
||||
// Insert BR element
|
||||
r.insertNode(br = dom.create('br'));
|
||||
|
||||
// Place caret after BR
|
||||
r.setStartAfter(br);
|
||||
r.setEndAfter(br);
|
||||
s.setRng(r);
|
||||
|
||||
// Could not place caret after BR then insert an nbsp entity and move the caret
|
||||
if (s.getSel().focusNode == br.previousSibling) {
|
||||
s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
|
||||
s.collapse(1);
|
||||
}
|
||||
|
||||
// Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
|
||||
ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y);
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('safari', tinymce.plugins.Safari);
|
||||
})();
|
||||
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.SearchReplacePlugin);})();
|
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.SearchReplacePlugin', {
|
||||
init : function(ed, url) {
|
||||
function open(m) {
|
||||
ed.windowManager.open({
|
||||
file : url + '/searchreplace.htm',
|
||||
width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
|
||||
height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
|
||||
inline : 1,
|
||||
auto_focus : 0
|
||||
}, {
|
||||
mode : m,
|
||||
search_string : ed.selection.getContent({format : 'text'}),
|
||||
plugin_url : url
|
||||
});
|
||||
};
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceSearch', function() {
|
||||
open('search');
|
||||
});
|
||||
|
||||
ed.addCommand('mceReplace', function() {
|
||||
open('replace');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
|
||||
ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
|
||||
|
||||
ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Search/Replace',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
|
||||
})();
|
@ -0,0 +1,117 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var SearchReplaceDialog = {
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");
|
||||
|
||||
this.switchMode(m);
|
||||
|
||||
f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");
|
||||
|
||||
// Focus input field
|
||||
f[m + '_panel_searchstring'].focus();
|
||||
},
|
||||
|
||||
switchMode : function(m) {
|
||||
var f, lm = this.lastMode;
|
||||
|
||||
if (lm != m) {
|
||||
f = document.forms[0];
|
||||
|
||||
if (lm) {
|
||||
f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;
|
||||
f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;
|
||||
f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;
|
||||
f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;
|
||||
}
|
||||
|
||||
mcTabs.displayTab(m + '_tab', m + '_panel');
|
||||
document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";
|
||||
document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";
|
||||
this.lastMode = m;
|
||||
}
|
||||
},
|
||||
|
||||
searchNext : function(a) {
|
||||
var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
|
||||
|
||||
// Get input
|
||||
f = document.forms[0];
|
||||
s = f[m + '_panel_searchstring'].value;
|
||||
b = f[m + '_panel_backwardsu'].checked;
|
||||
ca = f[m + '_panel_casesensitivebox'].checked;
|
||||
rs = f['replace_panel_replacestring'].value;
|
||||
|
||||
function fix() {
|
||||
// Correct Firefox graphics glitches
|
||||
r = se.getRng().cloneRange();
|
||||
ed.getDoc().execCommand('SelectAll', false, null);
|
||||
se.setRng(r);
|
||||
};
|
||||
|
||||
function replace() {
|
||||
if (tinymce.isIE)
|
||||
ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE
|
||||
else
|
||||
ed.getDoc().execCommand('InsertHTML', false, rs);
|
||||
};
|
||||
|
||||
// IE flags
|
||||
if (ca)
|
||||
fl = fl | 4;
|
||||
|
||||
switch (a) {
|
||||
case 'all':
|
||||
if (tinymce.isIE) {
|
||||
while (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
r.select();
|
||||
replace();
|
||||
fo = 1;
|
||||
}
|
||||
|
||||
tinyMCEPopup.storeSelection();
|
||||
} else {
|
||||
while (w.find(s, ca, b, false, false, false, false)) {
|
||||
replace();
|
||||
fo = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (fo)
|
||||
wm.alert(ed.getLang('searchreplace_dlg.allreplaced'));
|
||||
else
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
|
||||
return;
|
||||
|
||||
case 'current':
|
||||
replace();
|
||||
break;
|
||||
}
|
||||
|
||||
se.collapse(b);
|
||||
r = se.getRng();
|
||||
|
||||
// Whats the point
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
if (tinymce.isIE) {
|
||||
if (r.findText(s, b ? -1 : 1, fl)) {
|
||||
r.scrollIntoView();
|
||||
r.select();
|
||||
} else
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
|
||||
tinyMCEPopup.storeSelection();
|
||||
} else {
|
||||
if (!w.find(s, ca, b, false, false, false, false))
|
||||
wm.alert(ed.getLang('searchreplace_dlg.notfound'));
|
||||
else
|
||||
fix();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);
|
@ -0,0 +1,16 @@
|
||||
tinyMCE.addI18n('en.searchreplace_dlg',{
|
||||
searchnext_desc:"Find again",
|
||||
notfound:"The search has been completed. The search string could not be found.",
|
||||
search_title:"Find",
|
||||
replace_title:"Find/Replace",
|
||||
allreplaced:"All occurrences of the search string were replaced.",
|
||||
findwhat:"Find what",
|
||||
replacewith:"Replace with",
|
||||
direction:"Direction",
|
||||
up:"Up",
|
||||
down:"Down",
|
||||
mcase:"Match case",
|
||||
findnext:"Find next",
|
||||
replace:"Replace",
|
||||
replaceall:"Replace all"
|
||||
});
|
@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#searchreplace_dlg.replace_title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js"></script>
|
||||
<script type="text/javascript" src="js/searchreplace.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/searchreplace.css" />
|
||||
<base target="_self" />
|
||||
</head>
|
||||
<body style="display:none;">
|
||||
<form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="search_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>
|
||||
<li id="replace_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="search_panel" class="panel">
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><label for="search_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>
|
||||
<td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellspacing="0" cellpadding="0" class="direction">
|
||||
<tr>
|
||||
<td><label>{#searchreplace_dlg.direction}</label></td>
|
||||
<td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td>
|
||||
<td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
|
||||
<td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td>
|
||||
<td><label for="search_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
|
||||
<td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="replace_panel" class="panel">
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<tr>
|
||||
<td><label for="replace_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>
|
||||
<td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="replace_panel_replacestring">{#searchreplace_dlg.replacewith}</label></td>
|
||||
<td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellspacing="0" cellpadding="0" class="direction">
|
||||
<tr>
|
||||
<td><label>{#searchreplace_dlg.direction}</label></td>
|
||||
<td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td>
|
||||
<td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
|
||||
<td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td>
|
||||
<td><label for="replace_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
|
||||
<td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
|
||||
<input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
|
||||
<input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create('tinymce.plugins.StylePlugin',{init:function(ed,url){ed.addCommand('mceStyleProps',function(){ed.windowManager.open({file:url+'/props.htm',width:480+parseInt(ed.getLang('style.delta_width',0)),height:320+parseInt(ed.getLang('style.delta_height',0)),inline:1},{plugin_url:url,style_text:ed.selection.getNode().style.cssText});});ed.addCommand('mceSetElementStyle',function(ui,v){if(e=ed.selection.getNode()){ed.dom.setAttrib(e,'style',v);ed.execCommand('mceRepaint');}});ed.onNodeChange.add(function(ed,cm,n){cm.setDisabled('styleprops',n.nodeName==='BODY');});ed.addButton('styleprops',{title:'style.desc',cmd:'mceStyleProps'});},getInfo:function(){return{longname:'Style',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('style',tinymce.plugins.StylePlugin);})();
|
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* $Id: editor_plugin_src.js,v 1.1 2008/07/28 21:57:28 bao Exp $
|
||||
*
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.StylePlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceStyleProps', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/props.htm',
|
||||
width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
|
||||
height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url,
|
||||
style_text : ed.selection.getNode().style.cssText
|
||||
});
|
||||
});
|
||||
|
||||
ed.addCommand('mceSetElementStyle', function(ui, v) {
|
||||
if (e = ed.selection.getNode()) {
|
||||
ed.dom.setAttrib(e, 'style', v);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setDisabled('styleprops', n.nodeName === 'BODY');
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Style',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
|
||||
})();
|
@ -0,0 +1,641 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var defaultFonts = "" +
|
||||
"Arial, Helvetica, sans-serif=Arial, Helvetica, sans-serif;" +
|
||||
"Times New Roman, Times, serif=Times New Roman, Times, serif;" +
|
||||
"Courier New, Courier, mono=Courier New, Courier, mono;" +
|
||||
"Times New Roman, Times, serif=Times New Roman, Times, serif;" +
|
||||
"Georgia, Times New Roman, Times, serif=Georgia, Times New Roman, Times, serif;" +
|
||||
"Verdana, Arial, Helvetica, sans-serif=Verdana, Arial, Helvetica, sans-serif;" +
|
||||
"Geneva, Arial, Helvetica, sans-serif=Geneva, Arial, Helvetica, sans-serif";
|
||||
|
||||
var defaultSizes = "9;10;12;14;16;18;24;xx-small;x-small;small;medium;large;x-large;xx-large;smaller;larger";
|
||||
var defaultMeasurement = "+pixels=px;points=pt;em;in;cm;mm;picas;ems;exs;%";
|
||||
var defaultSpacingMeasurement = "pixels=px;points=pt;in;cm;mm;picas;+ems;exs;%";
|
||||
var defaultIndentMeasurement = "pixels=px;+points=pt;in;cm;mm;picas;ems;exs;%";
|
||||
var defaultWeight = "normal;bold;bolder;lighter;100;200;300;400;500;600;700;800;900";
|
||||
var defaultTextStyle = "normal;italic;oblique";
|
||||
var defaultVariant = "normal;small-caps";
|
||||
var defaultLineHeight = "normal";
|
||||
var defaultAttachment = "fixed;scroll";
|
||||
var defaultRepeat = "no-repeat;repeat;repeat-x;repeat-y";
|
||||
var defaultPosH = "left;center;right";
|
||||
var defaultPosV = "top;center;bottom";
|
||||
var defaultVAlign = "baseline;sub;super;top;text-top;middle;bottom;text-bottom";
|
||||
var defaultDisplay = "inline;block;list-item;run-in;compact;marker;table;inline-table;table-row-group;table-header-group;table-footer-group;table-row;table-column-group;table-column;table-cell;table-caption;none";
|
||||
var defaultBorderStyle = "none;solid;dashed;dotted;double;groove;ridge;inset;outset";
|
||||
var defaultBorderWidth = "thin;medium;thick";
|
||||
var defaultListType = "disc;circle;square;decimal;lower-roman;upper-roman;lower-alpha;upper-alpha;none";
|
||||
|
||||
function init() {
|
||||
var ce = document.getElementById('container'), h;
|
||||
|
||||
ce.style.cssText = tinyMCEPopup.getWindowArg('style_text');
|
||||
|
||||
h = getBrowserHTML('background_image_browser','background_image','image','advimage');
|
||||
document.getElementById("background_image_browser").innerHTML = h;
|
||||
|
||||
document.getElementById('text_color_pickcontainer').innerHTML = getColorPickerHTML('text_color_pick','text_color');
|
||||
document.getElementById('background_color_pickcontainer').innerHTML = getColorPickerHTML('background_color_pick','background_color');
|
||||
document.getElementById('border_color_top_pickcontainer').innerHTML = getColorPickerHTML('border_color_top_pick','border_color_top');
|
||||
document.getElementById('border_color_right_pickcontainer').innerHTML = getColorPickerHTML('border_color_right_pick','border_color_right');
|
||||
document.getElementById('border_color_bottom_pickcontainer').innerHTML = getColorPickerHTML('border_color_bottom_pick','border_color_bottom');
|
||||
document.getElementById('border_color_left_pickcontainer').innerHTML = getColorPickerHTML('border_color_left_pick','border_color_left');
|
||||
|
||||
fillSelect(0, 'text_font', 'style_font', defaultFonts, ';', true);
|
||||
fillSelect(0, 'text_size', 'style_font_size', defaultSizes, ';', true);
|
||||
fillSelect(0, 'text_size_measurement', 'style_font_size_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'text_case', 'style_text_case', "capitalize;uppercase;lowercase", ';', true);
|
||||
fillSelect(0, 'text_weight', 'style_font_weight', defaultWeight, ';', true);
|
||||
fillSelect(0, 'text_style', 'style_font_style', defaultTextStyle, ';', true);
|
||||
fillSelect(0, 'text_variant', 'style_font_variant', defaultVariant, ';', true);
|
||||
fillSelect(0, 'text_lineheight', 'style_font_line_height', defaultLineHeight, ';', true);
|
||||
fillSelect(0, 'text_lineheight_measurement', 'style_font_line_height_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'background_attachment', 'style_background_attachment', defaultAttachment, ';', true);
|
||||
fillSelect(0, 'background_repeat', 'style_background_repeat', defaultRepeat, ';', true);
|
||||
|
||||
fillSelect(0, 'background_hpos_measurement', 'style_background_hpos_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'background_vpos_measurement', 'style_background_vpos_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'background_hpos', 'style_background_hpos', defaultPosH, ';', true);
|
||||
fillSelect(0, 'background_vpos', 'style_background_vpos', defaultPosV, ';', true);
|
||||
|
||||
fillSelect(0, 'block_wordspacing', 'style_wordspacing', 'normal', ';', true);
|
||||
fillSelect(0, 'block_wordspacing_measurement', 'style_wordspacing_measurement', defaultSpacingMeasurement, ';', true);
|
||||
fillSelect(0, 'block_letterspacing', 'style_letterspacing', 'normal', ';', true);
|
||||
fillSelect(0, 'block_letterspacing_measurement', 'style_letterspacing_measurement', defaultSpacingMeasurement, ';', true);
|
||||
fillSelect(0, 'block_vertical_alignment', 'style_vertical_alignment', defaultVAlign, ';', true);
|
||||
fillSelect(0, 'block_text_align', 'style_text_align', "left;right;center;justify", ';', true);
|
||||
fillSelect(0, 'block_whitespace', 'style_whitespace', "normal;pre;nowrap", ';', true);
|
||||
fillSelect(0, 'block_display', 'style_display', defaultDisplay, ';', true);
|
||||
fillSelect(0, 'block_text_indent_measurement', 'style_text_indent_measurement', defaultIndentMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'box_width_measurement', 'style_box_width_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_height_measurement', 'style_box_height_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_float', 'style_float', 'left;right;none', ';', true);
|
||||
fillSelect(0, 'box_clear', 'style_clear', 'left;right;both;none', ';', true);
|
||||
fillSelect(0, 'box_padding_left_measurement', 'style_padding_left_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_top_measurement', 'style_padding_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_bottom_measurement', 'style_padding_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_padding_right_measurement', 'style_padding_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_left_measurement', 'style_margin_left_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_top_measurement', 'style_margin_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_bottom_measurement', 'style_margin_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'box_margin_right_measurement', 'style_margin_right_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'border_style_top', 'style_border_style_top', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_right', 'style_border_style_right', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_bottom', 'style_border_style_bottom', defaultBorderStyle, ';', true);
|
||||
fillSelect(0, 'border_style_left', 'style_border_style_left', defaultBorderStyle, ';', true);
|
||||
|
||||
fillSelect(0, 'border_width_top', 'style_border_width_top', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_right', 'style_border_width_right', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_bottom', 'style_border_width_bottom', defaultBorderWidth, ';', true);
|
||||
fillSelect(0, 'border_width_left', 'style_border_width_left', defaultBorderWidth, ';', true);
|
||||
|
||||
fillSelect(0, 'border_width_top_measurement', 'style_border_width_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_right_measurement', 'style_border_width_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_bottom_measurement', 'style_border_width_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'border_width_left_measurement', 'style_border_width_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'list_type', 'style_list_type', defaultListType, ';', true);
|
||||
fillSelect(0, 'list_position', 'style_list_position', "inside;outside", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_type', 'style_positioning_type', "absolute;relative;static", ';', true);
|
||||
fillSelect(0, 'positioning_visibility', 'style_positioning_visibility', "inherit;visible;hidden", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_width_measurement', 'style_positioning_width_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_height_measurement', 'style_positioning_height_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_overflow', 'style_positioning_overflow', "visible;hidden;scroll;auto", ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_placement_top_measurement', 'style_positioning_placement_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_right_measurement', 'style_positioning_placement_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_bottom_measurement', 'style_positioning_placement_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_placement_left_measurement', 'style_positioning_placement_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
fillSelect(0, 'positioning_clip_top_measurement', 'style_positioning_clip_top_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_right_measurement', 'style_positioning_clip_right_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_bottom_measurement', 'style_positioning_clip_bottom_measurement', defaultMeasurement, ';', true);
|
||||
fillSelect(0, 'positioning_clip_left_measurement', 'style_positioning_clip_left_measurement', defaultMeasurement, ';', true);
|
||||
|
||||
TinyMCE_EditableSelects.init();
|
||||
setupFormData();
|
||||
showDisabledControls();
|
||||
}
|
||||
|
||||
function setupFormData() {
|
||||
var ce = document.getElementById('container'), f = document.forms[0], s, b, i;
|
||||
|
||||
// Setup text fields
|
||||
|
||||
selectByValue(f, 'text_font', ce.style.fontFamily, true, true);
|
||||
selectByValue(f, 'text_size', getNum(ce.style.fontSize), true, true);
|
||||
selectByValue(f, 'text_size_measurement', getMeasurement(ce.style.fontSize));
|
||||
selectByValue(f, 'text_weight', ce.style.fontWeight, true, true);
|
||||
selectByValue(f, 'text_style', ce.style.fontStyle, true, true);
|
||||
selectByValue(f, 'text_lineheight', getNum(ce.style.lineHeight), true, true);
|
||||
selectByValue(f, 'text_lineheight_measurement', getMeasurement(ce.style.lineHeight));
|
||||
selectByValue(f, 'text_case', ce.style.textTransform, true, true);
|
||||
selectByValue(f, 'text_variant', ce.style.fontVariant, true, true);
|
||||
f.text_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.color);
|
||||
updateColor('text_color_pick', 'text_color');
|
||||
f.text_underline.checked = inStr(ce.style.textDecoration, 'underline');
|
||||
f.text_overline.checked = inStr(ce.style.textDecoration, 'overline');
|
||||
f.text_linethrough.checked = inStr(ce.style.textDecoration, 'line-through');
|
||||
f.text_blink.checked = inStr(ce.style.textDecoration, 'blink');
|
||||
|
||||
// Setup background fields
|
||||
|
||||
f.background_color.value = tinyMCEPopup.editor.dom.toHex(ce.style.backgroundColor);
|
||||
updateColor('background_color_pick', 'background_color');
|
||||
f.background_image.value = ce.style.backgroundImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
selectByValue(f, 'background_repeat', ce.style.backgroundRepeat, true, true);
|
||||
selectByValue(f, 'background_attachment', ce.style.backgroundAttachment, true, true);
|
||||
selectByValue(f, 'background_hpos', getNum(getVal(ce.style.backgroundPosition, 0)), true, true);
|
||||
selectByValue(f, 'background_hpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 0)));
|
||||
selectByValue(f, 'background_vpos', getNum(getVal(ce.style.backgroundPosition, 1)), true, true);
|
||||
selectByValue(f, 'background_vpos_measurement', getMeasurement(getVal(ce.style.backgroundPosition, 1)));
|
||||
|
||||
// Setup block fields
|
||||
|
||||
selectByValue(f, 'block_wordspacing', getNum(ce.style.wordSpacing), true, true);
|
||||
selectByValue(f, 'block_wordspacing_measurement', getMeasurement(ce.style.wordSpacing));
|
||||
selectByValue(f, 'block_letterspacing', getNum(ce.style.letterSpacing), true, true);
|
||||
selectByValue(f, 'block_letterspacing_measurement', getMeasurement(ce.style.letterSpacing));
|
||||
selectByValue(f, 'block_vertical_alignment', ce.style.verticalAlign, true, true);
|
||||
selectByValue(f, 'block_text_align', ce.style.textAlign, true, true);
|
||||
f.block_text_indent.value = getNum(ce.style.textIndent);
|
||||
selectByValue(f, 'block_text_indent_measurement', getMeasurement(ce.style.textIndent));
|
||||
selectByValue(f, 'block_whitespace', ce.style.whiteSpace, true, true);
|
||||
selectByValue(f, 'block_display', ce.style.display, true, true);
|
||||
|
||||
// Setup box fields
|
||||
|
||||
f.box_width.value = getNum(ce.style.width);
|
||||
selectByValue(f, 'box_width_measurement', getMeasurement(ce.style.width));
|
||||
|
||||
f.box_height.value = getNum(ce.style.height);
|
||||
selectByValue(f, 'box_height_measurement', getMeasurement(ce.style.height));
|
||||
|
||||
if (tinymce.isGecko)
|
||||
selectByValue(f, 'box_float', ce.style.cssFloat, true, true);
|
||||
else
|
||||
selectByValue(f, 'box_float', ce.style.styleFloat, true, true);
|
||||
|
||||
selectByValue(f, 'box_clear', ce.style.clear, true, true);
|
||||
|
||||
setupBox(f, ce, 'box_padding', 'padding', '');
|
||||
setupBox(f, ce, 'box_margin', 'margin', '');
|
||||
|
||||
// Setup border fields
|
||||
|
||||
setupBox(f, ce, 'border_style', 'border', 'Style');
|
||||
setupBox(f, ce, 'border_width', 'border', 'Width');
|
||||
setupBox(f, ce, 'border_color', 'border', 'Color');
|
||||
|
||||
updateColor('border_color_top_pick', 'border_color_top');
|
||||
updateColor('border_color_right_pick', 'border_color_right');
|
||||
updateColor('border_color_bottom_pick', 'border_color_bottom');
|
||||
updateColor('border_color_left_pick', 'border_color_left');
|
||||
|
||||
f.elements.border_color_top.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_top.value);
|
||||
f.elements.border_color_right.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_right.value);
|
||||
f.elements.border_color_bottom.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_bottom.value);
|
||||
f.elements.border_color_left.value = tinyMCEPopup.editor.dom.toHex(f.elements.border_color_left.value);
|
||||
|
||||
// Setup list fields
|
||||
|
||||
selectByValue(f, 'list_type', ce.style.listStyleType, true, true);
|
||||
selectByValue(f, 'list_position', ce.style.listStylePosition, true, true);
|
||||
f.list_bullet_image.value = ce.style.listStyleImage.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
|
||||
// Setup box fields
|
||||
|
||||
selectByValue(f, 'positioning_type', ce.style.position, true, true);
|
||||
selectByValue(f, 'positioning_visibility', ce.style.visibility, true, true);
|
||||
selectByValue(f, 'positioning_overflow', ce.style.overflow, true, true);
|
||||
f.positioning_zindex.value = ce.style.zIndex ? ce.style.zIndex : "";
|
||||
|
||||
f.positioning_width.value = getNum(ce.style.width);
|
||||
selectByValue(f, 'positioning_width_measurement', getMeasurement(ce.style.width));
|
||||
|
||||
f.positioning_height.value = getNum(ce.style.height);
|
||||
selectByValue(f, 'positioning_height_measurement', getMeasurement(ce.style.height));
|
||||
|
||||
setupBox(f, ce, 'positioning_placement', '', '', ['top', 'right', 'bottom', 'left']);
|
||||
|
||||
s = ce.style.clip.replace(new RegExp("rect\\('?([^']*)'?\\)", 'gi'), "$1");
|
||||
s = s.replace(/,/g, ' ');
|
||||
|
||||
if (!hasEqualValues([getVal(s, 0), getVal(s, 1), getVal(s, 2), getVal(s, 3)])) {
|
||||
f.positioning_clip_top.value = getNum(getVal(s, 0));
|
||||
selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
|
||||
f.positioning_clip_right.value = getNum(getVal(s, 1));
|
||||
selectByValue(f, 'positioning_clip_right_measurement', getMeasurement(getVal(s, 1)));
|
||||
f.positioning_clip_bottom.value = getNum(getVal(s, 2));
|
||||
selectByValue(f, 'positioning_clip_bottom_measurement', getMeasurement(getVal(s, 2)));
|
||||
f.positioning_clip_left.value = getNum(getVal(s, 3));
|
||||
selectByValue(f, 'positioning_clip_left_measurement', getMeasurement(getVal(s, 3)));
|
||||
} else {
|
||||
f.positioning_clip_top.value = getNum(getVal(s, 0));
|
||||
selectByValue(f, 'positioning_clip_top_measurement', getMeasurement(getVal(s, 0)));
|
||||
f.positioning_clip_right.value = f.positioning_clip_bottom.value = f.positioning_clip_left.value;
|
||||
}
|
||||
|
||||
// setupBox(f, ce, '', 'border', 'Color');
|
||||
}
|
||||
|
||||
function getMeasurement(s) {
|
||||
return s.replace(/^([0-9]+)(.*)$/, "$2");
|
||||
}
|
||||
|
||||
function getNum(s) {
|
||||
if (new RegExp('^[0-9]+[a-z%]+$', 'gi').test(s))
|
||||
return s.replace(/[^0-9]/g, '');
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function inStr(s, n) {
|
||||
return new RegExp(n, 'gi').test(s);
|
||||
}
|
||||
|
||||
function getVal(s, i) {
|
||||
var a = s.split(' ');
|
||||
|
||||
if (a.length > 1)
|
||||
return a[i];
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function setValue(f, n, v) {
|
||||
if (f.elements[n].type == "text")
|
||||
f.elements[n].value = v;
|
||||
else
|
||||
selectByValue(f, n, v, true, true);
|
||||
}
|
||||
|
||||
function setupBox(f, ce, fp, pr, sf, b) {
|
||||
if (typeof(b) == "undefined")
|
||||
b = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
|
||||
if (isSame(ce, pr, sf, b)) {
|
||||
f.elements[fp + "_same"].checked = true;
|
||||
|
||||
setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_top"].disabled = false;
|
||||
|
||||
f.elements[fp + "_right"].value = "";
|
||||
f.elements[fp + "_right"].disabled = true;
|
||||
f.elements[fp + "_bottom"].value = "";
|
||||
f.elements[fp + "_bottom"].disabled = true;
|
||||
f.elements[fp + "_left"].value = "";
|
||||
f.elements[fp + "_left"].disabled = true;
|
||||
|
||||
if (f.elements[fp + "_top_measurement"]) {
|
||||
selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_left_measurement"].disabled = true;
|
||||
f.elements[fp + "_bottom_measurement"].disabled = true;
|
||||
f.elements[fp + "_right_measurement"].disabled = true;
|
||||
}
|
||||
} else {
|
||||
f.elements[fp + "_same"].checked = false;
|
||||
|
||||
setValue(f, fp + "_top", getNum(ce.style[pr + b[0] + sf]));
|
||||
f.elements[fp + "_top"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_right", getNum(ce.style[pr + b[1] + sf]));
|
||||
f.elements[fp + "_right"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_bottom", getNum(ce.style[pr + b[2] + sf]));
|
||||
f.elements[fp + "_bottom"].disabled = false;
|
||||
|
||||
setValue(f, fp + "_left", getNum(ce.style[pr + b[3] + sf]));
|
||||
f.elements[fp + "_left"].disabled = false;
|
||||
|
||||
if (f.elements[fp + "_top_measurement"]) {
|
||||
selectByValue(f, fp + '_top_measurement', getMeasurement(ce.style[pr + b[0] + sf]));
|
||||
selectByValue(f, fp + '_right_measurement', getMeasurement(ce.style[pr + b[1] + sf]));
|
||||
selectByValue(f, fp + '_bottom_measurement', getMeasurement(ce.style[pr + b[2] + sf]));
|
||||
selectByValue(f, fp + '_left_measurement', getMeasurement(ce.style[pr + b[3] + sf]));
|
||||
f.elements[fp + "_left_measurement"].disabled = false;
|
||||
f.elements[fp + "_bottom_measurement"].disabled = false;
|
||||
f.elements[fp + "_right_measurement"].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isSame(e, pr, sf, b) {
|
||||
var a = [], i, x;
|
||||
|
||||
if (typeof(b) == "undefined")
|
||||
b = ['Top', 'Right', 'Bottom', 'Left'];
|
||||
|
||||
if (typeof(sf) == "undefined" || sf == null)
|
||||
sf = "";
|
||||
|
||||
a[0] = e.style[pr + b[0] + sf];
|
||||
a[1] = e.style[pr + b[1] + sf];
|
||||
a[2] = e.style[pr + b[2] + sf];
|
||||
a[3] = e.style[pr + b[3] + sf];
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == null)
|
||||
return false;
|
||||
|
||||
for (x=0; x<a.length; x++) {
|
||||
if (a[x] != a[i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function hasEqualValues(a) {
|
||||
var i, x;
|
||||
|
||||
for (i=0; i<a.length; i++) {
|
||||
if (a[i] == null)
|
||||
return false;
|
||||
|
||||
for (x=0; x<a.length; x++) {
|
||||
if (a[x] != a[i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyAction() {
|
||||
var ce = document.getElementById('container'), ed = tinyMCEPopup.editor;
|
||||
|
||||
generateCSS();
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
ed.dom.setAttrib(ed.selection.getNode(), 'style', tinyMCEPopup.editor.dom.serializeStyle(tinyMCEPopup.editor.dom.parseStyle(ce.style.cssText)));
|
||||
}
|
||||
|
||||
function updateAction() {
|
||||
applyAction();
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function generateCSS() {
|
||||
var ce = document.getElementById('container'), f = document.forms[0], num = new RegExp('[0-9]+', 'g'), s, t;
|
||||
|
||||
ce.style.cssText = "";
|
||||
|
||||
// Build text styles
|
||||
ce.style.fontFamily = f.text_font.value;
|
||||
ce.style.fontSize = f.text_size.value + (isNum(f.text_size.value) ? (f.text_size_measurement.value || 'px') : "");
|
||||
ce.style.fontStyle = f.text_style.value;
|
||||
ce.style.lineHeight = f.text_lineheight.value + (isNum(f.text_lineheight.value) ? f.text_lineheight_measurement.value : "");
|
||||
ce.style.textTransform = f.text_case.value;
|
||||
ce.style.fontWeight = f.text_weight.value;
|
||||
ce.style.fontVariant = f.text_variant.value;
|
||||
ce.style.color = f.text_color.value;
|
||||
|
||||
s = "";
|
||||
s += f.text_underline.checked ? " underline" : "";
|
||||
s += f.text_overline.checked ? " overline" : "";
|
||||
s += f.text_linethrough.checked ? " line-through" : "";
|
||||
s += f.text_blink.checked ? " blink" : "";
|
||||
s = s.length > 0 ? s.substring(1) : s;
|
||||
|
||||
if (f.text_none.checked)
|
||||
s = "none";
|
||||
|
||||
ce.style.textDecoration = s;
|
||||
|
||||
// Build background styles
|
||||
|
||||
ce.style.backgroundColor = f.background_color.value;
|
||||
ce.style.backgroundImage = f.background_image.value != "" ? "url(" + f.background_image.value + ")" : "";
|
||||
ce.style.backgroundRepeat = f.background_repeat.value;
|
||||
ce.style.backgroundAttachment = f.background_attachment.value;
|
||||
|
||||
if (f.background_hpos.value != "") {
|
||||
s = "";
|
||||
s += f.background_hpos.value + (isNum(f.background_hpos.value) ? f.background_hpos_measurement.value : "") + " ";
|
||||
s += f.background_vpos.value + (isNum(f.background_vpos.value) ? f.background_vpos_measurement.value : "");
|
||||
ce.style.backgroundPosition = s;
|
||||
}
|
||||
|
||||
// Build block styles
|
||||
|
||||
ce.style.wordSpacing = f.block_wordspacing.value + (isNum(f.block_wordspacing.value) ? f.block_wordspacing_measurement.value : "");
|
||||
ce.style.letterSpacing = f.block_letterspacing.value + (isNum(f.block_letterspacing.value) ? f.block_letterspacing_measurement.value : "");
|
||||
ce.style.verticalAlign = f.block_vertical_alignment.value;
|
||||
ce.style.textAlign = f.block_text_align.value;
|
||||
ce.style.textIndent = f.block_text_indent.value + (isNum(f.block_text_indent.value) ? f.block_text_indent_measurement.value : "");
|
||||
ce.style.whiteSpace = f.block_whitespace.value;
|
||||
ce.style.display = f.block_display.value;
|
||||
|
||||
// Build box styles
|
||||
|
||||
ce.style.width = f.box_width.value + (isNum(f.box_width.value) ? f.box_width_measurement.value : "");
|
||||
ce.style.height = f.box_height.value + (isNum(f.box_height.value) ? f.box_height_measurement.value : "");
|
||||
ce.style.styleFloat = f.box_float.value;
|
||||
|
||||
if (tinymce.isGecko)
|
||||
ce.style.cssFloat = f.box_float.value;
|
||||
|
||||
ce.style.clear = f.box_clear.value;
|
||||
|
||||
if (!f.box_padding_same.checked) {
|
||||
ce.style.paddingTop = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
|
||||
ce.style.paddingRight = f.box_padding_right.value + (isNum(f.box_padding_right.value) ? f.box_padding_right_measurement.value : "");
|
||||
ce.style.paddingBottom = f.box_padding_bottom.value + (isNum(f.box_padding_bottom.value) ? f.box_padding_bottom_measurement.value : "");
|
||||
ce.style.paddingLeft = f.box_padding_left.value + (isNum(f.box_padding_left.value) ? f.box_padding_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.padding = f.box_padding_top.value + (isNum(f.box_padding_top.value) ? f.box_padding_top_measurement.value : "");
|
||||
|
||||
if (!f.box_margin_same.checked) {
|
||||
ce.style.marginTop = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
|
||||
ce.style.marginRight = f.box_margin_right.value + (isNum(f.box_margin_right.value) ? f.box_margin_right_measurement.value : "");
|
||||
ce.style.marginBottom = f.box_margin_bottom.value + (isNum(f.box_margin_bottom.value) ? f.box_margin_bottom_measurement.value : "");
|
||||
ce.style.marginLeft = f.box_margin_left.value + (isNum(f.box_margin_left.value) ? f.box_margin_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.margin = f.box_margin_top.value + (isNum(f.box_margin_top.value) ? f.box_margin_top_measurement.value : "");
|
||||
|
||||
// Build border styles
|
||||
|
||||
if (!f.border_style_same.checked) {
|
||||
ce.style.borderTopStyle = f.border_style_top.value;
|
||||
ce.style.borderRightStyle = f.border_style_right.value;
|
||||
ce.style.borderBottomStyle = f.border_style_bottom.value;
|
||||
ce.style.borderLeftStyle = f.border_style_left.value;
|
||||
} else
|
||||
ce.style.borderStyle = f.border_style_top.value;
|
||||
|
||||
if (!f.border_width_same.checked) {
|
||||
ce.style.borderTopWidth = f.border_width_top.value + (isNum(f.border_width_top.value) ? f.border_width_top_measurement.value : "");
|
||||
ce.style.borderRightWidth = f.border_width_right.value + (isNum(f.border_width_right.value) ? f.border_width_right_measurement.value : "");
|
||||
ce.style.borderBottomWidth = f.border_width_bottom.value + (isNum(f.border_width_bottom.value) ? f.border_width_bottom_measurement.value : "");
|
||||
ce.style.borderLeftWidth = f.border_width_left.value + (isNum(f.border_width_left.value) ? f.border_width_left_measurement.value : "");
|
||||
} else
|
||||
ce.style.borderWidth = f.border_width_top.value;
|
||||
|
||||
if (!f.border_color_same.checked) {
|
||||
ce.style.borderTopColor = f.border_color_top.value;
|
||||
ce.style.borderRightColor = f.border_color_right.value;
|
||||
ce.style.borderBottomColor = f.border_color_bottom.value;
|
||||
ce.style.borderLeftColor = f.border_color_left.value;
|
||||
} else
|
||||
ce.style.borderColor = f.border_color_top.value;
|
||||
|
||||
// Build list styles
|
||||
|
||||
ce.style.listStyleType = f.list_type.value;
|
||||
ce.style.listStylePosition = f.list_position.value;
|
||||
ce.style.listStyleImage = f.list_bullet_image.value != "" ? "url(" + f.list_bullet_image.value + ")" : "";
|
||||
|
||||
// Build positioning styles
|
||||
|
||||
ce.style.position = f.positioning_type.value;
|
||||
ce.style.visibility = f.positioning_visibility.value;
|
||||
|
||||
if (ce.style.width == "")
|
||||
ce.style.width = f.positioning_width.value + (isNum(f.positioning_width.value) ? f.positioning_width_measurement.value : "");
|
||||
|
||||
if (ce.style.height == "")
|
||||
ce.style.height = f.positioning_height.value + (isNum(f.positioning_height.value) ? f.positioning_height_measurement.value : "");
|
||||
|
||||
ce.style.zIndex = f.positioning_zindex.value;
|
||||
ce.style.overflow = f.positioning_overflow.value;
|
||||
|
||||
if (!f.positioning_placement_same.checked) {
|
||||
ce.style.top = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
|
||||
ce.style.right = f.positioning_placement_right.value + (isNum(f.positioning_placement_right.value) ? f.positioning_placement_right_measurement.value : "");
|
||||
ce.style.bottom = f.positioning_placement_bottom.value + (isNum(f.positioning_placement_bottom.value) ? f.positioning_placement_bottom_measurement.value : "");
|
||||
ce.style.left = f.positioning_placement_left.value + (isNum(f.positioning_placement_left.value) ? f.positioning_placement_left_measurement.value : "");
|
||||
} else {
|
||||
s = f.positioning_placement_top.value + (isNum(f.positioning_placement_top.value) ? f.positioning_placement_top_measurement.value : "");
|
||||
ce.style.top = s;
|
||||
ce.style.right = s;
|
||||
ce.style.bottom = s;
|
||||
ce.style.left = s;
|
||||
}
|
||||
|
||||
if (!f.positioning_clip_same.checked) {
|
||||
s = "rect(";
|
||||
s += (isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_right.value) ? f.positioning_clip_right.value + f.positioning_clip_right_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_bottom.value) ? f.positioning_clip_bottom.value + f.positioning_clip_bottom_measurement.value : "auto") + " ";
|
||||
s += (isNum(f.positioning_clip_left.value) ? f.positioning_clip_left.value + f.positioning_clip_left_measurement.value : "auto");
|
||||
s += ")";
|
||||
|
||||
if (s != "rect(auto auto auto auto)")
|
||||
ce.style.clip = s;
|
||||
} else {
|
||||
s = "rect(";
|
||||
t = isNum(f.positioning_clip_top.value) ? f.positioning_clip_top.value + f.positioning_clip_top_measurement.value : "auto";
|
||||
s += t + " ";
|
||||
s += t + " ";
|
||||
s += t + " ";
|
||||
s += t + ")";
|
||||
|
||||
if (s != "rect(auto auto auto auto)")
|
||||
ce.style.clip = s;
|
||||
}
|
||||
|
||||
ce.style.cssText = ce.style.cssText;
|
||||
}
|
||||
|
||||
function isNum(s) {
|
||||
return new RegExp('[0-9]+', 'g').test(s);
|
||||
}
|
||||
|
||||
function showDisabledControls() {
|
||||
var f = document.forms, i, a;
|
||||
|
||||
for (i=0; i<f.length; i++) {
|
||||
for (a=0; a<f[i].elements.length; a++) {
|
||||
if (f[i].elements[a].disabled)
|
||||
tinyMCEPopup.editor.dom.addClass(f[i].elements[a], "disabled");
|
||||
else
|
||||
tinyMCEPopup.editor.dom.removeClass(f[i].elements[a], "disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fillSelect(f, s, param, dval, sep, em) {
|
||||
var i, ar, p, se;
|
||||
|
||||
f = document.forms[f];
|
||||
sep = typeof(sep) == "undefined" ? ";" : sep;
|
||||
|
||||
if (em)
|
||||
addSelectValue(f, s, "", "");
|
||||
|
||||
ar = tinyMCEPopup.getParam(param, dval).split(sep);
|
||||
for (i=0; i<ar.length; i++) {
|
||||
se = false;
|
||||
|
||||
if (ar[i].charAt(0) == '+') {
|
||||
ar[i] = ar[i].substring(1);
|
||||
se = true;
|
||||
}
|
||||
|
||||
p = ar[i].split('=');
|
||||
|
||||
if (p.length > 1) {
|
||||
addSelectValue(f, s, p[0], p[1]);
|
||||
|
||||
if (se)
|
||||
selectByValue(f, s, p[1]);
|
||||
} else {
|
||||
addSelectValue(f, s, p[0], p[0]);
|
||||
|
||||
if (se)
|
||||
selectByValue(f, s, p[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSame(ce, pre) {
|
||||
var el = document.forms[0].elements, i;
|
||||
|
||||
if (ce.checked) {
|
||||
el[pre + "_top"].disabled = false;
|
||||
el[pre + "_right"].disabled = true;
|
||||
el[pre + "_bottom"].disabled = true;
|
||||
el[pre + "_left"].disabled = true;
|
||||
|
||||
if (el[pre + "_top_measurement"]) {
|
||||
el[pre + "_top_measurement"].disabled = false;
|
||||
el[pre + "_right_measurement"].disabled = true;
|
||||
el[pre + "_bottom_measurement"].disabled = true;
|
||||
el[pre + "_left_measurement"].disabled = true;
|
||||
}
|
||||
} else {
|
||||
el[pre + "_top"].disabled = false;
|
||||
el[pre + "_right"].disabled = false;
|
||||
el[pre + "_bottom"].disabled = false;
|
||||
el[pre + "_left"].disabled = false;
|
||||
|
||||
if (el[pre + "_top_measurement"]) {
|
||||
el[pre + "_top_measurement"].disabled = false;
|
||||
el[pre + "_right_measurement"].disabled = false;
|
||||
el[pre + "_bottom_measurement"].disabled = false;
|
||||
el[pre + "_left_measurement"].disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
showDisabledControls();
|
||||
}
|
||||
|
||||
function synch(fr, to) {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.elements[to].value = f.elements[fr].value;
|
||||
|
||||
if (f.elements[fr + "_measurement"])
|
||||
selectByValue(f, to + "_measurement", f.elements[fr + "_measurement"].value);
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -0,0 +1,63 @@
|
||||
tinyMCE.addI18n('en.style_dlg',{
|
||||
title:"Edit CSS Style",
|
||||
apply:"Apply",
|
||||
text_tab:"Text",
|
||||
background_tab:"Background",
|
||||
block_tab:"Block",
|
||||
box_tab:"Box",
|
||||
border_tab:"Border",
|
||||
list_tab:"List",
|
||||
positioning_tab:"Positioning",
|
||||
text_props:"Text",
|
||||
text_font:"Font",
|
||||
text_size:"Size",
|
||||
text_weight:"Weight",
|
||||
text_style:"Style",
|
||||
text_variant:"Variant",
|
||||
text_lineheight:"Line height",
|
||||
text_case:"Case",
|
||||
text_color:"Color",
|
||||
text_decoration:"Decoration",
|
||||
text_overline:"overline",
|
||||
text_underline:"underline",
|
||||
text_striketrough:"strikethrough",
|
||||
text_blink:"blink",
|
||||
text_none:"none",
|
||||
background_color:"Background color",
|
||||
background_image:"Background image",
|
||||
background_repeat:"Repeat",
|
||||
background_attachment:"Attachment",
|
||||
background_hpos:"Horizontal position",
|
||||
background_vpos:"Vertical position",
|
||||
block_wordspacing:"Word spacing",
|
||||
block_letterspacing:"Letter spacing",
|
||||
block_vertical_alignment:"Vertical alignment",
|
||||
block_text_align:"Text align",
|
||||
block_text_indent:"Text indent",
|
||||
block_whitespace:"Whitespace",
|
||||
block_display:"Display",
|
||||
box_width:"Width",
|
||||
box_height:"Height",
|
||||
box_float:"Float",
|
||||
box_clear:"Clear",
|
||||
padding:"Padding",
|
||||
same:"Same for all",
|
||||
top:"Top",
|
||||
right:"Right",
|
||||
bottom:"Bottom",
|
||||
left:"Left",
|
||||
margin:"Margin",
|
||||
style:"Style",
|
||||
width:"Width",
|
||||
height:"Height",
|
||||
color:"Color",
|
||||
list_type:"Type",
|
||||
bullet_image:"Bullet image",
|
||||
position:"Position",
|
||||
positioning_type:"Type",
|
||||
visibility:"Visibility",
|
||||
zindex:"Z-index",
|
||||
overflow:"Overflow",
|
||||
placement:"Placement",
|
||||
clip:"Clip"
|
||||
});
|