?? ie5script.js
字號:
// Purpose: functions specific to Internet Explorer
function wp_divReturn(obj) {
var sel = obj.edit_object.document.selection.createRange()
parentTag = wp_skipInline(sel)
if (parentTag.tagName == "TD"
|| parentTag.tagName == "THEAD"
|| parentTag.tagName == "TFOOT"
|| parentTag.tagName == "BODY"
|| parentTag.tagName == "HTML"
|| parentTag.tagName == "P") {
obj.edit_object.document.execCommand("FormatBlock", false, "<div>")
}
return true
}
function wp_skipInline(sel) {
var foo = sel.parentElement()
var tagName = foo.tagName
while((wp_inline_tags.test(tagName)) && (tagName!="HTML")) {
foo = foo.parentElement
tagName = foo.tagName
}
return foo
}
function wp_editor(obj,config) {
// Strings:
obj.name = config.name
obj.instance_lang = config.instance_lang
obj.encoding = config.encoding
obj.xhtml_lang = config.xhtml_lang
obj.baseURLurl = config.baseURLurl
obj.baseURL = config.baseURL
obj.doctype = config.doctype
obj.charset = config.charset
if (config.domain1) {
obj.domain1 = config.domain1
obj.domain2 = config.domain2
}
obj.instance_img_dir = config.instance_img_dir
obj.instance_doc_dir = config.instance_doc_dir
obj.imagewindow = config.imagewindow
obj.links = config.links
obj.custom_inserts = config.custom_inserts
obj.stylesheet = config.stylesheet
obj.styles = ''
obj.color_swatches = config.color_swatches
// lang
obj.lng = config.lang
//integers:
obj.imenu_height = config.imenu_height
obj.bmenu_height = config.bmenu_height
obj.smenu_height = config.smenu_height
obj.tmenu_height = config.tmenu_height
obj.border_visible = config.border_visible
// booleen
obj.usep = config.usep
if (obj.usep) {
obj.tdInners = '<p> </p>';
} else {
obj.tdInners = '<div> </div>';
}
obj.showbookmarkmngr = config.showbookmarkmngr
obj.snippit = true
obj.html_mode=false
obj.preview_mode=false
obj.safe = true
obj.initfocus = false
obj.subsequent =config.subsequent
obj.useXHTML = config.useXHTML
// methods
obj.getCode = wp_GetCode
obj.getPreviewCode = wp_GetPreviewCode
obj.setCode = wp_SetCode
obj.insertAtSelection = wp_InsertAtSelection
obj.getSelectedText = wp_GetSelectedText
obj.moveFocus = wp_Focus
obj.openDialog = wp_openDialog
obj.showPreview = wp_showPreview
obj.showCode = wp_showCode
obj.showDesign = wp_showDesign
obj.updateHTML = wp_updateHTML
obj.updateWysiwyg = wp_updateWysiwyg
// objects:
// 222 frame position fix
obj.format_frame = document.frames(obj.name+"_format_frame")
obj.class_frame = document.frames(obj.name+"_class_frame")
obj.font_frame = document.frames(obj.name+"_font_frame")
obj.size_frame = document.frames(obj.name+"_size_frame")
obj.format_frame.written = false
obj.class_frame.written = false
obj.font_frame.written = false
obj.size_frame.written = false
// end 222
obj.font_face = eval("document.all."+obj.name+"_font_face")
obj.font_size = eval("document.all."+obj.name+"_font_size")
obj.format_list = eval("document.all."+obj.name+"_format_list")
obj.class_menu = eval("document.all."+obj.name+"_class_menu")
obj.html_edit_area = eval("document.getElementById('"+obj.name+"')")
var tbar=eval("document.getElementById('"+obj.name+"_tab_one')")
var tbarimages = document.getElementById(obj.name+"_tab_one").getElementsByTagName('IMG')
obj.tbarimages = tbarimages
obj.tbarlength = tbarimages.length
obj.edit_object = document.frames(obj.name+"_editFrame")
obj.editFrame = obj.edit_object
obj.previewFrame = document.frames(obj.name+"_previewFrame")
// submit_form
var container = document.getElementById(obj.name+"_container")
var node = container.parentElement;
while(node.tagName != 'FORM' && node.tagName != "BODY" && node.tagName != "HTML") {
node= node.parentElement;
}
if (node.tagName == 'FORM') {
node.attachEvent('onsubmit', wp_submit_editors)
}
// end
if (!wp_is_ie50) {
var table = document.getElementById(obj.name+"_toolbar1")
var n = table.all.length
for (i=0; i<n; i++) {
table.all[i].unselectable = "on"
}
var table = document.getElementById(obj.name+"_toolbar2")
var n = table.all.length
for (i=0; i<n; i++) {
table.all[i].unselectable = "on"
}
var tab_table = document.getElementById(obj.name+'_tab_table')
var n=tab_table.all.length
for (i=0; i<n; i++) {
tab_table.all[i].unselectable = "on"
}
var hidden = document.getElementById(obj.name+'_hidden')
var n=hidden.all.length
for (i=0; i<n; i++) {
hidden.all[i].unselectable = "on"
}
}
obj.edit_object.document.designMode="on"
wp_next(obj)
}
function wp_next (obj) {
// baseURL
var str = obj.html_edit_area.value
// 222 fix to ensure script and form tags are not removed in snippit mode
if (str.search(/<body/gi) != -1) {
obj.snippit = false
str2 = obj.doctype
if (obj.baseURL != '') {
str2+=obj.baseURL
}
str = str2 + str
} else {
obj.snippit = true
str2 = obj.doctype+'<html><head>'+obj.charset
if (obj.baseURL != '') {
str2+=obj.baseURL
}
str = str2 + '</head><body>' + str + '</body></html>'
}
// end 222
try {
obj.edit_object.document.open()
} catch (e) {
document.location.reload()
}
obj.edit_object.document.write(str)
obj.edit_object.document.close()
obj.edit_object.document.execCommand("2D-Position", true, true)
obj.edit_object.document.execCommand("LiveResize", true, true)
obj.edit_object.document.execCommand("MultipleSelection", true, true)
if (obj.stylesheet != '') {
var num = obj.stylesheet.length;
for (var i=0; i < num; i++) {
obj.edit_object.document.createStyleSheet(obj.stylesheet[i])
}
}
// detect keypress
obj.edit_object.document.onkeydown = function () {
// make the enter keypress use <div> instead of <p> as the default.
if (obj.edit_object.event.keyCode == 13) { // ENTER
//var sel=obj.edit_object.document.selection.createRange()
if ((obj.html_mode==false) && (obj.safe) && (!obj.usep) && (obj.edit_object.document.selection.type != "Control")) {
wp_divReturn(obj)
}
} else
// make the tab key create tabs rather moving the focus away from the editor, which just pisses off people who are used to MS Word.
if (obj.edit_object.event.keyCode == 9) { // TAB
if ((obj.html_mode==false) && (obj.safe)) {
var sel = obj.edit_object.document.selection.createRange()
sel.pasteHTML(' ')
return false
}
} else
// arrow key selection fix
if (obj.edit_object.event.keyCode == 39 || obj.edit_object.event.keyCode == 37) {
wp_set_button_states(obj)
}
}
if (!wp_is_ie50) {
// context menus
obj.edit_object.document.oncontextmenu = function () {
if (obj.safe) {
wp_current_obj = obj
var sel=obj.edit_object.document.selection.createRange()
if (obj.edit_object.document.selection.type == "Control") {
if (sel(0).tagName == "IMG") {
if ((sel(0).getAttribute('name')) && (sel(0).src.search(wp_directory+"/images/bookmark_symbol.gif") != -1)) {
var menu = document.getElementById(obj.name+"_bookmarkMenu")
oHeight = obj.bmenu_height + 2
oWidth=230
} else {
var menu = document.getElementById(obj.name+"_imageMenu")
oHeight = obj.imenu_height + 2
oWidth=230
}
} else {
if (sel(0).tagName == "TABLE") {
var menu = document.getElementById(obj.name+"_standardMenu")
oHeight = obj.smenu_height + 2
oWidth=230
} else {
return false
}
}
} else {
if (wp_isInside(obj, 'TD')) {
var menu = document.getElementById(obj.name+"_tableMenu")
oHeight = obj.tmenu_height + 2
oWidth=270
} else {
var menu = document.getElementById(obj.name+"_standardMenu")
oHeight = obj.smenu_height + 2
oWidth=230
}
}
// make inactive menu items disabled
var menuRows = menu.getElementsByTagName('TR')
if (menu == document.getElementById(obj.name+"_tableMenu")) {
wp_getTable(obj, sel)
}
var n=menuRows.length
for (var i=0; i < n; i++) {
var cmd = menuRows[i].cid
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = "progid:DXImageTransform.Microsoft.MaskFilter() progid:DXImageTransform.Microsoft.MaskFilter(color=#AAAAAA)"
if (cmd == 'unmergeright') {
if (wp_thisCell.colSpan >= 2) {
menuRows[i].disabled=false
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = ""
} else {
menuRows[i].disabled=true
}
} else if (cmd == 'mergeright') {
if ((!wp_thisCell.nextSibling) || (wp_thisCell.rowSpan != wp_thisCell.nextSibling.rowSpan)) {
menuRows[i].disabled=true
} else {
menuRows[i].disabled=false
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = ""
}
} else if (cmd == 'mergebelow') {
var numrows = wp_thisTable.getElementsByTagName('TR').length
var topRowIndex = wp_thisRow.rowIndex
if ((!wp_thisRow.nextSibling) || (numrows - (topRowIndex + wp_thisCell.rowSpan) <= 0)) {
menuRows[i].disabled=true
} else {
menuRows[i].disabled=false
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = ""
}
} else if (cmd == 'unmergebelow') {
if (wp_thisCell.rowSpan < 2) {
menuRows[i].disabled=true
} else {
menuRows[i].disabled=false
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = ""
}
} else {
if (obj.edit_object.document.queryCommandEnabled(cmd)) {
menuRows[i].disabled=false
menuRows[i].getElementsByTagName('TD')[0].getElementsByTagName('IMG')[0].style.filter = ""
} else {
menuRows[i].disabled=true
}
}
}
// now actually make the menus
var oPopUpBody = wp_oPopUp.document.body
var evnt = obj.edit_object.event
wp_oPopUp.document.createStyleSheet(wp_directory+'editor_theme.css');
oPopUpBody.innerHTML = menu.innerHTML
oPopUpBody.onmouseup = wp_closePopupTimer
wp_oPopUp.show(evnt.screenX, evnt.screenY, oWidth, oHeight)
//document.body.onmouseup = closePopup
return false
} else {
return true
}
}
}
if (document.attachEvent) {
eval(obj.name+".edit_object.document.attachEvent('onmouseup', wp_"+obj.name+"_mouseUpHandler, true)")
} else {
eval(obj.name+".edit_object.document.onmouseup = wp_"+obj.name+"_mouseUpHandler")
}
if (obj.border_visible == 1) {
wp_show_borders(obj)
} else {
wp_hide_borders(obj)
}
// 222
wp_font_hack(obj.edit_object.document.body, obj);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -