[$] Pr1v473 xHeEl B4ckD00RzZ [$]

Current Path : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalCMS/scripts/editor/scripts/moz/
Upload File
Current File : D:/InetPub/vhosts/kuccs.com.kw/httpdocs/PortalCMS/scripts/editor/scripts/moz/bookmark.htm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../style/editor.css" rel="stylesheet" type="text/css">
<script>
  var sLangDir=parent.oUtil.langDir;
  document.write("<scr"+"ipt src='../language/"+sLangDir+"/bookmark.js'></scr"+"ipt>");
</script>
<script>writeTitle()</script>
<script>
/*** COMMON ***/
function GetElement(oElement,sMatchTag)
    {
    while (oElement!=null&&oElement.tagName!=sMatchTag)
        {
        if(oElement.tagName=="BODY")return null;
        oElement=oElement.parentNode;
        }
    return oElement;
    }

/*** REALTIME + PREVIEW ***/
function doWindowFocus()
    {
    parent.oUtil.onSelectionChanged=new Function("realTime()");
    updateList();
    }

function bodyOnLoad()
    {
    loadTxt();

    window.onfocus=doWindowFocus;
    parent.oUtil.onSelectionChanged=new Function("realTime()");
    updateList();
    realTime();
    }

function bodyOnUnload() {
  parent.oUtil.onSelectionChanged=null;
}

function updateList()
    {
    var oEditor=parent.oUtil.oEditor;

    var lstBookmark = document.getElementsByName("lstBookmark")[0];

    while(lstBookmark.options.length!=0) lstBookmark.options[0] = null;

    var aNode = oEditor.document.getElementsByTagName("A");
    for(var i=0;i<aNode.length;i++)
        {
        if (aNode[i].name != "")
            {
            var op = document.createElement("OPTION");
            op.text=aNode[i].name;
            op.value=aNode[i].name;
            lstBookmark.options[lstBookmark.options.length] = op;
            }
        }
    }

function selectBookmark(sName)
    {
    var lstBookmark = document.getElementById("lstBookmark");
    var sel = lstBookmark.selectedIndex;
    var oEditor=parent.oUtil.oEditor;

    var aNode = oEditor.document.getElementsByName(sName);
    if (aNode.length > 0) {
        var range = oEditor.document.createRange();
        range.selectNode(aNode[0]);
        oSel = oEditor.getSelection();
        oSel.removeAllRanges();
        oSel.addRange(range);
    }
    realTime();
    parent.realTime(parent.oUtil.obj);
    parent.oUtil.obj.selectElement(0);
    window.focus();
    lstBookmark.focus();
    lstBookmark.selectedIndex = sel;
    }

function realTime()
    {

    var btnInsert = document.getElementById("btnInsert");
    var btnApply = document.getElementById("btnApply");
    var btnOk = document.getElementById("btnOk");
    var inpName = document.getElementById("inpName");

    var oEditor=parent.oUtil.oEditor;

    var oSel=oEditor.getSelection();
    var oEl = parent.getSelectedElement(oSel);

    if (oEl.nodeName == "A")
        {

        var range =oEditor.document.createRange();
        range.selectNode(oEl);
        oSel.removeAllRanges();
        oSel.addRange(range);

        btnInsert.style.display="none";
        btnApply.style.display="block";
        btnOk.style.display="block";

        if(oEl.NAME)inpName.value=oEl.NAME;
        if(oEl.name)inpName.value=oEl.name;
        }
    else
        {
        btnInsert.style.display="block";
        btnApply.style.display="none";
        btnOk.style.display="none";

        inpName.value="";
        }
    }

function doApply()
    {

    var inpName = document.getElementById("inpName");

    var oEditor=parent.oUtil.oEditor;

    parent.oUtil.obj.saveForUndo();

    var oSel = oEditor.getSelection();
    var range = oSel.getRangeAt(0);

    if(inpName.value!="") {
        var emptySel = false;
        if (range.toString() == "") {
            emptySel = true;
            var node = oEditor.document.createTextNode("#");
            range.insertNode(node);

            range = oEditor.document.createRange();
            range.setStart(node, 0);
            range.setEnd(node, "#".length);

            oSel = oEditor.getSelection();
            oSel.removeAllRanges();
            oSel.addRange(range);
        }

        var isSelInMidText = (range.startContainer.nodeType==Node.TEXT_NODE) && (range.startOffset>0)

        oEditor.document.execCommand("CreateLink", false, "#");

        oSel = oEditor.getSelection();
        range = oSel.getRangeAt(0);

        //get A element
        if (range.startContainer.nodeType == Node.TEXT_NODE) {

            var node = (emptySel || !isSelInMidText ? range.startContainer.parentNode : range.startContainer.nextSibling); //A node
            range = oEditor.document.createRange();
            range.selectNode(node);

            oSel = oEditor.getSelection();
            oSel.removeAllRanges();
            oSel.addRange(range);

        }

        var oEl = range.startContainer.childNodes[range.startOffset];
        oEl.removeAttribute("HREF");
        oEl.setAttribute("NAME", inpName.value);

    } else {
        var oEl = range.startContainer.childNodes[range.startOffset];
        oEl.setAttribute("HREF", "dummy");
        oEditor.document.execCommand("unlink", false, null);//unlink
    }

    updateList();
    realTime();

    //~~~~~~~~ Focus stuff
    var oEditor=parent.oUtil.oEditor;
    oEditor.focus()

    parent.realTime(parent.oUtil.obj);

    if (inpName.value!="")
        {
            parent.oUtil.obj.selectElement(0);
        } else {
            parent.oUtil.activeElement=null;
        }

    window.setTimeout("window.focus()", 10);
    }

</script>
</head>
<body style="overflow:hidden;">

<table width=100% height=100% align=center cellpadding=0 cellspacing=0>
<tr>
<td valign=top style="padding:5;height:100%">

    <table width=100% border="0">
    <tr>
    <td width="100%">
    <select name="lstBookmark" id="lstBookmark" style="width:100%" size="5" onchange="selectBookmark(this.value)" class="inpSel">
    </select>
    <td>
    </tr>
    </table><br>

    <table width=100%>
    <tr>
        <td nowrap><span id="txtLang" name="txtLang">Name</span>:</td>
        <td style="width:100%;padding-right:5"><INPUT type="text" ID="inpName" NAME="inpName" style="width:100%" class="inpTxt"></td>
    </tr>
    </table>

</td>
</tr>
<tr>
<td class="dialogFooter" align="right">
    <table cellpadding=0 cellspacing=0>
    <tr>
    <td>
    <input type=button name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
    </td>
    <td>
    <input type=button name=btnInsert id=btnInsert value="insert" onclick="doApply()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
    </td>
    <td>
    <input type=button name=btnApply id=btnApply value="apply" style="display:none" onclick="doApply()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
    </td>
    <td>
    <input type=button name=btnOk id=btnOk value=" ok " style="display:none;" onclick="doApply();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
    </td>
    </tr>
    </table>
</td>
</tr>
</table>

</body>
</html>