HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bs.kntsleep.com/system/extend/ueditor/dialogs/link/link.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" src="../internal.js"></script>
    <style type="text/css">
        *{margin:0;padding:0;color: #838383;} 
        .txt{width:284px;height:32px; border-radius:3px; line-height:30px;border:1px solid #d8d8d8; padding:0 8px;}
		body>table{margin:12px;}
		body>table td{padding:4px;}
		body>table label{white-space:nowrap; display:inline-block; min-width:78px;}
		
::-webkit-scrollbar{width:4px; height:4px;}
::-webkit-scrollbar-thumb{width:4px; height:4px; border-radius:4px; background:#fff;}
::-webkit-scrollbar-thumb:hover{background:#1880fe;}
::-webkit-scrollbar-track-piece{width:4px; height:4px; background:#fff;}
    </style>
</head>
<body>
    <table>
        <tr>
            <td><label for="text"> <var id="lang_input_text"></var></label></td>
            <td><input class="txt" id="text" type="text" disabled="true"/></td>
        </tr>
        <tr>
            <td><label for="href"> <var id="lang_input_url"></var></label></td>
            <td><input class="txt" id="href" type="text" /></td>
        </tr>
        <tr>
            <td><label for="title"> <var id="lang_input_title"></var></label></td>
            <td><input class="txt" id="title" type="text"/></td>
        </tr>
        <tr>
             <td colspan="2">
				 <span style="display:inline-block; width:50%;">
					 <label for="target"><var id="lang_input_target"></var></label>
					 <input id="target" type="checkbox"/>
				 </span>
				 <span>
					 <label for="button"><var id="lang_input_button"></var></label>
					 <input id="button" type="checkbox"/>
				 </span>
             </td>
        </tr>
        <tr>
            <td colspan="2" id="msg"></td>
        </tr>
    </table>
<script type="text/javascript">

    editor.setOpt('allowLinkProtocols', ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', '../', './', '://', 'upload/']);
    var allowLinkProtocols = editor.getOpt('allowLinkProtocols');

    var range = editor.selection.getRange(),
        link = range.collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(),
        url,
        text = $G('text'),
        rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(),'a',true),
        orgText;

    link = domUtils.findParentByTagName( link, "a", true );

    if(link){
        url = utils.html(link.getAttribute( '_href' ) || link.getAttribute( 'href', 2 ));

        if(rangeLink === link && !link.getElementsByTagName('img').length){
            text.removeAttribute('disabled');
            orgText = text.value = link[browser.ie ? 'innerText':'textContent'];
        }else{
            text.setAttribute('disabled','true');
            text.value = lang.validLink;
        }

    }else{
        if(range.collapsed){
            text.removeAttribute('disabled');
            text.value = '';
        }else{
            text.setAttribute('disabled','true');
            text.value = lang.validLink;
        }

    }
    $G("title").value = url ? link.title : "";
    $G("href").value = url ? url: '';
    $G("target").checked = url && link.target == "_blank" ? true :  false;
    $G("button").checked = url && link.getAttribute('button') == "button" ? true :  false;
    $focus($G("href"));

    function handleDialogOk(){
        var href =$G('href').value.replace(/^\s+|\s+$/g, '');
        if(href){
            if(!hrefStartWith(href, allowLinkProtocols)) {
                href  = "http://" + href;
            }
            var obj = {
                'href' : href,
                'target' : $G("target").checked ? "_blank" : '_self',
                'button' : $G("button").checked ? "button" : 'none',
                'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
                '_href':href
            };
            //修改链接内容的情况太特殊了,所以先做到这里了
            //todo:情况多的时候,做到command里
            if(orgText && text.value != orgText){
                link[browser.ie ? 'innerText' : 'textContent'] =  obj.textValue = text.value;
                range.selectNode(link).select()
            }
            if(range.collapsed){
                obj.textValue = text.value;
            }
            editor.execCommand('link',utils.clearEmptyAttrs(obj) );
            dialog.close();
        }
    }
    dialog.onok = handleDialogOk;
    $G('href').onkeydown = $G('title').onkeydown = function(evt){
        evt = evt || window.event;
        if (evt.keyCode == 13) {
            handleDialogOk();
            return false;
        }
    };
    $G('href').onblur = function(){
        if(!hrefStartWith(this.value, allowLinkProtocols)){
            $G("msg").innerHTML = "<span style='color: red'>"+lang.httpPrompt+"</span>";
        }else{
            $G("msg").innerHTML = "";
        }
    };

    function hrefStartWith(href,arr){
        href = href.replace(/^\s+|\s+$/g, '');
        for(var i=0,ai;ai=arr[i++];){
            if(href.indexOf(ai)==0){
                return true;
            }
        }
        return false;
    }


</script>
</body>
</html>