code stringlengths 1 2.08M | language stringclasses 1 value |
|---|---|
// Copyright 2012 Google Inc.
/**
* @author Chris Broadfoot (Google)
* @fileoverview
* Feature model class for Store Locator library.
*/
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Representation of a feature of a store. (e.g. 24 hours, BYO, etc).
* @example <pre>
* var feature = new storeLocator.Feature('24hour', 'Open 24 Hours');
* </pre>
* @param {string} id unique identifier for this feature.
* @param {string} name display name of this feature.
* @constructor
* @implements storeLocator_Feature
*/
storeLocator.Feature = function(id, name) {
this.id_ = id;
this.name_ = name;
};
storeLocator['Feature'] = storeLocator.Feature;
/**
* Gets this Feature's ID.
* @return {string} this feature's ID.
*/
storeLocator.Feature.prototype.getId = function() {
return this.id_;
};
/**
* Gets this Feature's display name.
* @return {string} this feature's display name.
*/
storeLocator.Feature.prototype.getDisplayName = function() {
return this.name_;
};
storeLocator.Feature.prototype.toString = function() {
return this.getDisplayName();
};
| JavaScript |
// A simple demo showing how to grab places using the Maps API Places Library.
// Useful extensions may include using "name" filtering or "keyword" search.
google.maps.event.addDomListener(window, 'load', function() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(-28, 135),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var panelDiv = document.getElementById('panel');
var data = new PlacesDataSource(map);
var view = new storeLocator.View(map, data);
var markerSize = new google.maps.Size(24, 24);
view.createMarker = function(store) {
return new google.maps.Marker({
position: store.getLocation(),
icon: new google.maps.MarkerImage(store.getDetails().icon, null, null,
null, markerSize)
});
};
new storeLocator.Panel(panelDiv, {
view: view
});
});
/**
* Creates a new PlacesDataSource.
* @param {google.maps.Map} map
* @constructor
*/
function PlacesDataSource(map) {
this.service_ = new google.maps.places.PlacesService(map);
}
/**
* @inheritDoc
*/
PlacesDataSource.prototype.getStores = function(bounds, features, callback) {
this.service_.search({
bounds: bounds
}, function(results, status) {
var stores = [];
for (var i = 0, result; result = results[i]; i++) {
var latLng = result.geometry.location;
var store = new storeLocator.Store(result.id, latLng, null, {
title: result.name,
address: result.types.join(', '),
icon: result.icon
});
stores.push(store);
}
callback(stores);
});
};
| JavaScript |
google.maps.event.addDomListener(window, 'load', function() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(-28, 135),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var panelDiv = document.getElementById('panel');
var data = new MedicareDataSource;
var view = new storeLocator.View(map, data, {
geolocation: false,
features: data.getFeatures()
});
new storeLocator.Panel(panelDiv, {
view: view
});
});
| JavaScript |
// Store locator with customisations
// - custom marker
// - custom info window (using Info Bubble)
// - custom info window content (+ store hours)
var ICON = new google.maps.MarkerImage('medicare.png', null, null,
new google.maps.Point(14, 13));
var SHADOW = new google.maps.MarkerImage('medicare-shadow.png', null, null,
new google.maps.Point(14, 13));
google.maps.event.addDomListener(window, 'load', function() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(-28, 135),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var panelDiv = document.getElementById('panel');
var data = new MedicareDataSource;
var view = new storeLocator.View(map, data, {
geolocation: false,
features: data.getFeatures()
});
view.createMarker = function(store) {
var markerOptions = {
position: store.getLocation(),
icon: ICON,
shadow: SHADOW,
title: store.getDetails().title
};
return new google.maps.Marker(markerOptions);
}
var infoBubble = new InfoBubble;
view.getInfoWindow = function(store) {
if (!store) {
return infoBubble;
}
var details = store.getDetails();
var html = ['<div class="store"><div class="title">', details.title,
'</div><div class="address">', details.address, '</div>',
'<div class="hours misc">', details.hours, '</div></div>'].join('');
infoBubble.setContent($(html)[0]);
return infoBubble;
};
new storeLocator.Panel(panelDiv, {
view: view
});
});
| JavaScript |
/**
* @extends storeLocator.StaticDataFeed
* @constructor
*/
function MedicareDataSource() {
$.extend(this, new storeLocator.StaticDataFeed);
var that = this;
$.get('medicare.csv', function(data) {
that.setStores(that.parse_(data));
});
}
/**
* @const
* @type {!storeLocator.FeatureSet}
* @private
*/
MedicareDataSource.prototype.FEATURES_ = new storeLocator.FeatureSet(
new storeLocator.Feature('Wheelchair-YES', 'Wheelchair access'),
new storeLocator.Feature('Audio-YES', 'Audio')
);
/**
* @return {!storeLocator.FeatureSet}
*/
MedicareDataSource.prototype.getFeatures = function() {
return this.FEATURES_;
};
/**
* @private
* @param {string} csv
* @return {!Array.<!storeLocator.Store>}
*/
MedicareDataSource.prototype.parse_ = function(csv) {
var stores = [];
var rows = csv.split('\n');
var headings = this.parseRow_(rows[0]);
for (var i = 1, row; row = rows[i]; i++) {
row = this.toObject_(headings, this.parseRow_(row));
var features = new storeLocator.FeatureSet;
features.add(this.FEATURES_.getById('Wheelchair-' + row.Wheelchair));
features.add(this.FEATURES_.getById('Audio-' + row.Audio));
var position = new google.maps.LatLng(row.Ycoord, row.Xcoord);
var shop = this.join_([row.Shp_num_an, row.Shp_centre], ', ');
var locality = this.join_([row.Locality, row.Postcode], ', ');
var store = new storeLocator.Store(row.uuid, position, features, {
title: row.Fcilty_nam,
address: this.join_([shop, row.Street_add, locality], '<br>'),
hours: row.Hrs_of_bus
});
stores.push(store);
}
return stores;
};
/**
* Joins elements of an array that are non-empty and non-null.
* @private
* @param {!Array} arr array of elements to join.
* @param {string} sep the separator.
* @return {string}
*/
MedicareDataSource.prototype.join_ = function(arr, sep) {
var parts = [];
for (var i = 0, ii = arr.length; i < ii; i++) {
arr[i] && parts.push(arr[i]);
}
return parts.join(sep);
};
/**
* Very rudimentary CSV parsing - we know how this particular CSV is formatted.
* IMPORTANT: Don't use this for general CSV parsing!
* @private
* @param {string} row
* @return {Array.<string>}
*/
MedicareDataSource.prototype.parseRow_ = function(row) {
// Strip leading quote.
if (row.charAt(0) == '"') {
row = row.substring(1);
}
// Strip trailing quote. There seems to be a character between the last quote
// and the line ending, hence 2 instead of 1.
if (row.charAt(row.length - 2) == '"') {
row = row.substring(0, row.length - 2);
}
row = row.split('","');
return row;
};
/**
* Creates an object mapping headings to row elements.
* @private
* @param {Array.<string>} headings
* @param {Array.<string>} row
* @return {Object}
*/
MedicareDataSource.prototype.toObject_ = function(headings, row) {
var result = {};
for (var i = 0, ii = row.length; i < ii; i++) {
result[headings[i]] = row[i];
}
return result;
};
| JavaScript |
/**
* @implements storeLocator.DataFeed
* @constructor
*/
function MedicareDataSource() {
}
MedicareDataSource.prototype.getStores = function(bounds, features, callback) {
var center = bounds.getCenter();
var that = this;
var audioFeature = this.FEATURES_.getById('Audio-YES');
var wheelchairFeature = this.FEATURES_.getById('Wheelchair-YES');
$.getJSON('https://storelocator-go-demo.appspot.com/query?callback=?', {
lat: center.lat(),
lng: center.lng(),
n: bounds.getNorthEast().lat(),
e: bounds.getNorthEast().lng(),
s: bounds.getSouthWest().lat(),
w: bounds.getSouthWest().lng(),
audio: features.contains(audioFeature) || '',
access: features.contains(wheelchairFeature) || ''
}, function(resp) {
var stores = that.parse_(resp.data);
that.sortByDistance_(center, stores);
callback(stores);
});
};
MedicareDataSource.prototype.parse_ = function(data) {
var stores = [];
for (var i = 0, row; row = data[i]; i++) {
var features = new storeLocator.FeatureSet;
features.add(this.FEATURES_.getById('Wheelchair-' + row.Wheelchair));
features.add(this.FEATURES_.getById('Audio-' + row.Audio));
var position = new google.maps.LatLng(row.Ycoord, row.Xcoord);
var shop = this.join_([row.Shp_num_an, row.Shp_centre], ', ');
var locality = this.join_([row.Locality, row.Postcode], ', ');
var store = new storeLocator.Store(row.uuid, position, features, {
title: row.Fcilty_nam,
address: this.join_([shop, row.Street_add, locality], '<br>'),
hours: row.Hrs_of_bus
});
stores.push(store);
}
return stores;
};
/**
* @const
* @type {!storeLocator.FeatureSet}
* @private
*/
MedicareDataSource.prototype.FEATURES_ = new storeLocator.FeatureSet(
new storeLocator.Feature('Wheelchair-YES', 'Wheelchair access'),
new storeLocator.Feature('Audio-YES', 'Audio')
);
/**
* @return {!storeLocator.FeatureSet}
*/
MedicareDataSource.prototype.getFeatures = function() {
return this.FEATURES_;
};
/**
* Joins elements of an array that are non-empty and non-null.
* @private
* @param {!Array} arr array of elements to join.
* @param {string} sep the separator.
* @return {string}
*/
MedicareDataSource.prototype.join_ = function(arr, sep) {
var parts = [];
for (var i = 0, ii = arr.length; i < ii; i++) {
arr[i] && parts.push(arr[i]);
}
return parts.join(sep);
};
/**
* Sorts a list of given stores by distance from a point in ascending order.
* Directly manipulates the given array (has side effects).
* @private
* @param {google.maps.LatLng} latLng the point to sort from.
* @param {!Array.<!storeLocator.Store>} stores the stores to sort.
*/
MedicareDataSource.prototype.sortByDistance_ = function(latLng,
stores) {
stores.sort(function(a, b) {
return a.distanceTo(latLng) - b.distanceTo(latLng);
});
};
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Source";
txtLang[1].innerHTML = "Background";
txtLang[2].innerHTML = "Width";
txtLang[3].innerHTML = "Height";
txtLang[4].innerHTML = "Quality";
txtLang[5].innerHTML = "Align";
txtLang[6].innerHTML = "Loop";
txtLang[7].innerHTML = "Yes";
txtLang[8].innerHTML = "No";
txtLang[9].innerHTML = "Class ID";
txtLang[10].innerHTML = "CodeBase";
txtLang[11].innerHTML = "PluginsPage";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Low"
optLang[1].text = "High"
optLang[2].text = "<Not Set>"
optLang[3].text = "Left"
optLang[4].text = "Right"
optLang[5].text = "Top"
optLang[6].text = "Bottom"
document.getElementById("btnPick").value = "Pick";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Insert Flash</title>")
} | JavaScript |
var sStyleWeight1;
var sStyleWeight2;
var sStyleWeight3;
var sStyleWeight4;
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Font";
txtLang[1].innerHTML = "Style";
txtLang[2].innerHTML = "Size";
txtLang[3].innerHTML = "Foreground";
txtLang[4].innerHTML = "Background";
txtLang[5].innerHTML = "Decoration";
txtLang[6].innerHTML = "Text Case";
txtLang[7].innerHTML = "Minicaps";
txtLang[8].innerHTML = "Vertical";
txtLang[9].innerHTML = "Not Set";
txtLang[10].innerHTML = "Underline";
txtLang[11].innerHTML = "Overline";
txtLang[12].innerHTML = "Line-through";
txtLang[13].innerHTML = "None";
txtLang[14].innerHTML = "Not Set";
txtLang[15].innerHTML = "Capitalize";
txtLang[16].innerHTML = "Uppercase";
txtLang[17].innerHTML = "Lowercase";
txtLang[18].innerHTML = "None";
txtLang[19].innerHTML = "Not Set";
txtLang[20].innerHTML = "Small-Caps";
txtLang[21].innerHTML = "Normal";
txtLang[22].innerHTML = "Not Set";
txtLang[23].innerHTML = "Superscript";
txtLang[24].innerHTML = "Subscript";
txtLang[25].innerHTML = "Relative";
txtLang[26].innerHTML = "Baseline";
txtLang[27].innerHTML = "Character Spacing";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Regular"
optLang[1].text = "Italic"
optLang[2].text = "Bold"
optLang[3].text = "Bold Italic"
optLang[0].value = "Regular"
optLang[1].value = "Italic"
optLang[2].value = "Bold"
optLang[3].value = "Bold Italic"
sStyleWeight1 = "Regular"
sStyleWeight2 = "Italic"
sStyleWeight3 = "Bold"
sStyleWeight4 = "Bold Italic"
optLang[4].text = "Top"
optLang[5].text = "Middle"
optLang[6].text = "Bottom"
optLang[7].text = "Text-Top"
optLang[8].text = "Text-Bottom"
document.getElementById("btnPick1").value = "Pick";
document.getElementById("btnPick2").value = "Pick";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Text Formatting</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Name";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>File Field</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "AutoFit";
txtLang[1].innerHTML = "Properties";
txtLang[2].innerHTML = "Style";
txtLang[3].innerHTML = "Width";
txtLang[4].innerHTML = "AutoFit to contents";
txtLang[5].innerHTML = "Fixed cell width";
txtLang[6].innerHTML = "Height";
txtLang[7].innerHTML = "AutoFit to contents";
txtLang[8].innerHTML = "Fixed cell height";
txtLang[9].innerHTML = "Text Alignment";
txtLang[10].innerHTML = "Padding";
txtLang[11].innerHTML = "Left";
txtLang[12].innerHTML = "Right";
txtLang[13].innerHTML = "Top";
txtLang[14].innerHTML = "Bottom";
txtLang[15].innerHTML = "White Space";
txtLang[16].innerHTML = "Background";
txtLang[17].innerHTML = "Preview";
txtLang[18].innerHTML = "CSS Text";
txtLang[19].innerHTML = "Apply to";
document.getElementById("btnPick").value = "Pick";
document.getElementById("btnImage").value = "Image";
document.getElementById("btnText").value = " Text Formatting ";
document.getElementById("btnBorder").value = " Border Style ";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "pixels"
optLang[1].text = "percent"
optLang[2].text = "pixels"
optLang[3].text = "percent"
optLang[4].text = "not set"
optLang[5].text = "top"
optLang[6].text = "middle"
optLang[7].text = "bottom"
optLang[8].text = "baseline"
optLang[9].text = "sub"
optLang[10].text = "super"
optLang[11].text = "text-top"
optLang[12].text = "text-bottom"
optLang[13].text = "not set"
optLang[14].text = "left"
optLang[15].text = "center"
optLang[16].text = "right"
optLang[17].text = "justify"
optLang[18].text = "Not Set"
optLang[19].text = "No Wrap"
optLang[20].text = "pre"
optLang[21].text = "Normal"
optLang[22].text = "Current Cell"
optLang[23].text = "Current Row"
optLang[24].text = "Current Column"
optLang[25].text = "Whole Table"
}
function getTxt(s)
{
switch(s)
{
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Cell Properties</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Alignment";
txtLang[1].innerHTML = "Indentation";
txtLang[2].innerHTML = "Word Spacing";
txtLang[3].innerHTML = "Character Spacing";
txtLang[4].innerHTML = "Line Height";
txtLang[5].innerHTML = "Text Case";
txtLang[6].innerHTML = "White Space";
document.getElementById("divPreview").innerHTML = "Lorem ipsum dolor sit amet, " +
"consetetur sadipscing elitr, " +
"sed diam nonumy eirmod tempor invidunt ut labore et " +
"dolore magna aliquyam erat, " +
"sed diam voluptua. At vero eos et accusam et justo " +
"duo dolores et ea rebum. Stet clita kasd gubergren, " +
"no sea takimata sanctus est Lorem ipsum dolor sit amet.";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Not Set";
optLang[1].text = "Left";
optLang[2].text = "Right";
optLang[3].text = "Center";
optLang[4].text = "Justify";
optLang[5].text = "Not Set";
optLang[6].text = "Capitalize";
optLang[7].text = "Uppercase";
optLang[8].text = "Lowercase";
optLang[9].text = "None";
optLang[10].text = "Not Set";
optLang[11].text = "No Wrap";
optLang[12].text = "pre";
optLang[13].text = "Normal";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Paragraph Formatting</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Auto Format";
document.getElementById("btnClose").value = "close";
}
function getTxt(s)
{
}
function writeTitle()
{
document.write("<title>Table Auto Format</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Name";
txtLang[1].innerHTML = "Value";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Hidden Field</title>")
}
| JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Wrap Text";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Search":return "Search";
case "Cut":return "Cut";
case "Copy":return "Copy";
case "Paste":return "Paste";
case "Undo":return "Undo";
case "Redo":return "Redo";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Source Editor</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Image Source";
txtLang[1].innerHTML = "Repeat";
txtLang[2].innerHTML = "Horizontal Align";
txtLang[3].innerHTML = "Vertical Align";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Repeat"
optLang[1].text = "No repeat"
optLang[2].text = "Repeat horizontally"
optLang[3].text = "Repeat vertically"
optLang[4].text = "left"
optLang[5].text = "center"
optLang[6].text = "right"
optLang[7].text = "pixels"
optLang[8].text = "percent"
optLang[9].text = "top"
optLang[10].text = "center"
optLang[11].text = "bottom"
optLang[12].text = "pixels"
optLang[13].text = "percent"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Background Image</title>")
}
| JavaScript |
function loadTxt()
{
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>URL</title>")
} | JavaScript |
var sStyleWeight1;
var sStyleWeight2;
var sStyleWeight3;
var sStyleWeight4;
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Font";
txtLang[1].innerHTML = "Style";
txtLang[2].innerHTML = "Size";
txtLang[3].innerHTML = "Foreground";
txtLang[4].innerHTML = "Background";
txtLang[5].innerHTML = "Decoration";
txtLang[6].innerHTML = "Text Case";
txtLang[7].innerHTML = "Minicaps";
txtLang[8].innerHTML = "Vertical";
txtLang[9].innerHTML = "Not Set";
txtLang[10].innerHTML = "Underline";
txtLang[11].innerHTML = "Overline";
txtLang[12].innerHTML = "Line-through";
txtLang[13].innerHTML = "None";
txtLang[14].innerHTML = "Not Set";
txtLang[15].innerHTML = "Capitalize";
txtLang[16].innerHTML = "Uppercase";
txtLang[17].innerHTML = "Lowercase";
txtLang[18].innerHTML = "None";
txtLang[19].innerHTML = "Not Set";
txtLang[20].innerHTML = "Small-Caps";
txtLang[21].innerHTML = "Normal";
txtLang[22].innerHTML = "Not Set";
txtLang[23].innerHTML = "Superscript";
txtLang[24].innerHTML = "Subscript";
txtLang[25].innerHTML = "Relative";
txtLang[26].innerHTML = "Baseline";
txtLang[27].innerHTML = "Character Spacing";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Regular"
optLang[1].text = "Italic"
optLang[2].text = "Bold"
optLang[3].text = "Bold Italic"
optLang[0].value = "Regular"
optLang[1].value = "Italic"
optLang[2].value = "Bold"
optLang[3].value = "Bold Italic"
sStyleWeight1 = "Regular"
sStyleWeight2 = "Italic"
sStyleWeight3 = "Bold"
sStyleWeight4 = "Bold Italic"
optLang[4].text = "Top"
optLang[5].text = "Middle"
optLang[6].text = "Bottom"
optLang[7].text = "Text-Top"
optLang[8].text = "Text-Bottom"
document.getElementById("btnPick1").value = "Pick";
document.getElementById("btnPick2").value = "Pick";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Text Formatting</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Percentage</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Name";
txtLang[1].innerHTML = "Value";
txtLang[2].innerHTML = "Default";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Checked"
optLang[1].text = "Unchecked"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Checkbox</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Insert Row";
txtLang[1].innerHTML = "Insert Column";
txtLang[2].innerHTML = "Increase/Decrease<br>Rowspan";
txtLang[3].innerHTML = "Increase/Decrease<br>Colspan";
txtLang[4].innerHTML = "Delete Row";
txtLang[5].innerHTML = "Delete Column";
document.getElementById("btnInsRowAbove").title="Insert Row (Above)";
document.getElementById("btnInsRowBelow").title="Insert Row (Below)";
document.getElementById("btnInsColLeft").title="Insert Column (Left)";
document.getElementById("btnInsColRight").title="Insert Column (Right)";
document.getElementById("btnIncRowSpan").title="Increase Rowspan";
document.getElementById("btnDecRowSpan").title="Decrease Rowspan";
document.getElementById("btnIncColSpan").title="Increase Colspan";
document.getElementById("btnDecColSpan").title="Decrease Colspan";
document.getElementById("btnDelRow").title="Delete Row";
document.getElementById("btnDelCol").title="Delete Column";
document.getElementById("btnClose").value = " close ";
}
function getTxt(s)
{
switch(s)
{
case "Cannot delete column.":
return "Cannot delete column. The column contains spanned cells from another column. Please remove the span first.";
case "Cannot delete row.":
return "Cannot delete row. The row contains spanned cells from another rows. Please remove the span first.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Table Size</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Type";
txtLang[1].innerHTML = "Name";
txtLang[2].innerHTML = "Value";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Button"
optLang[1].text = "Submit"
optLang[2].text = "Reset"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Button</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Paste text content here (CTRL-V) ";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Paste Text</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Source";
txtLang[1].innerHTML = "Bookmark";
txtLang[2].innerHTML = "Target";
txtLang[3].innerHTML = "Title";
txtLang[4].innerHTML = "Rel";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Self"
optLang[1].text = "Blank"
optLang[2].text = "Parent"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Hyperlink</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Search";
txtLang[1].innerHTML = "Replace";
txtLang[2].innerHTML = "Match case";
txtLang[3].innerHTML = "Match whole word";
document.getElementById("btnSearch").value = "search next";;
document.getElementById("btnReplace").value = "replace";
document.getElementById("btnReplaceAll").value = "replace all";
document.getElementById("btnClose").value = "close";
}
function getTxt(s)
{
switch(s)
{
case "Finished searching": return "Finished searching the document.\nSearch again from the top?";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Search & Replace</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Paste Word content here (CTRL-V) ";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Paste From Word</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Name";
txtLang[1].innerHTML = "Size";
txtLang[2].innerHTML = "Multiple select";
txtLang[3].innerHTML = "Values";
document.getElementById("btnAdd").value = " add ";
document.getElementById("btnUp").value = " up ";
document.getElementById("btnDown").value = " down ";
document.getElementById("btnDel").value = " del ";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>List</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Color";
txtLang[1].innerHTML = "Shading";
txtLang[2].innerHTML = "Margin";
txtLang[3].innerHTML = "Left";
txtLang[4].innerHTML = "Right";
txtLang[5].innerHTML = "Top";
txtLang[6].innerHTML = "Bottom";
txtLang[7].innerHTML = "Padding";
txtLang[8].innerHTML = "Left";
txtLang[9].innerHTML = "Right";
txtLang[10].innerHTML = "Top";
txtLang[11].innerHTML = "Bottom";
txtLang[12].innerHTML = "Dimension";
txtLang[13].innerHTML = "Width";
txtLang[14].innerHTML = "Height";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "pixels";
optLang[1].text = "percent";
optLang[2].text = "pixels";
optLang[3].text = "percent";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "No Border": return "No Border";
case "Outside Border": return "Outside Border";
case "Left Border": return "Left Border";
case "Top Border": return "Top Border";
case "Right Border": return "Right Border";
case "Bottom Border": return "Bottom Border";
case "Pick": return "Pick";
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Box Formatting</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Preview";
txtLang[1].innerHTML = "CSS Text";
txtLang[2].innerHTML = "Class Name";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "You're selecting BODY element.":
return "You're selecting BODY element.";
case "Please select a text.":
return "Please select a text.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Custom CSS</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "CSS Text";
txtLang[1].innerHTML = "Class Name";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "You're selecting BODY element.":
return "You're selecting BODY element.";
case "Please select a text.":
return "Please select a text.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Custom CSS</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Rows";
txtLang[1].innerHTML = "Spacing";
txtLang[2].innerHTML = "Columns";
txtLang[3].innerHTML = "Padding";
txtLang[4].innerHTML = "Borders";
txtLang[5].innerHTML = "Collapse";
txtLang[6].innerHTML = "Caption";
txtLang[7].innerHTML = "Summary";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "No Border";
optLang[1].text = "Yes";
optLang[2].text = "No";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnSpan1").value = "Span v";
document.getElementById("btnSpan2").value = "Span >";
}
function writeTitle()
{
document.write("<title>Insert Table</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Source";
txtLang[1].innerHTML = "Width";
txtLang[2].innerHTML = "Height";
txtLang[3].innerHTML = "Auto Start";
txtLang[4].innerHTML = "Show Controls";
txtLang[5].innerHTML = "Show Status Bar";
txtLang[6].innerHTML = "Show Display";
txtLang[7].innerHTML = "Auto Rewind";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Media</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Styles";
txtLang[1].innerHTML = "Preview";
txtLang[2].innerHTML = "Apply to";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Selected Text"
optLang[1].text = "Current Tag"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "You're selecting BODY element.":
return "You're selecting BODY element.";
case "Please select a text.":
return "Please select a text.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Styles</title>")
}
| JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Name";
txtLang[1].innerHTML = "Action";
txtLang[2].innerHTML = "Method";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Form</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Web Pallete";
txtLang[1].innerHTML = "Named Colors";
txtLang[2].innerHTML = "216 Web Safe";
txtLang[3].innerHTML = "New";
txtLang[4].innerHTML = "Current";
txtLang[5].innerHTML = "Custom colors";
document.getElementById("btnAddToCustom").value = "Add to Custom Colors";
document.getElementById("btnCancel").value = " cancel ";
document.getElementById("btnRemove").value = " remove color ";
document.getElementById("btnApply").value = " apply ";
document.getElementById("btnOk").value = " ok ";
}
function getTxt (s)
{
switch (s) {
case "Use Color Name": return "Use color name";
}
}
function writeTitle()
{
document.write("<title>Colors</title>")
}
| JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Name";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Bookmark</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
//txtLang[0].innerHTML = "Size";
txtLang[0].innerHTML = "AutoFit";
txtLang[1].innerHTML = "Properties";
txtLang[2].innerHTML = "Style";
//txtLang[4].innerHTML = "Insert Row";
//txtLang[5].innerHTML = "Insert Column";
//txtLang[6].innerHTML = "Span/Split Row";
//txtLang[7].innerHTML = "Span/Split Column";
//txtLang[8].innerHTML = "Delete Row";
//txtLang[9].innerHTML = "Delete Column";
txtLang[3].innerHTML = "Width";
txtLang[4].innerHTML = "AutoFit to contents";
txtLang[5].innerHTML = "Fixed table width";
txtLang[6].innerHTML = "AutoFit to window";
txtLang[7].innerHTML = "Height";
txtLang[8].innerHTML = "AutoFit to contents";
txtLang[9].innerHTML = "Fixed table height";
txtLang[10].innerHTML = "AutoFit to window";
txtLang[11].innerHTML = "Cell Padding";
txtLang[12].innerHTML = "Cell Spacing";
txtLang[13].innerHTML = "Borders";
txtLang[14].innerHTML = "Collapse";
txtLang[15].innerHTML = "Background";
txtLang[16].innerHTML = "Alignment";
txtLang[17].innerHTML = "Margin";
txtLang[18].innerHTML = "Left";
txtLang[19].innerHTML = "Right";
txtLang[20].innerHTML = "Top";
txtLang[21].innerHTML = "Bottom";
txtLang[22].innerHTML = "Caption";
txtLang[23].innerHTML = "Summary";
txtLang[24].innerHTML = "CSS Text";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "pixels"
optLang[1].text = "percent"
optLang[2].text = "pixels"
optLang[3].text = "percent"
optLang[4].text = "No Border"
optLang[5].text = "Yes"
optLang[6].text = "No"
optLang[7].text = ""
optLang[8].text = "left"
optLang[9].text = "center"
optLang[10].text = "right"
document.getElementById("btnPick").value="Pick";
document.getElementById("btnImage").value="Image";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Cannot delete column.":
return "Cannot delete column. The column contains spanned cells from another column. Please remove the span first.";
case "Cannot delete row.":
return "Cannot delete row. The row contains spanned cells from another rows. Please remove the span first.";
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Table Properties</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Youtube Url";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
}
function writeTitle()
{
document.write("<title>Insert Youtube Video</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Length</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Type";
txtLang[1].innerHTML = "Name";
txtLang[2].innerHTML = "Size";
txtLang[3].innerHTML = "Max Length";
txtLang[4].innerHTML = "Num Line";
txtLang[5].innerHTML = "Value";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Text"
optLang[1].text = "Textarea"
optLang[2].text = "Password"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Text Field</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("btnClose").value = "close";
}
function writeTitle()
{
document.write("<title>Preview</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("btnCheckAgain").value = " Check Again ";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Required":
return "ieSpell (from www.iespell.com) is required.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>Check Spelling</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Source";
txtLang[1].innerHTML = "Title";
txtLang[2].innerHTML = "Spacing";
txtLang[3].innerHTML = "Alignment";
txtLang[4].innerHTML = "Top";
txtLang[5].innerHTML = "Border";
txtLang[6].innerHTML = "Bottom";
txtLang[7].innerHTML = "Width";
txtLang[8].innerHTML = "Left";
txtLang[9].innerHTML = "Height";
txtLang[10].innerHTML = "Right";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "absBottom";
optLang[1].text = "absMiddle";
optLang[2].text = "baseline";
optLang[3].text = "bottom";
optLang[4].text = "left";
optLang[5].text = "middle";
optLang[6].text = "right";
optLang[7].text = "textTop";
optLang[8].text = "top";
document.getElementById("btnBorder").value = " Border Style ";
document.getElementById("btnReset").value = "reset"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Image</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "HTML Code";
document.getElementById("btnClose").value = "close";
}
function writeTitle()
{
document.write("<title>Special Characters</title>")
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Name";
txtLang[1].innerHTML = "Value";
txtLang[2].innerHTML = "Default";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "Checked"
optLang[1].text = "Unchecked"
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnInsert").value = "insert";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function writeTitle()
{
document.write("<title>Radio Button</title>")
} | JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Color";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "No Border": return "No Border";
case "Outside Border": return "Outside Border";
case "Left Border": return "Left Border";
case "Top Border": return "Top Border";
case "Right Border": return "Right Border";
case "Bottom Border": return "Bottom Border";
case "Pick": return "Pick";
case "Custom Colors": return "Custom Colors";
case "More Colors...": return "More Colors...";
default: return "";
}
}
function writeTitle()
{
document.write("<title>Borders</title>")
} | JavaScript |
/*** Translation ***/
LanguageDirectory="en-US";
function getTxt(s)
{
switch(s)
{
case "Save":return "Save";
case "Preview":return "Preview";
case "Full Screen":return "Full Screen";
case "Search":return "Search";
case "Check Spelling":return "Check Spelling";
case "Text Formatting":return "Text Formatting";
case "List Formatting":return "List Formatting";
case "Paragraph Formatting":return "Paragraph Formatting";
case "Styles":return "Styles";
case "Custom CSS":return "Custom CSS";
case "Styles & Formatting":return "Styles & Formatting";
case "Style Selection":return "Style Selection";
case "Paragraph":return "Paragraph";
case "Font Name":return "Font Name";
case "Font Size":return "Font Size";
case "Cut":return "Cut";
case "Copy":return "Copy";
case "Paste":return "Paste";
case "Undo":return "Undo";
case "Redo":return "Redo";
case "Bold":return "Bold";
case "Italic":return "Italic";
case "Underline":return "Underline";
case "Strikethrough":return "Strikethrough";
case "Superscript":return "Superscript";
case "Subscript":return "Subscript";
case "Justify Left":return "Justify Left";
case "Justify Center":return "Justify Center";
case "Justify Right":return "Justify Right";
case "Justify Full":return "Justify Full";
case "Numbering":return "Numbering";
case "Bullets":return "Bullets";
case "Indent":return "Indent";
case "Outdent":return "Outdent";
case "Left To Right":return "Left To Right";
case "Right To Left":return "Right To Left";
case "Foreground Color":return "Foreground Color";
case "Background Color":return "Background Color";
case "Hyperlink":return "Hyperlink";
case "Bookmark":return "Bookmark";
case "Special Characters":return "Special Characters";
case "Image":return "Image";
case "Flash":return "Flash";
case "YoutubeVideo":return "Insert Youtube Video";
case "Media":return "Media";
case "Content Block":return "Content Block";
case "Internal Link":return "Internal Link";
case "Internal Image":return "Internal Image";
case "Object":return "Object";
case "Insert Table":return "Insert Table";
case "Table Size":return "Table Size";
case "Edit Table":return "Edit Table";
case "Edit Cell":return "Edit Cell";
case "Table":return "Table";
case "AutoTable":return "Table Auto Format";
case "Border & Shading":return "Border & Shading";
case "Show/Hide Guidelines":return "Show/Hide Guidelines";
case "Absolute":return "Absolute";
case "Paste from Word":return "Paste from Word";
case "Line":return "Line";
case "Form Editor":return "Form Editor";
case "Form":return "Form";
case "Text Field":return "Text Field";
case "List":return "List";
case "Checkbox":return "Checkbox";
case "Radio Button":return "Radio Button";
case "Hidden Field":return "Hidden Field";
case "File Field":return "File Field";
case "Button":return "Button";
case "Clean":return "Clean";//not used
case "View/Edit Source":return "View/Edit Source";
case "Tag Selector":return "Tag Selector";
case "Clear All":return "Clear All";
case "Tags":return "Tags";
case "Heading 1":return "Heading 1";
case "Heading 2":return "Heading 2";
case "Heading 3":return "Heading 3";
case "Heading 4":return "Heading 4";
case "Heading 5":return "Heading 5";
case "Heading 6":return "Heading 6";
case "Preformatted":return "Preformatted";
case "Normal (P)":return "Normal (P)";
case "Normal (DIV)":return "Normal (DIV)";
case "Size 1":return "Size 1";
case "Size 2":return "Size 2";
case "Size 3":return "Size 3";
case "Size 4":return "Size 4";
case "Size 5":return "Size 5";
case "Size 6":return "Size 6";
case "Size 7":return "Size 7";
case "Are you sure you wish to delete all contents?":
return "Are you sure you wish to delete all contents?";
case "Remove Tag":return "Remove Tag";
case "Custom Colors":return "Custom Colors";
case "More Colors...":return "More Colors...";
case "Box Formatting":return "Box Formatting";
case "Advanced Table Insert":return "Advanced Table Insert";
case "Edit Table/Cell":return "Edit Table/Cell";
case "Print":return "Print";
case "Paste Text":return "Paste Text";
case "CSS Builder":return "CSS Builder";
case "Remove Formatting":return "Remove Formatting";
case "Table Dimension Text": return "Table";
case "Table Advance Link": return "Advanced";
default:return "";
}
} | JavaScript |
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "Numbered";
txtLang[1].innerHTML = "Bulleted";
txtLang[2].innerHTML = "Starting Number";
txtLang[3].innerHTML = "Left Margin";
txtLang[4].innerHTML = "Using Image - url"
txtLang[5].innerHTML = "Left Margin";
document.getElementById("btnCancel").value = "cancel";
document.getElementById("btnApply").value = "apply";
document.getElementById("btnOk").value = " ok ";
}
function getTxt(s)
{
switch(s)
{
case "Please select a list.":return "Please select a list.";
default:return "";
}
}
function writeTitle()
{
document.write("<title>List Formatting</title>")
}
| JavaScript |
/*** Color Picker Object ***/
var arrColorPickerObjects=[];
function ColorPicker(sName,sParent)
{
this.oParent=sParent;
if(sParent)
{
this.oName=sParent+"."+sName;
this.oRenderName=sName+sParent;
}
else
{
this.oName=sName;
this.oRenderName=sName;
}
arrColorPickerObjects.push(this.oName);
this.url="color_picker.htm";
this.onShow=function(){return true;};
this.onHide=function(){return true;};
this.onPickColor=function(){return true;};
this.onRemoveColor=function(){return true;};
this.onMoreColor=function(){return true;};
this.show=showColorPicker;
this.hide=hideColorPicker;
this.hideAll=hideColorPickerAll;
this.color;
this.customColors=[];
this.refreshCustomColor=refreshCustomColor;
this.isActive=false;
this.txtCustomColors="Custom Colors";
this.txtMoreColors="More Colors...";
this.align="left";
this.currColor="#ffffff";//default current color
this.RENDER=drawColorPicker;
}
function drawColorPicker()
{
var arrColors=[["#800000","#8b4513","#006400","#2f4f4f","#000080","#4b0082","#800080","#000000"],
["#ff0000","#daa520","#6b8e23","#708090","#0000cd","#483d8b","#c71585","#696969"],
["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"],
["#ff6347","#ffd700","#32cd32","#87ceeb","#00bfff","#9370db","#ff69b4","#dcdcdc"],
["#ffdab9","#ffffe0","#98fb98","#e0ffff","#87cefa","#e6e6fa","#dda0dd","#ffffff"]]
var sHTMLColor="<table id=dropColor"+this.oRenderName+" style=\"z-index:1;display:none;position:absolute;border:#9b95a6 1px solid;cursor:default;background-color:#f4f4f4;padding:2px\" unselectable=on cellpadding=0 cellspacing=0 width=145px><tr><td unselectable=on>"
sHTMLColor+="<table align=center cellpadding=0 cellspacing=0 border=0 unselectable=on>";
for(var i=0;i<arrColors.length;i++)
{
sHTMLColor+="<tr>";
for(var j=0;j<arrColors[i].length;j++)
sHTMLColor+="<td onclick=\""+this.oName+".color='"+arrColors[i][j]+"';"+this.oName+".onPickColor();"+this.oName+".currColor='"+arrColors[i][j]+"';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
"<table style='border-collapse:collapse;margin:0px;width:13px;height:13px;background:"+arrColors[i][j]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td unselectable=on></td></tr>"+
"</table></td>";
sHTMLColor+="</tr>";
}
//~~~ custom colors ~~~~
sHTMLColor+="<tr><td colspan=8 id=idCustomColor"+this.oRenderName+"></td></tr>";
//~~~ remove color & more colors ~~~~
sHTMLColor+= "<tr>";
sHTMLColor+= "<td unselectable=on>"+
"<table style='margin-left:1px;width:14px;height:14px;background:#f4f4f4;' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onRemoveColor();"+this.oName+".currColor='';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='white 1px solid'\" style=\"cursor:default;padding:1px;border:white 1px solid;font-family:verdana;font-size:10px;font-color:black;line-height:9px;\" align=center valign=top unselectable=on>x</td></tr>"+
"</table></td>";
sHTMLColor+= "<td colspan=7 unselectable=on>"+
"<table style='margin:1px;width:117px;height:16px;background:#f4f4f4;border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td id='"+this.oName+"moreColTd' onclick=\""+this.oName+".onMoreColor();"+this.oName+".hideAll();parent.modalDialogShow('"+this.url+"?" +this.oName+ "', 455, 455, window,{'oName':'"+this.oName+"'})\" onmouseover=\"this.style.border='#777777 1px solid';this.style.background='#444444';this.style.color='#ffffff'\" onmouseout=\"this.style.border='#f4f4f4 1px solid';this.style.background='#f4f4f4';this.style.color='#000000'\" style=\"cursor:default;font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\" align=center valign=top nowrap unselectable=on>"+this.txtMoreColors+"</td></tr>"+
"</table></td>";
sHTMLColor+= "</tr>";
sHTMLColor+= "</table>";
sHTMLColor+="</td></tr></table>";
document.write(sHTMLColor);
}
function refreshCustomColor()
{
var arg = eval(dialogArgument[0]);
var arg2 = eval(dialogArgument[1]);
if(arg.oUtil)//[CUSTOM]
this.customColors=arg.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
else //text2.htm [CUSTOM]
this.customColors=arg2.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
if(this.customColors.length==0)
{
document.getElementById("idCustomColor"+this.oRenderName).innerHTML="";
return;
}
sHTML="<table cellpadding=0 cellspacing=0 width=100%><tr><td colspan=8 style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1\">"+this.txtCustomColors+":</td></tr></table>"
sHTML+="<table cellpadding=0 cellspacing=0><tr>";
for(var i=0;i<this.customColors.length;i++)
{
if(i<22)
{
if(i==8||i==16||i==24||i==32)sHTML+="</tr></table><table cellpadding=0 cellspacing=0><tr>"
sHTML+="<td onclick=\""+this.oName+".color='"+this.customColors[i]+"';"+this.oName+".onPickColor()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
" <table style='margin:0;width:13px;height:13px;background:"+this.customColors[i]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
" <tr><td unselectable=on></td></tr>"+
" </table>"+
"</td>";
}
}
sHTML+="</tr></table>";
document.getElementById("idCustomColor"+this.oRenderName).innerHTML=sHTML;
}
function showColorPicker(oEl)
{
this.onShow();
this.hideAll();
var box=document.getElementById("dropColor"+this.oRenderName);
//remove hilite
var allTds = box.getElementsByTagName("TD");
for (var i = 0; i<allTds.length; i++) {
allTds[i].style.border="#f4f4f4 1px solid";
if (allTds[i].id==this.oName+"moreColTd") {
allTds[i].style.border="#f4f4f4 1px solid";
allTds[i].style.background="#f4f4f4";
allTds[i].style.color="#000000";
}
}
box.style.display="block";
var nTop=0;
var nLeft=0;
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.top!="")
nTop+=oElTmp.style.top.substring(1,oElTmp.style.top.length-2)*1;
else nTop+=oElTmp.offsetTop;
oElTmp = oElTmp.offsetParent;
}
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.left!="")
nLeft+=oElTmp.style.left.substring(1,oElTmp.style.left.length-2)*1;
else nLeft+=oElTmp.offsetLeft;
oElTmp=oElTmp.offsetParent;
}
if(this.align=="left")
box.style.left=nLeft;
else//right
box.style.left=nLeft-143+oEl.offsetWidth;
//box.style.top=nTop+1;//[CUSTOM]
box.style.top=nTop+1+oEl.offsetHeight;//[CUSTOM]
this.isActive=true;
this.refreshCustomColor();
}
function hideColorPicker()
{
this.onHide();
var box=document.getElementById("dropColor"+this.oRenderName);
box.style.display="none";
this.isActive=false;
}
function hideColorPickerAll()
{
for(var i=0;i<arrColorPickerObjects.length;i++)
{
var box=document.getElementById("dropColor"+eval(arrColorPickerObjects[i]).oRenderName);
box.style.display="none";
eval(arrColorPickerObjects[i]).isActive=false;
}
}
function convertHexToDec(hex)
{
return parseInt(hex,16);
}
function convertDecToHex(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("0" +tmp);
return tmp;//.toUpperCase();
}
function convertDecToHex2(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("00000" +tmp);
if(tmp.length == 2) tmp = ("0000" +tmp);
if(tmp.length == 3) tmp = ("000" +tmp);
if(tmp.length == 4) tmp = ("00" +tmp);
if(tmp.length == 5) tmp = ("0" +tmp);
tmp = tmp.substr(4,1) + tmp.substr(5,1) + tmp.substr(2,1) + tmp.substr(3,1) + tmp.substr(0,1) + tmp.substr(1,1)
return tmp;//.toUpperCase();
}
//input color in format rgb(R,G,B)
//ex, return by document.queryCommandValue(forcolor)
function extractRGBColor(col) {
var re = /rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/i;
if (re.test(col)) {
var result = re.exec(col);
return convertDecToHex(parseInt(result[1])) +
convertDecToHex(parseInt(result[2])) +
convertDecToHex(parseInt(result[3]));
}
return convertDecToHex2(0);
}
| JavaScript |
/*** Color Picker Object ***/
var arrColorPickerObjects=[];
function ColorPicker(sName,sParent)
{
this.oParent=sParent;
if(sParent)
{
this.oName=sParent+"."+sName;
this.oRenderName=sName+sParent;
}
else
{
this.oName=sName;
this.oRenderName=sName;
}
arrColorPickerObjects.push(this.oName);
this.url="color_picker.htm";
this.onShow=function(){return true;};
this.onHide=function(){return true;};
this.onPickColor=function(){return true;};
this.onRemoveColor=function(){return true;};
this.onMoreColor=function(){return true;};
this.show=showColorPicker;
this.hide=hideColorPicker;
this.hideAll=hideColorPickerAll;
this.color;
this.customColors=[];
this.refreshCustomColor=refreshCustomColor;
this.isActive=false;
this.txtCustomColors="Custom Colors";
this.txtMoreColors="More Colors...";
this.align="left";
this.currColor="#ffffff";//default current color
this.RENDER=drawColorPicker;
}
function drawColorPicker()
{
var arrColors=[["#800000","#8b4513","#006400","#2f4f4f","#000080","#4b0082","#800080","#000000"],
["#ff0000","#daa520","#6b8e23","#708090","#0000cd","#483d8b","#c71585","#696969"],
["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"],
["#ff6347","#ffd700","#32cd32","#87ceeb","#00bfff","#9370db","#ff69b4","#dcdcdc"],
["#ffdab9","#ffffe0","#98fb98","#e0ffff","#87cefa","#e6e6fa","#dda0dd","#ffffff"]]
var sHTMLColor="<table id=dropColor"+this.oRenderName+" style=\"z-index:1;display:none;position:absolute;border:#9b95a6 1px solid;cursor:default;background-color:#f4f4f4;padding:2px\" unselectable=on cellpadding=0 cellspacing=0 width=145px><tr><td unselectable=on>"
sHTMLColor+="<table align=center cellpadding=0 cellspacing=0 border=0 unselectable=on>";
for(var i=0;i<arrColors.length;i++)
{
sHTMLColor+="<tr>";
for(var j=0;j<arrColors[i].length;j++)
sHTMLColor+="<td onclick=\""+this.oName+".color='"+arrColors[i][j]+"';"+this.oName+".onPickColor();"+this.oName+".currColor='"+arrColors[i][j]+"';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
"<table style='margin:0px;width:13px;height:13px;background:"+arrColors[i][j]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td unselectable=on></td></tr>"+
"</table></td>";
sHTMLColor+="</tr>";
}
//~~~ custom colors ~~~~
sHTMLColor+="<tr><td colspan=8 id=idCustomColor"+this.oRenderName+"></td></tr>";
//~~~ remove color & more colors ~~~~
sHTMLColor+= "<tr>";
sHTMLColor+= "<td unselectable=on>"+
"<table style='margin-left:1px;width:14px;height:14px;background:#f4f4f4;' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onRemoveColor();"+this.oName+".currColor='';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='white 1px solid'\" style=\"cursor:default;padding:1px;border:white 1px solid;font-family:verdana;font-size:10px;color:black;line-height:9px;\" align=center valign=top unselectable=on>x</td></tr>"+
"</table></td>";
sHTMLColor+= "<td colspan=7 unselectable=on>"+
"<table style='margin:1px;width:117px;height:16px;background:#f4f4f4;border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td id='"+this.oName+"moreColTd' onclick=\""+this.oName+".onMoreColor();"+this.oName+".hideAll();parent.modalDialogShow('"+this.url+"?" +this.oName+ "', 440, 430, window,{'oName':'"+this.oName+"'})\" onmouseover=\"this.style.border='#777777 1px solid';this.style.background='#444444';this.style.color='#ffffff'\" onmouseout=\"this.style.border='#f4f4f4 1px solid';this.style.background='#f4f4f4';this.style.color='#000000'\" style=\"cursor:default;font-family:verdana;font-size:9px;color:black;line-height:9px;padding:1px\" align=center valign=top nowrap unselectable=on>"+this.txtMoreColors+"</td></tr>"+
"</table></td>";
sHTMLColor+= "</tr>";
sHTMLColor+= "</table>";
sHTMLColor+="</td></tr></table>";
document.write(sHTMLColor);
}
function refreshCustomColor()
{
var arg = eval(dialogArgument[0]);
var arg2 = eval(dialogArgument[1]);
if(arg.oUtil)//[CUSTOM]
this.customColors=arg.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
else //text2.htm [CUSTOM]
this.customColors=arg2.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
if(this.customColors.length==0)
{
document.getElementById("idCustomColor"+this.oRenderName).innerHTML="";
return;
}
sHTML="<table cellpadding=0 cellspacing=0 width=100%><tr><td colspan=8 style=\"font-family:verdana;font-size:9px;color:black;line-height:9px;padding:1\">"+this.txtCustomColors+":</td></tr></table>"
sHTML+="<table cellpadding=0 cellspacing=0><tr>";
for(var i=0;i<this.customColors.length;i++)
{
if(i<22)
{
if(i==8||i==16||i==24||i==32)sHTML+="</tr></table><table cellpadding=0 cellspacing=0><tr>"
sHTML+="<td onclick=\""+this.oName+".color='"+this.customColors[i]+"';"+this.oName+".onPickColor()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
" <table style='margin:0;width:13;height:13;background:"+this.customColors[i]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
" <tr><td unselectable=on></td></tr>"+
" </table>"+
"</td>";
}
}
sHTML+="</tr></table>";
document.getElementById("idCustomColor"+this.oRenderName).innerHTML=sHTML;
}
function showColorPicker(oEl)
{
this.onShow();
this.hideAll();
var box=document.getElementById("dropColor"+this.oRenderName);
//remove hilite
var allTds = box.getElementsByTagName("TD");
for (var i = 0; i<allTds.length; i++) {
allTds[i].style.border="#f4f4f4 1px solid";
if (allTds[i].id==this.oName+"moreColTd") {
allTds[i].style.border="#f4f4f4 1px solid";
allTds[i].style.background="#f4f4f4";
allTds[i].style.color="#000000";
}
}
box.style.display="block";
var nTop=0;
var nLeft=0;
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.top!="")
nTop+=oElTmp.style.top.substring(1,oElTmp.style.top.length-2)*1;
else nTop+=oElTmp.offsetTop;
oElTmp = oElTmp.offsetParent;
}
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.left!="")
nLeft+=oElTmp.style.left.substring(1,oElTmp.style.left.length-2)*1;
else nLeft+=oElTmp.offsetLeft;
oElTmp=oElTmp.offsetParent;
}
if(this.align=="left")
box.style.left=nLeft;
else//right
box.style.left=nLeft-143+oEl.offsetWidth;
//box.style.top=nTop+1;//[CUSTOM]
box.style.top=nTop+1+oEl.offsetHeight;//[CUSTOM]
this.isActive=true;
this.refreshCustomColor();
}
function hideColorPicker()
{
this.onHide();
var box=document.getElementById("dropColor"+this.oRenderName);
box.style.display="none";
this.isActive=false;
}
function hideColorPickerAll()
{
for(var i=0;i<arrColorPickerObjects.length;i++)
{
var box=document.getElementById("dropColor"+eval(arrColorPickerObjects[i]).oRenderName);
box.style.display="none";
eval(arrColorPickerObjects[i]).isActive=false;
}
}
function convertHexToDec(hex)
{
return parseInt(hex,16);
}
function convertDecToHex(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("0" +tmp);
return tmp;//.toUpperCase();
}
function convertDecToHex2(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("00000" +tmp);
if(tmp.length == 2) tmp = ("0000" +tmp);
if(tmp.length == 3) tmp = ("000" +tmp);
if(tmp.length == 4) tmp = ("00" +tmp);
if(tmp.length == 5) tmp = ("0" +tmp);
tmp = tmp.substr(4,1) + tmp.substr(5,1) + tmp.substr(2,1) + tmp.substr(3,1) + tmp.substr(0,1) + tmp.substr(1,1)
return tmp;//.toUpperCase();
}
//input color in format rgb(R,G,B)
//ex, return by document.queryCommandValue(forcolor)
function extractRGBColor(col) {
var re = /rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/i;
if (re.test(col)) {
var result = re.exec(col);
return convertDecToHex(parseInt(result[1])) +
convertDecToHex(parseInt(result[2])) +
convertDecToHex(parseInt(result[3]));
}
return convertDecToHex2(0);
}
| JavaScript |
/*** Editor Script Wrapper ***/
var oScripts=document.getElementsByTagName("script");
var sEditorPath;
for(var i=0;i<oScripts.length;i++)
{
var sSrc=oScripts[i].src.toLowerCase();
if(sSrc.indexOf("scripts/innovaeditor.js")!=-1) sEditorPath=oScripts[i].src.replace(/innovaeditor.js/,"");
}
document.write("<li"+"nk rel='stylesheet' href='"+sEditorPath+"style/istoolbar.css' type='text/css' />");
document.write("<scr"+"ipt src='"+sEditorPath+"istoolbar.js'></scr"+"ipt>");
if(navigator.appName.indexOf('Microsoft')!=-1) {
document.write("<scr"+"ipt src='"+sEditorPath+"editor.js'></scr"+"ipt>");
} else if(navigator.userAgent.indexOf('Safari')!=-1) {
document.write("<scr"+"ipt src='"+sEditorPath+"saf/editor.js'></scr"+"ipt>");
} else {
document.write("<scr"+"ipt src='"+sEditorPath+"moz/editor.js'></scr"+"ipt>");
} | JavaScript |
function doCmd(idIframe,sCmd,sOption)
{
var oEditor=eval(idIframe);
var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
var oTarget=(sType=="None"?oEditor.document:oSel);
oTarget.execCommand(sCmd,false,sOption);
}
function getHTMLBody(idIframe)
{
var oEditor=eval(idIframe);
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
return sHTML;
}
function getXHTMLBody(idIframe)
{
var oEditor=eval(idIframe);
cleanDeprecated(idIframe);
return recur(oEditor.document.body,"");
}
/*Insert custom HTML function*/
function insertHTML(wndIframe, sHTML)
{
var oEditor=wndIframe;
var oSel=oEditor.document.selection.createRange();
var arrA = String(sHTML).match(/<A[^>]*>/ig);
if(arrA)
for(var i=0;i<arrA.length;i++)
{
sTmp = arrA[i].replace(/href=/,"href_iwe=");
sHTML=String(sHTML).replace(arrA[i],sTmp);
}
var arrB = String(sHTML).match(/<IMG[^>]*>/ig);
if(arrB)
for(var i=0;i<arrB.length;i++)
{
sTmp = arrB[i].replace(/src=/,"src_iwe=");
sHTML=String(sHTML).replace(arrB[i],sTmp);
}
if(oSel.parentElement)oSel.pasteHTML(sHTML);
else oSel.item(0).outerHTML=sHTML;
for(var i=0;i<oEditor.document.all.length;i++)
{
if(oEditor.document.all[i].getAttribute("href_iwe"))
{
oEditor.document.all[i].href=oEditor.document.all[i].getAttribute("href_iwe");
oEditor.document.all[i].removeAttribute("href_iwe",0);
}
if(oEditor.document.all[i].getAttribute("src_iwe"))
{
oEditor.document.all[i].src=oEditor.document.all[i].getAttribute("src_iwe");
oEditor.document.all[i].removeAttribute("src_iwe",0);
}
}
}
/************************************
CLEAN DEPRECATED TAGS; Used in loadHTML, getHTMLBody, getXHTMLBody
*************************************/
function cleanDeprecated(idIframe)
{
var oEditor=eval(idIframe);
var elements;
//elements=oEditor.document.body.getElementsByTagName("STRONG");
//cleanTags(idIframe,elements,"bold");
//elements=oEditor.document.body.getElementsByTagName("B");
//cleanTags(idIframe,elements,"bold");
//elements=oEditor.document.body.getElementsByTagName("I");
//cleanTags(idIframe,elements,"italic");
//elements=oEditor.document.body.getElementsByTagName("EM");
//cleanTags(idIframe,elements,"italic");
elements=oEditor.document.body.getElementsByTagName("STRIKE");
cleanTags(idIframe,elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("S");
cleanTags(idIframe,elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("U");
cleanTags(idIframe,elements,"underline");
replaceTags(idIframe,"DIR","DIV");
replaceTags(idIframe,"MENU","DIV");
replaceTags(idIframe,"CENTER","DIV");
replaceTags(idIframe,"XMP","PRE");
replaceTags(idIframe,"BASEFONT","SPAN");//will be removed by cleanEmptySpan()
elements=oEditor.document.body.getElementsByTagName("APPLET");
var count=elements.length;
while(count>0)
{
f=elements[0];
f.removeNode(false);
count--;
}
cleanFonts(idIframe);
cleanEmptySpan(idIframe);
return true;
}
function cleanEmptySpan(idIframe)//WARNING: blm bisa remove span yg bertumpuk dgn style sama,dst.
{
var bReturn=false;
var oEditor=eval(idIframe);
var allSpans=oEditor.document.getElementsByTagName("SPAN");
if(allSpans.length==0)return false;
var emptySpans=[];
var reg = /<\s*SPAN\s*>/gi;
for(var i=0;i<allSpans.length;i++)
{
if(allSpans[i].outerHTML.search(reg)==0)
emptySpans[emptySpans.length]=allSpans[i];
}
var theSpan,theParent;
for(var i=0;i<emptySpans.length;i++)
{
theSpan=emptySpans[i];
theSpan.removeNode(false);
bReturn=true;
}
return bReturn;
}
function cleanFonts(idIframe)
{
var oEditor=eval(idIframe);
var allFonts=oEditor.document.body.getElementsByTagName("FONT");
if(allFonts.length==0)return false;
var f;
while(allFonts.length>0)
{
f=allFonts[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{
//if font containts only span child node
copyAttribute(f.childNodes[0],f);
f.removeNode(false);
}
else
if(f.parentElement.nodeName=="SPAN" && f.parentElement.childNodes.length==1)
{
//font is the only child node of span.
copyAttribute(f.parentElement,f);
f.removeNode(false);
}
else
{
var newSpan=oEditor.document.createElement("SPAN");
copyAttribute(newSpan,f);
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
}
}
return true;
}
function cleanTags(idIframe,elements,sVal)//WARNING: Dgn asumsi underline & linethrough tidak bertumpuk
{
var oEditor=eval(idIframe);
var f;
while(elements.length>0)
{
f=elements[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{//if font containts only span child node
if(sVal=="bold")f.childNodes[0].style.fontWeight="bold";
if(sVal=="italic")f.childNodes[0].style.fontStyle="italic";
if(sVal=="line-through")f.childNodes[0].style.textDecoration="line-through";
if(sVal=="underline")f.childNodes[0].style.textDecoration="underline";
f.removeNode(false);
}
else
if(f.parentElement.nodeName=="SPAN" && f.parentElement.childNodes.length==1)
{//font is the only child node of span.
if(sVal=="bold")f.parentElement.style.fontWeight="bold";
if(sVal=="italic")f.parentElement.style.fontStyle="italic";
if(sVal=="line-through")f.parentElement.style.textDecoration="line-through";
if(sVal=="underline")f.parentElement.style.textDecoration="underline";
f.removeNode(false);
}
else
{
var newSpan=oEditor.document.createElement("SPAN");
if(sVal=="bold")newSpan.style.fontWeight="bold";
if(sVal=="italic")newSpan.style.fontStyle="italic";
if(sVal=="line-through")newSpan.style.textDecoration="line-through";
if(sVal=="underline")newSpan.style.textDecoration="underline";
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
}
}
}
function replaceTags(idIframe,sFrom,sTo)
{
var oEditor=eval(idIframe);
var elements=oEditor.document.getElementsByTagName(sFrom);
var newSpan;
var count=elements.length;
while(count > 0)
{
f=elements[0];
newSpan=oEditor.document.createElement(sTo);
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
count--;
}
}
function copyAttribute(newSpan,f)
{
if((f.face!=null)&&(f.face!=""))newSpan.style.fontFamily=f.face;
if((f.size!=null)&&(f.size!=""))
{
var nSize="";
if(f.size==1)nSize="8pt";
else if(f.size==2)nSize="10pt";
else if(f.size==3)nSize="12pt";
else if(f.size==4)nSize="14pt";
else if(f.size==5)nSize="18pt";
else if(f.size==6)nSize="24pt";
else if(f.size>=7)nSize="36pt";
else if(f.size<=-2||f.size=="0")nSize="8pt";
else if(f.size=="-1")nSize="10pt";
else if(f.size==0)nSize="12pt";
else if(f.size=="+1")nSize="14pt";
else if(f.size=="+2")nSize="18pt";
else if(f.size=="+3")nSize="24pt";
else if(f.size=="+4"||f.size=="+5"||f.size=="+6")nSize="36pt";
else nSize="";
if(nSize!="")newSpan.style.fontSize=nSize;
}
if((f.style.backgroundColor!=null)&&(f.style.backgroundColor!=""))newSpan.style.backgroundColor=f.style.backgroundColor;
if((f.color!=null)&&(f.color!=""))newSpan.style.color=f.color;
}
function GetElement(oElement,sMatchTag)
{
while (oElement!=null&&oElement.tagName!=sMatchTag)
{
if(oElement.tagName=="BODY")return null;
oElement=oElement.parentElement;
}
return oElement;
}
/************************************
HTML to XHTML
*************************************/
function lineBreak1(tag) //[0]<TAG>[1]text[2]</TAG>
{
arrReturn = ["\n","",""];
if( tag=="A"||tag=="B"||tag=="CITE"||tag=="CODE"||tag=="EM"||
tag=="FONT"||tag=="I"||tag=="SMALL"||tag=="STRIKE"||tag=="BIG"||
tag=="STRONG"||tag=="SUB"||tag=="SUP"||tag=="U"||tag=="SAMP"||
tag=="S"||tag=="VAR"||tag=="BASEFONT"||tag=="KBD"||tag=="TT")
arrReturn=["","",""];
if( tag=="TEXTAREA"||tag=="TABLE"||tag=="THEAD"||tag=="TBODY"||
tag=="TR"||tag=="OL"||tag=="UL"||tag=="DIR"||tag=="MENU"||
tag=="FORM"||tag=="SELECT"||tag=="MAP"||tag=="DL"||tag=="HEAD"||
tag=="BODY"||tag=="HTML")
arrReturn=["\n","","\n"];
if( tag=="STYLE"||tag=="SCRIPT")
arrReturn=["\n","",""];
if(tag=="BR"||tag=="HR")
arrReturn=["","\n",""];
return arrReturn;
}
function fixAttr(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
s = String(s).replace(/"/g, """);
return s;
}
function fixVal(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
var x = escape(s);
x = unescape(x.replace(/\%A0/gi, "-*REPL*-"));
s = x.replace(/-\*REPL\*-/gi, " ");
return s;
}
function recur(oEl,sTab)
{
var sHTML="";
for(var i=0;i<oEl.childNodes.length;i++)
{
var oNode=oEl.childNodes(i);
if(oNode.nodeType==1)//tag
{
var sTagName = oNode.nodeName;
var sCloseTag = oNode.outerHTML;
if (sCloseTag.indexOf("<?xml:namespace") > -1) sCloseTag=sCloseTag.substr(sCloseTag.indexOf(">")+1);
sCloseTag = sCloseTag.substring(1, sCloseTag.indexOf(">"));
if (sCloseTag.indexOf(" ")>-1) sCloseTag=sCloseTag.substring(0, sCloseTag.indexOf(" "));
var bDoNotProcess=false;
if(sTagName.substring(0,1)=="/")
{
bDoNotProcess=true;//do not process
}
else
{
/*** tabs ***/
var sT= sTab;
sHTML+= lineBreak1(sTagName)[0];
if(lineBreak1(sTagName)[0] !="") sHTML+= sT;//If new line, use base Tabs
/************/
}
if(bDoNotProcess)
{
;//do not process
}
else if(sTagName=="OBJECT" || sTagName=="EMBED")
{
s=oNode.outerHTML;
s=s.replace(/\"[^\"]*\"/ig,function(x){
x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
return x});
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()});
s=s.replace(/ ([^=]+)=([^"' >]+)/ig," $1=\"$2\"");//new
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
s=s.replace(/<param([^>]*)>/ig,"\n<param$1 />").replace(/\/ \/>$/ig," \/>");//no closing tag
if(sTagName=="EMBED")
if(oNode.innerHTML=="")
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
s=s.replace(/<param name=\"Play\" value=\"0\" \/>/,"<param name=\"Play\" value=\"-1\" \/>");
sHTML+=s;
}
else if(sTagName=="TITLE")
{
sHTML+="<title>"+oNode.innerHTML+"</title>";
}
else
{
if(sTagName=="AREA")
{
var sCoords=oNode.coords;
var sShape=oNode.shape;
}
var oNode2=oNode.cloneNode();
if (oNode.checked) oNode2.checked=oNode.checked;
s=oNode2.outerHTML.replace(/<\/[^>]*>/,"");
s = s.replace(/(\r\n)+/,"");
if(sTagName=="STYLE")
{
var arrTmp=s.match(/<[^>]*>/ig);
s=arrTmp[0];
}
s=s.replace(/\"[^\"]*\"/ig,function(x){
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
x=x.replace(/&/g, "&").replace(/&amp;/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
return x});
//info ttg: .replace(/&amp;/g, "&")
//ini karena '&' di (hanya) '&' selalu di-replace lagi dgn &.
//tapi kalau < , > tdk (no problem) => default behaviour
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()});
s=s.replace(/ ([^=]+)=([^" >]+)/ig," $1=\"$2\"");
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
//single attribute
s=s.replace(/[<hr]?(noshade)/ig,"noshade=\"noshade\"");
s=s.replace(/[<input]?(checked)/ig,"checked=\"checked\"");
s=s.replace(/[<select]?(multiple)/ig,"multiple=\"multiple\"");
s=s.replace(/[<option]?(selected)/ig,"selected=\"true\"");
s=s.replace(/[<input]?(readonly)/ig,"readonly=\"readonly\"");
s=s.replace(/[<input]?(disabled)/ig,"disabled=\"disabled\"");
s=s.replace(/[<td]?(nowrap )/ig,"nowrap=\"nowrap\" ");
s=s.replace(/[<td]?(nowrap\>)/ig,"nowrap=\"nowrap\"\>");
s=s.replace(/ contenteditable=\"true\"/ig,"");
if(sTagName=="AREA")
{
s=s.replace(/ coords=\"0,0,0,0\"/ig," coords=\""+sCoords+"\"");
s=s.replace(/ shape=\"RECT\"/ig," shape=\""+sShape+"\"");
}
var bClosingTag=true;
if(sTagName=="IMG"||sTagName=="BR"||
sTagName=="AREA"||sTagName=="HR"||
sTagName=="INPUT"||sTagName=="BASE"||
sTagName=="LINK")//no closing tag
{
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
bClosingTag=false;
}
sHTML+=s;
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+= lineBreak1(sTagName)[1];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[1] !="") sHTML+= sT;//If new line, use base Tabs
/************/
if(bClosingTag)
{
/*** CONTENT ***/
s=oNode.outerHTML;
if(sTagName=="SCRIPT")
{
s = s.replace(/<script([^>]*)>[\n+\s+\t+]*/ig,"<script$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/script>/ig,"<\/script>");//clean spaces
s = s.replace(/<script([^>]*)>\/\/<!\[CDATA\[/ig,"");
s = s.replace(/\/\/\]\]><\/script>/ig,"");
s = s.replace(/<script([^>]*)>/ig,"");
s = s.replace(/<\/script>/ig,"");
s = s.replace(/^\s+/,'').replace(/\s+$/,'');
sHTML+="\n"+
sT + "//<![CDATA[\n"+
sT + s + "\n"+
sT + "//]]>\n"+sT;
}
if(sTagName=="STYLE")
{
s = s.replace(/<style([^>]*)>[\n+\s+\t+]*/ig,"<style$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/style>/ig,"<\/style>");//clean spaces
s = s.replace(/<style([^>]*)><!--/ig,"");
s = s.replace(/--><\/style>/ig,"");
s = s.replace(/<style([^>]*)>/ig,"");
s = s.replace(/<\/style>/ig,"");
s = s.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n"+
sT + "<!--\n"+
sT + s + "\n"+
sT + "-->\n"+sT;
}
if(sTagName=="DIV"||sTagName=="P")
{
if(oNode.innerHTML==""||oNode.innerHTML==" ")
{
sHTML+=" ";
}
else sHTML+=recur(oNode,sT+"\t");
}
else
{
sHTML+=recur(oNode,sT+"\t");
}
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+=lineBreak1(sTagName)[2];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[2] !="")sHTML+=sT;//If new line, use base Tabs
/************/
//sHTML+="</" + sTagName.toLowerCase() + ">";
sHTML+="</" + sCloseTag.toLowerCase() + ">";//spy bisa <a:b>
}
}
}
else if(oNode.nodeType==3)//text
{
sHTML+= fixVal(oNode.nodeValue);
}
else if(oNode.nodeType==8)
{
if(oNode.outerHTML.substring(0,2)=="<"+"%")
{//server side script
sTmp=(oNode.outerHTML.substring(2));
sTmp=sTmp.substring(0,sTmp.length-2);
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
/*** tabs ***/
var sT= sTab;
/************/
sHTML+="\n" +
sT + "<%\n"+
sT + sTmp + "\n" +
sT + "%>\n"+sT;
}
else
{//comments
sTmp=oNode.nodeValue;
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n" +
sT + "<!--\n"+
sT + sTmp + "\n" +
sT + "-->\n"+sT;
}
}
else
{
;//Not Processed
}
}
return sHTML;
}
function toggleViewSource(chk, idIframe) {
if (chk.checked) {
//view souce
viewSource(idIframe);
} else {
//wysiwyg mode
applySource(idIframe);
}
}
function viewSource(idIframe) {
var oEditor=eval(idIframe);
var sHTML=getXHTMLBody(idIframe);
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.innerText = sHTML.replace(/\n+/, "");
}
function applySource(idIframe) {
var oEditor=eval(idIframe);
var s = oEditor.document.documentElement.outerHTML;
var arrTmp = s.split("<BODY")
var beforeBody = arrTmp[0] + "<BODY" + arrTmp[1].substring(0, arrTmp[1].indexOf(">")+1);
var afterBody = s.substr(s.indexOf("</BODY>"));
var body = oEditor.document.body.innerText
//alert(beforeBody + oEditor.document.body.innerText + afterBody);
var oDoc = oEditor.document.open("text/html", "replace");
oDoc.write(beforeBody + body + afterBody);
oDoc.close();
oEditor.document.body.contentEditable=true
oEditor.document.execCommand("2D-Position", true, true);
oEditor.document.execCommand("MultipleSelection", true, true);
oEditor.document.execCommand("LiveResize", true, true);
oEditor.document.body.onmouseup=function() { oUtil.oEditor = oEditor } ;
} | JavaScript |
function getHTMLBody(idIframe)
{
var oEditor=eval(idIframe);
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
return sHTML;
}
/*Insert custom HTML function*/
function insertHTML(wndIframe, sHTML)
{
var oEditor=wndIframe;
var oSel=oEditor.document.selection.createRange();
var arrA = String(sHTML).match(/<A[^>]*>/ig);
if(arrA)
for(var i=0;i<arrA.length;i++)
{
sTmp = arrA[i].replace(/href=/,"href_iwe=");
sHTML=String(sHTML).replace(arrA[i],sTmp);
}
var arrB = String(sHTML).match(/<IMG[^>]*>/ig);
if(arrB)
for(var i=0;i<arrB.length;i++)
{
sTmp = arrB[i].replace(/src=/,"src_iwe=");
sHTML=String(sHTML).replace(arrB[i],sTmp);
}
if(oSel.parentElement)oSel.pasteHTML(sHTML);
else oSel.item(0).outerHTML=sHTML;
for(var i=0;i<oEditor.document.all.length;i++)
{
if(oEditor.document.all[i].getAttribute("href_iwe"))
{
oEditor.document.all[i].href=oEditor.document.all[i].getAttribute("href_iwe");
oEditor.document.all[i].removeAttribute("href_iwe",0);
}
if(oEditor.document.all[i].getAttribute("src_iwe"))
{
oEditor.document.all[i].src=oEditor.document.all[i].getAttribute("src_iwe");
oEditor.document.all[i].removeAttribute("src_iwe",0);
}
}
}
function doCmd(idIframe,sCmd,sOption)
{
var oEditor=eval(idIframe);
var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
var oTarget=(sType=="None"?oEditor.document:oSel);
oTarget.execCommand(sCmd,false,sOption);
}
function toggleViewSource(chk, idIframe) {
if (chk.checked) {
//view souce
viewSource(idIframe);
} else {
//wysiwyg mode
applySource(idIframe);
}
}
function viewSource(idIframe) {
var oEditor=eval(idIframe);
var sHTML=oEditor.document.body.innerHTML;
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.innerText = sHTML;
}
function applySource(idIframe) {
var oEditor=eval(idIframe);
var s = oEditor.document.documentElement.outerHTML;
var arrTmp = s.split("<BODY")
var beforeBody = arrTmp[0] + "<BODY" + arrTmp[1].substring(0, arrTmp[1].indexOf(">")+1);
var afterBody = s.substr(s.indexOf("</BODY>"));
var body = oEditor.document.body.innerText
//alert(beforeBody + oEditor.document.body.innerText + afterBody);
var oDoc = oEditor.document.open("text/html", "replace");
oDoc.write(beforeBody + body + afterBody);
oDoc.close();
oEditor.document.body.contentEditable=true
oEditor.document.execCommand("2D-Position", true, true);
oEditor.document.execCommand("MultipleSelection", true, true);
oEditor.document.execCommand("LiveResize", true, true);
oEditor.document.body.onmouseup=function() { oUtil.oEditor = oEditor } ;
} | JavaScript |
var oUtil = new EditorUtil();
function EditorUtil() {
this.obj = null;
this.oEditor = null;
this.arrEditor = [];
var oScripts=document.getElementsByTagName("script");
for(var i=0;i<oScripts.length;i++)
{
var sSrc=oScripts[i].src.toLowerCase();
if(sSrc.indexOf("scripts/quick/ie/xhtmleditor.js")!=-1) this.scriptPath = oScripts[i].src.replace(/quick\/ie\/xhtmleditor.js/ig,"");
}
}
function InnovaEditor(oName) {
this.oName = oName;
this.height = "400px";
this.width = "100%";
this.heightAdjustment=-20;
this.rangeBookmark = null;
this.controlBookmark=null;
this.RENDER = RENDER;
this.doCmd = edt_doCmd;
this.getHTMLBody = edt_getHTMLBody;
this.getXHTMLBody = edt_getXHTMLBody;
this.insertHTML = edt_insertHTML;
this.cleanDeprecated = edt_cleanDeprecated;
this.cleanEmptySpan = edt_cleanEmptySpan;
this.cleanFonts = edt_cleanFonts;
this.cleanTags = edt_cleanTags;
this.replaceTags = edt_replaceTags;
this.toggleViewSource = edt_toggleViewSource;
this.viewSource = edt_viewSource;
this.applySource = edt_applySource;
this.encodeIO = false;
this.init = function(){return true;};
this.bookmarkSelection = function() {
var oEditor=eval("idContent"+this.oName);
var oSel=oEditor.document.selection;
var oRange=oSel.createRange();
if (oSel.type == "None" || oSel.type == "Text") {
this.rangeBookmark = oRange;
this.controlBookmark=null;
} else {
this.controlBookmark = oRange.item(0);
this.rangeBookmark=null;
}
};
this.setFocus=function() {
var oEditor=eval("idContent"+this.oName);
oEditor.focus();
try {
if(this.rangeBookmark!=null) {
var oSel=oEditor.document.selection;
var oRange = oSel.createRange()
var bmRange = this.rangeBookmark;
if(bmRange.parentElement()) {
oRange.moveToElementText(bmRange.parentElement());
oRange.setEndPoint("StarttoStart", bmRange);
oRange.setEndPoint("EndToEnd", bmRange);
oRange.select();
}
} else
if(this.controlBookmark!=null) {
var oSel = oEditor.document.body.createControlRange();
oSel.add(this.controlBookmark); oSel.select()
}
} catch(e) {}
};
this.adjustHeight = function() {
if(document.compatMode && document.compatMode!="BackCompat") {
if(String(this.height).indexOf("%") == -1) {
var eh = parseInt(this.height, 10);
eh += parseInt(this.heightAdjustment, 10);
this.height = eh + "px";
var edtArea = document.getElementById("idArea" + oName);
edtArea.style.height=this.height;
}
}
}
}
function RENDER() {
}
function edt_doCmd(sCmd,sOption)
{
var oEditor=eval("idContent"+this.oName);
var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
var oTarget=(sType=="None"?oEditor.document:oSel);
oTarget.execCommand(sCmd,false,sOption);
}
function edt_getHTMLBody()
{
var oEditor=eval("idContent"+this.oName);
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
if(this.encodeIO)sHTML = encodeHTMLCode(sHTML);
return sHTML;
}
function edt_getXHTMLBody()
{
var sHTML = "";
if (document.getElementById("chkViewSource"+this.oName).checked)
{
var oEditor=eval("idContent"+this.oName);
sHTML = oEditor.document.body.innerText
} else {
var oEditor=eval("idContent"+this.oName);
this.cleanDeprecated();
sHTML = recur(oEditor.document.body,"");
}
if(this.encodeIO)sHTML = encodeHTMLCode(sHTML);
return sHTML;
}
/*Insert custom HTML function*/
function edt_insertHTML(sHTML)
{
var oEditor=eval("idContent"+this.oName);
var oSel=oEditor.document.selection.createRange();
var arrA = String(sHTML).match(/<A[^>]*>/ig);
if(arrA)
for(var i=0;i<arrA.length;i++)
{
sTmp = arrA[i].replace(/href=/,"href_iwe=");
sHTML=String(sHTML).replace(arrA[i],sTmp);
}
var arrB = String(sHTML).match(/<IMG[^>]*>/ig);
if(arrB)
for(var i=0;i<arrB.length;i++)
{
sTmp = arrB[i].replace(/src=/,"src_iwe=");
sHTML=String(sHTML).replace(arrB[i],sTmp);
}
if(oSel.parentElement)oSel.pasteHTML(sHTML);
else oSel.item(0).outerHTML=sHTML;
for(var i=0;i<oEditor.document.all.length;i++)
{
if(oEditor.document.all[i].getAttribute("href_iwe"))
{
oEditor.document.all[i].href=oEditor.document.all[i].getAttribute("href_iwe");
oEditor.document.all[i].removeAttribute("href_iwe",0);
}
if(oEditor.document.all[i].getAttribute("src_iwe"))
{
oEditor.document.all[i].src=oEditor.document.all[i].getAttribute("src_iwe");
oEditor.document.all[i].removeAttribute("src_iwe",0);
}
}
}
/************************************
CLEAN DEPRECATED TAGS; Used in loadHTML, getHTMLBody, getXHTMLBody
*************************************/
function edt_cleanDeprecated()
{
var oEditor=eval("idContent"+this.oName);
var elements;
elements=oEditor.document.body.getElementsByTagName("STRIKE");
this.cleanTags(elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("S");
this.cleanTags(elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("U");
this.cleanTags(elements,"underline");
this.replaceTags("DIR","DIV");
this.replaceTags("MENU","DIV");
this.replaceTags("CENTER","DIV");
this.replaceTags("XMP","PRE");
this.replaceTags("BASEFONT","SPAN");//will be removed by cleanEmptySpan()
elements=oEditor.document.body.getElementsByTagName("APPLET");
var count=elements.length;
while(count>0)
{
f=elements[0];
f.removeNode(false);
count--;
}
this.cleanFonts();
this.cleanEmptySpan();
return true;
}
function edt_cleanEmptySpan()//WARNING: blm bisa remove span yg bertumpuk dgn style sama,dst.
{
var bReturn=false;
var oEditor=eval("idContent"+this.oName);
var allSpans=oEditor.document.getElementsByTagName("SPAN");
if(allSpans.length==0)return false;
var emptySpans=[];
var reg = /<\s*SPAN\s*>/gi;
for(var i=0;i<allSpans.length;i++)
{
if(allSpans[i].outerHTML.search(reg)==0)
emptySpans[emptySpans.length]=allSpans[i];
}
var theSpan,theParent;
for(var i=0;i<emptySpans.length;i++)
{
theSpan=emptySpans[i];
theSpan.removeNode(false);
bReturn=true;
}
return bReturn;
}
function edt_cleanFonts()
{
var oEditor=eval("idContent"+this.oName);
var allFonts=oEditor.document.body.getElementsByTagName("FONT");
if(allFonts.length==0)return false;
var f;
while(allFonts.length>0)
{
f=allFonts[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{
//if font containts only span child node
copyAttribute(f.childNodes[0],f);
f.removeNode(false);
}
else
if(f.parentElement.nodeName=="SPAN" && f.parentElement.childNodes.length==1)
{
//font is the only child node of span.
copyAttribute(f.parentElement,f);
f.removeNode(false);
}
else
{
var newSpan=oEditor.document.createElement("SPAN");
copyAttribute(newSpan,f);
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
}
}
return true;
}
function edt_cleanTags(elements,sVal)//WARNING: Dgn asumsi underline & linethrough tidak bertumpuk
{
var oEditor=eval("idContent"+this.oName);
var f;
while(elements.length>0)
{
f=elements[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{//if font containts only span child node
if(sVal=="bold")f.childNodes[0].style.fontWeight="bold";
if(sVal=="italic")f.childNodes[0].style.fontStyle="italic";
if(sVal=="line-through")f.childNodes[0].style.textDecoration="line-through";
if(sVal=="underline")f.childNodes[0].style.textDecoration="underline";
f.removeNode(false);
}
else
if(f.parentElement.nodeName=="SPAN" && f.parentElement.childNodes.length==1)
{//font is the only child node of span.
if(sVal=="bold")f.parentElement.style.fontWeight="bold";
if(sVal=="italic")f.parentElement.style.fontStyle="italic";
if(sVal=="line-through")f.parentElement.style.textDecoration="line-through";
if(sVal=="underline")f.parentElement.style.textDecoration="underline";
f.removeNode(false);
}
else
{
var newSpan=oEditor.document.createElement("SPAN");
if(sVal=="bold")newSpan.style.fontWeight="bold";
if(sVal=="italic")newSpan.style.fontStyle="italic";
if(sVal=="line-through")newSpan.style.textDecoration="line-through";
if(sVal=="underline")newSpan.style.textDecoration="underline";
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
}
}
}
function edt_replaceTags(sFrom,sTo)
{
var oEditor=eval("idContent"+this.oName);
var elements=oEditor.document.getElementsByTagName(sFrom);
var newSpan;
var count=elements.length;
while(count > 0)
{
f=elements[0];
newSpan=oEditor.document.createElement(sTo);
newSpan.innerHTML=f.innerHTML;
f.replaceNode(newSpan);
count--;
}
}
function copyAttribute(newSpan,f)
{
if((f.face!=null)&&(f.face!=""))newSpan.style.fontFamily=f.face;
if((f.size!=null)&&(f.size!=""))
{
var nSize="";
if(f.size==1)nSize="8pt";
else if(f.size==2)nSize="10pt";
else if(f.size==3)nSize="12pt";
else if(f.size==4)nSize="14pt";
else if(f.size==5)nSize="18pt";
else if(f.size==6)nSize="24pt";
else if(f.size>=7)nSize="36pt";
else if(f.size<=-2||f.size=="0")nSize="8pt";
else if(f.size=="-1")nSize="10pt";
else if(f.size==0)nSize="12pt";
else if(f.size=="+1")nSize="14pt";
else if(f.size=="+2")nSize="18pt";
else if(f.size=="+3")nSize="24pt";
else if(f.size=="+4"||f.size=="+5"||f.size=="+6")nSize="36pt";
else nSize="";
if(nSize!="")newSpan.style.fontSize=nSize;
}
if((f.style.backgroundColor!=null)&&(f.style.backgroundColor!=""))newSpan.style.backgroundColor=f.style.backgroundColor;
if((f.color!=null)&&(f.color!=""))newSpan.style.color=f.color;
}
function GetElement(oElement,sMatchTag)
{
while (oElement!=null&&oElement.tagName!=sMatchTag)
{
if(oElement.tagName=="BODY")return null;
oElement=oElement.parentElement;
}
return oElement;
}
/************************************
HTML to XHTML
*************************************/
function lineBreak1(tag) //[0]<TAG>[1]text[2]</TAG>
{
arrReturn = ["\n","",""];
if( tag=="A"||tag=="B"||tag=="CITE"||tag=="CODE"||tag=="EM"||
tag=="FONT"||tag=="I"||tag=="SMALL"||tag=="STRIKE"||tag=="BIG"||
tag=="STRONG"||tag=="SUB"||tag=="SUP"||tag=="U"||tag=="SAMP"||
tag=="S"||tag=="VAR"||tag=="BASEFONT"||tag=="KBD"||tag=="TT")
arrReturn=["","",""];
if( tag=="TEXTAREA"||tag=="TABLE"||tag=="THEAD"||tag=="TBODY"||
tag=="TR"||tag=="OL"||tag=="UL"||tag=="DIR"||tag=="MENU"||
tag=="FORM"||tag=="SELECT"||tag=="MAP"||tag=="DL"||tag=="HEAD"||
tag=="BODY"||tag=="HTML")
arrReturn=["\n","","\n"];
if( tag=="STYLE"||tag=="SCRIPT")
arrReturn=["\n","",""];
if(tag=="BR"||tag=="HR")
arrReturn=["","\n",""];
return arrReturn;
}
function fixAttr(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
s = String(s).replace(/"/g, """);
return s;
}
function fixVal(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
var x = escape(s);
x = unescape(x.replace(/\%A0/gi, "-*REPL*-"));
s = x.replace(/-\*REPL\*-/gi, " ");
return s;
}
function recur(oEl,sTab)
{
var sHTML="";
for(var i=0;i<oEl.childNodes.length;i++)
{
var oNode=oEl.childNodes(i);
if(oNode.nodeType==1)//tag
{
var sTagName = oNode.nodeName;
var sCloseTag = oNode.outerHTML;
if (sCloseTag.indexOf("<?xml:namespace") > -1) sCloseTag=sCloseTag.substr(sCloseTag.indexOf(">")+1);
sCloseTag = sCloseTag.substring(1, sCloseTag.indexOf(">"));
if (sCloseTag.indexOf(" ")>-1) sCloseTag=sCloseTag.substring(0, sCloseTag.indexOf(" "));
var bDoNotProcess=false;
if(sTagName.substring(0,1)=="/")
{
bDoNotProcess=true;//do not process
}
else
{
/*** tabs ***/
var sT= sTab;
sHTML+= lineBreak1(sTagName)[0];
if(lineBreak1(sTagName)[0] !="") sHTML+= sT;//If new line, use base Tabs
/************/
}
if(bDoNotProcess)
{
;//do not process
}
else if(sTagName=="OBJECT" || sTagName=="EMBED")
{
s=oNode.outerHTML;
s=s.replace(/\"[^\"]*\"/ig,function(x){
x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
return x});
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()});
s=s.replace(/ ([^=]+)=([^"' >]+)/ig," $1=\"$2\"");//new
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
s=s.replace(/<param([^>]*)>/ig,"\n<param$1 />").replace(/\/ \/>$/ig," \/>");//no closing tag
if(sTagName=="EMBED")
if(oNode.innerHTML=="")
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
s=s.replace(/<param name=\"Play\" value=\"0\" \/>/,"<param name=\"Play\" value=\"-1\" \/>");
sHTML+=s;
}
else if(sTagName=="TITLE")
{
sHTML+="<title>"+oNode.innerHTML+"</title>";
}
else
{
if(sTagName=="AREA")
{
var sCoords=oNode.coords;
var sShape=oNode.shape;
}
var oNode2=oNode.cloneNode();
if (oNode.checked) oNode2.checked=oNode.checked;
s=oNode2.outerHTML.replace(/<\/[^>]*>/,"");
s = s.replace(/(\r\n)+/,"");
if(sTagName=="STYLE")
{
var arrTmp=s.match(/<[^>]*>/ig);
s=arrTmp[0];
}
s=s.replace(/\"[^\"]*\"/ig,function(x){
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
x=x.replace(/&/g, "&").replace(/&amp;/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
return x});
//info ttg: .replace(/&amp;/g, "&")
//ini karena '&' di (hanya) '&' selalu di-replace lagi dgn &.
//tapi kalau < , > tdk (no problem) => default behaviour
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()});
s=s.replace(/ ([^=]+)=([^" >]+)/ig," $1=\"$2\"");
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
//single attribute
s=s.replace(/[<hr]?(noshade)/ig,"noshade=\"noshade\"");
s=s.replace(/[<input]?(checked)/ig,"checked=\"checked\"");
s=s.replace(/[<select]?(multiple)/ig,"multiple=\"multiple\"");
s=s.replace(/[<option]?(selected)/ig,"selected=\"true\"");
s=s.replace(/[<input]?(readonly)/ig,"readonly=\"readonly\"");
s=s.replace(/[<input]?(disabled)/ig,"disabled=\"disabled\"");
s=s.replace(/[<td]?(nowrap )/ig,"nowrap=\"nowrap\" ");
s=s.replace(/[<td]?(nowrap\>)/ig,"nowrap=\"nowrap\"\>");
s=s.replace(/ contenteditable=\"true\"/ig,"");
if(sTagName=="AREA")
{
s=s.replace(/ coords=\"0,0,0,0\"/ig," coords=\""+sCoords+"\"");
s=s.replace(/ shape=\"RECT\"/ig," shape=\""+sShape+"\"");
}
var bClosingTag=true;
if(sTagName=="IMG"||sTagName=="BR"||
sTagName=="AREA"||sTagName=="HR"||
sTagName=="INPUT"||sTagName=="BASE"||
sTagName=="LINK")//no closing tag
{
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
bClosingTag=false;
}
sHTML+=s;
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+= lineBreak1(sTagName)[1];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[1] !="") sHTML+= sT;//If new line, use base Tabs
/************/
if(bClosingTag)
{
/*** CONTENT ***/
s=oNode.outerHTML;
if(sTagName=="SCRIPT")
{
s = s.replace(/<script([^>]*)>[\n+\s+\t+]*/ig,"<script$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/script>/ig,"<\/script>");//clean spaces
s = s.replace(/<script([^>]*)>\/\/<!\[CDATA\[/ig,"");
s = s.replace(/\/\/\]\]><\/script>/ig,"");
s = s.replace(/<script([^>]*)>/ig,"");
s = s.replace(/<\/script>/ig,"");
s = s.replace(/^\s+/,'').replace(/\s+$/,'');
sHTML+="\n"+
sT + "//<![CDATA[\n"+
sT + s + "\n"+
sT + "//]]>\n"+sT;
}
if(sTagName=="STYLE")
{
s = s.replace(/<style([^>]*)>[\n+\s+\t+]*/ig,"<style$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/style>/ig,"<\/style>");//clean spaces
s = s.replace(/<style([^>]*)><!--/ig,"");
s = s.replace(/--><\/style>/ig,"");
s = s.replace(/<style([^>]*)>/ig,"");
s = s.replace(/<\/style>/ig,"");
s = s.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n"+
sT + "<!--\n"+
sT + s + "\n"+
sT + "-->\n"+sT;
}
if(sTagName=="DIV"||sTagName=="P")
{
if(oNode.innerHTML==""||oNode.innerHTML==" ")
{
sHTML+=" ";
}
else sHTML+=recur(oNode,sT+"\t");
}
else
{
sHTML+=recur(oNode,sT+"\t");
}
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+=lineBreak1(sTagName)[2];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[2] !="")sHTML+=sT;//If new line, use base Tabs
/************/
if (sCloseTag.indexOf(":") >=0)
{
sHTML+="</" + sCloseTag.toLowerCase() + ">";//spy bisa <a:b>
}
else
{
sHTML+="</" + sTagName.toLowerCase() + ">";
}
}
}
}
else if(oNode.nodeType==3)//text
{
sHTML+= fixVal(oNode.nodeValue);
}
else if(oNode.nodeType==8)
{
if(oNode.outerHTML.substring(0,2)=="<"+"%")
{//server side script
sTmp=(oNode.outerHTML.substring(2));
sTmp=sTmp.substring(0,sTmp.length-2);
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
/*** tabs ***/
var sT= sTab;
/************/
sHTML+="\n" +
sT + "<%\n"+
sT + sTmp + "\n" +
sT + "%>\n"+sT;
}
else
{//comments
sTmp=oNode.nodeValue;
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n" +
sT + "<!--\n"+
sT + sTmp + "\n" +
sT + "-->\n"+sT;
}
}
else
{
;//Not Processed
}
}
return sHTML;
}
function edt_toggleViewSource(chk) {
if (chk.checked) {
//view souce
this.viewSource();
} else {
//wysiwyg mode
this.applySource();
}
}
function edt_viewSource() {
var oEditor=eval("idContent" + this.oName);
this.cleanDeprecated();
var sHTML=recur(oEditor.document.body,"");
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.innerText = sHTML.replace(/\n+/, "");
}
function edt_applySource() {
var oEditor=eval("idContent" + this.oName);
var s = oEditor.document.documentElement.outerHTML;
var arrTmp = s.split("<BODY")
var beforeBody = arrTmp[0] + "<BODY" + arrTmp[1].substring(0, arrTmp[1].indexOf(">")+1);
var afterBody = s.substr(s.indexOf("</BODY>"));
var body = oEditor.document.body.innerText
//alert(beforeBody + oEditor.document.body.innerText + afterBody);
var oDoc = oEditor.document.open("text/html", "replace");
oDoc.write(beforeBody + body + afterBody);
oDoc.close();
oEditor.document.body.contentEditable=true
oEditor.document.execCommand("2D-Position", true, true);
oEditor.document.execCommand("MultipleSelection", true, true);
oEditor.document.execCommand("LiveResize", true, true);
oEditor.document.body.onmouseup=function() { oUtil.oEditor = oEditor } ;
}
function encodeHTMLCode(sHTML) {
return sHTML.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
}
function ISWindow(id) {
var ua = navigator.userAgent.toUpperCase();
var isIE =(ua.indexOf('MSIE') >= 0) ? true : false,
isIE7=(ua.indexOf("MSIE 7.0") >=0),
isIE8=(ua.indexOf("MSIE 8.0") >=0),
isIE6=(!isIE7 && !isIE8 && isIE),
IEBackCompat = (isIE && document.compatMode=="BackCompat");
var me=this;
this.id=id;
this.opts=null;
this.rt={};
this.iconPath="icons/";
ISWindow.objs[id] = this;
this.show=function(opt) {
if(!document.getElementById(this.id)) {
//render
var e = document.createElement("div");
e.id = "cnt$"+this.id;
e.innerHTML = this.render(opt.url);
document.body.insertBefore(e, document.body.childNodes[0]);
}
if(!this.rt.win) {
this.rt.win = document.getElementById(this.id);
this.rt.frm = document.getElementById("frm$"+this.id);
this.rt.ttl = document.getElementById("ttl$"+this.id);
}
if(opt.overlay==true) this.showOverlay();
this.setSize(opt.width, opt.height, opt.center);
ISWindow.zIndex+=2;
this.rt.win.style.zIndex = ISWindow.zIndex;
this.rt.win.style.display="block";
var fn =
function() {
me.rt.ttl.innerHTML = me.rt.frm.contentWindow.document.title;
me.rt.frm.contentWindow.openerWin = opt.openerWin ? opt.openerWin : window;
me.rt.frm.contentWindow.opener = opt.openerWin ? opt.openerWin : window;
me.rt.frm.contentWindow.options = opt.options?opt.options:{};
me.rt.frm.contentWindow.close=function() {
me.close();
};
if (typeof(me.rt.frm.contentWindow.bodyOnLoad) != "undefined") me.rt.frm.contentWindow.bodyOnLoad();
} ;
if(this.rt.frm.attachEvent) this.rt.frm.attachEvent("onload", fn);
if(this.rt.frm.addEventListener) this.rt.frm.addEventListener("load", fn, true);
setTimeout(function() {me.rt.frm.src = opt.url;}, 0);
};
this.close = function() {
var d = document.getElementById("cnt$"+this.id);
if(d) {
if(this.rt.frm.contentWindow.bodyOnUnload) this.rt.frm.contentWindow.bodyOnUnload();
d.parentNode.removeChild(d);
}
this.hideOverlay();
};
this.hide=function() {
if(!this.rt.win) {
this.rt.win = document.getElementById(this.id);
}
this.rt.win.style.display="none";
};
this.showOverlay=function() {
var ov;
if(!document.getElementById("ovr$"+this.id)) {
ov = document.createElement("div");
ov.id = "ovr$"+this.id;
ov.style.display="none";
ov.style.position=(isIE6 || IEBackCompat ? "absolute" : "fixed");
ov.style.backgroundColor="#ffffff";
ov.style.filter = "alpha(opacity=35)";
ov.style.mozOpacity = "0.4";
ov.style.opacity = "0.4";
ov.style.Opacity = "0.4";
document.body.insertBefore(ov, document.body.childNodes[0]);
}
var cl = ISWindow.clientSize();
if(isIE6 || IEBackCompat) {
var db=document.body, de=document.documentElement, w, h;
w=Math.min(
Math.max(db.scrollWidth, de.scrollWidth),
Math.max(db.offsetWidth, de.offsetWidth)
);
var mf=((de.scrollHeight<de.offsetHeight) || (db.scrollHeight<db.offsetHeight))?Math.min:Math.max;
h=mf(
Math.max(db.scrollHeight, de.scrollHeight),
Math.max(db.offsetHeight, de.offsetHeight)
);
cl.w = Math.max(cl.w, w);
cl.h = Math.max(cl.h, h);
ov.style.position="absolute";
}
ov.style.width = cl.w+"px";
ov.style.height = cl.h+"px";
ov.style.top="0px";
ov.style.left="0px";
ov.style.zIndex = ISWindow.zIndex+1;
ov.style.display="block";
};
this.hideOverlay=function() {
var ov=document.getElementById("ovr$"+this.id);
if(ov) ov.style.display="none";
};
this.setSize=function(w, h, center) {
this.rt.win.style.width=w;
this.rt.win.style.height=h;
this.rt.frm.style.height=parseInt(h, 10)-30 + "px";
if(center) {
this.center();
}
};
this.center=function() {
var c=ISWindow.clientSize();
var px=parseInt(this.rt.win.style.width, 10), py=parseInt(this.rt.win.style.height, 10);
px=(isNaN(px)?0:(px>c.w?c.w:px));
py=(isNaN(py)?0:(py>c.h?c.h:py));
var p = {x:(c.w-px)/2, y:(c.h-py)/2};
if(isIE6 || IEBackCompat) {
p.x=p.x+(document.body.scrollLeft||document.documentElement.scrollLeft);
p.y=p.y+(document.body.scrollTop||document.documentElement.scrollTop);
}
this.setPosition(p.x, p.y);
};
this.setPosition=function(x, y) {
this.rt.win.style.top=y+"px";
this.rt.win.style.left=x+"px";
};
this.render=function(attr) {
var s=[],j=0,ps=isIE6 || IEBackCompat ?"absolute":"fixed";
s[j++] = "<div style='position:"+ps+";display:none;z-index:100000;background-color:#ffffff;filter:alpha(opacity=25);opacity:0.25;-moz-opacity:0.25;border:#999999 1px solid' id=\"dd$"+this.id+"\"></div>";
s[j++] = "<div unselectable='on' id=\""+this.id+"\" style='position:"+ps+";z-index:100000;border:#d7d7d7 1px solid;'>";
s[j++] = " <div unselectable=\"on\" style=\"cursor:move;height:30px;background-image:url("+this.iconPath+"dialogbg.gif);\" onmousedown=\"ISWindow._ddMouseDown(event, '"+this.id+"');\"><span style=\"font-weight:bold;float:left;margin-top:7px;margin-left:11px;\" id=\"ttl$"+this.id+"\"></span><img src=\""+this.iconPath+"btnClose.gif\" onmousedown=\"event.cancelBubble=true;if(event.preventDefault) event.preventDefault();\" onclick=\"ISWindow.objs['" + this.id + "'].close();\" style='float:right;margin-top:5px;margin-right:5px;cursor:pointer' /></div>";
s[j++] = " <iframe id=\"frm$"+this.id+"\" style=\"width:100%;\" frameborder='no'></iframe>";
s[j++] = "</div>";
return s.join("");
};
ISWindow.clientSize=function() {
return {w:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,
h:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight};
};
ISWindow._ddMouseDown=function(ev, elId) {
var d=document;
d.onmousemove=function(e) {ISWindow._startDrag(e?e:ev);}
d.onmouseup=function(e) {ISWindow._endDrag(e?e:ev);}
d.onselectstart=function() { return false;}
d.onmousedown=function() { return false;}
d.ondragstart=function() { return false;}
ISWindow.trgElm = document.getElementById(elId);
ISWindow.gstElm = document.getElementById("dd$"+elId);
ISWindow.gstElm.style.top=ISWindow.trgElm.style.top;
ISWindow.gstElm.style.left=ISWindow.trgElm.style.left;
ISWindow.gstElm.style.width=ISWindow.trgElm.style.width;
ISWindow.gstElm.style.height=ISWindow.trgElm.style.height;
ISWindow.gstElm.style.display="block";
ISWindow.posDif = {x:ev.clientX-parseInt(ISWindow.trgElm.style.left, 10),
y:ev.clientY-parseInt(ISWindow.trgElm.style.top, 10)};
};
ISWindow._startDrag = function(ev) {
ISWindow.gstElm.style.left=(ev.clientX-ISWindow.posDif.x)+"px";
ISWindow.gstElm.style.top=(ev.clientY-ISWindow.posDif.y)+"px";
};
ISWindow._endDrag = function(ev) {
ISWindow.gstElm.style.display="none";
ISWindow.trgElm.style.top=ISWindow.gstElm.style.top;
ISWindow.trgElm.style.left=ISWindow.gstElm.style.left;
document.onmousemove=null;
document.onmouseup=null;
document.onmousedown=function() { return true;};
document.onselectstart=function() { return true;};
document.onselectstart=function() { return true;};
};
};
ISWindow.objs={};
ISWindow.zIndex=2000; | JavaScript |
var onloadOverrided = false;
function onload_new()
{
onload_original();
setMozEdit();
}
function onload_original()
{
}
function setMozEdit(idIframe)
{
if ((idIframe != null) && (idIframe!="")) {
try {document.getElementById(idIframe).contentDocument.designMode="on";} catch(e) {}
} else {
for (var i=0; i<oUtil.arrIframe.length; i++)
{
try {document.getElementById(oUtil.arrIframe[i]).contentDocument.designMode="on";} catch(e) {alert(e)}
}
}
}
function doCmd(idIframe,sCmd,sOption)
{
var oEditor=document.getElementById(idIframe).contentWindow;
oEditor.document.execCommand(sCmd,false,sOption);
}
function getHTMLBody(idIframe)
{
var oEditor=document.getElementById(idIframe).contentWindow;
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/ contentEditable=true/g,"");
sHTML = String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
return sHTML;
}
function getXHTMLBody(idIframe)
{
var oEditor=document.getElementById(idIframe).contentWindow;
this.cleanDeprecated(idIframe);
return recur(oEditor.document.body,"");
}
/*Insert custon HTML function*/
function insertHTML(idIframe, sHTML)
{
var oEditor=document.getElementById(idIframe).contentWindow;
var oSel=oEditor.getSelection();
var range = oSel.getRangeAt(0);
var docFrag = range.createContextualFragment(sHTML);
range.collapse(true);
var lastNode = docFrag.childNodes[docFrag.childNodes.length-1];
range.insertNode(docFrag);
try { oEditor.document.designMode="on"; } catch (e) {}
if (lastNode.nodeType==Node.TEXT_NODE)
{
range = oEditor.document.createRange();
range.setStart(lastNode, lastNode.nodeValue.length);
range.setEnd(lastNode, lastNode.nodeValue.length);
oSel = oEditor.getSelection();
oSel.removeAllRanges();
oSel.addRange(range);
}
}
/************************************
CLEAN DEPRECATED TAGS; Used in loadHTML, getHTMLBody, getXHTMLBody
*************************************/
function cleanDeprecated(idIframe)
{
var oEditor=document.getElementById(idIframe).contentWindow;
var elements;
//elements=oEditor.document.body.getElementsByTagName("STRONG");
//this.cleanTags(idIframe,elements,"bold");
//elements=oEditor.document.body.getElementsByTagName("B");
//this.cleanTags(idIframe,elements,"bold");
//elements=oEditor.document.body.getElementsByTagName("I");
//this.cleanTags(idIframe,elements,"italic");
//elements=oEditor.document.body.getElementsByTagName("EM");
//this.cleanTags(idIframe,elements,"italic");
elements=oEditor.document.body.getElementsByTagName("STRIKE");
this.cleanTags(idIframe,elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("S");
this.cleanTags(idIframe,elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("U");
this.cleanTags(idIframe,elements,"underline");
this.replaceTags(idIframe,"DIR","DIV");
this.replaceTags(idIframe,"MENU","DIV");
this.replaceTags(idIframe,"CENTER","DIV");
this.replaceTags(idIframe,"XMP","PRE");
this.replaceTags(idIframe,"BASEFONT","SPAN");//will be removed by cleanEmptySpan()
elements=oEditor.document.body.getElementsByTagName("APPLET");
while(elements.length>0)
{
var f = elements[0];
theParent = f.parentNode;
theParent.removeChild(f);
}
this.cleanFonts(idIframe);
this.cleanEmptySpan(idIframe);
return true;
}
function cleanEmptySpan(idIframe)
{
var bReturn=false;
var oEditor=document.getElementById(idIframe).contentWindow;
var reg = /<\s*SPAN\s*>/gi;
while (true)
{
var allSpans = oEditor.document.getElementsByTagName("SPAN");
if(allSpans.length==0) break;
var emptySpans = [];
for (var i=0; i<allSpans.length; i++)
{
if (getOuterHTML(allSpans[i]).search(reg) == 0)
emptySpans[emptySpans.length]=allSpans[i];
}
if (emptySpans.length == 0) break;
var theSpan, theParent;
for (var i=0; i<emptySpans.length; i++)
{
theSpan = emptySpans[i];
theParent = theSpan.parentNode;
if (!theParent) continue;
if (theSpan.hasChildNodes())
{
var range = oEditor.document.createRange();
range.selectNodeContents(theSpan);
var docFrag = range.extractContents();
theParent.replaceChild(docFrag, theSpan);
}
else
{
theParent.removeChild(theSpan);
}
bReturn=true;
}
}
return bReturn;
}
function cleanFonts(idIframe)
{
var oEditor=document.getElementById(idIframe).contentWindow;
var allFonts = oEditor.document.body.getElementsByTagName("FONT");
if(allFonts.length==0)return false;
var f; var range;
while (allFonts.length>0)
{
f = allFonts[0];
if (f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{
//if font containts only span child node
var theSpan = f.childNodes[0];
copyAttribute(theSpan, f);
range = oEditor.document.createRange();
range.selectNode(f);
range.insertNode(theSpan);
range.selectNode(f);
range.deleteContents();
}
else
if (f.parentNode.nodeName=="SPAN" && f.parentNode.childNodes.length==1)
{
//font is the only child node of span.
var theSpan = f.parentNode;
copyAttribute(theSpan, f);
theSpan.innerHTML = f.innerHTML;
}
else
{
var newSpan = oEditor.document.createElement("SPAN");
copyAttribute(newSpan, f);
newSpan.innerHTML = f.innerHTML;
f.parentNode.replaceChild(newSpan, f);
}
}
return true;
}
function cleanTags(idIframe,elements,sVal)
{
var oEditor=document.getElementById(idIframe).contentWindow;
if(elements.length==0)return false;
var f;var range;
while(elements.length>0)
{
f = elements[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{//if font containts only span child node
var theSpan=f.childNodes[0];
if(sVal=="bold")theSpan.style.fontWeight="bold";
if(sVal=="italic")theSpan.style.fontStyle="italic";
if(sVal=="line-through")theSpan.style.textDecoration="line-through";
if(sVal=="underline")theSpan.style.textDecoration="underline";
range=oEditor.document.createRange();
range.selectNode(f);
range.insertNode(theSpan);
range.selectNode(f);
range.deleteContents();
}
else
if (f.parentNode.nodeName=="SPAN" && f.parentNode.childNodes.length==1)
{
//font is the only child node of span.
var theSpan=f.parentNode;
if(sVal=="bold")theSpan.style.fontWeight="bold";
if(sVal=="italic")theSpan.style.fontStyle="italic";
if(sVal=="line-through")theSpan.style.textDecoration="line-through";
if(sVal=="underline")theSpan.style.textDecoration="underline";
theSpan.innerHTML=f.innerHTML;
}
else
{
var newSpan = oEditor.document.createElement("SPAN");
if(sVal=="bold")newSpan.style.fontWeight="bold";
if(sVal=="italic")newSpan.style.fontStyle="italic";
if(sVal=="line-through")newSpan.style.textDecoration="line-through";
if(sVal=="underline")newSpan.style.textDecoration="underline";
newSpan.innerHTML=f.innerHTML;
f.parentNode.replaceChild(newSpan,f);
}
}
return true;
}
function replaceTags(idIframe,sFrom,sTo)
{
var oEditor=document.getElementById(idIframe).contentWindow;
var elements=oEditor.document.body.getElementsByTagName(sFrom);
while(elements.length>0)
{
f = elements[0];
var newSpan = oEditor.document.createElement(sTo);
newSpan.innerHTML=f.innerHTML;
f.parentNode.replaceChild(newSpan,f);
}
}
function copyAttribute(newSpan,f)
{
if ((f.face != null) && (f.face != ""))newSpan.style.fontFamily=f.face;
if ((f.size != null) && (f.size != ""))
{
var nSize="";
if(f.size==1)nSize="8pt";
else if(f.size==2)nSize="10pt";
else if(f.size==3)nSize="12pt";
else if(f.size==4)nSize="14pt";
else if(f.size==5)nSize="18pt";
else if(f.size==6)nSize="24pt";
else if(f.size>=7)nSize="36pt";
else if(f.size<=-2||f.size=="0")nSize="8pt";
else if(f.size=="-1")nSize="10pt";
else if(f.size==0)nSize="12pt";
else if(f.size=="+1")nSize="14pt";
else if(f.size=="+2")nSize="18pt";
else if(f.size=="+3")nSize="24pt";
else if(f.size=="+4"||f.size=="+5"||f.size=="+6")nSize="36pt";
else nSize="";
if(nSize!="")newSpan.style.fontSize=nSize;
}
if ((f.style.backgroundColor != null)&&(f.style.backgroundColor != ""))newSpan.style.backgroundColor=f.style.backgroundColor;
if ((f.color != null)&&(f.color != ""))newSpan.style.color=f.color;
}
function GetElement(oElement,sMatchTag)//Used in realTime() only.
{
while (oElement!=null&&oElement.tagName!=sMatchTag)
{
if(oElement.tagName=="BODY")return null;
oElement=oElement.parentNode;
}
return oElement;
}
/************************************
HTML to XHTML
*************************************/
function lineBreak1(tag) //[0]<TAG>[1]text[2]</TAG>
{
arrReturn = ["\n","",""];
if( tag=="A"||tag=="B"||tag=="CITE"||tag=="CODE"||tag=="EM"||
tag=="FONT"||tag=="I"||tag=="SMALL"||tag=="STRIKE"||tag=="BIG"||
tag=="STRONG"||tag=="SUB"||tag=="SUP"||tag=="U"||tag=="SAMP"||
tag=="S"||tag=="VAR"||tag=="BASEFONT"||tag=="KBD"||tag=="TT")
arrReturn=["","",""];
if( tag=="TEXTAREA"||tag=="TABLE"||tag=="THEAD"||tag=="TBODY"||
tag=="TR"||tag=="OL"||tag=="UL"||tag=="DIR"||tag=="MENU"||
tag=="FORM"||tag=="SELECT"||tag=="MAP"||tag=="DL"||tag=="HEAD"||
tag=="BODY"||tag=="HTML")
arrReturn=["\n","","\n"];
if( tag=="STYLE"||tag=="SCRIPT")
arrReturn=["\n","",""];
if(tag=="BR"||tag=="HR")
arrReturn=["","\n",""];
return arrReturn;
}
function fixAttr(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
s = String(s).replace(/"/g, """);
return s;
}
function fixVal(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
var x = escape(s);
x = unescape(x.replace(/\%A0/gi, "-*REPL*-"));
s = x.replace(/-\*REPL\*-/gi, " ");
return s;
}
function recur(oEl,sTab)
{
var sHTML="";
for(var i=0;i<oEl.childNodes.length;i++)
{
var oNode=oEl.childNodes[i];
if(oNode.nodeType==1)//tag
{
var sTagName = oNode.nodeName;
var bDoNotProcess=false;
if(sTagName.substring(0,1)=="/")
{
bDoNotProcess=true;//do not process
}
else
{
/*** tabs ***/
var sT= sTab;
sHTML+= lineBreak1(sTagName)[0];
if(lineBreak1(sTagName)[0] !="") sHTML+= sT;//If new line, use base Tabs
/************/
}
if(bDoNotProcess)
{
;//do not process
}
else if(sTagName=="OBJECT" || sTagName=="EMBED")
{
s=getOuterHTML(oNode);
s=s.replace(/\"[^\"]*\"/ig,function(x){
x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
return x});
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()})
s=s.replace(/ ([^=]+)=([^"' >]+)/ig," $1=\"$2\"");//new
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
s=s.replace(/<param([^>]*)>/ig,"\n<param$1 />").replace(/\/ \/>$/ig," \/>");//no closing tag
if(sTagName=="EMBED")
if(oNode.innerHTML=="")
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
s=s.replace(/<param name=\"Play\" value=\"0\" \/>/,"<param name=\"Play\" value=\"-1\" \/>")
sHTML+=s;
}
else if(sTagName=="TITLE")
{
sHTML+="<title>"+oNode.innerHTML+"</title>";
}
else
{
if(sTagName=="AREA")
{
var sCoords=oNode.coords;
var sShape=oNode.shape;
}
var oNode2=oNode.cloneNode(false);
s=getOuterHTML(oNode2).replace(/<\/[^>]*>/,"");
if(sTagName=="STYLE")
{
var arrTmp=s.match(/<[^>]*>/ig);
s=arrTmp[0];
}
s=s.replace(/\"[^\"]*\"/ig,function(x){
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
x=x.replace(/&/g, "&").replace(/&amp;/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
return x});
//info ttg: .replace(/&amp;/g, "&")
//ini karena '&' di (hanya) '&' selalu di-replace lagi dgn &.
//tapi kalau < , > tdk (no problem) => default behaviour
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()})
s=s.replace(/ ([^=]+)=([^" >]+)/ig," $1=\"$2\"");
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
//single attribute
s=s.replace(/[<hr]?(noshade="")/ig,"noshade=\"noshade\"");
s=s.replace(/[<input]?(checked="")/ig,"checked=\"checked\"");
s=s.replace(/[<select]?(multiple="")/ig,"multiple=\"multiple\"");
s=s.replace(/[<option]?(selected="")/ig,"selected=\"true\"");
s=s.replace(/[<input]?(readonly="")/ig,"readonly=\"readonly\"");
s=s.replace(/[<input]?(disabled="")/ig,"disabled=\"disabled\"");
s=s.replace(/[<td]?(nowrap="" )/ig,"nowrap=\"nowrap\" ");
s=s.replace(/[<td]?(nowrap=""\>)/ig,"nowrap=\"nowrap\"\>");
s=s.replace(/ contenteditable=\"true\"/ig,"");
if(sTagName=="AREA")
{
s=s.replace(/ coords=\"0,0,0,0\"/ig," coords=\""+sCoords+"\"");
s=s.replace(/ shape=\"RECT\"/ig," shape=\""+sShape+"\"");
}
var bClosingTag=true;
if(sTagName=="IMG"||sTagName=="BR"||
sTagName=="AREA"||sTagName=="HR"||
sTagName=="INPUT"||sTagName=="BASE"||
sTagName=="LINK")//no closing tag
{
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
bClosingTag=false;
}
sHTML+=s;
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+= lineBreak1(sTagName)[1];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[1] !="") sHTML+= sT;//If new line, use base Tabs
/************/
if(bClosingTag)
{
/*** CONTENT ***/
s=getOuterHTML(oNode);
if(sTagName=="SCRIPT")
{
s = s.replace(/<script([^>]*)>[\n+\s+\t+]*/ig,"<script$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/script>/ig,"<\/script>");//clean spaces
s = s.replace(/<script([^>]*)>\/\/<!\[CDATA\[/ig,"");
s = s.replace(/\/\/\]\]><\/script>/ig,"");
s = s.replace(/<script([^>]*)>/ig,"");
s = s.replace(/<\/script>/ig,"");
s = s.replace(/^\s+/,'').replace(/\s+$/,'');
sHTML+="\n"+
sT + "//<![CDATA[\n"+
sT + s + "\n" +
sT + "//]]>\n"+sT;
}
if(sTagName=="STYLE")
{
s = s.replace(/<style([^>]*)>[\n+\s+\t+]*/ig,"<style$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/style>/ig,"<\/style>");//clean spaces
s = s.replace(/<style([^>]*)><!--/ig,"");
s = s.replace(/--><\/style>/ig,"");
s = s.replace(/<style([^>]*)>/ig,"");
s = s.replace(/<\/style>/ig,"");
s = s.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n"+
sT + "<!--\n"+
sT + s + "\n" +
sT + "-->\n"+sT;
}
if(sTagName=="DIV"||sTagName=="P")
{
if(oNode.innerHTML==""||oNode.innerHTML==" ")
{
sHTML+=" ";
}
else sHTML+=recur(oNode,sT+"\t");
}
else
if (sTagName == "STYLE" || sTagName=="SCRIPT")
{
//do nothing
}
else
{
sHTML+=recur(oNode,sT+"\t");
}
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+=lineBreak1(sTagName)[2];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[2] !="")sHTML+=sT;//If new line, use base Tabs
/************/
sHTML+="</" + sTagName.toLowerCase() + ">";
}
}
}
else if(oNode.nodeType==3)//text
{
sHTML+= fixVal(oNode.nodeValue);
}
else if(oNode.nodeType==8)
{
if(getOuterHTML(oNode).substring(0,2)=="<"+"%")
{//server side script
sTmp=(getOuterHTML(oNode).substring(2))
sTmp=sTmp.substring(0,sTmp.length-2)
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
/*** tabs ***/
var sT= sTab;
/************/
sHTML+="\n" +
sT + "<%\n"+
sT + sTmp + "\n" +
sT + "%>\n"+sT;
}
else
{//comments
/*** tabs ***/
var sT= sTab;
/************/
sTmp=oNode.nodeValue;
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n" +
sT + "<!--\n"+
sT + sTmp + "\n" +
sT + "-->\n"+sT;
}
}
else
{
;//Not Processed
}
}
return sHTML;
}
function getOuterHTML(node)
{
var sHTML = "";
switch (node.nodeType)
{
case Node.ELEMENT_NODE:
sHTML = "<" + node.nodeName;
var tagVal ="";
for (var atr=0; atr < node.attributes.length; atr++)
{
if (node.attributes[atr].nodeName.substr(0,4) == "_moz" ) continue;
if (node.attributes[atr].nodeValue.substr(0,4) == "_moz" ) continue;//yus
if (node.nodeName=='TEXTAREA' && node.attributes[atr].nodeName.toLowerCase()=='value')
{
tagVal = node.attributes[atr].nodeValue;
}
else
{
sHTML += ' ' + node.attributes[atr].nodeName + '="' + node.attributes[atr].nodeValue + '"';
}
}
sHTML += '>';
sHTML += (node.nodeName!='TEXTAREA' ? node.innerHTML : tagVal);
sHTML += "</"+node.nodeName+">";
break;
case Node.COMMENT_NODE:
sHTML = "<!"+"--"+node.nodeValue+ "--"+">"; break;
case Node.TEXT_NODE:
sHTML = node.nodeValue; break;
}
return sHTML
}
function toggleViewSource(chk, idIframe) {
if (chk.checked) {
//view souce
viewSource(idIframe);
} else {
//wysiwyg mode
applySource(idIframe);
}
}
function viewSource(idIframe) {
var oEditor=document.getElementById(idIframe).contentWindow;
var sHTML=getXHTMLBody(idIframe);
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.appendChild(oEditor.document.createTextNode(sHTML));
}
function applySource(idIframe) {
var oEditor=document.getElementById(idIframe).contentWindow;
var range = oEditor.document.body.ownerDocument.createRange();
range.selectNodeContents(oEditor.document.body);
var sHTML = range.toString();
sHTML = sHTML.replace(/>\s+</gi, "><"); //replace space between tag
sHTML = sHTML.replace(/\r/gi, ""); //replace space between tag
sHTML = sHTML.replace(/(<br>)\s+/gi, "$1"); //replace space between BR and text
sHTML = sHTML.replace(/(<br\s*\/>)\s+/gi, "$1"); //replace space between <BR/> and text. spasi antara <br /> menyebebkan content menggeser kekanan saat di apply
sHTML = sHTML.replace(/\s+/gi, " "); //replace spaces with space
oEditor.document.body.innerHTML = sHTML;
} | JavaScript |
var onloadOverrided = false;
function onload_new()
{
onload_original();
setMozEdit();
}
function onload_original()
{
}
function setMozEdit(idIframe)
{
if ((idIframe != null) && (idIframe!="")) {
try {document.getElementById(idIframe).contentDocument.designMode="on";} catch(e) {}
} else {
for (var i=0; i<oUtil.arrIframe.length; i++)
{
try {document.getElementById(oUtil.arrIframe[i]).contentDocument.designMode="on";} catch(e) {alert(e)}
}
}
}
function getHTMLBody(idIframe)
{
var oEditor=document.getElementById(idIframe).contentWindow;
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/ contentEditable=true/g,"");
sHTML = String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
return sHTML;
}
/*Insert custon HTML function*/
function insertHTML(idIframe, sHTML)
{
var oEditor=document.getElementById(idIframe).contentWindow;
var oSel=oEditor.getSelection();
var range = oSel.getRangeAt(0);
var docFrag = range.createContextualFragment(sHTML);
range.collapse(true);
var lastNode = docFrag.childNodes[docFrag.childNodes.length-1];
range.insertNode(docFrag);
try { oEditor.document.designMode="on"; } catch (e) {}
if (lastNode.nodeType==Node.TEXT_NODE)
{
range = oEditor.document.createRange();
range.setStart(lastNode, lastNode.nodeValue.length);
range.setEnd(lastNode, lastNode.nodeValue.length);
oSel = oEditor.getSelection();
oSel.removeAllRanges();
oSel.addRange(range);
}
}
function doCmd(idIframe,sCmd,sOption)
{
var oEditor=document.getElementById(idIframe).contentWindow;
oEditor.document.execCommand(sCmd,false,sOption);
}
function toggleViewSource(chk, idIframe) {
if (chk.checked) {
//view souce
viewSource(idIframe);
} else {
//wysiwyg mode
applySource(idIframe);
}
}
function viewSource(idIframe) {
var oEditor=document.getElementById(idIframe).contentWindow;
var sHTML="";
sHTML = oEditor.document.body.innerHTML;
sHTML = sHTML.replace(/>\s+</gi, "><"); //replace space between tag
sHTML = sHTML.replace(/\r/gi, ""); //replace space between tag
sHTML = sHTML.replace(/(<br>)\s+/gi, "$1"); //replace space between BR and text
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.appendChild(oEditor.document.createTextNode(sHTML));
}
function applySource(idIframe) {
var oEditor=document.getElementById(idIframe).contentWindow;
var range = oEditor.document.body.ownerDocument.createRange();
range.selectNodeContents(oEditor.document.body);
oEditor.document.body.innerHTML = range.toString();
}
| JavaScript |
var oUtil = new EditorUtil();
var onloadOverrided = false;
function onload_new()
{
onload_original();
setMozEdit();
}
function onload_original()
{
}
function setMozEdit(oName)
{
if ((oName != null) && (oName!="")) {
try {
var d = document.getElementById("idContent" + oName).contentDocument;
d.designMode="on";
if(typeof(d.contentEditable)!="undefined") d.contentEditable=true;
} catch(e) {}
} else {
for (var i=0; i<oUtil.arrEditor.length; i++)
{
try {
var d = document.getElementById("idContent" + oUtil.arrEditor[i]).contentDocument;
d.designMode="on";
if(typeof(d.contentEditable)!="undefined") d.contentEditable=true;
} catch(e) {}
}
}
}
function EditorUtil() {
this.obj = null;
this.oEditor = null;
this.arrEditor = [];
var oScripts=document.getElementsByTagName("script");
for(var i=0;i<oScripts.length;i++)
{
var sSrc=oScripts[i].src.toLowerCase();
if(sSrc.indexOf("scripts/quick/moz/xhtmleditor.js")!=-1) this.scriptPath = oScripts[i].src.replace(/quick\/moz\/xhtmleditor.js/ig,"");
}
}
function InnovaEditor(oName) {
this.oName = oName;
this.height = "400px";
this.width = "100%";
this.RENDER = RENDER;
this.doCmd = edt_doCmd;
this.getHTMLBody = edt_getHTMLBody;
this.getXHTMLBody = edt_getXHTMLBody;
this.insertHTML = edt_insertHTML;
this.cleanDeprecated = edt_cleanDeprecated;
this.cleanEmptySpan = edt_cleanEmptySpan;
this.cleanFonts = edt_cleanFonts;
this.cleanTags = edt_cleanTags;
this.replaceTags = edt_replaceTags;
this.toggleViewSource = edt_toggleViewSource;
this.viewSource = edt_viewSource;
this.applySource = edt_applySource;
this.encodeIO = false;
this.init = function(){return true;};
}
function RENDER() {
}
function edt_doCmd(sCmd,sOption)
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
oEditor.document.execCommand(sCmd,false,sOption);
}
function edt_getHTMLBody()
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
sHTML=oEditor.document.body.innerHTML;
sHTML=String(sHTML).replace(/ contentEditable=true/g,"");
sHTML = String(sHTML).replace(/\<PARAM NAME=\"Play\" VALUE=\"0\">/ig,"<PARAM NAME=\"Play\" VALUE=\"-1\">");
if(this.encodeIO)sHTML = encodeHTMLCode(sHTML);
sHTML = sHTML.replace(/class="Apple-style-span"/gi, "");
return sHTML;
}
function edt_getXHTMLBody()
{
var sHTML=""
if (document.getElementById("chkViewSource"+this.oName).checked)
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
sHTML = oEditor.document.body.textContent;
} else {
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
this.cleanDeprecated();
sHTML = recur(oEditor.document.body,"");
}
if(this.encodeIO)sHTML = encodeHTMLCode(sHTML);
sHTML = sHTML.replace(/class="Apple-style-span"/gi, "");
return sHTML;
}
/*Insert custon HTML function*/
function edt_insertHTML(sHTML)
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var oSel=oEditor.getSelection();
var range = oSel.getRangeAt(0);
var docFrag = range.createContextualFragment(sHTML);
range.collapse(true);
var lastNode = docFrag.childNodes[docFrag.childNodes.length-1];
range.insertNode(docFrag);
try { oEditor.document.designMode="on"; } catch (e) {}
if (lastNode.nodeType==Node.TEXT_NODE)
{
range = oEditor.document.createRange();
range.setStart(lastNode, lastNode.nodeValue.length);
range.setEnd(lastNode, lastNode.nodeValue.length);
oSel = oEditor.getSelection();
oSel.removeAllRanges();
oSel.addRange(range);
}
}
/************************************
CLEAN DEPRECATED TAGS; Used in loadHTML, getHTMLBody, getXHTMLBody
*************************************/
function edt_cleanDeprecated()
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var elements;
elements=oEditor.document.body.getElementsByTagName("STRIKE");
this.cleanTags(elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("S");
this.cleanTags(elements,"line-through");
elements=oEditor.document.body.getElementsByTagName("U");
this.cleanTags(elements,"underline");
this.replaceTags("DIR","DIV");
this.replaceTags("MENU","DIV");
this.replaceTags("CENTER","DIV");
this.replaceTags("XMP","PRE");
this.replaceTags("BASEFONT","SPAN");//will be removed by cleanEmptySpan()
elements=oEditor.document.body.getElementsByTagName("APPLET");
while(elements.length>0)
{
var f = elements[0];
theParent = f.parentNode;
theParent.removeChild(f);
}
this.cleanFonts();
this.cleanEmptySpan();
return true;
}
function edt_cleanEmptySpan()
{
var bReturn=false;
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var reg = /<\s*SPAN\s*>/gi;
while (true)
{
var allSpans = oEditor.document.getElementsByTagName("SPAN");
if(allSpans.length==0) break;
var emptySpans = [];
for (var i=0; i<allSpans.length; i++)
{
if (getOuterHTML(allSpans[i]).search(reg) == 0)
emptySpans[emptySpans.length]=allSpans[i];
}
if (emptySpans.length == 0) break;
var theSpan, theParent;
for (var i=0; i<emptySpans.length; i++)
{
theSpan = emptySpans[i];
theParent = theSpan.parentNode;
if (!theParent) continue;
if (theSpan.hasChildNodes())
{
var range = oEditor.document.createRange();
range.selectNodeContents(theSpan);
var docFrag = range.extractContents();
theParent.replaceChild(docFrag, theSpan);
}
else
{
theParent.removeChild(theSpan);
}
bReturn=true;
}
}
return bReturn;
}
function edt_cleanFonts()
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var allFonts = oEditor.document.body.getElementsByTagName("FONT");
if(allFonts.length==0)return false;
var f; var range;
while (allFonts.length>0)
{
f = allFonts[0];
if (f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{
//if font containts only span child node
var theSpan = f.childNodes[0];
copyAttribute(theSpan, f);
range = oEditor.document.createRange();
range.selectNode(f);
range.insertNode(theSpan);
range.selectNode(f);
range.deleteContents();
}
else
if (f.parentNode.nodeName=="SPAN" && f.parentNode.childNodes.length==1)
{
//font is the only child node of span.
var theSpan = f.parentNode;
copyAttribute(theSpan, f);
theSpan.innerHTML = f.innerHTML;
}
else
{
var newSpan = oEditor.document.createElement("SPAN");
copyAttribute(newSpan, f);
newSpan.innerHTML = f.innerHTML;
f.parentNode.replaceChild(newSpan, f);
}
}
return true;
}
function edt_cleanTags(elements,sVal)
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
if(elements.length==0)return false;
var f;var range;
while(elements.length>0)
{
f = elements[0];
if(f.hasChildNodes && f.childNodes.length==1 && f.childNodes[0].nodeType==1 && f.childNodes[0].nodeName=="SPAN")
{//if font containts only span child node
var theSpan=f.childNodes[0];
if(sVal=="bold")theSpan.style.fontWeight="bold";
if(sVal=="italic")theSpan.style.fontStyle="italic";
if(sVal=="line-through")theSpan.style.textDecoration="line-through";
if(sVal=="underline")theSpan.style.textDecoration="underline";
range=oEditor.document.createRange();
range.selectNode(f);
range.insertNode(theSpan);
range.selectNode(f);
range.deleteContents();
}
else
if (f.parentNode.nodeName=="SPAN" && f.parentNode.childNodes.length==1)
{
//font is the only child node of span.
var theSpan=f.parentNode;
if(sVal=="bold")theSpan.style.fontWeight="bold";
if(sVal=="italic")theSpan.style.fontStyle="italic";
if(sVal=="line-through")theSpan.style.textDecoration="line-through";
if(sVal=="underline")theSpan.style.textDecoration="underline";
theSpan.innerHTML=f.innerHTML;
}
else
{
var newSpan = oEditor.document.createElement("SPAN");
if(sVal=="bold")newSpan.style.fontWeight="bold";
if(sVal=="italic")newSpan.style.fontStyle="italic";
if(sVal=="line-through")newSpan.style.textDecoration="line-through";
if(sVal=="underline")newSpan.style.textDecoration="underline";
newSpan.innerHTML=f.innerHTML;
f.parentNode.replaceChild(newSpan,f);
}
}
return true;
}
function edt_replaceTags(sFrom,sTo)
{
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var elements=oEditor.document.body.getElementsByTagName(sFrom);
while(elements.length>0)
{
f = elements[0];
var newSpan = oEditor.document.createElement(sTo);
newSpan.innerHTML=f.innerHTML;
f.parentNode.replaceChild(newSpan,f);
}
}
function copyAttribute(newSpan,f)
{
if ((f.face != null) && (f.face != ""))newSpan.style.fontFamily=f.face;
if ((f.size != null) && (f.size != ""))
{
var nSize="";
if(f.size==1)nSize="8pt";
else if(f.size==2)nSize="10pt";
else if(f.size==3)nSize="12pt";
else if(f.size==4)nSize="14pt";
else if(f.size==5)nSize="18pt";
else if(f.size==6)nSize="24pt";
else if(f.size>=7)nSize="36pt";
else if(f.size<=-2||f.size=="0")nSize="8pt";
else if(f.size=="-1")nSize="10pt";
else if(f.size==0)nSize="12pt";
else if(f.size=="+1")nSize="14pt";
else if(f.size=="+2")nSize="18pt";
else if(f.size=="+3")nSize="24pt";
else if(f.size=="+4"||f.size=="+5"||f.size=="+6")nSize="36pt";
else nSize="";
if(nSize!="")newSpan.style.fontSize=nSize;
}
if ((f.style.backgroundColor != null)&&(f.style.backgroundColor != ""))newSpan.style.backgroundColor=f.style.backgroundColor;
if ((f.color != null)&&(f.color != ""))newSpan.style.color=f.color;
}
function GetElement(oElement,sMatchTag)//Used in realTime() only.
{
while (oElement!=null&&oElement.tagName!=sMatchTag)
{
if(oElement.tagName=="BODY")return null;
oElement=oElement.parentNode;
}
return oElement;
}
/************************************
HTML to XHTML
*************************************/
function lineBreak1(tag) //[0]<TAG>[1]text[2]</TAG>
{
arrReturn = ["\n","",""];
if( tag=="A"||tag=="B"||tag=="CITE"||tag=="CODE"||tag=="EM"||
tag=="FONT"||tag=="I"||tag=="SMALL"||tag=="STRIKE"||tag=="BIG"||
tag=="STRONG"||tag=="SUB"||tag=="SUP"||tag=="U"||tag=="SAMP"||
tag=="S"||tag=="VAR"||tag=="BASEFONT"||tag=="KBD"||tag=="TT")
arrReturn=["","",""];
if( tag=="TEXTAREA"||tag=="TABLE"||tag=="THEAD"||tag=="TBODY"||
tag=="TR"||tag=="OL"||tag=="UL"||tag=="DIR"||tag=="MENU"||
tag=="FORM"||tag=="SELECT"||tag=="MAP"||tag=="DL"||tag=="HEAD"||
tag=="BODY"||tag=="HTML")
arrReturn=["\n","","\n"];
if( tag=="STYLE"||tag=="SCRIPT")
arrReturn=["\n","",""];
if(tag=="BR"||tag=="HR")
arrReturn=["","\n",""];
return arrReturn;
}
function fixAttr(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
s = String(s).replace(/"/g, """);
return s;
}
function fixVal(s)
{
s = String(s).replace(/&/g, "&");
s = String(s).replace(/</g, "<");
var x = escape(s);
x = unescape(x.replace(/\%A0/gi, "-*REPL*-"));
s = x.replace(/-\*REPL\*-/gi, " ");
return s;
}
function recur(oEl,sTab)
{
var sHTML="";
for(var i=0;i<oEl.childNodes.length;i++)
{
var oNode=oEl.childNodes[i];
if(oNode.nodeType==1)//tag
{
var sTagName = oNode.nodeName;
var bDoNotProcess=false;
if(sTagName.substring(0,1)=="/")
{
bDoNotProcess=true;//do not process
}
else
{
/*** tabs ***/
var sT= sTab;
sHTML+= lineBreak1(sTagName)[0];
if(lineBreak1(sTagName)[0] !="") sHTML+= sT;//If new line, use base Tabs
/************/
}
if(bDoNotProcess)
{
;//do not process
}
else if(sTagName=="OBJECT" || sTagName=="EMBED")
{
s=getOuterHTML(oNode);
s=s.replace(/\"[^\"]*\"/ig,function(x){
x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
return x});
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()})
s=s.replace(/ ([^=]+)=([^"' >]+)/ig," $1=\"$2\"");//new
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
s=s.replace(/<param([^>]*)>/ig,"\n<param$1 />").replace(/\/ \/>$/ig," \/>");//no closing tag
if(sTagName=="EMBED")
if(oNode.innerHTML=="")
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
s=s.replace(/<param name=\"Play\" value=\"0\" \/>/,"<param name=\"Play\" value=\"-1\" \/>")
sHTML+=s;
}
else if(sTagName=="TITLE")
{
sHTML+="<title>"+oNode.innerHTML+"</title>";
}
else
{
if(sTagName=="AREA")
{
var sCoords=oNode.coords;
var sShape=oNode.shape;
}
var oNode2=oNode.cloneNode(false);
s=getOuterHTML(oNode2).replace(/<\/[^>]*>/,"");
if(sTagName=="STYLE")
{
var arrTmp=s.match(/<[^>]*>/ig);
s=arrTmp[0];
}
s=s.replace(/\"[^\"]*\"/ig,function(x){
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/ig,"#_#");
//x=x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
x=x.replace(/&/g, "&").replace(/&amp;/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\s+/ig,"#_#");
return x});
//info ttg: .replace(/&amp;/g, "&")
//ini karena '&' di (hanya) '&' selalu di-replace lagi dgn &.
//tapi kalau < , > tdk (no problem) => default behaviour
s=s.replace(/<([^ >]*)/ig,function(x){return x.toLowerCase()})
s=s.replace(/ ([^=]+)=([^" >]+)/ig," $1=\"$2\"");
s=s.replace(/ ([^=]+)=/ig,function(x){return x.toLowerCase()});
s=s.replace(/#_#/ig," ");
//single attribute
s=s.replace(/[<hr]?(noshade="")/ig,"noshade=\"noshade\"");
s=s.replace(/[<input]?(checked="")/ig,"checked=\"checked\"");
s=s.replace(/[<select]?(multiple="")/ig,"multiple=\"multiple\"");
s=s.replace(/[<option]?(selected="")/ig,"selected=\"true\"");
s=s.replace(/[<input]?(readonly="")/ig,"readonly=\"readonly\"");
s=s.replace(/[<input]?(disabled="")/ig,"disabled=\"disabled\"");
s=s.replace(/[<td]?(nowrap="" )/ig,"nowrap=\"nowrap\" ");
s=s.replace(/[<td]?(nowrap=""\>)/ig,"nowrap=\"nowrap\"\>");
s=s.replace(/ contenteditable=\"true\"/ig,"");
if(sTagName=="AREA")
{
s=s.replace(/ coords=\"0,0,0,0\"/ig," coords=\""+sCoords+"\"");
s=s.replace(/ shape=\"RECT\"/ig," shape=\""+sShape+"\"");
}
var bClosingTag=true;
if(sTagName=="IMG"||sTagName=="BR"||
sTagName=="AREA"||sTagName=="HR"||
sTagName=="INPUT"||sTagName=="BASE"||
sTagName=="LINK")//no closing tag
{
s=s.replace(/>$/ig," \/>").replace(/\/ \/>$/ig,"\/>");//no closing tag
bClosingTag=false;
}
sHTML+=s;
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+= lineBreak1(sTagName)[1];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[1] !="") sHTML+= sT;//If new line, use base Tabs
/************/
if(bClosingTag)
{
/*** CONTENT ***/
s=getOuterHTML(oNode);
if(sTagName=="SCRIPT")
{
s = s.replace(/<script([^>]*)>[\n+\s+\t+]*/ig,"<script$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/script>/ig,"<\/script>");//clean spaces
s = s.replace(/<script([^>]*)>\/\/<!\[CDATA\[/ig,"");
s = s.replace(/\/\/\]\]><\/script>/ig,"");
s = s.replace(/<script([^>]*)>/ig,"");
s = s.replace(/<\/script>/ig,"");
s = s.replace(/^\s+/,'').replace(/\s+$/,'');
sHTML+="\n"+
sT + "//<![CDATA[\n"+
sT + s + "\n" +
sT + "//]]>\n"+sT;
}
if(sTagName=="STYLE")
{
s = s.replace(/<style([^>]*)>[\n+\s+\t+]*/ig,"<style$1>");//clean spaces
s = s.replace(/[\n+\s+\t+]*<\/style>/ig,"<\/style>");//clean spaces
s = s.replace(/<style([^>]*)><!--/ig,"");
s = s.replace(/--><\/style>/ig,"");
s = s.replace(/<style([^>]*)>/ig,"");
s = s.replace(/<\/style>/ig,"");
s = s.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n"+
sT + "<!--\n"+
sT + s + "\n" +
sT + "-->\n"+sT;
}
if(sTagName=="DIV"||sTagName=="P")
{
if(oNode.innerHTML==""||oNode.innerHTML==" ")
{
sHTML+=" ";
}
else sHTML+=recur(oNode,sT+"\t");
}
else
if (sTagName == "STYLE" || sTagName=="SCRIPT")
{
//do nothing
}
else
{
sHTML+=recur(oNode,sT+"\t");
}
/*** tabs ***/
if(sTagName!="TEXTAREA")sHTML+=lineBreak1(sTagName)[2];
if(sTagName!="TEXTAREA")if(lineBreak1(sTagName)[2] !="")sHTML+=sT;//If new line, use base Tabs
/************/
sHTML+="</" + sTagName.toLowerCase() + ">";
}
}
}
else if(oNode.nodeType==3)//text
{
sHTML+= fixVal(oNode.nodeValue);
}
else if(oNode.nodeType==8)
{
if(getOuterHTML(oNode).substring(0,2)=="<"+"%")
{//server side script
sTmp=(getOuterHTML(oNode).substring(2))
sTmp=sTmp.substring(0,sTmp.length-2)
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
/*** tabs ***/
var sT= sTab;
/************/
sHTML+="\n" +
sT + "<%\n"+
sT + sTmp + "\n" +
sT + "%>\n"+sT;
}
else
{//comments
/*** tabs ***/
var sT= sTab;
/************/
sTmp=oNode.nodeValue;
sTmp = sTmp.replace(/^\s+/,"").replace(/\s+$/,"");
sHTML+="\n" +
sT + "<!--\n"+
sT + sTmp + "\n" +
sT + "-->\n"+sT;
}
}
else
{
;//Not Processed
}
}
return sHTML;
}
function getOuterHTML(node)
{
var sHTML = "";
switch (node.nodeType)
{
case Node.ELEMENT_NODE:
sHTML = "<" + node.nodeName;
var tagVal ="";
for (var atr=0; atr < node.attributes.length; atr++)
{
if (node.attributes[atr].nodeName.substr(0,4) == "_moz" ) continue;
if (node.attributes[atr].nodeValue.substr(0,4) == "_moz" ) continue;//yus
if (node.nodeName=='TEXTAREA' && node.attributes[atr].nodeName.toLowerCase()=='value')
{
tagVal = node.attributes[atr].nodeValue;
}
else
{
sHTML += ' ' + node.attributes[atr].nodeName + '="' + node.attributes[atr].nodeValue + '"';
}
}
sHTML += '>';
sHTML += (node.nodeName!='TEXTAREA' ? node.innerHTML : tagVal);
sHTML += "</"+node.nodeName+">";
break;
case Node.COMMENT_NODE:
sHTML = "<!"+"--"+node.nodeValue+ "--"+">"; break;
case Node.TEXT_NODE:
sHTML = node.nodeValue; break;
}
return sHTML
}
function edt_toggleViewSource(chk) {
if (chk.checked) {
//view souce
this.viewSource();
} else {
//wysiwyg mode
this.applySource();
}
}
function edt_viewSource() {
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
this.cleanDeprecated();
var sHTML=recur(oEditor.document.body,"");
sHTML = sHTML.replace(/class="Apple-style-span"/gi, "");
var docBody = oEditor.document.body;
docBody.innerHTML = "";
docBody.appendChild(oEditor.document.createTextNode(sHTML));
}
function edt_applySource() {
var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
var range = oEditor.document.body.ownerDocument.createRange();
range.selectNodeContents(oEditor.document.body);
var sHTML = range.toString();
sHTML = sHTML.replace(/>\s+</gi, "><"); //replace space between tag
sHTML = sHTML.replace(/\r/gi, ""); //replace space between tag
sHTML = sHTML.replace(/(<br>)\s+/gi, "$1"); //replace space between BR and text
sHTML = sHTML.replace(/(<br\s*\/>)\s+/gi, "$1"); //replace space between <BR/> and text. spasi antara <br /> menyebebkan content menggeser kekanan saat di apply
sHTML = sHTML.replace(/\s+/gi, " "); //replace spaces with space
oEditor.document.body.innerHTML = sHTML;
}
function encodeHTMLCode(sHTML) {
return sHTML.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
}
function getSelectedElement(sel)
{
var range = sel.getRangeAt(0);
var node = range.startContainer;
if (node.nodeType == Node.ELEMENT_NODE)
{
if (range.startOffset >= node.childNodes.length) return node;
node = node.childNodes[range.startOffset];
}
if (node.nodeType == Node.TEXT_NODE)
{
if (node.nodeValue.length == range.startOffset)
{
var el = node.nextSibling;
if (el && el.nodeType==Node.ELEMENT_NODE)
{
if (range.endContainer.nodeType==Node.TEXT_NODE && range.endContainer.nodeValue.length == range.endOffset)
{
if (el == range.endContainer.parentNode)
{
return el;
}
}
}
}
while (node!=null && node.nodeType != Node.ELEMENT_NODE)
{
node = node.parentNode;
}
}
return node;
}
function ISWindow(id) {
var ua = navigator.userAgent.toUpperCase();
var isIE =(ua.indexOf('MSIE') >= 0) ? true : false,
isIE7=(ua.indexOf("MSIE 7.0") >=0),
isIE8=(ua.indexOf("MSIE 8.0") >=0),
isIE6=(!isIE7 && !isIE8 && isIE),
IEBackCompat = (isIE && document.compatMode=="BackCompat");
var me=this;
this.id=id;
this.opts=null;
this.rt={};
this.iconPath="icons/";
ISWindow.objs[id] = this;
this.show=function(opt) {
if(!document.getElementById(this.id)) {
//render
var e = document.createElement("div");
e.id = "cnt$"+this.id;
e.innerHTML = this.render(opt.url);
document.body.insertBefore(e, document.body.childNodes[0]);
}
if(!this.rt.win) {
this.rt.win = document.getElementById(this.id);
this.rt.frm = document.getElementById("frm$"+this.id);
this.rt.ttl = document.getElementById("ttl$"+this.id);
}
if(opt.overlay==true) this.showOverlay();
this.setSize(opt.width, opt.height, opt.center);
ISWindow.zIndex+=2;
this.rt.win.style.zIndex = ISWindow.zIndex;
this.rt.win.style.display="block";
var fn =
function() {
me.rt.ttl.innerHTML = me.rt.frm.contentWindow.document.title;
me.rt.frm.contentWindow.openerWin = opt.openerWin ? opt.openerWin : window;
me.rt.frm.contentWindow.opener = opt.openerWin ? opt.openerWin : window;
me.rt.frm.contentWindow.options = opt.options?opt.options:{};
me.rt.frm.contentWindow.close=function() {
me.close();
};
if (typeof(me.rt.frm.contentWindow.bodyOnLoad) != "undefined") me.rt.frm.contentWindow.bodyOnLoad();
} ;
if(this.rt.frm.attachEvent) this.rt.frm.attachEvent("onload", fn);
if(this.rt.frm.addEventListener) this.rt.frm.addEventListener("load", fn, true);
setTimeout(function() {me.rt.frm.src = opt.url;}, 0);
};
this.close = function() {
var d = document.getElementById("cnt$"+this.id);
if(d) {
if(this.rt.frm.contentWindow.bodyOnUnload) this.rt.frm.contentWindow.bodyOnUnload();
d.parentNode.removeChild(d);
}
this.hideOverlay();
};
this.hide=function() {
if(!this.rt.win) {
this.rt.win = document.getElementById(this.id);
}
this.rt.win.style.display="none";
};
this.showOverlay=function() {
var ov;
if(!document.getElementById("ovr$"+this.id)) {
ov = document.createElement("div");
ov.id = "ovr$"+this.id;
ov.style.display="none";
ov.style.position=(isIE6 || IEBackCompat ? "absolute" : "fixed");
ov.style.backgroundColor="#ffffff";
ov.style.filter = "alpha(opacity=35)";
ov.style.mozOpacity = "0.4";
ov.style.opacity = "0.4";
ov.style.Opacity = "0.4";
document.body.insertBefore(ov, document.body.childNodes[0]);
}
var cl = ISWindow.clientSize();
if(isIE6 || IEBackCompat) {
var db=document.body, de=document.documentElement, w, h;
w=Math.min(
Math.max(db.scrollWidth, de.scrollWidth),
Math.max(db.offsetWidth, de.offsetWidth)
);
var mf=((de.scrollHeight<de.offsetHeight) || (db.scrollHeight<db.offsetHeight))?Math.min:Math.max;
h=mf(
Math.max(db.scrollHeight, de.scrollHeight),
Math.max(db.offsetHeight, de.offsetHeight)
);
cl.w = Math.max(cl.w, w);
cl.h = Math.max(cl.h, h);
ov.style.position="absolute";
}
ov.style.width = cl.w+"px";
ov.style.height = cl.h+"px";
ov.style.top="0px";
ov.style.left="0px";
ov.style.zIndex = ISWindow.zIndex+1;
ov.style.display="block";
};
this.hideOverlay=function() {
var ov=document.getElementById("ovr$"+this.id);
if(ov) ov.style.display="none";
};
this.setSize=function(w, h, center) {
this.rt.win.style.width=w;
this.rt.win.style.height=h;
this.rt.frm.style.height=parseInt(h, 10)-30 + "px";
if(center) {
this.center();
}
};
this.center=function() {
var c=ISWindow.clientSize();
var px=parseInt(this.rt.win.style.width, 10), py=parseInt(this.rt.win.style.height, 10);
px=(isNaN(px)?0:(px>c.w?c.w:px));
py=(isNaN(py)?0:(py>c.h?c.h:py));
var p = {x:(c.w-px)/2, y:(c.h-py)/2};
if(isIE6 || IEBackCompat) {
p.x=p.x+(document.body.scrollLeft||document.documentElement.scrollLeft);
p.y=p.y+(document.body.scrollTop||document.documentElement.scrollTop);
}
this.setPosition(p.x, p.y);
};
this.setPosition=function(x, y) {
this.rt.win.style.top=y+"px";
this.rt.win.style.left=x+"px";
};
this.render=function(attr) {
var s=[],j=0,ps=isIE6 || IEBackCompat ?"absolute":"fixed";
s[j++] = "<div style='position:"+ps+";display:none;z-index:100000;background-color:#ffffff;filter:alpha(opacity=25);opacity:0.25;-moz-opacity:0.25;border:#999999 1px solid' id=\"dd$"+this.id+"\"></div>";
s[j++] = "<div unselectable='on' id=\""+this.id+"\" style='position:"+ps+";z-index:100000;border:#d7d7d7 1px solid;'>";
s[j++] = " <div unselectable=\"on\" style=\"cursor:move;height:30px;background-image:url("+this.iconPath+"dialogbg.gif);\" onmousedown=\"ISWindow._ddMouseDown(event, '"+this.id+"');\"><span style=\"font-weight:bold;float:left;margin-top:7px;margin-left:11px;\" id=\"ttl$"+this.id+"\"></span><img src=\""+this.iconPath+"btnClose.gif\" onmousedown=\"event.cancelBubble=true;if(event.preventDefault) event.preventDefault();\" onclick=\"ISWindow.objs['" + this.id + "'].close();\" style='float:right;margin-top:5px;margin-right:5px;cursor:pointer' /></div>";
s[j++] = " <iframe id=\"frm$"+this.id+"\" style=\"width:100%;\" frameborder='no'></iframe>";
s[j++] = "</div>";
return s.join("");
};
ISWindow.clientSize=function() {
return {w:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,
h:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight};
};
ISWindow._ddMouseDown=function(ev, elId) {
var d=document;
d.onmousemove=function(e) {ISWindow._startDrag(e?e:ev);}
d.onmouseup=function(e) {ISWindow._endDrag(e?e:ev);}
d.onselectstart=function() { return false;}
d.onmousedown=function() { return false;}
d.ondragstart=function() { return false;}
ISWindow.trgElm = document.getElementById(elId);
ISWindow.gstElm = document.getElementById("dd$"+elId);
ISWindow.gstElm.style.top=ISWindow.trgElm.style.top;
ISWindow.gstElm.style.left=ISWindow.trgElm.style.left;
ISWindow.gstElm.style.width=ISWindow.trgElm.style.width;
ISWindow.gstElm.style.height=ISWindow.trgElm.style.height;
ISWindow.gstElm.style.display="block";
ISWindow.posDif = {x:ev.clientX-parseInt(ISWindow.trgElm.style.left, 10),
y:ev.clientY-parseInt(ISWindow.trgElm.style.top, 10)};
};
ISWindow._startDrag = function(ev) {
ISWindow.gstElm.style.left=(ev.clientX-ISWindow.posDif.x)+"px";
ISWindow.gstElm.style.top=(ev.clientY-ISWindow.posDif.y)+"px";
};
ISWindow._endDrag = function(ev) {
ISWindow.gstElm.style.display="none";
ISWindow.trgElm.style.top=ISWindow.gstElm.style.top;
ISWindow.trgElm.style.left=ISWindow.gstElm.style.left;
document.onmousemove=null;
document.onmouseup=null;
document.onmousedown=function() { return true;};
document.onselectstart=function() { return true;};
document.onselectstart=function() { return true;};
};
};
ISWindow.objs={};
ISWindow.zIndex=2000; | JavaScript |
/*** Color Picker Object ***/
var arrColorPickerObjects=[];
function ColorPicker(sName,sParent)
{
this.oParent=sParent;
if(sParent)
{
this.oName=sParent+"."+sName;
this.oRenderName=sName+sParent;
}
else
{
this.oName=sName;
this.oRenderName=sName;
}
arrColorPickerObjects.push(this.oName);
this.url="color_picker.htm";
this.onShow=function(){return true;};
this.onHide=function(){return true;};
this.onPickColor=function(){return true;};
this.onRemoveColor=function(){return true;};
this.onMoreColor=function(){return true;};
this.show=showColorPicker;
this.hide=hideColorPicker;
this.hideAll=hideColorPickerAll;
this.color;
this.customColors=[];
this.refreshCustomColor=refreshCustomColor;
this.isActive=false;
this.txtCustomColors="Custom Colors";
this.txtMoreColors="More Colors...";
this.align="left";
this.currColor="#ffffff";//default current color
this.RENDER=drawColorPicker;
}
function drawColorPicker()
{
var arrColors=[["#800000","#8b4513","#006400","#2f4f4f","#000080","#4b0082","#800080","#000000"],
["#ff0000","#daa520","#6b8e23","#708090","#0000cd","#483d8b","#c71585","#696969"],
["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"],
["#ff6347","#ffd700","#32cd32","#87ceeb","#00bfff","#9370db","#ff69b4","#dcdcdc"],
["#ffdab9","#ffffe0","#98fb98","#e0ffff","#87cefa","#e6e6fa","#dda0dd","#ffffff"]]
var sHTMLColor="<table id=dropColor"+this.oRenderName+" style=\"z-index:1;display:none;position:absolute;border:#9b95a6 1px solid;cursor:default;background-color:#f4f4f4;padding:2px\" unselectable=on cellpadding=0 cellspacing=0 width=143px height=109px><tr><td unselectable=on>"
sHTMLColor+="<table align=center cellpadding=0 cellspacing=0 style='border-collapse:separate' unselectable=on>";
for(var i=0;i<arrColors.length;i++)
{
sHTMLColor+="<tr>";
for(var j=0;j<arrColors[i].length;j++)
sHTMLColor+="<td onclick=\""+this.oName+".color='"+arrColors[i][j]+"';"+this.oName+".onPickColor();"+this.oName+".currColor='"+arrColors[i][j]+"';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
"<table style='margin:0px;width:13px;height:13px;background:"+arrColors[i][j]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td unselectable=on></td></tr>"+
"</table></td>";
sHTMLColor+="</tr>";
}
//~~~ custom colors ~~~~
sHTMLColor+="<tr><td colspan=8 id=idCustomColor"+this.oRenderName+"></td></tr>";
//~~~ remove color & more colors ~~~~
sHTMLColor+= "<tr>";
sHTMLColor+= "<td unselectable=on>"+
"<table style='margin-left:1px;width:14px;height:14px;background:#f4f4f4;' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onRemoveColor();"+this.oName+".currColor='';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='white 1px solid'\" style=\"cursor:default;padding:1px;border:white 1px solid;font-family:verdana;font-size:10px;font-color:black;line-height:9px;\" align=center valign=top unselectable=on>x</td></tr>"+
"</table></td>";
sHTMLColor+= "<td colspan=7 unselectable=on>"+
"<table style='margin:1px;width:117px;height:16px;background:#f4f4f4;border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onMoreColor();"+this.oName+".hideAll();parent.modalDialogShow('"+this.url+"',460,440, window,{'oName':'"+this.oName+"'});\" onmouseover=\"this.style.border='#777777 1px solid';this.style.background='#444444';this.style.color='#ffffff'\" onmouseout=\"this.style.border='#f4f4f4 1px solid';this.style.background='#f4f4f4';this.style.color='#000000'\" style=\"cursor:default;padding:1px;border:#efefef 1px solid\" style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\" align=center valign=top nowrap unselectable=on>"+this.txtMoreColors+"</td></tr>"+
"</table></td>";
sHTMLColor+= "</tr>";
sHTMLColor+= "</table>";
sHTMLColor+="</td></tr></table>";
document.write(sHTMLColor);
}
function refreshCustomColor()
{
var arg = eval(dialogArgument[0]);
var arg2 = eval(dialogArgument[1]);
if(arg.oUtil)//[CUSTOM]
this.customColors=arg.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
else //text2.htm [CUSTOM]
this.customColors=arg2.oUtil.obj.customColors;//[CUSTOM] (Get from public definition)
if(this.customColors.length==0)
{
eval("idCustomColor"+this.oRenderName).innerHTML="";
return;
}
sHTML="<table cellpadding='0' cellspacing='0' width=100%><tr><td colspan=8 style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\">"+this.txtCustomColors+":</td></tr></table>"
sHTML+="<table cellpadding=0 cellspacing=0 style='border-collapse:separate'><tr>";
for(var i=0;i<this.customColors.length;i++)
{
if(i<22)
{
if(i==8||i==16||i==24||i==32)sHTML+="</tr></table><table cellpadding=0 cellspacing=0><tr>"
sHTML+="<td onclick=\""+this.oName+".color='"+this.customColors[i]+"';"+this.oName+".onPickColor()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#f4f4f4 1px solid'\" style=\"cursor:default;padding:1px;border:#f4f4f4 1px solid;\" unselectable=on>"+
" <table style='margin:0px;width:13px;height:13px;background:"+this.customColors[i]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
" <tr><td unselectable=on></td></tr>"+
" </table>"+
"</td>";
}
}
sHTML+="</tr></table>";
eval("idCustomColor"+this.oRenderName).innerHTML=sHTML;
}
function showColorPicker(oEl)
{
this.onShow();
this.hideAll();
var box=eval("dropColor"+this.oRenderName);
box.style.display="block";
var nTop=0;
var nLeft=0;
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.top!="")
nTop+=oElTmp.style.top.substring(1,oElTmp.style.top.length-2)*1;
else nTop+=oElTmp.offsetTop;
oElTmp = oElTmp.offsetParent;
}
oElTmp=oEl;
while(oElTmp.tagName!="BODY" && oElTmp.tagName!="HTML")
{
if(oElTmp.style.left!="")
nLeft+=oElTmp.style.left.substring(1,oElTmp.style.left.length-2)*1;
else nLeft+=oElTmp.offsetLeft;
oElTmp=oElTmp.offsetParent;
}
if(this.align=="left")
box.style.left=nLeft + "px";
else//right
box.style.left=nLeft-143+oEl.offsetWidth + "px";
//box.style.top=nTop+1;//[CUSTOM]
box.style.top=nTop+1+oEl.offsetHeight + "px";//[CUSTOM]
this.isActive=true;
this.refreshCustomColor();
}
function hideColorPicker()
{
this.onHide();
var box=eval("dropColor"+this.oRenderName);
box.style.display="none";
this.isActive=false;
}
function hideColorPickerAll()
{
for(var i=0;i<arrColorPickerObjects.length;i++)
{
var box=eval("dropColor"+eval(arrColorPickerObjects[i]).oRenderName);
box.style.display="none";
eval(arrColorPickerObjects[i]).isActive=false;
}
}
function convertHexToDec(hex)
{
return parseInt(hex,16);
}
function convertDecToHex(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("0" +tmp);
return tmp;//.toUpperCase();
}
function convertDecToHex2(dec)
{
var tmp = parseInt(dec).toString(16);
if(tmp.length == 1) tmp = ("00000" +tmp);
if(tmp.length == 2) tmp = ("0000" +tmp);
if(tmp.length == 3) tmp = ("000" +tmp);
if(tmp.length == 4) tmp = ("00" +tmp);
if(tmp.length == 5) tmp = ("0" +tmp);
tmp = tmp.substr(4,1) + tmp.substr(5,1) + tmp.substr(2,1) + tmp.substr(3,1) + tmp.substr(0,1) + tmp.substr(1,1)
return tmp;//.toUpperCase();
}
//input color in format rgb(R,G,B)
//ex, return by document.queryCommandValue(forcolor)
function extractRGBColor(col) {
var re = /rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/i;
if (re.test(col)) {
var result = re.exec(col);
return convertDecToHex(parseInt(result[1])) +
convertDecToHex(parseInt(result[2])) +
convertDecToHex(parseInt(result[3]));
}
return convertDecToHex2(0);
} | JavaScript |
function getTxt(s)
{
switch(s)
{
case "Folder already exists.": return "Folder already exists.";
case "Folder created.": return "Folder created.";
case "Invalid input.": return "Invalid input.";
}
}
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "New Folder Name";
document.getElementById("btnCloseAndRefresh").value = "close & refresh";
document.getElementById("btnCreate").value = "create";
}
function writeTitle()
{
document.write("<title>Create Folder</title>")
}
| JavaScript |
function loadTxt()
{
document.getElementById("txtLang").innerHTML = "Are you sure you want to delete this folder?";
document.getElementById("btnClose").value = "close";
document.getElementById("btnDelete").value = "delete";
}
function writeTitle()
{
document.write("<title>Delete Folder</title>")
}
| JavaScript |
function getTxt(s)
{
switch(s)
{
case "Cannot delete Asset Base Folder.":return "Cannot delete Asset Base Folder.";
case "Delete this file ?":return "Delete this file ?";
case "Uploading...":return "Uploading...";
case "File already exists. Do you want to replace it?":return "File already exists. Do you want to replace it?";
case "Files": return "Files";
case "del": return "del";
case "Empty...": return "Empty...";
}
}
function loadTxt()
{
var txtLang = document.getElementsByName("txtLang");
txtLang[0].innerHTML = "New Folder";
txtLang[1].innerHTML = "Del Folder";
txtLang[2].innerHTML = "Upload File";
var optLang = document.getElementsByName("optLang");
optLang[0].text = "All Files";
optLang[1].text = "Media";
optLang[2].text = "Images";
optLang[3].text = "Flash";
document.getElementById("btnOk").value = " ok ";
document.getElementById("btnUpload").value = "upload";
}
function writeTitle()
{
document.write("<title>Asset manager</title>")
} | JavaScript |
function getTxt(s)
{
switch(s)
{
case "Folder deleted.": return "Folder deleted.";
case "Folder does not exist.": return "Folder does not exist.";
case "Cannot delete Asset Base Folder.": return "Cannot delete Asset Base Folder.";
}
}
function loadTxt()
{
document.getElementById("btnCloseAndRefresh").value = "close & refresh";
}
function writeTitle()
{
document.write("<title>Delete Folder</title>")
} | JavaScript |
/**
* AJAX Upload ( http://valums.com/ajax-upload/ )
* Copyright (c) Andrew Valums
* Licensed under the MIT license
*/
(function () {
/**
* Attaches event to a dom element.
* @param {Element} el
* @param type event name
* @param fn callback This refers to the passed element
*/
function addEvent(el, type, fn){
if (el.addEventListener) {
el.addEventListener(type, fn, false);
} else if (el.attachEvent) {
el.attachEvent('on' + type, function(){
fn.call(el);
});
} else {
throw new Error('not supported or DOM not loaded');
}
}
/**
* Attaches resize event to a window, limiting
* number of event fired. Fires only when encounteres
* delay of 100 after series of events.
*
* Some browsers fire event multiple times when resizing
* http://www.quirksmode.org/dom/events/resize.html
*
* @param fn callback This refers to the passed element
*/
function addResizeEvent(fn){
var timeout;
addEvent(window, 'resize', function(){
if (timeout){
clearTimeout(timeout);
}
timeout = setTimeout(fn, 100);
});
}
// Needs more testing, will be rewriten for next version
// getOffset function copied from jQuery lib (http://jquery.com/)
if (document.documentElement.getBoundingClientRect){
// Get Offset using getBoundingClientRect
// http://ejohn.org/blog/getboundingclientrect-is-awesome/
var getOffset = function(el){
var box = el.getBoundingClientRect();
var doc = el.ownerDocument;
var body = doc.body;
var docElem = doc.documentElement; // for ie
var clientTop = docElem.clientTop || body.clientTop || 0;
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
// In Internet Explorer 7 getBoundingClientRect property is treated as physical,
// while others are logical. Make all logical, like in IE8.
var zoom = 1;
if (body.getBoundingClientRect) {
var bound = body.getBoundingClientRect();
zoom = (bound.right - bound.left) / body.clientWidth;
}
if (zoom > 1) {
clientTop = 0;
clientLeft = 0;
}
var top = box.top / zoom + (window.pageYOffset || docElem && docElem.scrollTop / zoom || body.scrollTop / zoom) - clientTop, left = box.left / zoom + (window.pageXOffset || docElem && docElem.scrollLeft / zoom || body.scrollLeft / zoom) - clientLeft;
return {
top: top,
left: left
};
};
} else {
// Get offset adding all offsets
var getOffset = function(el){
var top = 0, left = 0;
do {
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
el = el.offsetParent;
} while (el);
return {
left: left,
top: top
};
};
}
/**
* Returns left, top, right and bottom properties describing the border-box,
* in pixels, with the top-left relative to the body
* @param {Element} el
* @return {Object} Contains left, top, right,bottom
*/
function getBox(el){
var left, right, top, bottom;
var offset = getOffset(el);
left = offset.left;
top = offset.top;
right = left + el.offsetWidth;
bottom = top + el.offsetHeight;
return {
left: left,
right: right,
top: top,
bottom: bottom
};
}
/**
* Helper that takes object literal
* and add all properties to element.style
* @param {Element} el
* @param {Object} styles
*/
function addStyles(el, styles){
for (var name in styles) {
if (styles.hasOwnProperty(name)) {
el.style[name] = styles[name];
}
}
}
/**
* Function places an absolutely positioned
* element on top of the specified element
* copying position and dimentions.
* @param {Element} from
* @param {Element} to
*/
function copyLayout(from, to){
var box = getBox(from);
addStyles(to, {
position: 'absolute',
left : box.left + 'px',
top : box.top + 'px',
width : from.offsetWidth + 'px',
height : from.offsetHeight + 'px'
});
}
/**
* Creates and returns element from html chunk
* Uses innerHTML to create an element
*/
var toElement = (function(){
var div = document.createElement('div');
return function(html){
div.innerHTML = html;
var el = div.firstChild;
return div.removeChild(el);
};
})();
/**
* Function generates unique id
* @return unique id
*/
var getUID = (function(){
var id = 0;
return function(){
return 'ValumsAjaxUpload' + id++;
};
})();
/**
* Get file name from path
* @param {String} file path to file
* @return filename
*/
function fileFromPath(file){
return file.replace(/.*(\/|\\)/, "");
}
/**
* Get file extension lowercase
* @param {String} file name
* @return file extenstion
*/
function getExt(file){
return (-1 !== file.indexOf('.')) ? file.replace(/.*[.]/, '') : '';
}
function hasClass(el, name){
var re = new RegExp('\\b' + name + '\\b');
return re.test(el.className);
}
function addClass(el, name){
if ( ! hasClass(el, name)){
el.className += ' ' + name;
}
}
function removeClass(el, name){
var re = new RegExp('\\b' + name + '\\b');
el.className = el.className.replace(re, '');
}
function removeNode(el){
el.parentNode.removeChild(el);
}
/**
* Easy styling and uploading
* @constructor
* @param button An element you want convert to
* upload button. Tested dimentions up to 500x500px
* @param {Object} options See defaults below.
*/
window.AjaxUpload = function(button, options){
this._settings = {
// Location of the server-side upload script
action: 'upload.php',
// File upload name
name: 'userfile',
// Select & upload multiple files at once FF3.6+, Chrome 4+
multiple: false,
// Additional data to send
data: {},
// Submit file as soon as it's selected
autoSubmit: true,
// The type of data that you're expecting back from the server.
// html and xml are detected automatically.
// Only useful when you are using json data as a response.
// Set to "json" in that case.
responseType: false,
// Class applied to button when mouse is hovered
hoverClass: 'hover',
// Class applied to button when button is focused
focusClass: 'focus',
// Class applied to button when AU is disabled
disabledClass: 'disabled',
// When user selects a file, useful with autoSubmit disabled
// You can return false to cancel upload
onChange: function(file, extension){
},
// Callback to fire before file is uploaded
// You can return false to cancel upload
onSubmit: function(file, extension){
},
// Fired when file upload is completed
// WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
onComplete: function(file, response){
}
};
// Merge the users options with our defaults
for (var i in options) {
if (options.hasOwnProperty(i)){
this._settings[i] = options[i];
}
}
// button isn't necessary a dom element
if (button.jquery){
// jQuery object was passed
button = button[0];
} else if (typeof button == "string") {
if (/^#.*/.test(button)){
// If jQuery user passes #elementId don't break it
button = button.slice(1);
}
button = document.getElementById(button);
}
if ( ! button || button.nodeType !== 1){
throw new Error("Please make sure that you're passing a valid element");
}
if ( button.nodeName.toUpperCase() == 'A'){
// disable link
addEvent(button, 'click', function(e){
if (e && e.preventDefault){
e.preventDefault();
} else if (window.event){
window.event.returnValue = false;
}
});
}
// DOM element
this._button = button;
// DOM element
this._input = null;
// If disabled clicking on button won't do anything
this._disabled = false;
// if the button was disabled before refresh if will remain
// disabled in FireFox, let's fix it
this.enable();
this._rerouteClicks();
};
// assigning methods to our class
AjaxUpload.prototype = {
setData: function(data){
this._settings.data = data;
},
disable: function(){
addClass(this._button, this._settings.disabledClass);
this._disabled = true;
var nodeName = this._button.nodeName.toUpperCase();
if (nodeName == 'INPUT' || nodeName == 'BUTTON'){
this._button.setAttribute('disabled', 'disabled');
}
// hide input
if (this._input){
if (this._input.parentNode) {
// We use visibility instead of display to fix problem with Safari 4
// The problem is that the value of input doesn't change if it
// has display none when user selects a file
this._input.parentNode.style.visibility = 'hidden';
}
}
},
enable: function(){
removeClass(this._button, this._settings.disabledClass);
this._button.removeAttribute('disabled');
this._disabled = false;
},
/**
* Creates invisible file input
* that will hover above the button
* <div><input type='file' /></div>
*/
_createInput: function(){
var self = this;
var input = document.createElement("input");
input.setAttribute('type', 'file');
input.setAttribute('name', this._settings.name);
if(this._settings.multiple) input.setAttribute('multiple', 'multiple');
addStyles(input, {
'position' : 'absolute',
// in Opera only 'browse' button
// is clickable and it is located at
// the right side of the input
'right' : 0,
'margin' : 0,
'padding' : 0,
'fontSize' : '480px',
// in Firefox if font-family is set to
// 'inherit' the input doesn't work
'fontFamily' : 'sans-serif',
'cursor' : 'pointer'
});
var div = document.createElement("div");
addStyles(div, {
'display' : 'block',
'position' : 'absolute',
'overflow' : 'hidden',
'margin' : 0,
'padding' : 0,
'opacity' : 0,
// Make sure browse button is in the right side
// in Internet Explorer
'direction' : 'ltr',
//Max zIndex supported by Opera 9.0-9.2
'zIndex': 2147483583
});
// Make sure that element opacity exists.
// Otherwise use IE filter
if ( div.style.opacity !== "0") {
if (typeof(div.filters) == 'undefined'){
throw new Error('Opacity not supported by the browser');
}
div.style.filter = "alpha(opacity=0)";
}
addEvent(input, 'change', function(){
if ( ! input || input.value === ''){
return;
}
// Get filename from input, required
// as some browsers have path instead of it
var file = fileFromPath(input.value);
if (false === self._settings.onChange.call(self, file, getExt(file))){
self._clearInput();
return;
}
// Submit form when value is changed
if (self._settings.autoSubmit) {
self.submit();
}
});
addEvent(input, 'mouseover', function(){
addClass(self._button, self._settings.hoverClass);
});
addEvent(input, 'mouseout', function(){
removeClass(self._button, self._settings.hoverClass);
removeClass(self._button, self._settings.focusClass);
if (input.parentNode) {
// We use visibility instead of display to fix problem with Safari 4
// The problem is that the value of input doesn't change if it
// has display none when user selects a file
input.parentNode.style.visibility = 'hidden';
}
});
addEvent(input, 'focus', function(){
addClass(self._button, self._settings.focusClass);
});
addEvent(input, 'blur', function(){
removeClass(self._button, self._settings.focusClass);
});
div.appendChild(input);
document.body.appendChild(div);
this._input = input;
},
_clearInput : function(){
if (!this._input){
return;
}
// this._input.value = ''; Doesn't work in IE6
removeNode(this._input.parentNode);
this._input = null;
this._createInput();
removeClass(this._button, this._settings.hoverClass);
removeClass(this._button, this._settings.focusClass);
},
/**
* Function makes sure that when user clicks upload button,
* the this._input is clicked instead
*/
_rerouteClicks: function(){
var self = this;
// IE will later display 'access denied' error
// if you use using self._input.click()
// other browsers just ignore click()
addEvent(self._button, 'mouseover', function(){
if (self._disabled){
return;
}
if ( ! self._input){
self._createInput();
}
var div = self._input.parentNode;
copyLayout(self._button, div);
div.style.visibility = 'visible';
});
// commented because we now hide input on mouseleave
/**
* When the window is resized the elements
* can be misaligned if button position depends
* on window size
*/
//addResizeEvent(function(){
// if (self._input){
// copyLayout(self._button, self._input.parentNode);
// }
//});
},
/**
* Creates iframe with unique name
* @return {Element} iframe
*/
_createIframe: function(){
// We can't use getTime, because it sometimes return
// same value in safari :(
var id = getUID();
// We can't use following code as the name attribute
// won't be properly registered in IE6, and new window
// on form submit will open
// var iframe = document.createElement('iframe');
// iframe.setAttribute('name', id);
var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
// src="javascript:false; was added
// because it possibly removes ie6 prompt
// "This page contains both secure and nonsecure items"
// Anyway, it doesn't do any harm.
iframe.setAttribute('id', id);
iframe.style.display = 'none';
document.body.appendChild(iframe);
return iframe;
},
/**
* Creates form, that will be submitted to iframe
* @param {Element} iframe Where to submit
* @return {Element} form
*/
_createForm: function(iframe){
var settings = this._settings;
// We can't use the following code in IE6
// var form = document.createElement('form');
// form.setAttribute('method', 'post');
// form.setAttribute('enctype', 'multipart/form-data');
// Because in this case file won't be attached to request
var form = toElement('<form method="post" enctype="multipart/form-data"></form>');
form.setAttribute('action', settings.action);
form.setAttribute('target', iframe.name);
form.style.display = 'none';
document.body.appendChild(form);
// Create hidden input element for each data key
for (var prop in settings.data) {
if (settings.data.hasOwnProperty(prop)){
var el = document.createElement("input");
el.setAttribute('type', 'hidden');
el.setAttribute('name', prop);
el.setAttribute('value', settings.data[prop]);
form.appendChild(el);
}
}
return form;
},
/**
* Gets response from iframe and fires onComplete event when ready
* @param iframe
* @param file Filename to use in onComplete callback
*/
_getResponse : function(iframe, file){
// getting response
var toDeleteFlag = false, self = this, settings = this._settings;
addEvent(iframe, 'load', function(){
if (// For Safari
iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
// For FF, IE
iframe.src == "javascript:'<html></html>';"){
// First time around, do not delete.
// We reload to blank page, so that reloading main page
// does not re-submit the post.
if (toDeleteFlag) {
// Fix busy state in FF3
setTimeout(function(){
removeNode(iframe);
}, 0);
}
return;
}
var doc = iframe.contentDocument ? iframe.contentDocument : window.frames[iframe.id].document;
// fixing Opera 9.26,10.00
if (doc.readyState && doc.readyState != 'complete') {
// Opera fires load event multiple times
// Even when the DOM is not ready yet
// this fix should not affect other browsers
return;
}
// fixing Opera 9.64
if (doc.body && doc.body.innerHTML == "false") {
// In Opera 9.64 event was fired second time
// when body.innerHTML changed from false
// to server response approx. after 1 sec
return;
}
var response;
if (doc.XMLDocument) {
// response is a xml document Internet Explorer property
response = doc.XMLDocument;
} else if (doc.body){
// response is html document or plain text
response = doc.body.innerHTML;
if (settings.responseType && settings.responseType.toLowerCase() == 'json') {
// If the document was sent as 'application/javascript' or
// 'text/javascript', then the browser wraps the text in a <pre>
// tag and performs html encoding on the contents. In this case,
// we need to pull the original text content from the text node's
// nodeValue property to retrieve the unmangled content.
// Note that IE6 only understands text/html
if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE') {
doc.normalize();
response = doc.body.firstChild.firstChild.nodeValue;
}
if (response) {
response = eval("(" + response + ")");
} else {
response = {};
}
}
} else {
// response is a xml document
response = doc;
}
settings.onComplete.call(self, file, response);
// Reload blank page, so that reloading main page
// does not re-submit the post. Also, remember to
// delete the frame
toDeleteFlag = true;
// Fix IE mixed content issue
iframe.src = "javascript:'<html></html>';";
});
},
/**
* Upload file contained in this._input
*/
submit: function(){
var self = this, settings = this._settings;
if ( ! this._input || this._input.value === ''){
return;
}
var file = fileFromPath(this._input.value);
// user returned false to cancel upload
if (false === settings.onSubmit.call(this, file, getExt(file))){
this._clearInput();
return;
}
// sending request
var iframe = this._createIframe();
var form = this._createForm(iframe);
// assuming following structure
// div -> input type='file'
removeNode(this._input.parentNode);
removeClass(self._button, self._settings.hoverClass);
removeClass(self._button, self._settings.focusClass);
form.appendChild(this._input);
form.submit();
// request set, clean up
removeNode(form); form = null;
removeNode(this._input); this._input = null;
// Get response from iframe and fire onComplete event when ready
this._getResponse(iframe, file);
// get ready for next request
this._createInput();
}
};
})();
| JavaScript |
/*
* jqFloat.js - jQuery plugin
* A Floating Effect with jQuery!
*
* Name: jqFloat.js
* Author: Kenny Ooi - http://www.inwebson.com
* Date: March 21, 2012
* Version: 1.0
* Example: http://www.inwebson.com/demo/jqfloat/
*
*/
(function($) {
//plugin methods
var methods = {
init : function(options) { //object initialize
//console.log('init');
return this.each(function() {
//define element data
$(this).data('jSetting', $.extend({}, $.fn.jqFloat.defaults, options));
$(this).data('jDefined', true);
//create wrapper
var wrapper = $('<div/>').css({
'width': $(this).outerWidth(true),
'height': $(this).outerHeight(true),
'z-index': $(this).css('zIndex')
});
//alert($(this).position().top);
if($(this).css('position') == 'absolute')
wrapper.css({
'position': 'absolute',
'top': $(this).position().top,
'left': $(this).position().left
});
else
wrapper.css({
'float': $(this).css('float'),
'position': 'relative'
});
//check for margin auto solution
if (($(this).css('marginLeft') == '0px' || $(this).css('marginLeft') == 'auto') && $(this).position().left > 0 && $(this).css('position') != 'absolute') {
wrapper.css({
'marginLeft': $(this).position().left
});
}
$(this).wrap(wrapper).css({
'position': 'absolute',
'top': 0,
'left': 0
});
//call play method
//methods.play.apply($(this));
});
},
update : function(options) {
$(this).data('jSetting', $.extend({}, $.fn.jqFloat.defaults, options));
},
play : function() { //start floating
if(!$(this).data('jFloating')) {
//console.log('play');
$(this).data('jFloating', true);
//alert(this.attr('id'));
floating(this);
}
},
stop : function() { //stop floating
//console.log('stop');
this.data('jFloating', false);
}
}
//private methods
var floating = function(obj) {
//generate random position
var setting = $(obj).data('jSetting');
var newX = Math.floor(Math.random()*setting.width) - setting.width/2;
var newY = Math.floor(Math.random()*setting.height) - setting.height/2 - setting.minHeight;
var spd = Math.floor(Math.random()*setting.speed) + setting.speed/2;
//inifnity loop XD
$(obj).stop().animate({
'top': newY,
'left': newX
}, spd, function() {
if ($(this).data('jFloating'))
floating(this);
else
$(this).animate({
'top': 0,
'left': 0
}, spd/2);
});
}
$.fn.jqFloat = function(method, options) {
var element = $(this);
if ( methods[method] ) {
if(element.data('jDefined')) {
//reset settings
if (options && typeof options === 'object')
methods.update.apply(this, Array.prototype.slice.call( arguments, 1 ));
}
else
methods.init.apply(this, Array.prototype.slice.call( arguments, 1 ));
methods[method].apply(this);
} else if ( typeof method === 'object' || !method ) {
if(element.data('jDefined')) {
if(method)
methods.update.apply(this, arguments);
}
else
methods.init.apply(this, arguments);
methods.play.apply(this);
} else
$.error( 'Method ' + method + ' does not exist!' );
return this;
}
$.fn.jqFloat.defaults = {
width: 100,
height: 100,
speed: 1000,
minHeight: 0
}
})(jQuery); | JavaScript |
document.write('<script src="http://connect.facebook.net/en_US/all.js"></script>');
var FB_LoginUrl= 'http://www.facebook.com/dialog/oauth?client_id=699473966748067&redirect_uri=http://www.c2life.com.vn/contest/OpenId&response_type=token&display=popup&scope=email,manage_pages,photo_upload,publish_actions,publish_stream,read_friendlists,status_update,user_birthday,user_photos,user_status,video_upload';
var windowInvite;
function FB_LOGIN(){
window.open(FB_LoginUrl,'_blank','width=750,height=450,status=no,toolbar=no,menubar=no,location=no');
}
function fbLogin(){
var obj = swfobject.getObjectById("swfcontent");
if(obj && obj.loginSuccess) {
obj.loginSuccess();
}
}
function login_openid(type){
$.post(root+'users/link_login/'+type,function(data){
window.open (data,type+'_login','menubar=0,resizable=1,width=600,height=500');
});
}
function track(trackName){
_gaq.push(['_trackPageview', trackName]);
}
function logText()
{
console.log('abc');
}
function checkFirstTime(){
var obj = swfobject.getObjectById("swfcontent");
if(obj && obj.checkFirstTime) {
obj.checkFirstTime();
}
}
function open_Popup_thanhcong(type){
var obj = swfobject.getObjectById("swfcontent");
if(obj && obj.open_Popup_Thongbao) {
obj.open_Popup_Thongbao(type);
}
}
function close_Popup(type){
$("#video").remove();
type = type || '';
var obj = swfobject.getObjectById("swfcontent");
if(obj && obj.close_Popup) {
obj.close_Popup(type);
}
}
function share_facebook(u,t,s,img) {
var url="http://www.facebook.com/sharer.php?s=100&p[title]="+encodeURIComponent(t)+"&p[url]="+encodeURIComponent(u)+"&p[summary]="+encodeURIComponent(s)+"&p[images][0]="+encodeURIComponent(img);
window.open(url);
return false;
}
| JavaScript |
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/
(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); | JavaScript |
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
* Requires: jQuery v1.3+
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
;(function($) {
var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
loadingTimer, loadingFrame = 1,
titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
/*
* Private methods
*/
_abort = function() {
loading.hide();
imgPreloader.onerror = imgPreloader.onload = null;
if (ajaxLoader) {
ajaxLoader.abort();
}
tmp.empty();
},
_error = function() {
if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
loading.hide();
busy = false;
return;
}
selectedOpts.titleShow = false;
selectedOpts.width = 'auto';
selectedOpts.height = 'auto';
tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
_process_inline();
},
_start = function() {
var obj = selectedArray[ selectedIndex ],
href,
type,
title,
str,
emb,
ret;
_abort();
selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
if (ret === false) {
busy = false;
return;
} else if (typeof ret == 'object') {
selectedOpts = $.extend(selectedOpts, ret);
}
title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
if (obj.nodeName && !selectedOpts.orig) {
selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
}
if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
title = selectedOpts.orig.attr('alt');
}
href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
if ((/^(?:javascript)/i).test(href) || href == '#') {
href = null;
}
if (selectedOpts.type) {
type = selectedOpts.type;
if (!href) {
href = selectedOpts.content;
}
} else if (selectedOpts.content) {
type = 'html';
} else if (href) {
if (href.match(imgRegExp)) {
type = 'image';
} else if (href.match(swfRegExp)) {
type = 'swf';
} else if ($(obj).hasClass("iframe")) {
type = 'iframe';
} else if (href.indexOf("#") === 0) {
type = 'inline';
} else {
type = 'ajax';
}
}
if (!type) {
_error();
return;
}
if (type == 'inline') {
obj = href.substr(href.indexOf("#"));
type = $(obj).length > 0 ? 'inline' : 'ajax';
}
selectedOpts.type = type;
selectedOpts.href = href;
selectedOpts.title = title;
if (selectedOpts.autoDimensions) {
if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
selectedOpts.width = 'auto';
selectedOpts.height = 'auto';
} else {
selectedOpts.autoDimensions = false;
}
}
if (selectedOpts.modal) {
selectedOpts.overlayShow = true;
selectedOpts.hideOnOverlayClick = false;
selectedOpts.hideOnContentClick = false;
selectedOpts.enableEscapeButton = false;
selectedOpts.showCloseButton = false;
}
selectedOpts.padding = parseInt(selectedOpts.padding, 10);
selectedOpts.margin = parseInt(selectedOpts.margin, 10);
tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
$('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
$(this).replaceWith(content.children());
});
switch (type) {
case 'html' :
tmp.html( selectedOpts.content );
_process_inline();
break;
case 'inline' :
if ( $(obj).parent().is('#fancybox-content') === true) {
busy = false;
return;
}
$('<div class="fancybox-inline-tmp" />')
.hide()
.insertBefore( $(obj) )
.bind('fancybox-cleanup', function() {
$(this).replaceWith(content.children());
}).bind('fancybox-cancel', function() {
$(this).replaceWith(tmp.children());
});
$(obj).appendTo(tmp);
_process_inline();
break;
case 'image':
busy = false;
$.fancybox.showActivity();
imgPreloader = new Image();
imgPreloader.onerror = function() {
_error();
};
imgPreloader.onload = function() {
busy = true;
imgPreloader.onerror = imgPreloader.onload = null;
_process_image();
};
imgPreloader.src = href;
break;
case 'swf':
selectedOpts.scrolling = 'no';
str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
emb = '';
$.each(selectedOpts.swf, function(name, val) {
str += '<param name="' + name + '" value="' + val + '"></param>';
emb += ' ' + name + '="' + val + '"';
});
str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
tmp.html(str);
_process_inline();
break;
case 'ajax':
busy = false;
$.fancybox.showActivity();
selectedOpts.ajax.win = selectedOpts.ajax.success;
ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
url : href,
data : selectedOpts.ajax.data || {},
error : function(XMLHttpRequest, textStatus, errorThrown) {
if ( XMLHttpRequest.status > 0 ) {
_error();
}
},
success : function(data, textStatus, XMLHttpRequest) {
var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
if (o.status == 200) {
if ( typeof selectedOpts.ajax.win == 'function' ) {
ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
if (ret === false) {
loading.hide();
return;
} else if (typeof ret == 'string' || typeof ret == 'object') {
data = ret;
}
}
tmp.html( data );
_process_inline();
}
}
}));
break;
case 'iframe':
_show();
break;
}
},
_process_inline = function() {
var
w = selectedOpts.width,
h = selectedOpts.height;
if (w.toString().indexOf('%') > -1) {
w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
} else {
w = w == 'auto' ? 'auto' : w + 'px';
}
if (h.toString().indexOf('%') > -1) {
h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
} else {
h = h == 'auto' ? 'auto' : h + 'px';
}
tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
selectedOpts.width = tmp.width();
selectedOpts.height = tmp.height();
_show();
},
_process_image = function() {
selectedOpts.width = imgPreloader.width;
selectedOpts.height = imgPreloader.height;
$("<img />").attr({
'id' : 'fancybox-img',
'src' : imgPreloader.src,
'alt' : selectedOpts.title
}).appendTo( tmp );
_show();
},
_show = function() {
var pos, equal;
loading.hide();
if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
$.event.trigger('fancybox-cancel');
busy = false;
return;
}
busy = true;
$(content.add( overlay )).unbind();
$(window).unbind("resize.fb scroll.fb");
$(document).unbind('keydown.fb');
if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
wrap.css('height', wrap.height());
}
currentArray = selectedArray;
currentIndex = selectedIndex;
currentOpts = selectedOpts;
if (currentOpts.overlayShow) {
overlay.css({
'background-color' : currentOpts.overlayColor,
'opacity' : currentOpts.overlayOpacity,
'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
'height' : $(document).height()
});
if (!overlay.is(':visible')) {
if (isIE6) {
$('select:not(#fancybox-tmp select)').filter(function() {
return this.style.visibility !== 'hidden';
}).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
this.style.visibility = 'inherit';
});
}
overlay.show();
}
} else {
overlay.hide();
}
final_pos = _get_zoom_to();
_process_title();
if (wrap.is(":visible")) {
$( close.add( nav_left ).add( nav_right ) ).hide();
pos = wrap.position(),
start_pos = {
top : pos.top,
left : pos.left,
width : wrap.width(),
height : wrap.height()
};
equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
content.fadeTo(currentOpts.changeFade, 0.3, function() {
var finish_resizing = function() {
content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
};
$.event.trigger('fancybox-change');
content
.empty()
.removeAttr('filter')
.css({
'border-width' : currentOpts.padding,
'width' : final_pos.width - currentOpts.padding * 2,
'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
});
if (equal) {
finish_resizing();
} else {
fx.prop = 0;
$(fx).animate({prop: 1}, {
duration : currentOpts.changeSpeed,
easing : currentOpts.easingChange,
step : _draw,
complete : finish_resizing
});
}
});
return;
}
wrap.removeAttr("style");
content.css('border-width', currentOpts.padding);
if (currentOpts.transitionIn == 'elastic') {
start_pos = _get_zoom_from();
content.html( tmp.contents() );
wrap.show();
if (currentOpts.opacity) {
final_pos.opacity = 0;
}
fx.prop = 0;
$(fx).animate({prop: 1}, {
duration : currentOpts.speedIn,
easing : currentOpts.easingIn,
step : _draw,
complete : _finish
});
return;
}
if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
title.show();
}
content
.css({
'width' : final_pos.width - currentOpts.padding * 2,
'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
})
.html( tmp.contents() );
wrap
.css(final_pos)
.fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
},
_format_title = function(title) {
if (title && title.length) {
if (currentOpts.titlePosition == 'float') {
return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
}
return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
}
return false;
},
_process_title = function() {
titleStr = currentOpts.title || '';
titleHeight = 0;
title
.empty()
.removeAttr('style')
.removeClass();
if (currentOpts.titleShow === false) {
title.hide();
return;
}
titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
if (!titleStr || titleStr === '') {
title.hide();
return;
}
title
.addClass('fancybox-title-' + currentOpts.titlePosition)
.html( titleStr )
.appendTo( 'body' )
.show();
switch (currentOpts.titlePosition) {
case 'inside':
title
.css({
'width' : final_pos.width - (currentOpts.padding * 2),
'marginLeft' : currentOpts.padding,
'marginRight' : currentOpts.padding
});
titleHeight = title.outerHeight(true);
title.appendTo( outer );
final_pos.height += titleHeight;
break;
case 'over':
title
.css({
'marginLeft' : currentOpts.padding,
'width' : final_pos.width - (currentOpts.padding * 2),
'bottom' : currentOpts.padding
})
.appendTo( outer );
break;
case 'float':
title
.css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
.appendTo( wrap );
break;
default:
title
.css({
'width' : final_pos.width - (currentOpts.padding * 2),
'paddingLeft' : currentOpts.padding,
'paddingRight' : currentOpts.padding
})
.appendTo( wrap );
break;
}
title.hide();
},
_set_navigation = function() {
if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
$(document).bind('keydown.fb', function(e) {
if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
e.preventDefault();
$.fancybox.close();
} else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
e.preventDefault();
$.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
}
});
}
if (!currentOpts.showNavArrows) {
nav_left.hide();
nav_right.hide();
return;
}
if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
nav_left.show();
}
if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
nav_right.show();
}
},
_finish = function () {
if (!$.support.opacity) {
content.get(0).style.removeAttribute('filter');
wrap.get(0).style.removeAttribute('filter');
}
if (selectedOpts.autoDimensions) {
content.css('height', 'auto');
}
wrap.css('height', 'auto');
if (titleStr && titleStr.length) {
title.show();
}
if (currentOpts.showCloseButton) {
close.show();
}
_set_navigation();
if (currentOpts.hideOnContentClick) {
content.bind('click', $.fancybox.close);
}
if (currentOpts.hideOnOverlayClick) {
overlay.bind('click', $.fancybox.close);
}
$(window).bind("resize.fb", $.fancybox.resize);
if (currentOpts.centerOnScroll) {
$(window).bind("scroll.fb", $.fancybox.center);
}
if (currentOpts.type == 'iframe') {
$('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
}
wrap.show();
busy = false;
$.fancybox.center();
currentOpts.onComplete(currentArray, currentIndex, currentOpts);
_preload_images();
},
_preload_images = function() {
var href,
objNext;
if ((currentArray.length -1) > currentIndex) {
href = currentArray[ currentIndex + 1 ].href;
if (typeof href !== 'undefined' && href.match(imgRegExp)) {
objNext = new Image();
objNext.src = href;
}
}
if (currentIndex > 0) {
href = currentArray[ currentIndex - 1 ].href;
if (typeof href !== 'undefined' && href.match(imgRegExp)) {
objNext = new Image();
objNext.src = href;
}
}
},
_draw = function(pos) {
var dim = {
width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
};
if (typeof final_pos.opacity !== 'undefined') {
dim.opacity = pos < 0.5 ? 0.5 : pos;
}
wrap.css(dim);
content.css({
'width' : dim.width - currentOpts.padding * 2,
'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
});
},
_get_viewport = function() {
return [
$(window).width() - (currentOpts.margin * 2),
$(window).height() - (currentOpts.margin * 2),
$(document).scrollLeft() + currentOpts.margin,
$(document).scrollTop() + currentOpts.margin
];
},
_get_zoom_to = function () {
var view = _get_viewport(),
to = {},
resize = currentOpts.autoScale,
double_padding = currentOpts.padding * 2,
ratio;
if (currentOpts.width.toString().indexOf('%') > -1) {
to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
} else {
to.width = currentOpts.width + double_padding;
}
if (currentOpts.height.toString().indexOf('%') > -1) {
to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
} else {
to.height = currentOpts.height + double_padding;
}
if (resize && (to.width > view[0] || to.height > view[1])) {
if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
ratio = (currentOpts.width ) / (currentOpts.height );
if ((to.width ) > view[0]) {
to.width = view[0];
to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
}
if ((to.height) > view[1]) {
to.height = view[1];
to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
}
} else {
to.width = Math.min(to.width, view[0]);
to.height = Math.min(to.height, view[1]);
}
}
to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
return to;
},
_get_obj_pos = function(obj) {
var pos = obj.offset();
pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
pos.width = obj.width();
pos.height = obj.height();
return pos;
},
_get_zoom_from = function() {
var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
from = {},
pos,
view;
if (orig && orig.length) {
pos = _get_obj_pos(orig);
from = {
width : pos.width + (currentOpts.padding * 2),
height : pos.height + (currentOpts.padding * 2),
top : pos.top - currentOpts.padding - 20,
left : pos.left - currentOpts.padding - 20
};
} else {
view = _get_viewport();
from = {
width : currentOpts.padding * 2,
height : currentOpts.padding * 2,
top : parseInt(view[3] + view[1] * 0.5, 10),
left : parseInt(view[2] + view[0] * 0.5, 10)
};
}
return from;
},
_animate_loading = function() {
if (!loading.is(':visible')){
clearInterval(loadingTimer);
return;
}
$('div', loading).css('top', (loadingFrame * -40) + 'px');
loadingFrame = (loadingFrame + 1) % 12;
};
/*
* Public methods
*/
$.fn.fancybox = function(options) {
if (!$(this).length) {
return this;
}
$(this)
.data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
.unbind('click.fb')
.bind('click.fb', function(e) {
e.preventDefault();
if (busy) {
return;
}
busy = true;
$(this).blur();
selectedArray = [];
selectedIndex = 0;
var rel = $(this).attr('rel') || '';
if (!rel || rel == '' || rel === 'nofollow') {
selectedArray.push(this);
} else {
selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
selectedIndex = selectedArray.index( this );
}
_start();
return;
});
return this;
};
$.fancybox = function(obj) {
var opts;
if (busy) {
return;
}
busy = true;
opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
selectedArray = [];
selectedIndex = parseInt(opts.index, 10) || 0;
if ($.isArray(obj)) {
for (var i = 0, j = obj.length; i < j; i++) {
if (typeof obj[i] == 'object') {
$(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
} else {
obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
}
}
selectedArray = jQuery.merge(selectedArray, obj);
} else {
if (typeof obj == 'object') {
$(obj).data('fancybox', $.extend({}, opts, obj));
} else {
obj = $({}).data('fancybox', $.extend({content : obj}, opts));
}
selectedArray.push(obj);
}
if (selectedIndex > selectedArray.length || selectedIndex < 0) {
selectedIndex = 0;
}
_start();
};
$.fancybox.showActivity = function() {
clearInterval(loadingTimer);
loading.show();
loadingTimer = setInterval(_animate_loading, 66);
};
$.fancybox.hideActivity = function() {
loading.hide();
};
$.fancybox.next = function() {
return $.fancybox.pos( currentIndex + 1);
};
$.fancybox.prev = function() {
return $.fancybox.pos( currentIndex - 1);
};
$.fancybox.pos = function(pos) {
if (busy) {
return;
}
pos = parseInt(pos);
selectedArray = currentArray;
if (pos > -1 && pos < currentArray.length) {
selectedIndex = pos;
_start();
} else if (currentOpts.cyclic && currentArray.length > 1) {
selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
_start();
}
return;
};
$.fancybox.cancel = function() {
if (busy) {
return;
}
busy = true;
$.event.trigger('fancybox-cancel');
_abort();
selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
busy = false;
};
// Note: within an iframe use - parent.$.fancybox.close();
$.fancybox.close = function() {
if (busy || wrap.is(':hidden')) {
return;
}
busy = true;
if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
busy = false;
return;
}
_abort();
$(close.add( nav_left ).add( nav_right )).hide();
$(content.add( overlay )).unbind();
$(window).unbind("resize.fb scroll.fb");
$(document).unbind('keydown.fb');
content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
if (currentOpts.titlePosition !== 'inside') {
title.empty();
}
wrap.stop();
function _cleanup() {
overlay.fadeOut('fast');
title.empty().hide();
wrap.hide();
$.event.trigger('fancybox-cleanup');
content.empty();
currentOpts.onClosed(currentArray, currentIndex, currentOpts);
currentArray = selectedOpts = [];
currentIndex = selectedIndex = 0;
currentOpts = selectedOpts = {};
busy = false;
}
if (currentOpts.transitionOut == 'elastic') {
start_pos = _get_zoom_from();
var pos = wrap.position();
final_pos = {
top : pos.top ,
left : pos.left,
width : wrap.width(),
height : wrap.height()
};
if (currentOpts.opacity) {
final_pos.opacity = 1;
}
title.empty().hide();
fx.prop = 1;
$(fx).animate({ prop: 0 }, {
duration : currentOpts.speedOut,
easing : currentOpts.easingOut,
step : _draw,
complete : _cleanup
});
} else {
wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
}
};
$.fancybox.resize = function() {
if (overlay.is(':visible')) {
overlay.css('height', $(document).height());
}
$.fancybox.center(true);
};
$.fancybox.center = function() {
var view, align;
if (busy) {
return;
}
align = arguments[0] === true ? 1 : 0;
view = _get_viewport();
if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
return;
}
wrap
.stop()
.animate({
'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
}, typeof arguments[0] == 'number' ? arguments[0] : 200);
};
$.fancybox.init = function() {
if ($("#fancybox-wrap").length) {
return;
}
$('body').append(
tmp = $('<div id="fancybox-tmp"></div>'),
loading = $('<div id="fancybox-loading"><div></div></div>'),
overlay = $('<div id="fancybox-overlay"></div>'),
wrap = $('<div id="fancybox-wrap"></div>')
);
outer = $('<div id="fancybox-outer"></div>')
.append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
.appendTo( wrap );
outer.append(
content = $('<div id="fancybox-content"></div>'),
close = $('<a id="fancybox-close"></a>'),
title = $('<div id="fancybox-title"></div>'),
nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
);
close.click($.fancybox.close);
loading.click($.fancybox.cancel);
nav_left.click(function(e) {
e.preventDefault();
$.fancybox.prev();
});
nav_right.click(function(e) {
e.preventDefault();
$.fancybox.next();
});
if ($.fn.mousewheel) {
wrap.bind('mousewheel.fb', function(e, delta) {
if (busy) {
e.preventDefault();
} else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
e.preventDefault();
$.fancybox[ delta > 0 ? 'prev' : 'next']();
}
});
}
if (!$.support.opacity) {
wrap.addClass('fancybox-ie');
}
if (isIE6) {
loading.addClass('fancybox-ie6');
wrap.addClass('fancybox-ie6');
$('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
}
};
$.fn.fancybox.defaults = {
padding : 10,
margin : 40,
opacity : false,
modal : false,
cyclic : false,
scrolling : 'auto', // 'auto', 'yes' or 'no'
width : 560,
height : 340,
autoScale : true,
autoDimensions : true,
centerOnScroll : false,
ajax : {},
swf : { wmode: 'transparent' },
hideOnOverlayClick : true,
hideOnContentClick : false,
overlayShow : true,
overlayOpacity : 0.7,
overlayColor : '#777',
titleShow : true,
titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
titleFormat : null,
titleFromAlt : false,
transitionIn : 'fade', // 'elastic', 'fade' or 'none'
transitionOut : 'fade', // 'elastic', 'fade' or 'none'
speedIn : 300,
speedOut : 300,
changeSpeed : 300,
changeFade : 'fast',
easingIn : 'swing',
easingOut : 'swing',
showCloseButton : true,
showNavArrows : true,
enableEscapeButton : true,
enableKeyboardNav : true,
onStart : function(){},
onCancel : function(){},
onComplete : function(){},
onCleanup : function(){},
onClosed : function(){},
onError : function(){}
};
$(document).ready(function() {
$.fancybox.init();
});
})(jQuery); | JavaScript |
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
| JavaScript |
/*
VideoJS - HTML5 Video Player
v2.0.2
This file is part of VideoJS. Copyright 2010 Zencoder, Inc.
VideoJS is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VideoJS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with VideoJS. If not, see <http://www.gnu.org/licenses/>.
*/
// Self-executing function to prevent global vars and help with minification
(function(window, undefined){
var document = window.document;
// Using jresig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
(function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; this.JRClass = function(){}; JRClass.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function JRClass() { if ( !initializing && this.init ) this.init.apply(this, arguments); } JRClass.prototype = prototype; JRClass.constructor = JRClass; JRClass.extend = arguments.callee; return JRClass;};})();
// Video JS Player Class
var VideoJS = JRClass.extend({
// Initialize the player for the supplied video tag element
// element: video tag
init: function(element, setOptions){
// Allow an ID string or an element
if (typeof element == 'string') {
this.video = document.getElementById(element);
} else {
this.video = element;
}
// Store reference to player on the video element.
// So you can acess the player later: document.getElementById("video_id").player.play();
this.video.player = this;
this.values = {}; // Cache video values.
this.elements = {}; // Store refs to controls elements.
// Default Options
this.options = {
autoplay: false,
preload: true,
useBuiltInControls: false, // Use the browser's controls (iPhone)
controlsBelow: false, // Display control bar below video vs. in front of
controlsAtStart: false, // Make controls visible when page loads
controlsHiding: true, // Hide controls when not over the video
defaultVolume: 0.85, // Will be overridden by localStorage volume if available
playerFallbackOrder: ["html5", "flash", "links"], // Players and order to use them
flashPlayer: "htmlObject",
flashPlayerVersion: false // Required flash version for fallback
};
// Override default options with global options
if (typeof VideoJS.options == "object") { _V_.merge(this.options, VideoJS.options); }
// Override default & global options with options specific to this player
if (typeof setOptions == "object") { _V_.merge(this.options, setOptions); }
// Override preload & autoplay with video attributes
if (this.getPreloadAttribute() !== undefined) { this.options.preload = this.getPreloadAttribute(); }
if (this.getAutoplayAttribute() !== undefined) { this.options.autoplay = this.getAutoplayAttribute(); }
// Store reference to embed code pieces
this.box = this.video.parentNode;
this.linksFallback = this.getLinksFallback();
this.hideLinksFallback(); // Will be shown again if "links" player is used
// Loop through the player names list in options, "html5" etc.
// For each player name, initialize the player with that name under VideoJS.players
// If the player successfully initializes, we're done
// If not, try the next player in the list
this.each(this.options.playerFallbackOrder, function(playerType){
if (this[playerType+"Supported"]()) { // Check if player type is supported
this[playerType+"Init"](); // Initialize player type
return true; // Stop looping though players
}
});
// Start Global Listeners - API doesn't exist before now
this.activateElement(this, "player");
this.activateElement(this.box, "box");
},
/* Behaviors
================================================================================ */
behaviors: {},
newBehavior: function(name, activate, functions){
this.behaviors[name] = activate;
this.extend(functions);
},
activateElement: function(element, behavior){
// Allow passing and ID string
if (typeof element == "string") { element = document.getElementById(element); }
this.behaviors[behavior].call(this, element);
},
/* Errors/Warnings
================================================================================ */
errors: [], // Array to track errors
warnings: [],
warning: function(warning){
this.warnings.push(warning);
this.log(warning);
},
/* History of errors/events (not quite there yet)
================================================================================ */
history: [],
log: function(event){
if (!event) { return; }
if (typeof event == "string") { event = { type: event }; }
if (event.type) { this.history.push(event.type); }
if (this.history.length >= 50) { this.history.shift(); }
try { console.log(event.type); } catch(e) { try { opera.postError(event.type); } catch(e){} }
},
/* Local Storage
================================================================================ */
setLocalStorage: function(key, value){
if (!localStorage) { return; }
try {
localStorage[key] = value;
} catch(e) {
if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
this.warning(VideoJS.warnings.localStorageFull);
}
}
},
/* Helpers
================================================================================ */
getPreloadAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload")) {
var preload = this.video.getAttribute("preload");
// Only included the attribute, thinking it was boolean
if (preload === "" || preload === "true") { return "auto"; }
if (preload === "false") { return "none"; }
return preload;
}
},
getAutoplayAttribute: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("autoplay")) {
var autoplay = this.video.getAttribute("autoplay");
if (autoplay === "false") { return false; }
return true;
}
},
// Calculates amoutn of buffer is full
bufferedPercent: function(){ return (this.duration()) ? this.buffered()[1] / this.duration() : 0; },
// Each that maintains player as context
// Break if true is returned
each: function(arr, fn){
if (!arr || arr.length === 0) { return; }
for (var i=0,j=arr.length; i<j; i++) {
if (fn.call(this, arr[i], i)) { break; }
}
},
extend: function(obj){
for (var attrname in obj) {
if (obj.hasOwnProperty(attrname)) { this[attrname]=obj[attrname]; }
}
}
});
VideoJS.player = VideoJS.prototype;
////////////////////////////////////////////////////////////////////////////////
// Player Types
////////////////////////////////////////////////////////////////////////////////
/* Flash Object Fallback (Player Type)
================================================================================ */
VideoJS.player.extend({
flashSupported: function(){
if (!this.flashElement) { this.flashElement = this.getFlashElement(); }
// Check if object exists & Flash Player version is supported
if (this.flashElement && this.flashPlayerVersionSupported()) {
return true;
} else {
return false;
}
},
flashInit: function(){
this.replaceWithFlash();
this.element = this.flashElement;
this.video.src = ""; // Stop video from downloading if HTML5 is still supported
var flashPlayerType = VideoJS.flashPlayers[this.options.flashPlayer];
this.extend(VideoJS.flashPlayers[this.options.flashPlayer].api);
(flashPlayerType.init.context(this))();
},
// Get Flash Fallback object element from Embed Code
getFlashElement: function(){
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (children[i].className == "vjs-flash-fallback") {
return children[i];
}
}
},
// Used to force a browser to fall back when it's an HTML5 browser but there's no supported sources
replaceWithFlash: function(){
// this.flashElement = this.video.removeChild(this.flashElement);
if (this.flashElement) {
this.box.insertBefore(this.flashElement, this.video);
this.video.style.display = "none"; // Removing it was breaking later players
}
},
// Check if browser can use this flash player
flashPlayerVersionSupported: function(){
var playerVersion = (this.options.flashPlayerVersion) ? this.options.flashPlayerVersion : VideoJS.flashPlayers[this.options.flashPlayer].flashPlayerVersion;
return VideoJS.getFlashVersion() >= playerVersion;
}
});
VideoJS.flashPlayers = {};
VideoJS.flashPlayers.htmlObject = {
flashPlayerVersion: 9,
init: function() { return true; },
api: { // No video API available with HTML Object embed method
width: function(width){
if (width !== undefined) {
this.element.width = width;
this.box.style.width = width+"px";
this.triggerResizeListeners();
return this;
}
return this.element.width;
},
height: function(height){
if (height !== undefined) {
this.element.height = height;
this.box.style.height = height+"px";
this.triggerResizeListeners();
return this;
}
return this.element.height;
}
}
};
/* Download Links Fallback (Player Type)
================================================================================ */
VideoJS.player.extend({
linksSupported: function(){ return true; },
linksInit: function(){
this.showLinksFallback();
this.element = this.video;
},
// Get the download links block element
getLinksFallback: function(){ return this.box.getElementsByTagName("P")[0]; },
// Hide no-video download paragraph
hideLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "none"; }
},
// Hide no-video download paragraph
showLinksFallback: function(){
if (this.linksFallback) { this.linksFallback.style.display = "block"; }
}
});
////////////////////////////////////////////////////////////////////////////////
// Class Methods
// Functions that don't apply to individual videos.
////////////////////////////////////////////////////////////////////////////////
// Combine Objects - Use "safe" to protect from overwriting existing items
VideoJS.merge = function(obj1, obj2, safe){
for (var attrname in obj2){
if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; }
}
return obj1;
};
VideoJS.extend = function(obj){ this.merge(this, obj, true); };
VideoJS.extend({
// Add VideoJS to all video tags with the video-js class when the DOM is ready
setupAllWhenReady: function(options){
// Options is stored globally, and added ot any new player on init
VideoJS.options = options;
VideoJS.DOMReady(VideoJS.setup);
},
// Run the supplied function when the DOM is ready
DOMReady: function(fn){
VideoJS.addToDOMReady(fn);
},
// Set up a specific video or array of video elements
// "video" can be:
// false, undefined, or "All": set up all videos with the video-js class
// A video tag ID or video tag element: set up one video and return one player
// An array of video tag elements/IDs: set up each and return an array of players
setup: function(videos, options){
var returnSingular = false,
playerList = [],
videoElement;
// If videos is undefined or "All", set up all videos with the video-js class
if (!videos || videos == "All") {
videos = VideoJS.getVideoJSTags();
// If videos is not an array, add to an array
} else if (typeof videos != 'object' || videos.nodeType == 1) {
videos = [videos];
returnSingular = true;
}
// Loop through videos and create players for them
for (var i=0; i<videos.length; i++) {
if (typeof videos[i] == 'string') {
videoElement = document.getElementById(videos[i]);
} else { // assume DOM object
videoElement = videos[i];
}
playerList.push(new VideoJS(videoElement, options));
}
// Return one or all depending on what was passed in
return (returnSingular) ? playerList[0] : playerList;
},
// Find video tags with the video-js class
getVideoJSTags: function() {
var videoTags = document.getElementsByTagName("video"),
videoJSTags = [], videoTag;
for (var i=0,j=videoTags.length; i<j; i++) {
videoTag = videoTags[i];
if (videoTag.className.indexOf("video-js") != -1) {
videoJSTags.push(videoTag);
}
}
return videoJSTags;
},
// Check if the browser supports video.
browserSupportsVideo: function() {
if (typeof VideoJS.videoSupport != "undefined") { return VideoJS.videoSupport; }
VideoJS.videoSupport = !!document.createElement('video').canPlayType;
return VideoJS.videoSupport;
},
getFlashVersion: function(){
// Cache Version
if (typeof VideoJS.flashVersion != "undefined") { return VideoJS.flashVersion; }
var version = 0, desc;
if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
desc = navigator.plugins["Shockwave Flash"].description;
if (desc && !(typeof navigator.mimeTypes != "undefined" && navigator.mimeTypes["application/x-shockwave-flash"] && !navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)) {
version = parseInt(desc.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1], 10);
}
} else if (typeof window.ActiveXObject != "undefined") {
try {
var testObject = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
if (testObject) {
version = parseInt(testObject.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1], 10);
}
}
catch(e) {}
}
VideoJS.flashVersion = version;
return VideoJS.flashVersion;
},
// Browser & Device Checks
isIE: function(){ return !+"\v1"; },
isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
iOSVersion: function() {
var match = navigator.userAgent.match(/OS (\d+)_/i);
if (match && match[1]) { return match[1]; }
},
isAndroid: function(){ return navigator.userAgent.match(/Android/i) !== null; },
androidVersion: function() {
var match = navigator.userAgent.match(/Android (\d+)\./i);
if (match && match[1]) { return match[1]; }
},
warnings: {
// Safari errors if you call functions on a video that hasn't loaded yet
videoNotReady: "Video is not ready yet (try playing the video first).",
// Getting a QUOTA_EXCEEDED_ERR when setting local storage occasionally
localStorageFull: "Local Storage is Full"
}
});
// Shim to make Video tag valid in IE
if(VideoJS.isIE()) { document.createElement("video"); }
// Expose to global
window.VideoJS = window._V_ = VideoJS;
/* HTML5 Player Type
================================================================================ */
VideoJS.player.extend({
html5Supported: function(){
if (VideoJS.browserSupportsVideo() && this.canPlaySource()) {
return true;
} else {
return false;
}
},
html5Init: function(){
this.element = this.video;
this.fixPreloading(); // Support old browsers that used autobuffer
this.supportProgressEvents(); // Support browsers that don't use 'buffered'
// Set to stored volume OR 85%
this.volume((localStorage && localStorage.volume) || this.options.defaultVolume);
// Update interface for device needs
if (VideoJS.isIOS()) {
this.options.useBuiltInControls = true;
this.iOSInterface();
} else if (VideoJS.isAndroid()) {
this.options.useBuiltInControls = true;
this.androidInterface();
}
// Add VideoJS Controls
if (!this.options.useBuiltInControls) {
this.video.controls = false;
if (this.options.controlsBelow) { _V_.addClass(this.box, "vjs-controls-below"); }
// Make a click on th video act as a play button
this.activateElement(this.video, "playToggle");
// Build Interface
this.buildStylesCheckDiv(); // Used to check if style are loaded
this.buildAndActivatePoster();
this.buildBigPlayButton();
this.buildAndActivateSpinner();
this.buildAndActivateControlBar();
this.loadInterface(); // Show everything once styles are loaded
this.getSubtitles();
}
},
/* Source Managemet
================================================================================ */
canPlaySource: function(){
// Cache Result
if (this.canPlaySourceResult) { return this.canPlaySourceResult; }
// Loop through sources and check if any can play
var children = this.video.children;
for (var i=0,j=children.length; i<j; i++) {
if (children[i].tagName.toUpperCase() == "SOURCE") {
var canPlay = this.video.canPlayType(children[i].type) || this.canPlayExt(children[i].src);
if (canPlay == "probably" || canPlay == "maybe") {
this.firstPlayableSource = children[i];
this.canPlaySourceResult = true;
return true;
}
}
}
this.canPlaySourceResult = false;
return false;
},
// Check if the extention is compatible, for when type won't work
canPlayExt: function(src){
if (!src) { return ""; }
var match = src.match(/\.([^\.]+)$/);
if (match && match[1]) {
var ext = match[1].toLowerCase();
// Android canPlayType doesn't work
if (VideoJS.isAndroid()) {
if (ext == "mp4" || ext == "m4v") { return "maybe"; }
// Allow Apple HTTP Streaming for iOS
} else if (VideoJS.isIOS()) {
if (ext == "m3u8") { return "maybe"; }
}
}
return "";
},
// Force the video source - Helps fix loading bugs in a handful of devices, like the iPad/iPhone poster bug
// And iPad/iPhone javascript include location bug. And Android type attribute bug
forceTheSource: function(){
this.video.src = this.firstPlayableSource.src; // From canPlaySource()
this.video.load();
},
/* Device Fixes
================================================================================ */
// Support older browsers that used "autobuffer"
fixPreloading: function(){
if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload") && this.video.preload != "none") {
this.video.autobuffer = true; // Was a boolean
} else {
this.video.autobuffer = false;
this.video.preload = "none";
}
},
// Listen for Video Load Progress (currently does not if html file is local)
// Buffered does't work in all browsers, so watching progress as well
supportProgressEvents: function(e){
_V_.addListener(this.video, 'progress', this.playerOnVideoProgress.context(this));
},
playerOnVideoProgress: function(event){
this.setBufferedFromProgress(event);
},
setBufferedFromProgress: function(event){ // HTML5 Only
if(event.total > 0) {
var newBufferEnd = (event.loaded / event.total) * this.duration();
if (newBufferEnd > this.values.bufferEnd) { this.values.bufferEnd = newBufferEnd; }
}
},
iOSInterface: function(){
if(VideoJS.iOSVersion() < 4) { this.forceTheSource(); } // Fix loading issues
if(VideoJS.isIPad()) { // iPad could work with controlsBelow
this.buildAndActivateSpinner(); // Spinner still works well on iPad, since iPad doesn't have one
}
},
// Fix android specific quirks
// Use built-in controls, but add the big play button, since android doesn't have one.
androidInterface: function(){
this.forceTheSource(); // Fix loading issues
_V_.addListener(this.video, "click", function(){ this.play(); }); // Required to play
this.buildBigPlayButton(); // But don't activate the normal way. Pause doesn't work right on android.
_V_.addListener(this.bigPlayButton, "click", function(){ this.play(); }.context(this));
this.positionBox();
this.showBigPlayButtons();
},
/* Wait for styles (TODO: move to _V_)
================================================================================ */
loadInterface: function(){
if(!this.stylesHaveLoaded()) {
// Don't want to create an endless loop either.
if (!this.positionRetries) { this.positionRetries = 1; }
if (this.positionRetries++ < 100) {
setTimeout(this.loadInterface.context(this),10);
return;
}
}
this.hideStylesCheckDiv();
this.showPoster();
if (this.video.paused !== false) { this.showBigPlayButtons(); }
if (this.options.controlsAtStart) { this.showControlBars(); }
this.positionAll();
},
/* Control Bar
================================================================================ */
buildAndActivateControlBar: function(){
/* Creating this HTML
<div class="vjs-controls">
<div class="vjs-play-control">
<span></span>
</div>
<div class="vjs-progress-control">
<div class="vjs-progress-holder">
<div class="vjs-load-progress"></div>
<div class="vjs-play-progress"></div>
</div>
</div>
<div class="vjs-time-control">
<span class="vjs-current-time-display">00:00</span><span> / </span><span class="vjs-duration-display">00:00</span>
</div>
<div class="vjs-volume-control">
<div>
<span></span><span></span><span></span><span></span><span></span><span></span>
</div>
</div>
<div class="vjs-fullscreen-control">
<div>
<span></span><span></span><span></span><span></span>
</div>
</div>
</div>
*/
// Create a div to hold the different controls
this.controls = _V_.createElement("div", { className: "vjs-controls" });
// Add the controls to the video's container
this.box.appendChild(this.controls);
this.activateElement(this.controls, "controlBar");
this.activateElement(this.controls, "mouseOverVideoReporter");
// Build the play control
this.playControl = _V_.createElement("div", { className: "vjs-play-control", innerHTML: "<span></span>" });
this.controls.appendChild(this.playControl);
this.activateElement(this.playControl, "playToggle");
// Build the progress control
this.progressControl = _V_.createElement("div", { className: "vjs-progress-control" });
this.controls.appendChild(this.progressControl);
// Create a holder for the progress bars
this.progressHolder = _V_.createElement("div", { className: "vjs-progress-holder" });
this.progressControl.appendChild(this.progressHolder);
this.activateElement(this.progressHolder, "currentTimeScrubber");
// Create the loading progress display
this.loadProgressBar = _V_.createElement("div", { className: "vjs-load-progress" });
this.progressHolder.appendChild(this.loadProgressBar);
this.activateElement(this.loadProgressBar, "loadProgressBar");
// Create the playing progress display
this.playProgressBar = _V_.createElement("div", { className: "vjs-play-progress" });
this.progressHolder.appendChild(this.playProgressBar);
this.activateElement(this.playProgressBar, "playProgressBar");
// Create the progress time display (00:00 / 00:00)
this.timeControl = _V_.createElement("div", { className: "vjs-time-control" });
this.controls.appendChild(this.timeControl);
// Create the current play time display
this.currentTimeDisplay = _V_.createElement("span", { className: "vjs-current-time-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.currentTimeDisplay);
this.activateElement(this.currentTimeDisplay, "currentTimeDisplay");
// Add time separator
this.timeSeparator = _V_.createElement("span", { innerHTML: " / " });
this.timeControl.appendChild(this.timeSeparator);
// Create the total duration display
this.durationDisplay = _V_.createElement("span", { className: "vjs-duration-display", innerHTML: "00:00" });
this.timeControl.appendChild(this.durationDisplay);
this.activateElement(this.durationDisplay, "durationDisplay");
// Create the volumne control
this.volumeControl = _V_.createElement("div", {
className: "vjs-volume-control",
innerHTML: "<div><span></span><span></span><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.volumeControl);
this.activateElement(this.volumeControl, "volumeScrubber");
this.volumeDisplay = this.volumeControl.children[0];
this.activateElement(this.volumeDisplay, "volumeDisplay");
// Crete the fullscreen control
this.fullscreenControl = _V_.createElement("div", {
className: "vjs-fullscreen-control",
innerHTML: "<div><span></span><span></span><span></span><span></span></div>"
});
this.controls.appendChild(this.fullscreenControl);
this.activateElement(this.fullscreenControl, "fullscreenToggle");
},
/* Poster Image
================================================================================ */
buildAndActivatePoster: function(){
this.updatePosterSource();
if (this.video.poster) {
this.poster = document.createElement("img");
// Add poster to video box
this.box.appendChild(this.poster);
// Add poster image data
this.poster.src = this.video.poster;
// Add poster styles
this.poster.className = "vjs-poster";
this.activateElement(this.poster, "poster");
} else {
this.poster = false;
}
},
/* Big Play Button
================================================================================ */
buildBigPlayButton: function(){
/* Creating this HTML
<div class="vjs-big-play-button"><span></span></div>
*/
this.bigPlayButton = _V_.createElement("div", {
className: "vjs-big-play-button",
innerHTML: "<span></span>"
});
this.box.appendChild(this.bigPlayButton);
this.activateElement(this.bigPlayButton, "bigPlayButton");
},
/* Spinner (Loading)
================================================================================ */
buildAndActivateSpinner: function(){
this.spinner = _V_.createElement("div", {
className: "vjs-spinner",
innerHTML: "<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>"
});
this.box.appendChild(this.spinner);
this.activateElement(this.spinner, "spinner");
},
/* Styles Check - Check if styles are loaded (move ot _V_)
================================================================================ */
// Sometimes the CSS styles haven't been applied to the controls yet
// when we're trying to calculate the height and position them correctly.
// This causes a flicker where the controls are out of place.
buildStylesCheckDiv: function(){
this.stylesCheckDiv = _V_.createElement("div", { className: "vjs-styles-check" });
this.stylesCheckDiv.style.position = "absolute";
this.box.appendChild(this.stylesCheckDiv);
},
hideStylesCheckDiv: function(){ this.stylesCheckDiv.style.display = "none"; },
stylesHaveLoaded: function(){
if (this.stylesCheckDiv.offsetHeight != 5) {
return false;
} else {
return true;
}
},
/* VideoJS Box - Holds all elements
================================================================================ */
positionAll: function(){
this.positionBox();
this.positionControlBars();
this.positionPoster();
},
positionBox: function(){
// Set width based on fullscreen or not.
if (this.videoIsFullScreen) {
this.box.style.width = "";
this.element.style.height="";
if (this.options.controlsBelow) {
this.box.style.height = "";
this.element.style.height = (this.box.offsetHeight - this.controls.offsetHeight) + "px";
}
} else {
this.box.style.width = this.width() + "px";
this.element.style.height=this.height()+"px";
if (this.options.controlsBelow) {
this.element.style.height = "";
// this.box.style.height = this.video.offsetHeight + this.controls.offsetHeight + "px";
}
}
},
/* Subtitles
================================================================================ */
getSubtitles: function(){
var tracks = this.video.getElementsByTagName("TRACK");
for (var i=0,j=tracks.length; i<j; i++) {
if (tracks[i].getAttribute("kind") == "subtitles" && tracks[i].getAttribute("src")) {
this.subtitlesSource = tracks[i].getAttribute("src");
this.loadSubtitles();
this.buildSubtitles();
}
}
},
loadSubtitles: function() { _V_.get(this.subtitlesSource, this.parseSubtitles.context(this)); },
parseSubtitles: function(subText) {
var lines = subText.split("\n"),
line = "",
subtitle, time, text;
this.subtitles = [];
this.currentSubtitle = false;
this.lastSubtitleIndex = 0;
for (var i=0; i<lines.length; i++) {
line = _V_.trim(lines[i]); // Trim whitespace and linebreaks
if (line) { // Loop until a line with content
// First line - Number
subtitle = {
id: line, // Subtitle Number
index: this.subtitles.length // Position in Array
};
// Second line - Time
line = _V_.trim(lines[++i]);
time = line.split(" --> ");
subtitle.start = this.parseSubtitleTime(time[0]);
subtitle.end = this.parseSubtitleTime(time[1]);
// Additional lines - Subtitle Text
text = [];
for (var j=i; j<lines.length; j++) { // Loop until a blank line or end of lines
line = _V_.trim(lines[++i]);
if (!line) { break; }
text.push(line);
}
subtitle.text = text.join('<br/>');
// Add this subtitle
this.subtitles.push(subtitle);
}
}
},
parseSubtitleTime: function(timeText) {
var parts = timeText.split(':'),
time = 0;
// hours => seconds
time += parseFloat(parts[0])*60*60;
// minutes => seconds
time += parseFloat(parts[1])*60;
// get seconds
var seconds = parts[2].split(/\.|,/); // Either . or ,
time += parseFloat(seconds[0]);
// add miliseconds
ms = parseFloat(seconds[1]);
if (ms) { time += ms/1000; }
return time;
},
buildSubtitles: function(){
/* Creating this HTML
<div class="vjs-subtitles"></div>
*/
this.subtitlesDisplay = _V_.createElement("div", { className: 'vjs-subtitles' });
this.box.appendChild(this.subtitlesDisplay);
this.activateElement(this.subtitlesDisplay, "subtitlesDisplay");
},
/* Player API - Translate functionality from player to video
================================================================================ */
addVideoListener: function(type, fn){ _V_.addListener(this.video, type, fn.rEvtContext(this)); },
play: function(){
this.video.play();
return this;
},
onPlay: function(fn){ this.addVideoListener("play", fn); return this; },
pause: function(){
this.video.pause();
return this;
},
onPause: function(fn){ this.addVideoListener("pause", fn); return this; },
paused: function() { return this.video.paused; },
currentTime: function(seconds){
if (seconds !== undefined) {
try { this.video.currentTime = seconds; }
catch(e) { this.warning(VideoJS.warnings.videoNotReady); }
this.values.currentTime = seconds;
return this;
}
return this.video.currentTime;
},
onCurrentTimeUpdate: function(fn){
this.currentTimeListeners.push(fn);
},
duration: function(){
return this.video.duration;
},
buffered: function(){
// Storing values allows them be overridden by setBufferedFromProgress
if (this.values.bufferStart === undefined) {
this.values.bufferStart = 0;
this.values.bufferEnd = 0;
}
if (this.video.buffered && this.video.buffered.length > 0) {
var newEnd = this.video.buffered.end(0);
if (newEnd > this.values.bufferEnd) { this.values.bufferEnd = newEnd; }
}
return [this.values.bufferStart, this.values.bufferEnd];
},
volume: function(percentAsDecimal){
if (percentAsDecimal !== undefined) {
// Force value to between 0 and 1
this.values.volume = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
this.video.volume = this.values.volume;
this.setLocalStorage("volume", this.values.volume);
return this;
}
if (this.values.volume) { return this.values.volume; }
return this.video.volume;
},
onVolumeChange: function(fn){ _V_.addListener(this.video, 'volumechange', fn.rEvtContext(this)); },
width: function(width){
if (width !== undefined) {
this.video.width = width; // Not using style so it can be overridden on fullscreen.
this.box.style.width = width+"px";
this.triggerResizeListeners();
return this;
}
return this.video.offsetWidth;
},
height: function(height){
if (height !== undefined) {
this.video.height = height;
this.box.style.height = height+"px";
this.triggerResizeListeners();
return this;
}
return this.video.offsetHeight;
},
supportsFullScreen: function(){
if(typeof this.video.webkitEnterFullScreen == 'function') {
// Seems to be broken in Chromium/Chrome
if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
return true;
}
}
return false;
},
html5EnterNativeFullScreen: function(){
try {
this.video.webkitEnterFullScreen();
} catch (e) {
if (e.code == 11) { this.warning(VideoJS.warnings.videoNotReady); }
}
return this;
},
// Turn on fullscreen (window) mode
// Real fullscreen isn't available in browsers quite yet.
enterFullScreen: function(){
if (this.supportsFullScreen()) {
this.html5EnterNativeFullScreen();
} else {
this.enterFullWindow();
}
},
exitFullScreen: function(){
if (this.supportsFullScreen()) {
// Shouldn't be called
} else {
this.exitFullWindow();
}
},
enterFullWindow: function(){
this.videoIsFullScreen = true;
// Storing original doc overflow value to return to when fullscreen is off
this.docOrigOverflow = document.documentElement.style.overflow;
// Add listener for esc key to exit fullscreen
_V_.addListener(document, "keydown", this.fullscreenOnEscKey.rEvtContext(this));
// Add listener for a window resize
_V_.addListener(window, "resize", this.fullscreenOnWindowResize.rEvtContext(this));
// Hide any scroll bars
document.documentElement.style.overflow = 'hidden';
// Apply fullscreen styles
_V_.addClass(this.box, "vjs-fullscreen");
// Resize the box, controller, and poster
this.positionAll();
},
// Turn off fullscreen (window) mode
exitFullWindow: function(){
this.videoIsFullScreen = false;
document.removeEventListener("keydown", this.fullscreenOnEscKey, false);
window.removeEventListener("resize", this.fullscreenOnWindowResize, false);
// Unhide scroll bars.
document.documentElement.style.overflow = this.docOrigOverflow;
// Remove fullscreen styles
_V_.removeClass(this.box, "vjs-fullscreen");
// Resize the box, controller, and poster to original sizes
this.positionAll();
},
onError: function(fn){ this.addVideoListener("error", fn); return this; },
onEnded: function(fn){
this.addVideoListener("ended", fn); return this;
}
});
////////////////////////////////////////////////////////////////////////////////
// Element Behaviors
// Tell elements how to act or react
////////////////////////////////////////////////////////////////////////////////
/* Player Behaviors - How VideoJS reacts to what the video is doing.
================================================================================ */
VideoJS.player.newBehavior("player", function(player){
this.onError(this.playerOnVideoError);
// Listen for when the video is played
this.onPlay(this.playerOnVideoPlay);
this.onPlay(this.trackCurrentTime);
// Listen for when the video is paused
this.onPause(this.playerOnVideoPause);
this.onPause(this.stopTrackingCurrentTime);
// Listen for when the video ends
this.onEnded(this.playerOnVideoEnded);
// Set interval for load progress using buffer watching method
// this.trackCurrentTime();
this.trackBuffered();
// Buffer Full
this.onBufferedUpdate(this.isBufferFull);
},{
playerOnVideoError: function(event){
this.log(event);
this.log(this.video.error);
},
playerOnVideoPlay: function(event){ this.hasPlayed = true; },
playerOnVideoPause: function(event){},
playerOnVideoEnded: function(event){
this.currentTime(0);
this.pause();
},
/* Load Tracking -------------------------------------------------------------- */
// Buffer watching method for load progress.
// Used for browsers that don't support the progress event
trackBuffered: function(){
this.bufferedInterval = setInterval(this.triggerBufferedListeners.context(this), 500);
},
stopTrackingBuffered: function(){ clearInterval(this.bufferedInterval); },
bufferedListeners: [],
onBufferedUpdate: function(fn){
this.bufferedListeners.push(fn);
},
triggerBufferedListeners: function(){
this.isBufferFull();
this.each(this.bufferedListeners, function(listener){
(listener.context(this))();
});
},
isBufferFull: function(){
if (this.bufferedPercent() == 1) { this.stopTrackingBuffered(); }
},
/* Time Tracking -------------------------------------------------------------- */
trackCurrentTime: function(){
if (this.currentTimeInterval) { clearInterval(this.currentTimeInterval); }
this.currentTimeInterval = setInterval(this.triggerCurrentTimeListeners.context(this), 100); // 42 = 24 fps
this.trackingCurrentTime = true;
},
// Turn off play progress tracking (when paused or dragging)
stopTrackingCurrentTime: function(){
clearInterval(this.currentTimeInterval);
this.trackingCurrentTime = false;
},
currentTimeListeners: [],
// onCurrentTimeUpdate is in API section now
triggerCurrentTimeListeners: function(late, newTime){ // FF passes milliseconds late as the first argument
this.each(this.currentTimeListeners, function(listener){
(listener.context(this))(newTime || this.currentTime());
});
},
/* Resize Tracking -------------------------------------------------------------- */
resizeListeners: [],
onResize: function(fn){
this.resizeListeners.push(fn);
},
// Trigger anywhere the video/box size is changed.
triggerResizeListeners: function(){
this.each(this.resizeListeners, function(listener){
(listener.context(this))();
});
}
}
);
/* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location
================================================================================ */
VideoJS.player.newBehavior("mouseOverVideoReporter", function(element){
// Listen for the mouse move the video. Used to reveal the controller.
_V_.addListener(element, "mousemove", this.mouseOverVideoReporterOnMouseMove.context(this));
// Listen for the mouse moving out of the video. Used to hide the controller.
_V_.addListener(element, "mouseout", this.mouseOverVideoReporterOnMouseOut.context(this));
},{
mouseOverVideoReporterOnMouseMove: function(){
this.showControlBars();
clearInterval(this.mouseMoveTimeout);
this.mouseMoveTimeout = setTimeout(this.hideControlBars.context(this), 4000);
},
mouseOverVideoReporterOnMouseOut: function(event){
// Prevent flicker by making sure mouse hasn't left the video
var parent = event.relatedTarget;
while (parent && parent !== this.box) {
parent = parent.parentNode;
}
if (parent !== this.box) {
this.hideControlBars();
}
}
}
);
/* Mouse Over Video Reporter Behaviors - i.e. Controls hiding based on mouse location
================================================================================ */
VideoJS.player.newBehavior("box", function(element){
this.positionBox();
_V_.addClass(element, "vjs-paused");
this.activateElement(element, "mouseOverVideoReporter");
this.onPlay(this.boxOnVideoPlay);
this.onPause(this.boxOnVideoPause);
},{
boxOnVideoPlay: function(){
_V_.removeClass(this.box, "vjs-paused");
_V_.addClass(this.box, "vjs-playing");
},
boxOnVideoPause: function(){
_V_.removeClass(this.box, "vjs-playing");
_V_.addClass(this.box, "vjs-paused");
}
}
);
/* Poster Image Overlay
================================================================================ */
VideoJS.player.newBehavior("poster", function(element){
this.activateElement(element, "mouseOverVideoReporter");
this.activateElement(element, "playButton");
this.onPlay(this.hidePoster);
this.onEnded(this.showPoster);
this.onResize(this.positionPoster);
},{
showPoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "block";
this.positionPoster();
},
positionPoster: function(){
// Only if the poster is visible
if (!this.poster || this.poster.style.display == 'none') { return; }
this.poster.style.height = this.height() + "px"; // Need incase controlsBelow
this.poster.style.width = this.width() + "px"; // Could probably do 100% of box
},
hidePoster: function(){
if (!this.poster) { return; }
this.poster.style.display = "none";
},
// Update poster source from attribute or fallback image
// iPad breaks if you include a poster attribute, so this fixes that
updatePosterSource: function(){
if (!this.video.poster) {
var images = this.video.getElementsByTagName("img");
if (images.length > 0) { this.video.poster = images[0].src; }
}
}
}
);
/* Control Bar Behaviors
================================================================================ */
VideoJS.player.newBehavior("controlBar", function(element){
if (!this.controlBars) {
this.controlBars = [];
this.onResize(this.positionControlBars);
}
this.controlBars.push(element);
_V_.addListener(element, "mousemove", this.onControlBarsMouseMove.context(this));
_V_.addListener(element, "mouseout", this.onControlBarsMouseOut.context(this));
},{
showControlBars: function(){
if (!this.options.controlsAtStart && !this.hasPlayed) { return; }
this.each(this.controlBars, function(bar){
bar.style.display = "block";
});
},
// Place controller relative to the video's position (now just resizing bars)
positionControlBars: function(){
this.updatePlayProgressBars();
this.updateLoadProgressBars();
},
hideControlBars: function(){
if (this.options.controlsHiding && !this.mouseIsOverControls) {
this.each(this.controlBars, function(bar){
bar.style.display = "none";
});
}
},
// Block controls from hiding when mouse is over them.
onControlBarsMouseMove: function(){ this.mouseIsOverControls = true; },
onControlBarsMouseOut: function(event){
this.mouseIsOverControls = false;
}
}
);
/* PlayToggle, PlayButton, PauseButton Behaviors
================================================================================ */
// Play Toggle
VideoJS.player.newBehavior("playToggle", function(element){
if (!this.elements.playToggles) {
this.elements.playToggles = [];
this.onPlay(this.playTogglesOnPlay);
this.onPause(this.playTogglesOnPause);
}
this.elements.playToggles.push(element);
_V_.addListener(element, "click", this.onPlayToggleClick.context(this));
},{
onPlayToggleClick: function(event){
if (this.paused()) {
this.play();
} else {
this.pause();
}
},
playTogglesOnPlay: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-paused");
_V_.addClass(toggle, "vjs-playing");
});
},
playTogglesOnPause: function(event){
this.each(this.elements.playToggles, function(toggle){
_V_.removeClass(toggle, "vjs-playing");
_V_.addClass(toggle, "vjs-paused");
});
}
}
);
// Play
VideoJS.player.newBehavior("playButton", function(element){
_V_.addListener(element, "click", this.onPlayButtonClick.context(this));
},{
onPlayButtonClick: function(event){ this.play(); }
}
);
// Pause
VideoJS.player.newBehavior("pauseButton", function(element){
_V_.addListener(element, "click", this.onPauseButtonClick.context(this));
},{
onPauseButtonClick: function(event){ this.pause(); }
}
);
/* Play Progress Bar Behaviors
================================================================================ */
VideoJS.player.newBehavior("playProgressBar", function(element){
if (!this.playProgressBars) {
this.playProgressBars = [];
this.onCurrentTimeUpdate(this.updatePlayProgressBars);
}
this.playProgressBars.push(element);
},{
// Ajust the play progress bar's width based on the current play time
updatePlayProgressBars: function(newTime){
var progress = (newTime !== undefined) ? newTime / this.duration() : this.currentTime() / this.duration();
if (isNaN(progress)) { progress = 0; }
this.each(this.playProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(progress * 100, 2) + "%"; }
});
}
}
);
/* Load Progress Bar Behaviors
================================================================================ */
VideoJS.player.newBehavior("loadProgressBar", function(element){
if (!this.loadProgressBars) { this.loadProgressBars = []; }
this.loadProgressBars.push(element);
this.onBufferedUpdate(this.updateLoadProgressBars);
},{
updateLoadProgressBars: function(){
this.each(this.loadProgressBars, function(bar){
if (bar.style) { bar.style.width = _V_.round(this.bufferedPercent() * 100, 2) + "%"; }
});
}
}
);
/* Current Time Display Behaviors
================================================================================ */
VideoJS.player.newBehavior("currentTimeDisplay", function(element){
if (!this.currentTimeDisplays) {
this.currentTimeDisplays = [];
this.onCurrentTimeUpdate(this.updateCurrentTimeDisplays);
}
this.currentTimeDisplays.push(element);
},{
// Update the displayed time (00:00)
updateCurrentTimeDisplays: function(newTime){
if (!this.currentTimeDisplays) { return; }
// Allows for smooth scrubbing, when player can't keep up.
var time = (newTime) ? newTime : this.currentTime();
this.each(this.currentTimeDisplays, function(dis){
dis.innerHTML = _V_.formatTime(time);
});
}
}
);
/* Duration Display Behaviors
================================================================================ */
VideoJS.player.newBehavior("durationDisplay", function(element){
if (!this.durationDisplays) {
this.durationDisplays = [];
this.onCurrentTimeUpdate(this.updateDurationDisplays);
}
this.durationDisplays.push(element);
},{
updateDurationDisplays: function(){
if (!this.durationDisplays) { return; }
this.each(this.durationDisplays, function(dis){
if (this.duration()) { dis.innerHTML = _V_.formatTime(this.duration()); }
});
}
}
);
/* Current Time Scrubber Behaviors
================================================================================ */
VideoJS.player.newBehavior("currentTimeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onCurrentTimeScrubberMouseDown.rEvtContext(this));
},{
// Adjust the play position when the user drags on the progress bar
onCurrentTimeScrubberMouseDown: function(event, scrubber){
event.preventDefault();
this.currentScrubber = scrubber;
this.stopTrackingCurrentTime(); // Allows for smooth scrubbing
this.videoWasPlaying = !this.paused();
this.pause();
_V_.blockTextSelection();
this.setCurrentTimeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onCurrentTimeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onCurrentTimeScrubberMouseUp.rEvtContext(this));
},
onCurrentTimeScrubberMouseMove: function(event){ // Removeable
this.setCurrentTimeWithScrubber(event);
},
onCurrentTimeScrubberMouseUp: function(event){ // Removeable
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onCurrentTimeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onCurrentTimeScrubberMouseUp, false);
if (this.videoWasPlaying) {
this.play();
this.trackCurrentTime();
}
},
setCurrentTimeWithScrubber: function(event){
var newProgress = _V_.getRelativePosition(event.pageX, this.currentScrubber);
var newTime = newProgress * this.duration();
this.triggerCurrentTimeListeners(0, newTime); // Allows for smooth scrubbing
// Don't let video end while scrubbing.
if (newTime == this.duration()) { newTime = newTime - 0.1; }
this.currentTime(newTime);
}
}
);
/* Volume Display Behaviors
================================================================================ */
VideoJS.player.newBehavior("volumeDisplay", function(element){
if (!this.volumeDisplays) {
this.volumeDisplays = [];
this.onVolumeChange(this.updateVolumeDisplays);
}
this.volumeDisplays.push(element);
this.updateVolumeDisplay(element); // Set the display to the initial volume
},{
// Update the volume control display
// Unique to these default controls. Uses borders to create the look of bars.
updateVolumeDisplays: function(){
if (!this.volumeDisplays) { return; }
this.each(this.volumeDisplays, function(dis){
this.updateVolumeDisplay(dis);
});
},
updateVolumeDisplay: function(display){
var volNum = Math.ceil(this.volume() * 6);
this.each(display.children, function(child, num){
if (num < volNum) {
_V_.addClass(child, "vjs-volume-level-on");
} else {
_V_.removeClass(child, "vjs-volume-level-on");
}
});
}
}
);
/* Volume Scrubber Behaviors
================================================================================ */
VideoJS.player.newBehavior("volumeScrubber", function(element){
_V_.addListener(element, "mousedown", this.onVolumeScrubberMouseDown.rEvtContext(this));
},{
// Adjust the volume when the user drags on the volume control
onVolumeScrubberMouseDown: function(event, scrubber){
// event.preventDefault();
_V_.blockTextSelection();
this.currentScrubber = scrubber;
this.setVolumeWithScrubber(event);
_V_.addListener(document, "mousemove", this.onVolumeScrubberMouseMove.rEvtContext(this));
_V_.addListener(document, "mouseup", this.onVolumeScrubberMouseUp.rEvtContext(this));
},
onVolumeScrubberMouseMove: function(event){
this.setVolumeWithScrubber(event);
},
onVolumeScrubberMouseUp: function(event){
this.setVolumeWithScrubber(event);
_V_.unblockTextSelection();
document.removeEventListener("mousemove", this.onVolumeScrubberMouseMove, false);
document.removeEventListener("mouseup", this.onVolumeScrubberMouseUp, false);
},
setVolumeWithScrubber: function(event){
var newVol = _V_.getRelativePosition(event.pageX, this.currentScrubber);
this.volume(newVol);
}
}
);
/* Fullscreen Toggle Behaviors
================================================================================ */
VideoJS.player.newBehavior("fullscreenToggle", function(element){
_V_.addListener(element, "click", this.onFullscreenToggleClick.context(this));
},{
// When the user clicks on the fullscreen button, update fullscreen setting
onFullscreenToggleClick: function(event){
if (!this.videoIsFullScreen) {
this.enterFullScreen();
} else {
this.exitFullScreen();
}
},
fullscreenOnWindowResize: function(event){ // Removeable
this.positionControlBars();
},
// Create listener for esc key while in full screen mode
fullscreenOnEscKey: function(event){ // Removeable
if (event.keyCode == 27) {
this.exitFullScreen();
}
}
}
);
/* Big Play Button Behaviors
================================================================================ */
VideoJS.player.newBehavior("bigPlayButton", function(element){
if (!this.elements.bigPlayButtons) {
this.elements.bigPlayButtons = [];
this.onPlay(this.bigPlayButtonsOnPlay);
this.onEnded(this.bigPlayButtonsOnEnded);
}
this.elements.bigPlayButtons.push(element);
this.activateElement(element, "playButton");
},{
bigPlayButtonsOnPlay: function(event){ this.hideBigPlayButtons(); },
bigPlayButtonsOnEnded: function(event){ this.showBigPlayButtons(); },
showBigPlayButtons: function(){
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "block";
});
},
hideBigPlayButtons: function(){
this.each(this.elements.bigPlayButtons, function(element){
element.style.display = "none";
});
}
}
);
/* Spinner
================================================================================ */
VideoJS.player.newBehavior("spinner", function(element){
if (!this.spinners) {
this.spinners = [];
_V_.addListener(this.video, "loadeddata", this.spinnersOnVideoLoadedData.context(this));
_V_.addListener(this.video, "loadstart", this.spinnersOnVideoLoadStart.context(this));
_V_.addListener(this.video, "seeking", this.spinnersOnVideoSeeking.context(this));
_V_.addListener(this.video, "seeked", this.spinnersOnVideoSeeked.context(this));
_V_.addListener(this.video, "canplay", this.spinnersOnVideoCanPlay.context(this));
_V_.addListener(this.video, "canplaythrough", this.spinnersOnVideoCanPlayThrough.context(this));
_V_.addListener(this.video, "waiting", this.spinnersOnVideoWaiting.context(this));
_V_.addListener(this.video, "stalled", this.spinnersOnVideoStalled.context(this));
_V_.addListener(this.video, "suspend", this.spinnersOnVideoSuspend.context(this));
_V_.addListener(this.video, "playing", this.spinnersOnVideoPlaying.context(this));
_V_.addListener(this.video, "timeupdate", this.spinnersOnVideoTimeUpdate.context(this));
}
this.spinners.push(element);
},{
showSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "block";
});
clearInterval(this.spinnerInterval);
this.spinnerInterval = setInterval(this.rotateSpinners.context(this), 100);
},
hideSpinners: function(){
this.each(this.spinners, function(spinner){
spinner.style.display = "none";
});
clearInterval(this.spinnerInterval);
},
spinnersRotated: 0,
rotateSpinners: function(){
this.each(this.spinners, function(spinner){
// spinner.style.transform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
spinner.style.WebkitTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
spinner.style.MozTransform = 'scale(0.5) rotate('+this.spinnersRotated+'deg)';
});
if (this.spinnersRotated == 360) { this.spinnersRotated = 0; }
this.spinnersRotated += 45;
},
spinnersOnVideoLoadedData: function(event){ this.hideSpinners(); },
spinnersOnVideoLoadStart: function(event){ this.showSpinners(); },
spinnersOnVideoSeeking: function(event){ /* this.showSpinners(); */ },
spinnersOnVideoSeeked: function(event){ /* this.hideSpinners(); */ },
spinnersOnVideoCanPlay: function(event){ /* this.hideSpinners(); */ },
spinnersOnVideoCanPlayThrough: function(event){ this.hideSpinners(); },
spinnersOnVideoWaiting: function(event){
// Safari sometimes triggers waiting inappropriately
// Like after video has played, any you play again.
this.showSpinners();
},
spinnersOnVideoStalled: function(event){},
spinnersOnVideoSuspend: function(event){},
spinnersOnVideoPlaying: function(event){ this.hideSpinners(); },
spinnersOnVideoTimeUpdate: function(event){
// Safari sometimes calls waiting and doesn't recover
if(this.spinner.style.display == "block") { this.hideSpinners(); }
}
}
);
/* Subtitles
================================================================================ */
VideoJS.player.newBehavior("subtitlesDisplay", function(element){
if (!this.subtitleDisplays) {
this.subtitleDisplays = [];
this.onCurrentTimeUpdate(this.subtitleDisplaysOnVideoTimeUpdate);
this.onEnded(function() { this.lastSubtitleIndex = 0; }.context(this));
}
this.subtitleDisplays.push(element);
},{
subtitleDisplaysOnVideoTimeUpdate: function(time){
// Assuming all subtitles are in order by time, and do not overlap
if (this.subtitles) {
// If current subtitle should stay showing, don't do anything. Otherwise, find new subtitle.
if (!this.currentSubtitle || this.currentSubtitle.start >= time || this.currentSubtitle.end < time) {
var newSubIndex = false,
// Loop in reverse if lastSubtitle is after current time (optimization)
// Meaning the user is scrubbing in reverse or rewinding
reverse = (this.subtitles[this.lastSubtitleIndex].start > time),
// If reverse, step back 1 becase we know it's not the lastSubtitle
i = this.lastSubtitleIndex - (reverse) ? 1 : 0;
while (true) { // Loop until broken
if (reverse) { // Looping in reverse
// Stop if no more, or this subtitle ends before the current time (no earlier subtitles should apply)
if (i < 0 || this.subtitles[i].end < time) { break; }
// End is greater than time, so if start is less, show this subtitle
if (this.subtitles[i].start < time) {
newSubIndex = i;
break;
}
i--;
} else { // Looping forward
// Stop if no more, or this subtitle starts after time (no later subtitles should apply)
if (i >= this.subtitles.length || this.subtitles[i].start > time) { break; }
// Start is less than time, so if end is later, show this subtitle
if (this.subtitles[i].end > time) {
newSubIndex = i;
break;
}
i++;
}
}
// Set or clear current subtitle
if (newSubIndex !== false) {
this.currentSubtitle = this.subtitles[newSubIndex];
this.lastSubtitleIndex = newSubIndex;
this.updateSubtitleDisplays(this.currentSubtitle.text);
} else if (this.currentSubtitle) {
this.currentSubtitle = false;
this.updateSubtitleDisplays("");
}
}
}
},
updateSubtitleDisplays: function(val){
this.each(this.subtitleDisplays, function(disp){
disp.innerHTML = val;
});
}
}
);
////////////////////////////////////////////////////////////////////////////////
// Convenience Functions (mini library)
// Functions not specific to video or VideoJS and could probably be replaced with a library like jQuery
////////////////////////////////////////////////////////////////////////////////
VideoJS.extend({
addClass: function(element, classToAdd){
if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) {
element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd;
}
},
removeClass: function(element, classToRemove){
if (element.className.indexOf(classToRemove) == -1) { return; }
var classNames = element.className.split(/\s+/);
classNames.splice(classNames.lastIndexOf(classToRemove),1);
element.className = classNames.join(" ");
},
createElement: function(tagName, attributes){
return this.merge(document.createElement(tagName), attributes);
},
// Attempt to block the ability to select text while dragging controls
blockTextSelection: function(){
document.body.focus();
document.onselectstart = function () { return false; };
},
// Turn off text selection blocking
unblockTextSelection: function(){ document.onselectstart = function () { return true; }; },
// Return seconds as MM:SS
formatTime: function(secs) {
var seconds = Math.round(secs);
var minutes = Math.floor(seconds / 60);
minutes = (minutes >= 10) ? minutes : "0" + minutes;
seconds = Math.floor(seconds % 60);
seconds = (seconds >= 10) ? seconds : "0" + seconds;
return minutes + ":" + seconds;
},
// Return the relative horizonal position of an event as a value from 0-1
getRelativePosition: function(x, relativeElement){
return Math.max(0, Math.min(1, (x - this.findPosX(relativeElement)) / relativeElement.offsetWidth));
},
// Get an objects position on the page
findPosX: function(obj) {
var curleft = obj.offsetLeft;
while(obj = obj.offsetParent) {
curleft += obj.offsetLeft;
}
return curleft;
},
getComputedStyleValue: function(element, style){
return window.getComputedStyle(element, null).getPropertyValue(style);
},
round: function(num, dec) {
if (!dec) { dec = 0; }
return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
},
addListener: function(element, type, handler){
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on"+type, handler);
}
},
removeListener: function(element, type, handler){
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else if (element.attachEvent) {
element.detachEvent("on"+type, handler);
}
},
get: function(url, onSuccess){
if (typeof XMLHttpRequest == "undefined") {
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant
throw new Error("This browser does not support XMLHttpRequest.");
};
}
var request = new XMLHttpRequest();
request.open("GET",url);
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
onSuccess(request.responseText);
}
}.context(this);
request.send();
},
trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); },
// DOM Ready functionality adapted from jQuery. http://jquery.com/
bindDOMReady: function(){
if (document.readyState === "complete") {
return VideoJS.onDOMReady();
}
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", VideoJS.DOMContentLoaded, false);
window.addEventListener("load", VideoJS.onDOMReady, false);
} else if (document.attachEvent) {
document.attachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
window.attachEvent("onload", VideoJS.onDOMReady);
}
},
DOMContentLoaded: function(){
if (document.addEventListener) {
document.removeEventListener( "DOMContentLoaded", VideoJS.DOMContentLoaded, false);
VideoJS.onDOMReady();
} else if ( document.attachEvent ) {
if ( document.readyState === "complete" ) {
document.detachEvent("onreadystatechange", VideoJS.DOMContentLoaded);
VideoJS.onDOMReady();
}
}
},
// Functions to be run once the DOM is loaded
DOMReadyList: [],
addToDOMReady: function(fn){
if (VideoJS.DOMIsReady) {
fn.call(document);
} else {
VideoJS.DOMReadyList.push(fn);
}
},
DOMIsReady: false,
onDOMReady: function(){
if (VideoJS.DOMIsReady) { return; }
if (!document.body) { return setTimeout(VideoJS.onDOMReady, 13); }
VideoJS.DOMIsReady = true;
if (VideoJS.DOMReadyList) {
for (var i=0; i<VideoJS.DOMReadyList.length; i++) {
VideoJS.DOMReadyList[i].call(document);
}
VideoJS.DOMReadyList = null;
}
}
});
VideoJS.bindDOMReady();
// Allows for binding context to functions
// when using in event listeners and timeouts
Function.prototype.context = function(obj){
var method = this,
temp = function(){
return method.apply(obj, arguments);
};
return temp;
};
// Like context, in that it creates a closure
// But insteaad keep "this" intact, and passes the var as the second argument of the function
// Need for event listeners where you need to know what called the event
// Only use with event callbacks
Function.prototype.evtContext = function(obj){
var method = this,
temp = function(){
var origContext = this;
return method.call(obj, arguments[0], origContext);
};
return temp;
};
// Removeable Event listener with Context
// Replaces the original function with a version that has context
// So it can be removed using the original function name.
// In order to work, a version of the function must already exist in the player/prototype
Function.prototype.rEvtContext = function(obj, funcParent){
if (this.hasContext === true) { return this; }
if (!funcParent) { funcParent = obj; }
for (var attrname in funcParent) {
if (funcParent[attrname] == this) {
funcParent[attrname] = this.evtContext(obj);
funcParent[attrname].hasContext = true;
return funcParent[attrname];
}
}
return this.evtContext(obj);
};
// jQuery Plugin
if (window.jQuery) {
(function($) {
$.fn.VideoJS = function(options) {
this.each(function() {
VideoJS.setup(this, options);
});
return this;
};
$.fn.player = function() {
return this[0].player;
};
})(jQuery);
}
// Expose to global
window.VideoJS = window._V_ = VideoJS;
// End self-executing function
})(window); | JavaScript |
(function($){
$.fn.colorTip = function(settings){
var defaultSettings = {
color : 'yellow',
timeout : 500
}
var supportedColors = ['red','green','blue','white','yellow','black'];
/* Combining the default settings object with the supplied one */
settings = $.extend(defaultSettings,settings);
/*
* Looping through all the elements and returning them afterwards.
* This will add chainability to the plugin.
*/
return this.each(function(){
var elem = $(this);
// If the title attribute is empty, continue with the next element
if(!elem.attr('title')) return true;
// Creating new eventScheduler and Tip objects for this element.
// (See the class definition at the bottom).
var scheduleEvent = new eventScheduler();
var tip = new Tip(elem.attr('title'));
// Adding the tooltip markup to the element and
// applying a special class:
elem.append(tip.generate()).addClass('colorTipContainer');
// Checking to see whether a supported color has been
// set as a classname on the element.
var hasClass = false;
for(var i=0;i<supportedColors.length;i++)
{
if(elem.hasClass(supportedColors[i])){
hasClass = true;
break;
}
}
// If it has been set, it will override the default color
if(!hasClass){
elem.addClass(settings.color);
}
// On mouseenter, show the tip, on mouseleave set the
// tip to be hidden in half a second.
elem.hover(function(){
tip.show();
// If the user moves away and hovers over the tip again,
// clear the previously set event:
scheduleEvent.clear();
},function(){
// Schedule event actualy sets a timeout (as you can
// see from the class definition below).
scheduleEvent.set(function(){
tip.hide();
},settings.timeout);
});
// Removing the title attribute, so the regular OS titles are
// not shown along with the tooltips.
elem.removeAttr('title');
});
}
/*
/ Event Scheduler Class Definition
*/
function eventScheduler(){}
eventScheduler.prototype = {
set : function (func,timeout){
// The set method takes a function and a time period (ms) as
// parameters, and sets a timeout
this.timer = setTimeout(func,timeout);
},
clear: function(){
// The clear method clears the timeout
clearTimeout(this.timer);
}
}
/*
/ Tip Class Definition
*/
function Tip(txt){
this.content = txt;
this.shown = false;
}
Tip.prototype = {
generate: function(){
// The generate method returns either a previously generated element
// stored in the tip variable, or generates it and saves it in tip for
// later use, after which returns it.
return this.tip || (this.tip = $('<span class="colorTip">'+this.content+
'<span class="pointyTipShadow"></span><span class="pointyTip"></span></span>'));
},
show: function(){
if(this.shown) return;
// Center the tip and start a fadeIn animation
this.tip.css('margin-left',-this.tip.outerWidth()/2).fadeIn('fast');
this.shown = true;
},
hide: function(){
this.tip.fadeOut();
this.shown = false;
}
}
})(jQuery);
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','cy',{placeholder:{title:"Priodweddau'r Daliwr Geiriau",toolbar:'Creu Daliwr Geiriau',text:'Testun y Daliwr Geiriau',edit:"Golygu'r Dailwr Geiriau",textMissing:"Mae'n rhaid i'r daliwr geiriau gynnwys testun."}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','tr',{placeholder:{title:'Yer tutucu özellikleri',toolbar:'Yer tutucu oluşturun',text:'Yer tutucu metini',edit:'Yer tutucuyu düzenle',textMissing:'Yer tutucu metin içermelidir.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','nb',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','fr',{placeholder:{title:"Propriétés de l'Espace réservé",toolbar:"Créer l'Espace réservé",text:"Texte de l'Espace réservé",edit:"Modifier l'Espace réservé",textMissing:"L'Espace réservé doit contenir du texte."}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'placeholder', 'fa',
{
placeholder :
{
title : 'ویژگیهای محل نگهداری',
toolbar : 'ایجاد یک محل نگهداری',
text : 'متن محل نگهداری',
edit : 'ویرایش محل نگهداری',
textMissing : 'محل نگهداری باید محتوی متن باشد.'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','eo',{placeholder:{title:'Atributoj de la rezervita spaco',toolbar:'Krei la rezervitan spacon',text:'Texto de la rezervita spaco',edit:'Modifi la rezervitan spacon',textMissing:'La rezervita spaco devas enteni tekston.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','uk',{placeholder:{title:'Налаштування Заповнювача',toolbar:'Створити Заповнювач',text:'Текст Заповнювача',edit:'Редагувати Заповнювач',textMissing:'Заповнювач повинен містити текст.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','he',{placeholder:{title:'מאפייני שומר מקום',toolbar:'צור שומר מקום',text:'תוכן שומר המקום',edit:'ערוך שומר מקום',textMissing:'שומר המקום חייב להכיל טקסט.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','de',{placeholder:{title:'Platzhalter Einstellungen',toolbar:'Platzhalter erstellen',text:'Platzhalter Text',edit:'Platzhalter bearbeiten',textMissing:'Der Platzhalter muss einen Text beinhalten.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'placeholder', 'ku',
{
placeholder :
{
title : 'خاسیهتی شوێن ههڵگر',
toolbar : 'درووستکردنی شوێن ههڵگر',
text : 'دهق بۆ شوێن ههڵگڕ',
edit : 'چاکسازی شوێن ههڵگڕ',
textMissing : 'شوێن ههڵگڕ دهبێت لهدهق پێکهاتبێت.'
}
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','no',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','el',{placeholder:{title:'Ιδιότητες Υποκατάστατου Κειμένου',toolbar:'Δημιουργία Υποκατάσταστου Κειμένου',text:'Υποκαθιστόμενο Κείμενο',edit:'Επεξεργασία Υποκατάσταστου Κειμένου',textMissing:'Πρέπει να υπάρχει υποκαθιστόμενο κείμενο.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','vi',{placeholder:{title:'Thuộc tính đặt chỗ',toolbar:'Tạo đặt chỗ',text:'Văn bản đặt chỗ',edit:'Chỉnh sửa ',textMissing:'The placeholder must contain text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','it',{placeholder:{title:'Proprietà segnaposto',toolbar:'Crea segnaposto',text:'Testo segnaposto',edit:'Modifica segnaposto',textMissing:'Il segnaposto deve contenere del testo.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','sk',{placeholder:{title:'Vlastnosti placeholdera',toolbar:'Vytvoriť placeholder',text:'Text placeholdera',edit:'Upraviť placeholder',textMissing:'Placeholder musí obsahovať text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','nl',{placeholder:{title:'Eigenschappen placeholder',toolbar:'Placeholder aanmaken',text:'Placeholder tekst',edit:'Placeholder wijzigen',textMissing:'De placeholder moet tekst bevatten.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','da',{placeholder:{title:'Egenskaber for pladsholder',toolbar:'Opret pladsholder',text:'Tekst til pladsholder',edit:'Redigér pladsholder',textMissing:'Pladsholder skal indeholde tekst'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','et',{placeholder:{title:'Kohahoidja omadused',toolbar:'Kohahoidja loomine',text:'Kohahoidja tekst',edit:'Kohahoidja muutmine',textMissing:'Kohahoidja peab sisaldama teksti.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','pt-br',{placeholder:{title:'Propriedades do Espaço Reservado',toolbar:'Criar Espaço Reservado',text:'Texto do Espaço Reservado',edit:'Editar Espaço Reservado',textMissing:'O espaço reservado deve conter texto.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','pl',{placeholder:{title:'Właściwości wypełniacza',toolbar:'Utwórz wypełniacz',text:'Tekst wypełnienia',edit:'Edytuj wypełnienie',textMissing:'Wypełnienie musi posiadać jakiś tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','cs',{placeholder:{title:'Vlastnosti vyhrazeného prostoru',toolbar:'Vytvořit vyhrazený prostor',text:'Vyhrazený text',edit:'Upravit vyhrazený prostor',textMissing:'Vyhrazený prostor musí obsahovat text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','hr',{placeholder:{title:'Svojstva rezerviranog mjesta',toolbar:'Napravi rezervirano mjesto',text:'Tekst rezerviranog mjesta',edit:'Uredi rezervirano mjesto',textMissing:'Rezervirano mjesto mora sadržavati tekst.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','fi',{placeholder:{title:'Paikkamerkin ominaisuudet',toolbar:'Luo paikkamerkki',text:'Paikkamerkin teksti',edit:'Muokkaa paikkamerkkiä',textMissing:'Paikkamerkin täytyy sisältää tekstiä'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','ug',{placeholder:{title:'ئورۇن بەلگە خاسلىقى',toolbar:'ئورۇن بەلگە قۇر',text:'ئورۇن بەلگە تېكىستى',edit:'ئورۇن بەلگە تەھرىر',textMissing:'ئورۇن بەلگىسىدە چوقۇم تېكىست بولۇشى لازىم'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','zh-cn',{placeholder:{title:'占位符属性',toolbar:'创建占位符',text:'占位符文字',edit:'编辑占位符',textMissing:'占位符必须包含文字。'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','bg',{placeholder:{title:'Настройки на контейнера',toolbar:'Нов контейнер',text:'Текст за контейнера',edit:'Промяна на контейнер',textMissing:'Контейнера трябва да съдържа текст.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang('placeholder','en',{placeholder:{title:'Placeholder Properties',toolbar:'Create Placeholder',text:'Placeholder Text',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'fa',
{
euro: 'نشان یورو',
lsquo: 'علامت نقل قول تکی چپ',
rsquo: 'علامت نقل قول تکی راست',
ldquo: 'علامت دوتایی نقل قول چپ',
rdquo: 'علامت دوتایی نقل قول راست',
ndash: 'En dash', // MISSING
mdash: 'Em dash', // MISSING
iexcl: 'علامت گذاری به عنوان علامت تعجب وارونه',
cent: 'نشان سنت',
pound: 'نشان پوند',
curren: 'نشان ارز',
yen: 'نشان ین',
brvbar: 'نوار شکسته',
sect: 'نشان بخش',
uml: 'Diaeresis', // MISSING
copy: 'نشان کپی رایت',
ordf: 'Feminine ordinal indicator', // MISSING
laquo: 'Left-pointing double angle quotation mark', // MISSING
not: 'علامت ثبت نشده',
reg: 'علامت ثبت شده',
macr: 'Macron', // MISSING
deg: 'نشان درجه',
sup2: 'بالانویس دو',
sup3: 'بالانویس سه',
acute: 'لهجه غلیظ',
micro: 'نشان مایکرو',
para: 'Pilcrow sign', // MISSING
middot: 'نقطه میانی',
cedil: 'Cedilla', // MISSING
sup1: 'Superscript one', // MISSING
ordm: 'Masculine ordinal indicator', // MISSING
raquo: 'نشان زاویهدار دوتایی نقل قول راست چین',
frac14: 'Vulgar fraction one quarter', // MISSING
frac12: 'Vulgar fraction one half', // MISSING
frac34: 'Vulgar fraction three quarters', // MISSING
iquest: 'Inverted question mark', // MISSING
Agrave: 'Latin capital letter A with grave accent', // MISSING
Aacute: 'Latin capital letter A with acute accent', // MISSING
Acirc: 'Latin capital letter A with circumflex', // MISSING
Atilde: 'Latin capital letter A with tilde', // MISSING
Auml: 'Latin capital letter A with diaeresis', // MISSING
Aring: 'Latin capital letter A with ring above', // MISSING
AElig: 'Latin Capital letter Æ', // MISSING
Ccedil: 'Latin capital letter C with cedilla', // MISSING
Egrave: 'Latin capital letter E with grave accent', // MISSING
Eacute: 'Latin capital letter E with acute accent', // MISSING
Ecirc: 'Latin capital letter E with circumflex', // MISSING
Euml: 'Latin capital letter E with diaeresis', // MISSING
Igrave: 'Latin capital letter I with grave accent', // MISSING
Iacute: 'Latin capital letter I with acute accent', // MISSING
Icirc: 'Latin capital letter I with circumflex', // MISSING
Iuml: 'Latin capital letter I with diaeresis', // MISSING
ETH: 'Latin capital letter Eth', // MISSING
Ntilde: 'Latin capital letter N with tilde', // MISSING
Ograve: 'Latin capital letter O with grave accent', // MISSING
Oacute: 'Latin capital letter O with acute accent', // MISSING
Ocirc: 'Latin capital letter O with circumflex', // MISSING
Otilde: 'Latin capital letter O with tilde', // MISSING
Ouml: 'Latin capital letter O with diaeresis', // MISSING
times: 'Multiplication sign', // MISSING
Oslash: 'Latin capital letter O with stroke', // MISSING
Ugrave: 'Latin capital letter U with grave accent', // MISSING
Uacute: 'Latin capital letter U with acute accent', // MISSING
Ucirc: 'Latin capital letter U with circumflex', // MISSING
Uuml: 'Latin capital letter U with diaeresis', // MISSING
Yacute: 'Latin capital letter Y with acute accent', // MISSING
THORN: 'Latin capital letter Thorn', // MISSING
szlig: 'Latin small letter sharp s', // MISSING
agrave: 'Latin small letter a with grave accent', // MISSING
aacute: 'Latin small letter a with acute accent', // MISSING
acirc: 'Latin small letter a with circumflex', // MISSING
atilde: 'Latin small letter a with tilde', // MISSING
auml: 'Latin small letter a with diaeresis', // MISSING
aring: 'Latin small letter a with ring above', // MISSING
aelig: 'Latin small letter æ', // MISSING
ccedil: 'Latin small letter c with cedilla', // MISSING
egrave: 'Latin small letter e with grave accent', // MISSING
eacute: 'Latin small letter e with acute accent', // MISSING
ecirc: 'Latin small letter e with circumflex', // MISSING
euml: 'Latin small letter e with diaeresis', // MISSING
igrave: 'Latin small letter i with grave accent', // MISSING
iacute: 'Latin small letter i with acute accent', // MISSING
icirc: 'Latin small letter i with circumflex', // MISSING
iuml: 'Latin small letter i with diaeresis', // MISSING
eth: 'Latin small letter eth', // MISSING
ntilde: 'Latin small letter n with tilde', // MISSING
ograve: 'Latin small letter o with grave accent', // MISSING
oacute: 'Latin small letter o with acute accent', // MISSING
ocirc: 'Latin small letter o with circumflex', // MISSING
otilde: 'Latin small letter o with tilde', // MISSING
ouml: 'Latin small letter o with diaeresis', // MISSING
divide: 'Division sign', // MISSING
oslash: 'Latin small letter o with stroke', // MISSING
ugrave: 'Latin small letter u with grave accent', // MISSING
uacute: 'Latin small letter u with acute accent', // MISSING
ucirc: 'Latin small letter u with circumflex', // MISSING
uuml: 'Latin small letter u with diaeresis', // MISSING
yacute: 'Latin small letter y with acute accent', // MISSING
thorn: 'Latin small letter thorn', // MISSING
yuml: 'Latin small letter y with diaeresis', // MISSING
OElig: 'Latin capital ligature OE', // MISSING
oelig: 'Latin small ligature oe', // MISSING
'372': 'Latin capital letter W with circumflex', // MISSING
'374': 'Latin capital letter Y with circumflex', // MISSING
'373': 'Latin small letter w with circumflex', // MISSING
'375': 'Latin small letter y with circumflex', // MISSING
sbquo: 'Single low-9 quotation mark', // MISSING
'8219': 'Single high-reversed-9 quotation mark', // MISSING
bdquo: 'Double low-9 quotation mark', // MISSING
hellip: 'Horizontal ellipsis', // MISSING
trade: 'Trade mark sign', // MISSING
'9658': 'Black right-pointing pointer', // MISSING
bull: 'Bullet', // MISSING
rarr: 'Rightwards arrow', // MISSING
rArr: 'Rightwards double arrow', // MISSING
hArr: 'جهتنمای دوتایی چپ به راست',
diams: 'Black diamond suit', // MISSING
asymp: 'تقریبا برابر با'
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'ku',
{
euro: 'نیشانهی یۆرۆ',
lsquo: 'نیشانهی فاریزهی سهرووژێری تاکی چهپ',
rsquo: 'نیشانهی فاریزهی سهرووژێری تاکی ڕاست',
ldquo: 'نیشانهی فاریزهی سهرووژێری دووهێندهی چهپ',
rdquo: 'نیشانهی فاریزهی سهرووژێری دووهێندهی ڕاست',
ndash: 'تهقهڵی کورت',
mdash: 'تهقهڵی درێژ',
iexcl: 'نیشانهی ههڵهوگێڕی سهرسوڕمێنهر',
cent: 'نیشانهی سهنت',
pound: 'نیشانهی پاوهند',
curren: 'نیشانهی دراو',
yen: 'نیشانهی یهنی ژاپۆنی',
brvbar: 'شریتی ئهستوونی پچڕاو',
sect: 'نیشانهی دوو s لهسهریهك',
uml: 'خاڵ',
copy: 'نیشانهی مافی چاپ',
ordf: 'هێڵ لهسهر پیتی a',
laquo: 'دوو تیری بهدووایهکی چهپ',
not: 'نیشانهی نهخێر',
reg: 'نیشانهی R لهناو بازنهدا',
macr: 'ماکڕوون',
deg: 'نیشانهی پله',
sup2: 'سهرنووسی دوو',
sup3: 'سهرنووسی سێ',
acute: 'لاری تیژ',
micro: 'نیشانهی u لق درێژی چهپی خواروو',
para: 'نیشانهیپهڕهگراف',
middot: 'ناوهڕاستی خاڵ',
cedil: 'نیشانهی c ژێر چووکره',
sup1: 'سهرنووسی یهك',
ordm: 'هێڵ لهژێر پیتی o',
raquo: 'دوو تیری بهدووایهکی ڕاست',
frac14: 'یهك لهسهر چووار',
frac12: 'یهك لهسهر دوو',
frac34: 'سێ لهسهر چووار',
iquest: 'هێمای ههڵهوگێری پرسیار',
Agrave: 'پیتی لاتینی A-ی گهوره لهگهڵ ڕوومهتداری لار',
Aacute: 'پیتی لاتینی A-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Acirc: 'پیتی لاتینی A-ی گهوره لهگهڵ نیشانه لهسهری',
Atilde: 'پیتی لاتینی A-ی گهوره لهگهڵ زهڕه',
Auml: 'پیتی لاتینی A-ی گهوره لهگهڵ نیشانه لهسهری',
Aring: 'پیتی لاتینی گهورهی Å',
AElig: 'پیتی لاتینی گهورهی Æ',
Ccedil: 'پیتی لاتینی C-ی گهوره لهگهڵ ژێر چووکره',
Egrave: 'پیتی لاتینی E-ی گهوره لهگهڵ ڕوومهتداری لار',
Eacute: 'پیتی لاتینی E-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ecirc: 'پیتی لاتینی E-ی گهوره لهگهڵ نیشانه لهسهری',
Euml: 'پیتی لاتینی E-ی گهوره لهگهڵ نیشانه لهسهری',
Igrave: 'پیتی لاتینی I-ی گهوره لهگهڵ ڕوومهتداری لار',
Iacute: 'پیتی لاتینی I-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Icirc: 'پیتی لاتینی I-ی گهوره لهگهڵ نیشانه لهسهری',
Iuml: 'پیتی لاتینی I-ی گهوره لهگهڵ نیشانه لهسهری',
ETH: 'پیتی لاتینی E-ی گهورهی',
Ntilde: 'پیتی لاتینی N-ی گهوره لهگهڵ زهڕه',
Ograve: 'پیتی لاتینی O-ی گهوره لهگهڵ ڕوومهتداری لار',
Oacute: 'پیتی لاتینی O-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ocirc: 'پیتی لاتینی O-ی گهوره لهگهڵ نیشانه لهسهری',
Otilde: 'پیتی لاتینی O-ی گهوره لهگهڵ زهڕه',
Ouml: 'پیتی لاتینی O-ی گهوره لهگهڵ نیشانه لهسهری',
times: 'نیشانهی لێکدان',
Oslash: 'پیتی لاتینی گهورهی Ø لهگهڵ هێمای دڵ وهستان',
Ugrave: 'پیتی لاتینی U-ی گهوره لهگهڵ ڕوومهتداری لار',
Uacute: 'پیتی لاتینی U-ی گهوره لهگهڵ ڕوومهتداری تیژ',
Ucirc: 'پیتی لاتینی U-ی گهوره لهگهڵ نیشانه لهسهری',
Uuml: 'پیتی لاتینی U-ی گهوره لهگهڵ نیشانه لهسهری',
Yacute: 'پیتی لاتینی Y-ی گهوره لهگهڵ ڕوومهتداری تیژ',
THORN: 'پیتی لاتینی دڕکی گهوره',
szlig: 'پیتی لاتنی نووك تیژی s',
agrave: 'پیتی لاتینی a-ی بچووك لهگهڵ ڕوومهتداری لار',
aacute: 'پیتی لاتینی a-ی بچووك لهگهڵ ڕوومهتداری تیژ',
acirc: 'پیتی لاتینی a-ی بچووك لهگهڵ نیشانه لهسهری',
atilde: 'پیتی لاتینی a-ی بچووك لهگهڵ زهڕه',
auml: 'پیتی لاتینی a-ی بچووك لهگهڵ نیشانه لهسهری',
aring: 'پیتی لاتینی å-ی بچووك',
aelig: 'پیتی لاتینی æ-ی بچووك',
ccedil: 'پیتی لاتینی c-ی بچووك لهگهڵ ژێر چووکره',
egrave: 'پیتی لاتینی e-ی بچووك لهگهڵ ڕوومهتداری لار',
eacute: 'پیتی لاتینی e-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ecirc: 'پیتی لاتینی e-ی بچووك لهگهڵ نیشانه لهسهری',
euml: 'پیتی لاتینی e-ی بچووك لهگهڵ نیشانه لهسهری',
igrave: 'پیتی لاتینی i-ی بچووك لهگهڵ ڕوومهتداری لار',
iacute: 'پیتی لاتینی i-ی بچووك لهگهڵ ڕوومهتداری تیژ',
icirc: 'پیتی لاتینی i-ی بچووك لهگهڵ نیشانه لهسهری',
iuml: 'پیتی لاتینی i-ی بچووك لهگهڵ نیشانه لهسهری',
eth: 'پیتی لاتینی e-ی بچووك',
ntilde: 'پیتی لاتینی n-ی بچووك لهگهڵ زهڕه',
ograve: 'پیتی لاتینی o-ی بچووك لهگهڵ ڕوومهتداری لار',
oacute: 'پیتی لاتینی o-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ocirc: 'پیتی لاتینی o-ی بچووك لهگهڵ نیشانه لهسهری',
otilde: 'پیتی لاتینی o-ی بچووك لهگهڵ زهڕه',
ouml: 'پیتی لاتینی o-ی بچووك لهگهڵ نیشانه لهسهری',
divide: 'نیشانهی دابهش',
oslash: 'پیتی لاتینی گهورهی ø لهگهڵ هێمای دڵ وهستان',
ugrave: 'پیتی لاتینی u-ی بچووك لهگهڵ ڕوومهتداری لار',
uacute: 'پیتی لاتینی u-ی بچووك لهگهڵ ڕوومهتداری تیژ',
ucirc: 'پیتی لاتینی u-ی بچووك لهگهڵ نیشانه لهسهری',
uuml: 'پیتی لاتینی u-ی بچووك لهگهڵ نیشانه لهسهری',
yacute: 'پیتی لاتینی y-ی بچووك لهگهڵ ڕوومهتداری تیژ',
thorn: 'پیتی لاتینی دڕکی بچووك',
yuml: 'پیتی لاتینی y-ی بچووك لهگهڵ نیشانه لهسهری',
OElig: 'پیتی لاتینی گهورهی پێکهوهنووسراوی OE',
oelig: 'پیتی لاتینی بچووکی پێکهوهنووسراوی oe',
'372': 'پیتی لاتینی W-ی گهوره لهگهڵ نیشانه لهسهری',
'374': 'پیتی لاتینی Y-ی گهوره لهگهڵ نیشانه لهسهری',
'373': 'پیتی لاتینی w-ی بچووکی لهگهڵ نیشانه لهسهری',
'375': 'پیتی لاتینی y-ی بچووکی لهگهڵ نیشانه لهسهری',
sbquo: 'نیشانهی فاریزهی نزم',
'8219': 'نیشانهی فاریزهی بهرزی پێچهوانه',
bdquo: 'دوو فاریزهی تهنیش یهك',
hellip: 'ئاسۆیی بازنه',
trade: 'نیشانهی بازرگانی',
'9658': 'ئاراستهی ڕهشی دهستی ڕاست',
bull: 'فیشهك',
rarr: 'تیری دهستی ڕاست',
rArr: 'دووتیری دهستی ڕاست',
hArr: 'دوو تیری ڕاست و چهپ',
diams: 'ڕهشی پاقڵاوهیی',
asymp: 'نیشانهی یهکسانه'
});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add('docprops',{init:function(a){var b=new CKEDITOR.dialogCommand('docProps');b.modes={wysiwyg:a.config.fullPage};a.addCommand('docProps',b);CKEDITOR.dialog.add('docProps',this.path+'dialogs/docprops.js');a.ui.addButton('DocProps',{label:a.lang.docprops.label,command:'docProps'});}});
| JavaScript |
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'a11yhelp', 'fa',
{
accessibilityHelp :
{
title : 'دستورالعملهای دسترسی',
contents : 'راهنمای فهرست مطالب. برای بستن این کادر محاورهای ESC را فشار دهید.',
legend :
[
{
name : 'عمومی',
items :
[
{
name : 'نوار ابزار ویرایشگر',
legend:
'${toolbarFocus} را برای باز کردن نوار ابزار بفشارید. با کلید Tab و Shif-Tab در مجموعه نوار ابزار بعدی و قبلی حرکت کنید. برای حرکت در کلید نوار ابزار قبلی و بعدی با کلید جهتنمای راست و چپ جابجا شوید. کلید Space یا Enter را برای فعال کردن کلید نوار ابزار بفشارید.'
},
{
name : 'پنجره محاورهای ویرایشگر',
legend :
'در داخل یک پنجره محاورهای، کلید Tab را بفشارید تا به پنجرهی بعدی بروید، Shift+Tab برای حرکت به فیلد قبلی، فشردن Enter برای ثبت اطلاعات پنجره، فشردن Esc برای لغو پنجره محاورهای و برای پنجرههایی که چندین برگه دارند، فشردن Alt+F10 جهت رفتن به Tab-List. در نهایت حرکت به برگه بعدی با Tab یا کلید جهتنمای راست. حرکت به برگه قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک برگه.'
},
{
name : 'منوی متنی ویرایشگر',
legend :
'${contextMenu} یا کلید برنامههای کاربردی را برای باز کردن منوی متن را بفشارید. سپس میتوانید برای حرکت به گزینه بعدی منو با کلید Tab و یا کلید جهتنمای پایین جابجا شوید. حرکت به گزینه قبلی با Shift+Tab یا کلید جهتنمای بالا. فشردن Space یا Enter برای انتخاب یک گزینه از منو. باز کردن زیر شاخه گزینه منو جاری با کلید Space یا Enter و یا کلید جهتنمای راست و چپ. بازگشت به منوی والد با کلید Esc یا کلید جهتنمای چپ. بستن منوی متن با Esc.'
},
{
name : 'جعبه فهرست ویرایشگر',
legend :
'در داخل جعبه لیست، قلم دوم از اقلام لیست بعدی را با TAB و یا Arrow Down حرکت دهید. انتقال به قلم دوم از اقلام لیست قبلی را با SHIFT + TAB یا UP ARROW. کلید Space یا ENTER را برای انتخاب گزینه لیست بفشارید. کلید ESC را برای بستن جعبه لیست بفشارید.'
},
{
name : 'ویرایشگر عنصر نوار راه',
legend :
'برای رفتن به مسیر عناصر ${elementsPathFocus} را بفشارید. حرکت به کلید عنصر بعدی با کلید Tab یا کلید جهتنمای راست. برگشت به کلید قبلی با Shift+Tab یا کلید جهتنمای چپ. فشردن Space یا Enter برای انتخاب یک عنصر در ویرایشگر.'
}
]
},
{
name : 'فرمانها',
items :
[
{
name : 'بازگشت فرمان',
legend : 'فشردن ${undo}'
},
{
name : 'انجام مجدد فرمان',
legend : 'فشردن ${redo}'
},
{
name : 'فرمان متن درشت',
legend : 'فشردن ${bold}'
},
{
name : 'فرمان متن کج',
legend : 'فشردن ${italic}'
},
{
name : 'فرمان متن زیرخطدار',
legend : 'فشردن ${underline}'
},
{
name : 'فرمان پیوند',
legend : 'فشردن ${link}'
},
{
name : 'بستن نوار ابزار فرمان',
legend : 'فشردن ${toolbarCollapse}'
},
{
name : 'راهنمای دسترسی',
legend : 'فشردن ${a11yHelp}'
}
]
}
]
}
});
| JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.