The new layer window for editing links of the baidu blog! Classic ~ Support for [FF] _ javascript skills

Source: Internet
Author: User
The new layer window for editing links of the baidu blog! Classic ~ Supports [FF]

<Script language = "JavaScript"> var IsDraging = false; var oEdit = null; var dragData = null; var backData = null; var oObj = null; var dragiframe = 1; var bNotReloadOnClose = false; var is_opera_d = (navigator. userAgent. toLowerCase (). indexOf ('Opera ')! =-1); String. prototype. trim = function () {return this. replace (/(^ [|] *) | ([|] * $)/g, "");} function $ (s) {if (document. getElementById) {return eval ('document. getElementById ("'+ s +'") ');} else {return eval ('document. all. '+ s) ;}} function $ (s) {return document. frames? Document. frames [s]: $ (s ). contentWindow;} function $ c (s) {return document. createElement (s);} function swap (s, a, B, c) {$ (s) [a] = $ (s) [a] = B? C: B;} function exist (s) {return $ (s )! = Null;} function dw (s) {document. write (s);} function hide (s) {$ (s ). style. display = $ (s ). style. display = "none "? "": "None";} function isNull (_ sVal) {return (_ sVal = "" | _ sVal = null | _ sVal = "undefined");} function removeNode (s) {if (exist (s) {$ (s ). innerHTML = ''; $ (s ). removeNode? $ (S ). removeNode (): $ (s ). parentNode. removeChild ($ (s) ;}} function dichild () {var titile = ''; var auto = 'y'; var width = 240; var height = 120; var src = ""; var path = ". /"; // the path of the image, excluding the image name var sFunc = '<input id = "dialogOk" type = "button" value = "Confirm"/> <input id = "dialogCancel" type = "button" value = "Remove"/> '; var sClose = '<input type = "image" id = "dialogBoxClose" src = "' + path + 'dialogclose. g If "border =" 0 "width =" 16 "height =" 16 "align =" absmiddle "title =" close "/> '; var sBody = '\ <table id = "dialogBodyBox" border = "0" align = "center" cellpadding = "0" cellspacing = "6" width = "100%" >\< tr height = "10"> <td colspan = "4"> </td> </tr> \ <tr> <td colspan = "4" align = "center"> \ <p id = "dialogMsgDiv" style = "text-align: center "& gt; <p id =" dialogMsg "style =" font-size: 12px; line-height: 180%; "> </p> \ </td> </tr> \ <tr> <t D id = "dialogFunc" colspan = "4" align = "center"> '+ sFunc +' </td> </tr> \ <tr height = "5"> <td colspan = "4" align = "center"> </td> </tr> \ </table> \'; var sIfram = '\'; var sBox = '\ <p id = "dialogBox" style = "border: 1px solid # C3D9FF; display: none; z-index: 10003; width: '+ width + 'px; ">\< table width =" 100% "border =" 0 "cellpadding =" 0 "cellspacing =" 0 ">\< tr height =" 24 "bgcolor =" #6795B4" >\< td >\< table style = "-moz -User-select: none; "width =" 100% "border =" 0 "cellpadding =" 0 "cellspacing =" 0 "style =" background-color: #709CD2; height: 25px; border-top: 1px solid # 92c3ec; ">\< tr >\< td width =" 6 "height =" 24 "> </td >\< td id =" dialogBoxTitle "style =" color: # fff; cursor: move; font-size: 14px; font-weight: bold; "> </td> \ <td id =" dialogClose "width =" 20 "align =" right "valign =" middle "> \ '+ sClose +' \ </td >\< td width = "6"> </td> \ </ Tr >\</table >\</td >\</tr >\< tr id = "dialogHeight" style = "height: '+ height +' "valign =" top "> \ <td id =" dialogBody "bgcolor =" # ffffff "> '+ sBody +' </td> \ </tr >\</table> </p> \ <p id = "dialogBoxShadow" style = "display: none; z-index: 10001; "> </p> \ '; var sBG =' \ <p id =" dialogBoxBG "style =" position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 10001; filter: alpha (opacity = 50); background-color: t Ransparent! Important; background-color: # EEE; "> </p> \ '; this. show = function () {this. middle ('dialogbox'); if ($ ('dialogiframbg ') {$ ('dialogiframbg '). style. top = $ ('dialogbox '). style. top; $ ('dialogiframbg '). style. left = $ ('dialogbox '). style. left; $ ('dialogiframbg '). style. width = $ ('dialogbox '). offsetWidth; $ ('dialogiframbg '). style. height = $ ('dialogbox '). offsetHeight; $ ('dialogiframbg '). style. display = 'block ';} This. shadow ();} this. reset = function () {if (! BNotReloadOnClose) {top. location = top. location. href;} this. close ();} this. close = function () {if ($ ('dialogiframbg ') {$ ('dialogiframbg '). style. display = 'none';} $ ('dialogbox '). style. display = 'none'; $ ('dialogboxbg '). style. display = 'none'; $ ('dialogboxshadow '). style. display = "none"; $ ('dialogbody '). innerHTML = sBody;} this.html = function (_ sHtml) {$ ("dialogBody "). innerHTML = _ sHtml; this. show ();} This. init = function (big_msg) {// alert ("a"); $ ('dialogcase ')? $ ('Dialogcase '). parentNode. removeChild ($ ('dialogcase'): function () {}; var oDiv = document. createElement ('span '); oDiv. id = "dialogCase"; if ('yes' = big_msg) {oDiv. innerHTML = sBG + sBox;} else {if (! Is_opera_d) {oDiv. innerHTML = sBG + sIfram + sBox;} else {oDiv. innerHTML = sBG + sBox;} document. body. appendChild (oDiv); $ ('dialogboxbg '). style. height = document. body. scrollHeight;} this. button = function (_ sId, _ sFuc) {if ($ (_ sId) {$ (_ sId ). style. display = ''; if ($ (_ sId ). addEventListener) {if ($ (_ sId ). act) {$ (_ sId ). removeEventListener ('click', function () {eval ($ (_ sId ). act)}, false);} $ (_ sI D ). act = _ sFuc; $ (_ sId ). addEventListener ('click', function () {eval (_ sFuc)}, false);} else {if ($ (_ sId ). act) {$ (_ sId ). detachEvent ('onclick', function () {eval ($ (_ sId ). act)}) ;}$ (_ sId ). act = _ sFuc; $ (_ sId ). attachEvent ('onclick', function () {eval (_ sFuc)}) ;}} this. shadow = function () {var oShadow = $ ('dialogboxshadow'); var oDialog = $ ('dialogbox '); oShadow ['style'] ['position'] = "absolute"; oShad Ow ['style'] ['background'] = "#000"; oShadow ['style'] ['display'] = ""; oShadow ['style'] ['opacity '] = "0.2"; oShadow ['style'] ['filter'] = "alpha (opacity = 20 )"; oShadow ['style'] ['top'] = oDialog. offsetTop + 6; oShadow ['style'] ['left'] = oDialog. offsetLeft + 6; oShadow ['style'] ['width'] = oDialog. offsetWidth; oShadow ['style'] ['height'] = oDialog. offsetHeight;} this. open = function (_ sUrl, _ sMode) {thi S. show (); if (! _ SMode | _ sMode = "no" | _ sMode = "yes") {if (_ sUrl. length> 100) {$ ("dialogBody "). innerHTML = _ sUrl;} else {var openIframe = ""; $ ("dialogBody "). innerHTML = openIframe ;}} this. showWindow = function (_ sUrl, _ iWidth, _ iHeight, _ sMode) {var oWindow; var sLeft = (screen. width )? (Screen. width-_ iWidth)/2: 0; var iTop =-80 + (screen. height-_ iHeight)/2; iTop = iTop> 0? ITop: (screen. height-_ iHeight)/2; var sTop = (screen. height )? ITop: 0; if (window. showModalDialog & _ sMode = "m") {oWindow = window. showModalDialog (_ sUrl, "", "dialogWidth:" + _ iWidth + "px; dialogheight:" + _ iHeight + "px");} else {oWindow = window. open (_ sUrl, '', 'height = '+ _ iHeight +', width = '+ _ iWidth +', top = '+ sTop + ', left = '+ sLeft +', toolbar = no, menubar = no, scrollbars = '+ _ sMode +', resizable = no, location = no, status = no '); this. reset ();}} This. event = function (_ sMsg, _ sOk, _ sCancel, _ sClose) {$ ('dialogfunc '). innerHTML = sFunc; $ ('dialogclose '). innerHTML = sClose; $ ('dialogbodybox') = null? $ ('Dialogbody'). innerHTML = sBody: function () {}; if (width> 400 & height> 300) {$ ('dialogmsg ')? $ ('Dialogmsg '). innerHTML = _ sMsg: function () {}; $ ('dialogmsg ')? $ ('Dialogmsg ') ['style'] ['fontweight'] = "bold": function () {}; $ ('dialogmsg ')? $ ('Dialogmsg ') ['style'] ['fontsize'] = "15px": function () {}; $ ('dialogmsg ')? $ ('Dialogmsg ') ['style'] ['color'] = "# ff9900": function () {}; $ ('dialogmsg ')? $ ('Dialogmsg ') ['style'] ['height'] = "150px": function () {};} else {$ ('dialogmsg ')? $ ('Dialogmsg '). innerHTML = _ sMsg: function () {};}_ sOk & _ sOk! = ""? This. button ('dialogok', _ sOk): $ ('dialogok'). style. display = 'none'; _ sCancel & _ sCancel! = ""? This. button ('dialogcancel', _ sCancel): $ ('dialogcancel'). style. display = 'none'; // _ sOk? This. button ('dialogok', _ sOk): _ sOk = ""? Function () {}:$ ('dialogcancel'). style. display = 'none'; // _ sCancel? This. button ('dialogcancel', _ sCancel): _ sCancel = ""? Function () {}:$ ('dialogcancel'). style. display = 'none'; _ sClose? This. button ('dialogboxclose', _ sClose): function () {}; this. show ();} this. set = function (_ oAttr, _ sVal) {var oShadow = $ ('dialogboxshadow'); var oDialog =$ ('dialogbox '); var oHeight = $ ('dialogheight'); if (_ sVal! = '') {Switch (_ oAttr) {case 'title': $ ('dialogboxtitle '). innerHTML = _ sVal; title = _ sVal; break; case 'width': oDialog ['style'] ['width'] = _ sVal; width = _ sVal; break; case 'height': oHeight ['style'] ['height'] = _ sVal; height = _ sVal; break; case 'src': $ ('dialogmsgdiv '). innerHTML = '\ <table border = "0" align = "center" cellpadding = "0" cellspacing = "0" width = "100%" >\< tr >\< td width = & quot; 30% & quot; align = & quot; ce & quot; Nter "> </td> \ <td id =" dialogMsg "style =" font-size: 12px; line-height: 180%; "width =" 70% "> </td> \ </tr> \ </table> \ '; $ ('dialogboxface ')? $ ('Dialogboxface '). src = path + _ sVal + '.gif ': function () {}; src = _ sVal; break; case 'auto': auto = _ sVal ;}} this. middle ('dialogbox'); oShadow ['style'] ['top'] = oDialog. offsetTop + 6; oShadow ['style'] ['left'] = oDialog. offsetLeft + 6; oShadow ['style'] ['width'] = oDialog. offsetWidth; oShadow ['style'] ['height'] = oDialog. offsetHeight;} this. moveStart = function (event, _ sId) {IsDraging = true; OObj = $ (_ sId); document. onmousemove = mousemove; document. onmouseup = mouseup; document. setCapture? OObj. setCapture (): function () {}; oEvent = window. event? Window. event: event; dragData = {x: oEvent. clientX, y: oEvent. clientY}; backData = {x: parseInt (oObj. style. top), y: parseInt (oObj. style. left)}; function mousemove () {if (! IsDraging) return; var oEvent = window. event? Window. event: event; var iLeft = oEvent. clientX-dragData ["x"] + parseInt (oObj. style. left); var iTop = oEvent. clientY-dragData ["y"] + parseInt (oObj. style. top); oObj. style. left = iLeft; oObj. style. top = iTop; $ ('dialogboxshadow '). style. left = iLeft + 6; $ ('dialogboxshadow '). style. top = iTop + 6; if ($ ('dialogiframbg ') {$ ('dialogiframbg '). style. left = iLeft; $ ('dialogiframbg '). style. top = iTop ;} DragData = {x: oEvent. clientX, y: oEvent. clientY};} function mouseup () {if (! IsDraging) return; var oEvent = window. event? Window. event: event; document. onmousemove = null; document. onmouseup = null; if (oEvent. clientX <1 | oEvent. clientY <1 | oEvent. clientX> document. body. clientWidth | oEvent. clientY> document. body. clientHeight) {oObj. style. left = backData. y; oObj. style. top = backData. x; $ ('dialogboxshadow '). style. left = backData. y + 6; $ ('dialogboxshadow '). style. top = backData. x + 6; if ($ ('dialogiframbg ')){ $ ('Dialogiframbg '). style. left = backData. y; $ ('dialogiframbg'). style. top = backData. x;} IsDraging = false; oObj. releaseCapture? OObj. releaseCapture (): function () {}}} this. hideModule = function (_ sType, _ sDisplay) {var aIframe = parent.doc ument. getElementsByTagName ("iframe"); var aType = document. getElementsByTagName (_ sType); var iChildObj, iChildLen; for (var I = 0; I <aType. length; I ++) {aType. style. display = _ sDisplay;} for (var j = 0; j <aIframe. length; j ++) {iChildObj = document. frames? Document. frames [j]: aIframe [j]. contentWindow; try {iChildLen = iChildObj.doc ument. body. getElementsByTagName (_ sType ). length; for (var k = 0; k <iChildLen; k ++) {iChildObj.doc ument. body. getElementsByTagName (_ sType) [k]. style. display = _ sDisplay;} catch (e) {}} this. middle = function (_ sId) {try {var aIframe = parent.doc ument. getElementById ("iframe_parent");} catch (e) {}if (aIframe) {var SClientWidth = aIframe. offsetWidth; var sClientHeight = aIframe. offsetHeight; var sScrollTop = 0;} else {var sClientWidth = parent? Parent.doc ument. body. clientWidth: document. body. clientWidth; var sClientHeight = parent? Parent.doc ument. body. clientHeight: document. body. clientHeight; var sScrollTop = parent? Parent.doc ument. body. scrollTop: document. body. scrollTop;} var sleft = (document. body. clientWidth/2)-($ (_ sId ). offsetWidth/2); var iTop =-80 + (sClientHeight/2 + sScrollTop)-($ (_ sId ). offsetHeight/2); var sTop = iTop> 0? ITop: (sClientHeight/2 + sScrollTop)-($ (_ sId ). offsetHeight/2); if (sTop <1) sTop = "20"; if (sleft <1) sleft = "20"; $ (_ sId) ['style'] ['display'] = ''; $ (_ sId) ['style'] ['position'] =" absolute "; $ (_ sId) ['style'] ['left'] = sleft; $ (_ sId) ['style'] ['top'] = sTop ;}} function _ error_msg_show (msg, click, icon, title) {click = click? Click: ''; icon = icon? Icon: ''; title = title? Title: ''; dg = new dialog (); dg. init (); dg. set ('src', get_icon (icon); dg. set ('title', title); dg. event (msg, click, '', click);} function get_icon (icons) {var icon = 'login _ wrong '; return icon;} function openWindow (_ sUrl, _ sWidth, _ sHeight, _ sTitle, _ sScroll, _ bReload) {bNotReloadOnClose = _ bReload | false; if(top.doc ument. embeds) {for (I = 0; I <top.doc ument. embeds. length; I ++) {top.doc ument. embed S. style. display = "none ";}} /// // oEdit = new dialog (); oEdit. init ('yes'); oEdit. set ('title', _ sTitle? _ STitle: "system prompt information"); oEdit. set ('width', _ sWidth); oEdit. set ('height', _ sHeight); oEdit. set ('auto', 'n'); oEdit. open (_ sUrl, _ sScroll! = "Yes "? 'No': 'yes');} function getFrameNode (sNode) {return document. frames? Document. frames [sNode]: document. getElementById (sNode ). contentWindow;} function zsxz (ta, zs, maxl) {if (ta. value. length> maxl) {ta. value = ta. value. substring (0, maxl);} else {zs. value = maxl-ta. value. length ;}} SCRIPT <META http-equiv = content-type content = "text/html; charset = gb2312"> Edit
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.