Guest User

Untitled

a guest
Mar 5th, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           dcinside_lite
  3. // @namespace      http://kasugano.tistory.com
  4. // @version        15021
  5. // @date           2016.04.21
  6. // @author         koreapyj 외
  7. // @description    디시인사이드 갤러리를 깔끔하게 볼 수 있고, 몇 가지 유용한 기능도 사용할 수 있습니다.
  8. // @include        http://gall.dcinside.com/*
  9. // @include        http://gall.dcgame.in/*
  10. // @include        http://job.dcinside.com/*
  11. // @grant          GM_xmlhttpRequest
  12. // @grant          GM_getValue
  13. // @grant          GM_setValue
  14. // @grant          GM_deleteValue
  15. // @grant          GM_listValues
  16. // ==/UserScript==
  17.  
  18. (function() {
  19.     var R_VERSION = "15021";    // 실제 버전
  20.     var VERSION = "15017";      // 설정 내용 버전
  21.     var P = {
  22.     version : "",
  23.  
  24.     loadAtList : 1,
  25.     loadAtView : 0,
  26.     loadAtWrite : 0,
  27.  
  28.     notification : 0,
  29.     notificationInterval : 0,
  30.  
  31.     filter : 1,
  32.     blockN : 1,
  33.     blockNA : 1,
  34.     blockNR : 0,
  35.     allowStyle : 1,
  36.     showLabel : 1,
  37.     blockAN : "",
  38.     allowAN : "",
  39.     blockAT : "",
  40.     allowAT : "",
  41.     blockAI : "",
  42.     allowAI : "",
  43.     blockCN : "",
  44.     allowCN : "",
  45.     blockCT : "",
  46.     allowCT : "",
  47.     blockCI : "127.0.0.0/8",
  48.     allowCI : "",
  49.  
  50.     modTitle : 0,
  51.     listTitle : "{G} - {P} 페이지",
  52.     articleTitle : "{T} ({W}) - {G}",
  53.     header : 1,
  54.     title : 1,
  55.     sidebar : 1,
  56.     pageWidth : 1200,
  57.     wide : 0,
  58.     wideWidth : 900,
  59.     listNumber : 1,
  60.     listDate : 1,
  61.     listCount : 1,
  62.     listRecom : 1,
  63.     listComment : 0,
  64.     listTime : 1,
  65.     listNick : 1,
  66.     menuList : "즐겨찾기||갤로그/구분선/이미지/베스트/개념글/구분선/설정/로그인",
  67.     menuPos : "left",
  68.     best : 1,
  69.     linkList : "게시판@47\n김유식@yusik",
  70.  
  71.     simpleWrite : 0,
  72.     albumFullsize : 1,
  73.  
  74.     page : 0,
  75.     pageCount : 5,
  76.     layerImage : 1,
  77.     layerText : 1,
  78.     layerTextLinkAlwaysNewTab : 0,
  79.     layerComment : 1,
  80.     layerThumb : 1,
  81.     layerLink : 1,
  82.     layerReply : 1,
  83.     layerSingle : 1,
  84.     layerResize : 1,
  85.     thumbWidth : 640,
  86.     thumbHeight : 480,
  87.     hide : 1,
  88.     hideImg : 0,
  89.     hideMov : 0,
  90.     autoForm : 0,
  91.     updUse : 1,
  92.     updDev : 0,
  93.     autoName : "",
  94.     autoPassword : "",
  95.     longExpires : 0,
  96.  
  97.     commentColor : 1,
  98.     commentColorType : "gc",
  99.     syncStore : 1,
  100.  
  101.     apiRead : 0,
  102.     autoBad : 0,
  103.  
  104.     fontOverride : 0,
  105.     fontList : "Segoe UI, Meiryo UI, Malgun Gothic, Dotum, sans-serif"
  106.     };
  107.  
  108.     // 기본 함수 및 상수, 변수
  109.     var BROWSER = {};
  110.     if(navigator.userAgent.indexOf("Firefox") !== -1) {
  111.         BROWSER.firefox = true;
  112.     } else if(navigator.userAgent.indexOf("Edge") !== -1) {
  113.         BROWSER.chrome = true;
  114.     } else if(navigator.userAgent.indexOf("Chrome") !== -1) {
  115.         BROWSER.chrome = true;
  116.         if(typeof chrome !=="undefined") {
  117.             BROWSER.chrome = {};
  118.             BROWSER.chrome.google=true;
  119.             if(chrome.storage)
  120.                 BROWSER.chrome.storage=true;
  121.         }
  122.     } else if(navigator.userAgent.indexOf("Opera") !== -1) {
  123.         BROWSER.opera = true;
  124.     } else if(navigator.userAgent.indexOf("Trident") !== -1) {
  125.         BROWSER.msie = true;
  126.     } else if(navigator.userAgent.indexOf("iPhone") !== -1) {
  127.         BROWSER.chrome = true;
  128.         BROWSER.iphone = true;
  129.         P.menuPos = 'top';
  130.         P.header = P.sidebar = P.best = 0;
  131.     } else if(navigator.userAgent.indexOf("AppleWebKit") !== -1) {
  132.         BROWSER.chrome = true;
  133.     } else {
  134.         BROWSER = false;
  135.         alert("디시라이트가 지원하지 않는 브라우저입니다.\n\n - 브라우저 타입이 지정되지 않음");
  136.     }
  137.    
  138.     if(typeof GM_getValue !== "undefined") {
  139.         BROWSER.greasemonkey = true;
  140.     }
  141.  
  142.     if (localStorage){
  143.         BROWSER.localStorage = true;
  144.     }else{
  145.         alert("디시라이트가 지원하지 않는 브라우저입니다.\n\n - 로컬 스토리지에 접근할 수 없거나 브라우저가 지원하지 않음");
  146.     }
  147.     var MODE = {};
  148.     MODE.prefix = "";
  149.     MODE.api = false;
  150.     location.pathnameN = location.pathname.replace(/\/+$/, '');
  151.     switch(location.pathnameN) {
  152.         case "/mgallery/board/write":
  153.             MODE.minor = true;
  154.         case "/board/write":
  155.             MODE.gall = true;
  156.             MODE.write = true;
  157.             break;
  158.         case "/mgallery/board/view":
  159.             MODE.minor = true;
  160.         case "/board/view":
  161.             MODE.gall = true;
  162.             MODE.article = true;
  163.             break;
  164.         case "/mgallery/board/comment_view":
  165.             MODE.minor = true;
  166.         case "/board/comment_view":
  167.             MODE.gall = true;
  168.             MODE.comment = true;
  169.             break;
  170.         case "/mgallery/board/lists":
  171.             MODE.minor = true;
  172.         case "/board/lists":
  173.             MODE.gall = true;
  174.             MODE.list = true;
  175.             break;
  176.         case "/singo/singo_write":
  177.         case "/singo/singo_nonmember":
  178.             MODE.gall = true;
  179.             MODE.singo= true;
  180.             document.title = "신고 게시물";
  181.             break;
  182.         case "/list.php":
  183.             if(parseQuery(location.search).no)
  184.                 location.replace("http://"+location.innerhost+"/board/view/"+location.search);
  185.             else
  186.                 location.replace("http://"+location.innerhost+"/board/lists/"+location.search);
  187.             MODE = false;
  188.             break;
  189.         case "/options.html":
  190.             if(location.protocol==="chrome-extension:") {
  191.                 MODE.settings=true;
  192.                 if(location.search=="?v2")
  193.                     MODE.settingsv2=true;
  194.             }
  195.             break;
  196.         default:
  197.             MODE = false;
  198.             break;
  199.     }
  200.  
  201.     if(MODE.minor)
  202.         MODE = false;
  203.  
  204.     var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:typeof btoa!=='undefined'?function(e){return btoa(e);}:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:typeof atob!=='undefined'?function(e){return atob(e);}:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}};
  205.  
  206.     var addStyle = typeof GM_addStyle!=='undefined'?GM_addStyle:
  207.         function(css) {
  208.             var parent = document.head || document.documentElement;
  209.             var style = document.createElement("style");
  210.             style.type = "text/css";
  211.             var textNode = document.createTextNode(css);
  212.             style.appendChild(textNode);
  213.             parent.appendChild(style);
  214.         };
  215.  
  216.     var GM_clearStorage = function() {
  217.         var keys = GM_listValues();
  218.         for (var i=0, key=null; key=keys[i]; i++) {
  219.             GM_deleteValue(key);
  220.         }
  221.     }
  222.  
  223.     String.prototype.toDomElement = function () {
  224.         var wrapper = document.createElement('div');
  225.         wrapper.innerHTML = this;
  226.         var df= document.createDocumentFragment();
  227.         df.appendChild(wrapper);
  228.         return df;
  229.     };
  230.  
  231.     var formWalk = function(form) {
  232.         var data='';
  233.         for(var i=(target=form.querySelectorAll('input,textarea')).length;i--;) {
  234.             if(!target[i].name)continue;
  235.             data+=encodeURIComponent(target[i].name) + '=' + encodeURIComponent(target[i].value) + '&';
  236.         }
  237.         return data;
  238.     };
  239.  
  240.     if(!XMLHttpRequest.prototype.sendAsBinary){     // 망할 크롬
  241.         XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
  242.             function byteValue(x) {
  243.                     return x.charCodeAt(0) & 0xff;
  244.             }
  245.             var ords = Array.prototype.map.call(datastr, byteValue);
  246.             var ui8a = new Uint8Array(ords);
  247.             this.send(ui8a.buffer);
  248.         }
  249.     }
  250.  
  251.     var xmlhttpRequest = typeof GM_xmlhttpRequest!=='undefined'?GM_xmlhttpRequest:
  252.         function(details) {
  253.             var bfloc = null;
  254.             var xmlhttp = new XMLHttpRequest();
  255.             xmlhttp.ontimeout = function() { details.ontimeout(); };
  256.             xmlhttp.onreadystatechange = function() {
  257.                 var responseState = {
  258.                     responseXML:(xmlhttp.readyState===4 ? xmlhttp.responseXML : ""),
  259.                     responseText:(xmlhttp.readyState===4 ? xmlhttp.responseText : ""),
  260.                     readyState:xmlhttp.readyState,
  261.                     responseHeaders:(xmlhttp.readyState===4 ? xmlhttp.getAllResponseHeaders() : ""),
  262.                     status:(xmlhttp.readyState===4 ? xmlhttp.status : 0),
  263.                     statusText:(xmlhttp.readyState===4 ? xmlhttp.statusText : "")
  264.                 };
  265.                 if(details.onreadystatechange) {
  266.                     details.onreadystatechange(responseState);
  267.                 }
  268.                 if(xmlhttp.readyState===4) {
  269.                     if(details.onload && xmlhttp.status>=200 && xmlhttp.status<300) {
  270.                         details.onload(responseState);
  271.                     }
  272.                     if(details.onerror && (xmlhttp.status<200 || xmlhttp.status>=300)) {
  273.                         details.onerror(responseState);
  274.                     }
  275.                 }
  276.             };
  277.             try {
  278.                 xmlhttp.open(details.method, details.url);
  279.             } catch(e) {
  280.                 if( details.onerror ) {
  281.                     details.onerror({responseXML:"",responseText:"",readyState:4,responseHeaders:"",status:403,statusText:"Forbidden"});
  282.                 }
  283.                 return;
  284.             }
  285.             if(details.headers) {
  286.                 for(var prop in details.headers) {
  287.                     if(details.headers.hasOwnProperty(prop)) {
  288.                         if(['origin','referer'].indexOf(prop.toLowerCase())==-1)
  289.                             xmlhttp.setRequestHeader(prop, details.headers[prop]);
  290.                         else {
  291.                             bfloc = location.toString();
  292.                             history.pushState(bfloc, '로드 중...', details.headers[prop]);
  293.                         }
  294.                     }
  295.                 }
  296.             }
  297.             try
  298.             {
  299.                 xmlhttp.send( (typeof(details.data)!=="undefined")?details.data:null );
  300.             }
  301.             catch (e)
  302.             {
  303.                 if( details.onerror ) {
  304.                     details.onerror({responseXML:"",responseText:"",readyState:4,responseHeaders:"",status:403,statusText:"Forbidden"});
  305.                 }
  306.                 return;
  307.             }
  308.  
  309.             if(bfloc !== null)
  310.                 history.pushState(bfloc, bfloc, bfloc);
  311.         };
  312.  
  313.     function softLoad(url,ispop) {
  314.         o_url = parseQuery(location.href);
  315.         p_url = parseQuery(url);
  316.         if(history.pushState && MODE.list) {
  317.             if(!ispop) {
  318.                 history.pushState(location.toString(), '로드 중...', url);
  319.                 SCROLL.scrollTop = 0;
  320.             }
  321.  
  322.             rebuildapi = false;
  323.             if(p_url.id!=_ID) {
  324.                 if(MODE.api)
  325.                     rebuildapi = true;
  326.                 MODE.api = false;
  327.                 _ID = p_url.id;
  328.             }
  329.  
  330.             if(p_url.s_type||o_url.s_type||
  331.                 p_url.exception_mode!=o_url.exception_mode||
  332.                 p_url.exception_mode=='winnerta'||o_url.exception_mode=='winnerta') {
  333.                 if(MODE.api)
  334.                     rebuildapi = true;
  335.                 MODE.api = false;
  336.             }
  337.  
  338.             for(var i=0,l=P.page?P.pageCount:1;i<l;i+=1) {
  339.                 pageLoad(i);
  340.             }
  341.             if(rebuildapi) {
  342.                 MODE.api = {};
  343.             }
  344.         }
  345.         else
  346.             location.href=url;
  347.     }
  348.  
  349.     function setValue(name,value,type) {
  350.         if(BROWSER.chrome && BROWSER.chrome.storage && P.store == 'Google') {
  351.             return;
  352.             chrome.storage.sync.set(JSON.parse('{"' + name + '":' + JSON.stringify(value) + '}'),function() {
  353.                 if (err=chrome.runtime.lastError) {
  354.                     alert('설정을 저장하던 중 심각한 오류가 발생하였습니다.\n\n자세한 내용은 콘솔을 참고하십시오.');
  355.                     console.log(err.message);
  356.                 }
  357.             });
  358.             return;
  359.         }else if(BROWSER.greasemonkey && P.store == 'GM') {
  360.             GM_setValue(name, value);
  361.             return;
  362.         }else if(BROWSER.localStorage && type === undefined) {
  363.             if(typeof value === "boolean") {
  364.                 value = Number(value);
  365.             }
  366.             P[name] = value;
  367.             localStorage.setItem(name, value);
  368.             return;
  369.         }
  370.  
  371.         if(typeof value === "boolean") {
  372.             value = Number(value);
  373.         }
  374.         P[name] = value;
  375.  
  376.         var cookie = [];
  377.         for(var i in P) {
  378.             if(P.hasOwnProperty(i)) {
  379.                 cookie.push(i+"\b"+P[i]);
  380.             }
  381.         }
  382.         cookie = escape(cookie.join("\b"));
  383.         if(type=='text')
  384.             return cookie;
  385.         if(cookie.length > 4083) {
  386.             alert("저장할 수 있는 값의 길이를 " + (cookie.length - 4083) + "자 초과하였습니다.");
  387.             return;
  388.         }
  389.         document.cookie = "dcinsidelitesetting=" + cookie + ";expires=" + (new Date((new Date()).getTime() + 31536000000)).toGMTString() + ";path=/;";
  390.     }
  391.     var eRemove = document.body.removeAttribute ?
  392.         function(elem,type) { // firefox 에서는 removeAttribute로만 삭제 가능, elem.onclick = null 은 에러 발생
  393.             elem.removeAttribute(type);
  394.         }
  395.         : function(elem,type) { // opera 에서는 removeAttribute로는 삭제 불가, chrome 는 둘다 가능
  396.             elem[type] = null;
  397.         };
  398.  
  399.     Array.prototype.contains = function(needle) {
  400.         for(var i=0; i < this.length; i++) if(this[i] === needle) return true;
  401.         return false;
  402.     }
  403.    
  404.     String.prototype.toUint8Array = function () {
  405.         var datastr = this;
  406.         function byteValue(x) {
  407.                 return x.charCodeAt(0) & 0xff;
  408.         }
  409.         var ords = Array.prototype.map.call(datastr, byteValue);
  410.         return new Uint8Array(ords);
  411.     }
  412.    
  413.     String.prototype.toBlob = function () {
  414.         var datastr = this;
  415.        
  416.         var bytes = new Uint8Array(datastr.length);
  417.         for (var i=0; i<datastr.length; i++)
  418.             bytes[i] = datastr.charCodeAt(i);
  419.  
  420.         return bytes;
  421.     }
  422.  
  423.     function $(id,multi) {return (multi?document.querySelectorAll(id):document.querySelector(id));};
  424.     function $id(id) {return document.getElementById(id);}
  425.     function cElement(tag,insert,property,func) {
  426.         var _DIRECT = ["className", "innerHTML", "textContent"];
  427.         var element;
  428.         if(!tag)
  429.             element= document.createTextNode(property);
  430.         else
  431.             element= document.createElement(tag);
  432.         if(insert) {
  433.             var parent;
  434.             var before = null;
  435.             if(insert.constructor === Array) {
  436.                 var target = insert[1];
  437.                 if(typeof target === "number") {
  438.                     parent = insert[0];
  439.                     before = parent.childNodes[target];
  440.                 } else {
  441.                     before = insert[0];
  442.                     parent = before.parentNode;
  443.                     if(target === "next") {
  444.                         before = before.nextSibling;
  445.                     }
  446.                     if(target === "prev") {
  447.                         before = before.previousSibling;
  448.                     }
  449.                 }
  450.             } else {
  451.                 parent = insert;
  452.             }
  453.             parent.insertBefore(element,before);
  454.         }
  455.         if(!tag)
  456.             return element;
  457.         if(property) {
  458.             if(typeof property === "object") {
  459.                 for(var i in property) {
  460.                     if(property.hasOwnProperty(i)) {
  461.                         if(_DIRECT.contains(i))
  462.                             element[i] = property[i];
  463.                         else
  464.                             element.setAttribute(i, property[i]);
  465.                     }
  466.                 }
  467.             } else {
  468.                 element.textContent = property;
  469.             }
  470.         }
  471.         if(func) {
  472.             element.addEventListener("click",func,false);
  473.         }
  474.         return element;
  475.     }
  476.     function simpleRequest(url,callback,method,headers,data,error) {
  477.         var details = {method:method?method:"GET",url:url,timeout:10000,ontimeout:function(e){error(e);}};
  478.         if(callback) {
  479.             details.onload = function(response){callback(response);};
  480.         }
  481.         if(headers) {
  482.             details.headers = headers;
  483.             for(var prop in details.headers) {
  484.                 if(details.headers.hasOwnProperty(prop)) {
  485.                     if(prop.toLowerCase() == 'content-type' && details.headers[prop].match(/multipart\/form-data/)) {
  486.                         details.binary = true;
  487.                     }
  488.                 }
  489.             }
  490.         }
  491.         if(data) {
  492.             details.data = data;
  493.         }
  494.         if(error) {
  495.             details.onerror = error;
  496.         }
  497.         xmlhttpRequest(details);
  498.     }
  499.  
  500.     function ePrevent(e) {
  501.         e.stopPropagation();
  502.         e.preventDefault();
  503.     }
  504.     function removeEventListenerAll(elem) {
  505.         elem.parentNode.replaceChild(elem.cloneNode(true), elem);
  506.     }
  507.     function cSearch(elem,search) {
  508.         return (new RegExp("(?:^|\\s+)"+search+"(?:\\s+|$)","")).test(elem.className);
  509.     }
  510.     function cAdd(elem,add) { // 다중 추가는 안함
  511.         if(!cSearch(elem,add)) {
  512.             elem.className += " " + add;
  513.         }
  514.     }
  515.     function cRemove(elem,remove) {
  516.         elem.className = elem.className.replace((new RegExp("(?:^|\\s+)"+remove+"(?:\\s+|$)","g"))," ");
  517.     }
  518.     function cSwitch(elem,remove,add) {
  519.         cRemove(elem,remove);
  520.         cAdd(elem,add);
  521.     }
  522.     function cToggle(elem,toggle) {
  523.         if(cSearch(elem,toggle)) {
  524.             cRemove(elem,toggle);
  525.         } else {
  526.             cAdd(elem,toggle);
  527.         }
  528.     }
  529.     function ipColorize(ip) {
  530.         var ipN = /(\d+)\.(\d+)/g.exec(ip);
  531.         return "hsl(" + Math.floor(Math.abs(Math.sin(ipN[1]))*360) + "," + Math.floor(Math.abs(Math.sin(ipN[2]))*100) + "%," + (P.commentColorType=="bg"?"80%":"40%") + ")";
  532.     }
  533.     function parseQuery(str) {
  534.         str = str.substr(str.indexOf("?")+1);
  535.         str = str.split("&");
  536.         var query = {};
  537.         var split;
  538.         for(var i=0,l=str.length ; i<l ; i+=1) {
  539.             split = str[i].split("=");
  540.             query[split[0]] = split[1];
  541.         }
  542.         return query;
  543.     }
  544.     function getScript(name) {
  545.         var value;
  546.         if(BROWSER.firefox || BROWSER.opera) {
  547.             value = WINDOW[name];
  548.         } else if(BROWSER.chrome){
  549.             var div = document.createElement("div");
  550.             div.style.cssText = "width:0 ; height:0 ; position:absolute ; overflow:hidden ; top:"+document.body.scrollTop+"px";
  551.             div.innerHTML = "<input onfocus='this.value="+name+";' />";
  552.             var input = div.firstChild;
  553.             document.body.appendChild(div);
  554.             input.focus();
  555.             value = input.value;
  556.             document.body.removeChild(div);
  557.         }
  558.         return value;
  559.     }
  560.     function getImgs(elem) {
  561.         var preImgs = elem.getElementsByTagName("img");
  562.         var imgs = [];
  563.         var img;
  564.         for(var i=0,l=preImgs.length ; i<l ; i+=1) {
  565.             img = preImgs[i];
  566.             if(img.src.indexOf("http://zzbang.dcinside.com/")===-1 && img.src.indexOf("http://wstatic.dcinside.com/")===-1) {
  567.                 imgs.push(img);
  568.             }
  569.         }
  570.         return imgs;
  571.     }
  572.     function autoLink(o) {
  573.         if(!o) {
  574.             return;
  575.         }
  576.         var next = o.nextSibling;
  577.         if(o.nodeType === 3) {
  578.             var parent = o.parentNode;
  579.             var value = o.nodeValue;
  580.             var regexp = /(?:http|https|ftp|magnet):[^\s'"]+/ig;
  581.             var index = 0;
  582.             var exec;
  583.             while( (exec=regexp.exec(value)) ) {
  584.                 if(index !== exec.index) {
  585.                     parent.insertBefore(document.createTextNode(value.substring(index,exec.index)),o);
  586.                 }
  587.                 cElement("a",[o],{href:exec,target:"_blank",textContent:exec});
  588.                 index = regexp.lastIndex;
  589.             }
  590.             if(index !== 0) {
  591.                 if(index !== value.length) {
  592.                     parent.insertBefore(document.createTextNode(value.substr(index)),o);
  593.                 }
  594.                 parent.removeChild(o);
  595.             }
  596.         } else if(o.nodeType === 1 && o.nodeName !== "A") {
  597.             autoLink(o.firstChild);
  598.         }
  599.         autoLink(next);
  600.     }
  601.  
  602.     function getHost() {
  603.         return window.location.toString().split('/')[2];
  604.     }
  605.  
  606.     function removeElement(e) {
  607.         return e.parentNode.removeChild(e);
  608.     }
  609.  
  610.     var BASE64 = { // base64 (data:image/png;base64,)
  611.         hideImg : "iVBORw0KGgoAAAANSUhEUgAAABkAAAAOCAYAAADaOrdAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMi8wNC8xMB87UF8AAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAAeUlEQVQ4jdWUQQrAMAgE19K36pviZ9uTEESTluqhe8wio2sSAoAxxoUmiQhRJ8B0ZAYzg5lLIGdmqGoJIITM3c+gaCrzVx4QxKWq6RR27uFWE/khpEPpTt4oi7gUsrsky8Vb3jv5xfuaz4/RNxI19o+dPImTgP4P8gZSi0Fd9LSJoQAAAABJRU5ErkJggg==",
  612.         hideMov : "iVBORw0KGgoAAAANSUhEUgAAABkAAAAOCAYAAADaOrdAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMi8wNC8xMB87UF8AAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAAa0lEQVQ4je2UXQrAIAyDv46d1Z5JL7s9FYq2sME6GCwgaH9IY1AB6L0fFEFVRSoJDFs1wWsk+xxorS1FY4wl52O2j86QKLGiqNlWNEyGb3jiVUVX9QjJFSzGZ5h98BNbLlIB8D/GWxCo/yBPUnI0t18AzcEAAAAASUVORK5CYII=",
  613.         hideOff : "iVBORw0KGgoAAAANSUhEUgAAABkAAAAOCAYAAADaOrdAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMi8wNC8xMB87UF8AAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAAwUlEQVQ4jb2Uyw2DQAxEnxcoCdEENXDEtORC4EBngIRzIiKQ8Akk77Q7lj0jr7QCUJaliwi/wMwkVlUvioI0TUmS5Lbh4zjSNA2AB4Asy241AAghkOc5ALGIEEXR4WZVfZ7NbFcHiM+kU9XVgC1902Qr1TesTJap5obzu5m91Ob6rsk7psZlgE/6knDE5Cp/MVmta7nrOx6eqqr8V/R976rqwd1p25ZhGK4nntF1HXVdAyAAqupTcfoo3f1d72nMTB7e0azZRgjcWAAAAABJRU5ErkJggg==",
  614.         viewAll : "iVBORw0KGgoAAAANSUhEUgAAAB4AAAARCAYAAADKZhx3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNAay06AAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDIvMDUvMTCnhzc6AAAA6klEQVRIib2VQQqEMAxFU/FGTXpSV+48godwl+uICsKfxaDUErU6Og8EU2yTfPPVERF57+Gco3+hqo5EBG3bYpomvM08z6jrGswMF0JA13VUluVaETOTqm7ipOLddWtvHBMRhRCoBLBJeiCPeUga51Lc2hXBzOuVrh9hthp3Z3WZPmsVc8a5xjfYm4GYXanTbpdDLEktqeMCTETkdRuliAiyhytneHLe7UJW4njQnuJnO72WOB6wJ7vOstOTEl9KvPfdju8t71p2GoZh3YymaTCO4+s26vseVVV9/07eeyqKAteEug8AUlX3AQ6usNTFNBFLAAAAAElFTkSuQmCC",
  615.         hideAll : "iVBORw0KGgoAAAANSUhEUgAAAB4AAAARCAYAAADKZhx3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNAay06AAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDIvMDUvMTCnhzc6AAAA5UlEQVRIicWVMQ6DMAxFnSg3ip2TMrFxBA7B5usgQEL6HVoQRKEkLbRviozg2992MERE3nsYY+hXqKohEUHbtpimCXczzzPqugYzw4QQ0HUdOefWjJiZVHV3ZuZtxuuzd7FtfEsIgRyAnegbe3YJpQSXc0os5lAxzryElBPZwkfW5ZBTsS3+6kWcN/fFUnnc5yWeisXxHSJy+xrFiAiyrY57nep9yTxkCad2+Vv+NlynwvHFcFXVWVN9pcVFwkerknt/bxmGYX0ZTdNgHMfb16jve1RV9fw7ee/JWosyoz4HAKmqeQBQB60uBTy2vgAAAABJRU5ErkJggg==",
  616.         bestIcon : "iVBORw0KGgoAAAANSUhEUgAAAAIAAAADAQMAAACDJEzCAAAAA3NCSVQICAjb4U/gAAAABlBMVEUAAAD///+l2Z/dAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFnRFWHRDcmVhdGlvbiBUaW1lADA0LzA4LzEwNj3a3QAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNAay06AAAAAOSURBVAiZY3BgaGBwAAADBgEB/Jz9DgAAAABJRU5ErkJggg==",
  617.         dialogClose :
  618.         "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAUklEQVR4XqXPYQrAIAhAYW/gXd8NJxTopVqsGEhtf+L9/ERU2k/HSMFQpKcYJeNFI9Be0LCMij8cYyjj5EHIivGBkwLfrbX3IF8PqumVmnDpEG+eDsKibPG2JwAAAABJRU5ErkJggg==",
  619.         dialogClose_H :
  620.         "iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAQAAAC1QeVaAAAAnUlEQVR4XoWQQQ6CQAxFewjkJkMCyXgJPMk7AiYczyBeZEAX6AKctGIaN+bt+trk9wtGQc/IkhnoKGxqqiWxOSZalapWFZ6VrIUDExsN0a5JRBq9LoVOR0eEQMoEhKizXhhsn0p1sCWVo7CwOf1RytPL8CPvwuBUoHL6ugeK30CVD1TqK7V/hdpe+VNChhOzV8xWny/+xosHF8578W/Hmc1OOC3wmwAAAABJRU5ErkJggg==",
  621.         transparentBg :
  622.         "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAQMAAAC3R49OAAAABGdBTUEAALGPC/xhBQAAAAZQTFRF8PDwAAAAfqfmLAAAAAJ0Uk5TzAAR3FV6AAAAFElEQVQI12NgsP/AQAz+f4CBGAwAJIIdTTn0+w0AAAAASUVORK5CYII=",
  623.  
  624.         viewerPrev :
  625.         "R0lGODdhHgAeAMIAAP///wAAAMzMzJmZmWZmZjMzM////////ywAAAAAHgAeAAADXQi63P4wyulGoViNwPPcXOc9YBgIY1OGaLqsXOsC8DlrZnzTuX3XMletRyzyisikIMksDptJAAFKDeCqzFdPwO16v19GbafNkRVT83l8TpvOx/c6F/yx4Lg6fj9LAAA7",
  626.         viewerNext :
  627.         "R0lGODdhHgAeAMIAAP///wAAAMzMzJmZmTMzM2ZmZv///////ywAAAAAHgAeAAADWgi63P4wyhlFGDQDG66WXOd9kChi5GN2RaquqMuso7zQsQ3gjOD/wCBwwFPQjshicpnEMJ84qLQTmi6d1quu2smluDUX2Esab2mCM0xtIqfWuls33iC46XhXAgA7",
  628.         viewerZoomin :
  629.         "R0lGODdhHgAeAIAAAP///wAAACwAAAAAHgAeAAACQYSPEMubD1FrsabJrFY4bNt5XxSOZGdCZXqhrOS+xlqF9o3n+s73/g8MCoc8DU12fCVZy1TT9BxFP9NN1RhDZiEFADs=",
  630.         viewerZoomout :
  631.         "R0lGODdhHgAeAIAAAP///wAAACwAAAAAHgAeAAACKYSPqcvtD6OctNqLs968pwCG4kiW5omm6sq27gvH8nx69o3n+s73flcAADs=",
  632.         viewerRotateL :
  633.         "R0lGODdhHgAeAMIAAP///wAAADMzM8zMzGZmZpmZmf///////ywAAAAAHgAeAAADgwi63P4wyukGESEHUQatWhgK3gdgYpoRn+pmwvTOMYSmAnG5LJiWjILqgZMUgynKj0EQASPCUIFx23wGop4iaxLlZplJNQCIqmqSsaI5VI4WbA1aFtIC4nOJOTNF5o1OFSYAR4NISYZrYxp2Jlguf1eQiQuPXJQKljBPlI8cnJihogsJADs=",
  634.         viewerRotateR :
  635.         "R0lGODdhHgAeAMIAAP///wAAADMzM8zMzGZmZpmZmf///////ywAAAAAHgAeAAADggi63P4wyqlGESEHQQZ1A6aNmvcBBKlqwieu8PTCMZSuHDGP7bMWoJWJsQtIio2BiqICLgokp0Q5IjBumtOsp1h+sBkGiQuhacAbSlED9E5gVhTp1HxGtWwGdXQCZKQLSCdDej99D2gscYcKaxmEh46Qh4kBk4chJJeMFiKbjKChJwkAOw==",
  636.         viewerClose :
  637.         "R0lGODdhHgAeAIAAAP///wAAACwAAAAAHgAeAAACOoSPqcvtD6OcJtiLs85o+2914IiJJGmeYKp61AvHMttqdF0e+HfvQb+bCYdEIM5YQ7aUKuapCI1KKQUAOw==",
  638.     };
  639.  
  640.     if(MODE.minor)
  641.         MODE.prefix = "/mgallery";
  642.  
  643.     if(location.host == "gallog.dcinside.com")
  644.         MODE = false;
  645.  
  646.     if(parseQuery(location.search)["s_keyword"]) {
  647.         MODE.search = true;
  648.     }
  649.  
  650.     if(MODE!=false && MODE.gall) {
  651.         var WINDOW = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window;
  652.         var SCROLL = BROWSER.firefox || BROWSER.opera ? document.documentElement : document.body;
  653.         var _ID = parseQuery(location.search).id; // 갤러리 id
  654.         var _GID = $('#favorite_gallog_img')?$('#favorite_gallog_img').href.match(/http:\/\/gallog\.dcinside\.com\/(.+)$/):null; // 로그인 상태
  655.             _GID = (_GID!=null?_GID[1]:false);
  656.         var _RECOMM = (parseQuery(location.search).recommend==undefined?0:parseQuery(location.search).recommend); // 개념글
  657.         if(MODE.write || MODE.singo || !$('.gallery_title .tit'))
  658.             GALLERY = document.title.replace(/ 갤러리$/,"");
  659.         else
  660.             GALLERY = decodeURIComponent($('.gallery_title .tit').textContent); // 갤러리(한글)
  661.         var PAGE = Number(parseQuery(location.search).page) || 1;
  662.     }
  663.  
  664.     // 환경 설정
  665.     var SET = {
  666.     innerElement : {},
  667.     call : function() {
  668.         if(!$id("DCL_set_wrap")) {
  669.             var dclset={};
  670.  
  671.             if(!MODE.settingsv2) {
  672.                 addStyle(
  673.                     "div.DCL_set_wrap { top: 50%; left: 50%; margin-top: -330px; margin-left: -320px; width: 640px; height: 660px; }" +
  674.                     "div.DCL_set_wrap > div.body { overflow-y: scroll; height:570px; }" +
  675.  
  676.                     "div.DCL_set_wrap button, " +
  677.                     "div.DCL_set_wrap input[type=button], " +
  678.                     "div.DCL_set_wrap select, " +
  679.                     "div.DCL_set_wrap input[type=submit] { padding: 2px 15px; border-radius: 2px; background-image: linear-gradient(0deg, #dedede, #ededed); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.75); border: 1px solid rgba(0, 0, 0, 0.25); text-shadow: 0 1px 0 rgb(240, 240, 240); color: #444; outline: none; margin: 0 4px 0 0; }" +
  680.  
  681.                     "div.DCL_set_wrap input[type=text]," +
  682.                     "div.DCL_set_wrap input[type=number] { border: 1px solid #CCC; cursor: auto; outline: none; border-radius: 2px; padding: 2px 5px; margin: 0 4px 0 0; }" +
  683.  
  684.                     "div.DCL_set_wrap button:hover, " +
  685.                     "div.DCL_set_wrap input[type=button]:hover, " +
  686.                     "div.DCL_set_wrap select:hover, " +
  687.                     "div.DCL_set_wrap input[type=submit]:hover, " +
  688.                     "div.DCL_set_wrap input[type=text]:hover, " +
  689.                     "div.DCL_set_wrap input[type=number]:hover { border: 1px solid rgba(0, 0, 0, 0.45); }" +
  690.  
  691.                     "div.DCL_set_wrap button:focus, " +
  692.                     "div.DCL_set_wrap input[type=button]:focus, " +
  693.                     "div.DCL_set_wrap select:focus, " +
  694.                     "div.DCL_set_wrap input[type=submit]:focus, " +
  695.                     "div.DCL_set_wrap input[type=text]:focus," +
  696.                     "div.DCL_set_wrap input[type=number]:focus { border: 1px solid #09E; }" +
  697.                     ""
  698.                 );
  699.                 dclset.bg = cElement("div", document.body, {id:"DCL_set_bg"}, SET.close);
  700.                 dclset.wrap = cElement("div", document.body, {id:"DCL_set_wrap", className:"DCL_set_wrap"});
  701.                 dclset.head = cElement("div", dclset.wrap, {className:"head"});
  702.                     cElement("button", dclset.head, {textContent:"닫기"}, SET.close);
  703.                     cElement("h2", dclset.head, {textContent:"디시라이트 설정"});
  704.             }
  705.             else {
  706.                 addStyle(
  707.                     "html,body { margin: 0px; overflow: hidden; }" +
  708.                     "div#DCL_set:before { margin-top: 10px; content: ''; display: block; }" +
  709.                     "div.DCL_set_wrap { position: static; top: auto; left: auto; margin: 0; padding: 0; width: 640px; height: 540px; box-shadow: none; border-radius: 0px; }" +
  710.                     "div.DCL_set_wrap > div.body { overflow-y: scroll; height: 500px; }" +
  711.                     "div.DCL_set_wrap select { padding-right: 20px; }" +
  712.  
  713.                     "div.DCL_set_wrap button, " +
  714.                     "div.DCL_set_wrap input[type=button], " +
  715.                     "div.DCL_set_wrap select, " +
  716.                     "div.DCL_set_wrap input[type=submit] { padding: 2px 15px; margin: 0 4px 0 0; }" +
  717.  
  718.                     "div.DCL_set_wrap input[type=text]," +
  719.                     "div.DCL_set_wrap input[type=number] { padding: 2px 5px; margin: 0 4px 0 0; }" +
  720.                     ""
  721.                 );
  722.                 dclset.wrap = cElement("div", document.body, {id:"DCL_set_wrap", className:"DCL_set_wrap"});
  723.             }
  724.                 addStyle(
  725.                     "div#DCL_set_bg { position: fixed; left: 0; right: 0; bottom: 0; top: 0; background-color: white; opacity: .6; z-index: 101; }" +
  726.                     "div.DCL_set_wrap,"+
  727.                     "div.DCL_set_mdi { box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0,0,0,0.15); border-radius: 3px; background-color:rgba(255,255,255,.9); }" +
  728.                     "div.DCL_set_wrap {z-index: 102; position: fixed; }" +
  729.  
  730.                     "div.DCL_set_wrap > div.head > button," +
  731.                     "div.DCL_set_mdi > div.head > button {height: 14px; width: 14px; float: right; border: 0; border-radius: 7px; margin: 10px 10px; font-size: 0px; background:url('data:image/png;base64,"+BASE64.dialogClose+"'); padding: 0; box-shadow: none; text-shadow: none; }" +
  732.                     "div.DCL_set_wrap > div.head > button:hover," +
  733.                     "div.DCL_set_mdi > div.head > button:hover{ background:url('data:image/png;base64,"+BASE64.dialogClose_H+"'); }" +
  734.                     "div.DCL_set_wrap > div.head > h2," +
  735.                     "div.DCL_set_mdi > div.head > h2{ padding:10px 20px; font-weight: normal; font-size: 120%;}" +
  736.  
  737.                     "div.DCL_set_wrap * { cursor: default; margin:0 ; padding:0 ; font-size: 12px; line-height:1.6em ; font-family: " + P.fontList + "; vertical-align:middle}" +
  738.                     "div.DCL_set_wrap div.indent { margin-left: 1.2em; font-size: 0.9em; }" +
  739.                     "div.DCL_set_wrap small { margin-left: 0.5em; font-size: 0.9em; }" +
  740.                     "div.DCL_set_wrap textarea { border: 1px solid #CCC; cursor: auto; font-family: monospace; outline: none; }" +
  741.  
  742.                     "div.DCL_set_wrap > div.foot > input[type=submit]," +
  743.                     "div.DCL_set_mdi > div.foot > input[type=submit] { float: right; margin: 10px 15px; }" +
  744.                     "div.DCL_set_wrap ::selection { background: inherit; }" +
  745.  
  746.                     "div#DCL_set_mdibg { z-index: 103; position: fixed; left: 0; right: 0; bottom: 0; top: 0; background-color: white; opacity: .6; }" +
  747.                     "div.DCL_set_mdi { z-index: 104; position: fixed; top: 50%; left: 50%; margin-top: -173px; margin-left: -270px; height: 346px; width: 540px; display: none; }" +
  748.                     "div.DCL_set_mdi > div.body { height:257px; padding: 0 20px; overflow: hidden; }" +
  749.                     "div.DCL_set_mdi > div.body div#linkList { height: 100%; width: 100% }" +
  750.                     "div.DCL_set_mdi > div.body div#linkList > textarea { height: 198px; width: 100%; border-radius: 2px 0 0 2px; }" +
  751.                     "div.DCL_set_mdi > div.filter div[id^=textbox] { height: 190px; }" +
  752.                     "div.DCL_set_mdi > div.filter div[id^=textbox] > textarea { overflow-y: scroll; height: 100%; width: 249px; resize: none; }" +
  753.                     "div.DCL_set_mdi > div.filter div[id^=textbox] > textarea:first-of-type { width:50%; box-sizing: border-box; border-radius: 2px 0 0 2px; }" +
  754.                     "div.DCL_set_mdi > div.filter div[id^=textbox] > textarea:nth-of-type(2) { border-left: none; border-radius: 0 2px 2px 0; }" +
  755.                     "div.DCL_set_mdi > div.filter div#textboxAT," +
  756.                     "div.DCL_set_mdi > div.filter div#textboxAI," +
  757.                     "div.DCL_set_mdi > div.filter div#textboxCN," +
  758.                     "div.DCL_set_mdi > div.filter div#textboxCT," +
  759.                     "div.DCL_set_mdi > div.filter div#textboxCI { display: none; }" +
  760.                     "div.DCL_set_mdi > div.filter div#info { height: 20px; }" +
  761.                     "div.DCL_set_mdi > div.filter div#info > span { display: inline-block; font-weight: bold; width: 50%; }" +
  762.                     "div.DCL_set_mdi > div.tooltip { display: none; position: absolute; z-index: 1; background-color: white; padding: 10px 20px; border-radius: 3px; box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 4px 0px; }" +
  763.                     "div.DCL_set_mdi > div.tooltip:before { content: ''; position: absolute; left: 18px; top: -10px; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid rgba(0, 0, 0, 0.1); z-index: 0; }" +
  764.                     "div.DCL_set_mdi > div.tooltip > div:first-of-type { position: absolute; left: 19px; top: -9px; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 9px solid white; z-index: 1; }" +
  765.                     "div.DCL_set_mdi > div.tooltip .bold { font-weight: bold; }" +
  766.  
  767.                     "div#DCL_set > div { margin: 0 20px 10px 20px; }" +
  768.                     "div#DCL_set > div > h3 { font-size: 120%; font-weight: normal; }" +
  769.                     "div#DCL_set > div ul > li { padding: 5px 0 5px 28px; }" +
  770.                     "div#DCL_set > div ul > li.indent { padding-left: 40px; }" +
  771.                     "div#DCL_set > div ul > li ul > li { padding-left: 12px; }" +
  772.                     "div#DCL_set > div ul > li.info + li { padding-top: 0; }" +
  773.                     "div#DCL_set > div ul > li.disabled { color: gray; }" +
  774.  
  775.                     "div#DCL_set > div input[type=text]::-webkit-input-placeholder, " +
  776.                     "div#DCL_set > div input[type=text]:-moz-placeholder { color:black; }" +
  777.                     "div#DCL_set > div input[type=text].number { text-align: right; }" +
  778.                        
  779.                     "div#DCL_set > div:first-of-type > ul:first-of-type.disabled { height: 55px; overflow: hidden; }" +
  780.                     "div#DCL_set > div a { cursor: auto; text-decoration: underline; color: blue; }" +
  781.                     "div#DCL_set > div div.small { font-size: 10px; }" +
  782.                     "div#DCL_set > div div.br { font-size: 10px; margin-top: 12px; }" +
  783.                     "div#DCL_set > div div.copyable { cursor:auto; }" +
  784.                     "div#DCL_set > div div.copyable::selection," +
  785.                     "div#DCL_set > div input::selection," +
  786.                     "div#DCL_set > div textarea::selection" + "{ background: #0BF; color: white; }" +
  787.                     "");
  788.  
  789.             dclset.body = cElement("div", dclset.wrap, {id:"DCL_set", className:"body"});
  790.             dclset.body.mdibg = cElement("div", dclset.body, {id:"DCL_set_mdibg"});
  791.             dclset.body.mdibg.style.display="none";
  792.  
  793.             dclset.body.loadSet = cElement("div", dclset.body);
  794.             cElement("h3", dclset.body.loadSet, "로드 설정");
  795.             dclset.body.loadSet.innerList = cElement("ul", dclset.body.loadSet);
  796.                 dclset.body.loadSet.innerList.info = cElement("li", dclset.body.loadSet.innerList);
  797.                 cElement("div", dclset.body.loadSet.innerList.info, "디시라이트를 사용할 페이지를 설정합니다.");
  798.                 dclset.body.loadSet.innerList.loadAtList = cElement("li", dclset.body.loadSet.innerList);
  799.                 cElement("input", dclset.body.loadSet.innerList.loadAtList, {type:"checkbox", id:"DCL_loadAtList", disabled:"disabled"});
  800.                 cElement("label", dclset.body.loadSet.innerList.loadAtList, {"for":"DCL_loadAtList",textContent:"갤러리"});
  801.                 dclset.body.loadSet.innerList.loadAtView = cElement("li", dclset.body.loadSet.innerList);
  802.                 cElement("input", dclset.body.loadSet.innerList.loadAtView, {type:"checkbox", id:"DCL_loadAtView"});
  803.                 cElement("label", dclset.body.loadSet.innerList.loadAtView, {"for":"DCL_loadAtView",textContent:"게시글 내용"});
  804.                 cElement("small", dclset.body.loadSet.innerList.loadAtView, {textContent:"(느려질 수도 있음)"});
  805.                 dclset.body.loadSet.innerList.loadAtWrite = cElement("li", dclset.body.loadSet.innerList);
  806.                 cElement("input", dclset.body.loadSet.innerList.loadAtWrite, {type:"checkbox", id:"DCL_loadAtWrite"});
  807.                 cElement("label", dclset.body.loadSet.innerList.loadAtWrite, {"for":"DCL_loadAtWrite",textContent:"글쓰기 화면"});
  808.                 cElement("small", dclset.body.loadSet.innerList.loadAtWrite, {textContent:"(별로 소용없는데 왜 굳이?)"});
  809.  
  810.             dclset.body.notification = cElement("div", dclset.body);
  811.             cElement("h3", dclset.body.notification, "알림");
  812.             dclset.body.notification.innerList = cElement("ul", dclset.body.notification);
  813.                 dclset.body.notification.innerList.info = cElement("li", dclset.body.notification.innerList);
  814.                 cElement("div", dclset.body.notification.innerList.info, "내가 쓴 글에 댓글이 달릴 때 데스크톱 알림으로 알려줍니다.");
  815.                 dclset.body.notification.innerList.enabled = cElement("li", dclset.body.notification.innerList);
  816.                 cElement("input", dclset.body.notification.innerList.enabled, {type:"checkbox", id:"DCL_notification"});
  817.                 cElement("label", dclset.body.notification.innerList.enabled, {"for":"DCL_notification",textContent:"알림 사용"});
  818.                 dclset.body.notification.innerList.notificationInterval = cElement("li", dclset.body.notification.innerList,{className:'indent'});
  819.                 cElement("label", dclset.body.notification.innerList.notificationInterval, {"for":"DCL_notificationInterval", textContent:"확인주기 "});
  820.                 dclset.body.notification.innerList.notificationInterval.selector = cElement("select", dclset.body.notification.innerList.notificationInterval, {id:"DCL_notificationInterval"});
  821.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"5",textContent:"5초"});
  822.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"10",textContent:"10초"});
  823.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"30",textContent:"30초"});
  824.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"60",textContent:"1분"});
  825.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"600",textContent:"10분"});
  826.                     cElement("option", dclset.body.notification.innerList.notificationInterval.selector, {value:"0",textContent:"수동"});
  827.  
  828.             dclset.body.filter = cElement("div", dclset.body);
  829.             cElement("h3", dclset.body.filter, "필터");
  830.             dclset.body.filter.innerList = cElement("ul", dclset.body.filter);
  831.                 dclset.body.filter.innerList.info = cElement("li", dclset.body.filter.innerList, {textContent:"미리 설정한 조건에 맞는 게시물을 보이지 않게 할 수 있습니다.", className:"info"});
  832.                 dclset.body.filter.innerList.filter = cElement("li", dclset.body.filter.innerList);
  833.                 cElement("input", dclset.body.filter.innerList.filter, {type:"checkbox", id:"DCL_filter"});
  834.                 cElement("label", dclset.body.filter.innerList.filter, {"for":"DCL_filter",textContent:"필터 사용"});
  835.                
  836.                 dclset.body.filter.innerList.blockN = cElement("li", dclset.body.filter.innerList);
  837.                 cElement("input", dclset.body.filter.innerList.blockN, {type:"checkbox", id:"DCL_blockN"});
  838.                 cElement("label", dclset.body.filter.innerList.blockN, {"for":"DCL_blockN",textContent:"공지 차단"});
  839.                     dclset.body.filter.innerList.blockN.innerList = cElement("ul", dclset.body.filter.innerList.blockN);
  840.                     dclset.body.filter.innerList.blockN.innerList.blockNA = cElement("li", dclset.body.filter.innerList.blockN.innerList);
  841.                     cElement("input", dclset.body.filter.innerList.blockN.innerList.blockNA, {type:"checkbox", id:"DCL_blockNA"});
  842.                     cElement("label", dclset.body.filter.innerList.blockN.innerList.blockNA, {"for":"DCL_blockNA",textContent:"운영자 공지만 차단"});
  843.                     dclset.body.filter.innerList.blockN.innerList.blockNR = cElement("li", dclset.body.filter.innerList.blockN.innerList);
  844.                     cElement("input", dclset.body.filter.innerList.blockN.innerList.blockNR, {type:"text", placeholder:"0", class:"number", id:"DCL_blockNR","size":"2"});
  845.                     cElement("label", dclset.body.filter.innerList.blockN.innerList.blockNR, {"for":"DCL_blockNR",textContent:"일 이내 공지 표시"});
  846.                    
  847.                 dclset.body.filter.innerList.allowStyle = cElement("li", dclset.body.filter.innerList);
  848.                 cElement("input", dclset.body.filter.innerList.allowStyle, {type:"checkbox", id:"DCL_allowStyle"});
  849.                 cElement("label", dclset.body.filter.innerList.allowStyle, {"for":"DCL_allowStyle",textContent:"예외 단어 강조"});
  850.                 dclset.body.filter.innerList.showLabel = cElement("li", dclset.body.filter.innerList);
  851.                 cElement("input", dclset.body.filter.innerList.showLabel, {type:"checkbox", id:"DCL_showLabel"});
  852.                 cElement("label", dclset.body.filter.innerList.showLabel, {"for":"DCL_showLabel",textContent:"차단된 사용자 표시"});
  853.                 dclset.body.filter.innerList.filterPattern = cElement("li", dclset.body.filter.innerList);
  854.                 cElement("input", dclset.body.filter.innerList.filterPattern, {type:"button", value:"필터 패턴 관리..."}, function() { dclset.body.filter.mdiwrap.style.display=dclset.body.mdibg.style.display="block"; });
  855.  
  856.                 dclset.body.filter.mdiwrap = cElement("div", dclset.body.filter, {className:"DCL_set_mdi"});
  857.                 dclset.body.filter.mdihead = cElement("div", dclset.body.filter.mdiwrap, {className:"head"});
  858.                     cElement("button", dclset.body.filter.mdihead, {textContent:"닫기"}, function() { dclset.body.filter.mdiwrap.style.display=dclset.body.mdibg.style.display="none"; });
  859.                     cElement("h2", dclset.body.filter.mdihead, {textContent:"필터 패턴 관리"});
  860.                 dclset.body.filter.mdibody = cElement("div", dclset.body.filter.mdiwrap, {className:"body filter"});
  861.                 dclset.body.filter.mdibody.selector = cElement("select", cElement("div", dclset.body.filter.mdibody));
  862.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"0",textContent:"게시물 작성자"});
  863.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"1",textContent:"게시물 제목"});
  864.                 if(P.apiRead)
  865.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"2",textContent:"게시물 IP"});
  866.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"3",textContent:"댓글 작성자"});
  867.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"4",textContent:"댓글 내용"});
  868.                     cElement("option", dclset.body.filter.mdibody.selector, {value:"5",textContent:"댓글 IP"});
  869.                     dclset.body.filter.mdibody.info = cElement("div", dclset.body.filter.mdibody, {id:"info"});
  870.                     cElement("span", dclset.body.filter.mdibody.info, "차단");
  871.                     cElement("span", dclset.body.filter.mdibody.info, "허용");
  872.                     dclset.body.filter.mdibody.textbox=new Array();
  873.                     dclset.body.filter.mdibody.textbox[0] = cElement("div", dclset.body.filter.mdibody, {id:"textboxAN"});
  874.                     cElement("textarea", dclset.body.filter.mdibody.textbox[0], {id:"DCL_blockAN"});
  875.                     cElement("textarea", dclset.body.filter.mdibody.textbox[0], {id:"DCL_allowAN"});
  876.                     dclset.body.filter.mdibody.textbox[1] = cElement("div", dclset.body.filter.mdibody, {id:"textboxAT"});
  877.                     cElement("textarea", dclset.body.filter.mdibody.textbox[1], {id:"DCL_blockAT"});
  878.                     cElement("textarea", dclset.body.filter.mdibody.textbox[1], {id:"DCL_allowAT"});
  879.                     dclset.body.filter.mdibody.textbox[2] = cElement("div", dclset.body.filter.mdibody, {id:"textboxAI"});
  880.                     cElement("textarea", dclset.body.filter.mdibody.textbox[2], {id:"DCL_blockAI"});
  881.                     cElement("textarea", dclset.body.filter.mdibody.textbox[2], {id:"DCL_allowAI"});
  882.                     dclset.body.filter.mdibody.textbox[3] = cElement("div", dclset.body.filter.mdibody, {id:"textboxCN"});
  883.                     cElement("textarea", dclset.body.filter.mdibody.textbox[3], {id:"DCL_blockCN"});
  884.                     cElement("textarea", dclset.body.filter.mdibody.textbox[3], {id:"DCL_allowCN"});
  885.                     dclset.body.filter.mdibody.textbox[4] = cElement("div", dclset.body.filter.mdibody, {id:"textboxCT"});
  886.                     cElement("textarea", dclset.body.filter.mdibody.textbox[4], {id:"DCL_blockCT"});
  887.                     cElement("textarea", dclset.body.filter.mdibody.textbox[4], {id:"DCL_allowCT"});
  888.                     dclset.body.filter.mdibody.textbox[5] = cElement("div", dclset.body.filter.mdibody, {id:"textboxCI"});
  889.                     cElement("textarea", dclset.body.filter.mdibody.textbox[5], {id:"DCL_blockCI"});
  890.                     cElement("textarea", dclset.body.filter.mdibody.textbox[5], {id:"DCL_allowCI"});
  891.                     dclset.body.filter.mdibody.help = cElement("div", dclset.body.filter.mdibody);
  892.                     dclset.body.filter.mdibody.help.button = cElement("a", dclset.body.filter.mdibody.help, {href:"",textContent:"도움말..."},ePrevent);
  893.                     dclset.body.filter.mdibody.help.button.addEventListener("mousemove", function() { dclset.body.filter.tooltip.style.display="block"; });
  894.                     dclset.body.filter.mdibody.help.button.addEventListener("mouseout", function() { dclset.body.filter.tooltip.style.display=""; });
  895.                 dclset.body.filter.tooltip = cElement("div", dclset.body.filter.mdiwrap, {className:"tooltip",style:"left: 10px; margin-top: 5px;"});
  896.                     cElement("div", dclset.body.filter.tooltip);
  897.                     cElement("div", dclset.body.filter.tooltip, {className:"bold",textContent:"특수 패턴 문자"});
  898.                     cElement("div", dclset.body.filter.tooltip, {textContent:"\\ : 이스케이프 문자"});
  899.                     cElement("div", dclset.body.filter.tooltip, {textContent:"* : 와일드카드 (0문자 이상)"});
  900.                     cElement("div", dclset.body.filter.tooltip, {textContent:"+ : 와일드카드 (1문자 이상)"});
  901.                     cElement("div", dclset.body.filter.tooltip, {textContent:"? : 와일드카드 (0문자 또는 1문자)"});
  902.                     cElement("div", dclset.body.filter.tooltip, {textContent:"#(null) : 비회원"});
  903.                     cElement("div", dclset.body.filter.tooltip, {textContent:"#갤로그ID : 특정 갤로거"});
  904.                     cElement("div", dclset.body.filter.tooltip, {textContent:"IP 패턴은 123.45.0.0/16 형식으로 입력해야 합니다."});
  905.                 dclset.body.filter.mdifoot = cElement("div", dclset.body.filter.mdiwrap, {className:"foot"});
  906.                     cElement("input", dclset.body.filter.mdifoot, {type:"submit", value:"닫기"}, function() { dclset.body.filter.mdiwrap.style.display=dclset.body.mdibg.style.display="none"; });
  907.  
  908.                 dclset.body.filter.mdibody.selector.addEventListener("change", function() {
  909.                     for(i=0;dclset.body.filter.mdibody.textbox[i];i++) {
  910.                         if(i==dclset.body.filter.mdibody.selector.value)
  911.                             dclset.body.filter.mdibody.textbox[i].style.display="block";
  912.                         else
  913.                             dclset.body.filter.mdibody.textbox[i].style.display="none";
  914.                     }
  915.                 });
  916.             dclset.body.layout = cElement("div", dclset.body);
  917.             cElement("h3", dclset.body.layout, "레이아웃 변경");
  918.             dclset.body.layout.innerList = cElement("ul", dclset.body.layout);
  919.                 dclset.body.layout.innerList.info = cElement("li", dclset.body.layout.innerList);
  920.                 cElement("div", dclset.body.layout.innerList.info, "페이지 레이아웃을 변형해서 목록을 보기 쉽게 합니다.");
  921.                 dclset.body.layout.innerList.pageWidth = cElement("li", dclset.body.layout.innerList,{className:'indent'});
  922.                 cElement("label", dclset.body.layout.innerList.pageWidth, {"for":"DCL_pageWidth", textContent:"페이지 폭"});
  923.                 cElement("input", dclset.body.layout.innerList.pageWidth, {type:"text", id:"DCL_pageWidth", className:"number", size:"4"});
  924.                 cElement(null, dclset.body.layout.innerList.pageWidth, "px");
  925.                 dclset.body.layout.innerList.header = cElement("li", dclset.body.layout.innerList);
  926.                 cElement("input", dclset.body.layout.innerList.header, {type:"checkbox", id:"DCL_header"});
  927.                 cElement("label", dclset.body.layout.innerList.header, {"for":"DCL_header",textContent:"상단 메뉴 표시"});
  928.                 dclset.body.layout.innerList.kanban = cElement("li", dclset.body.layout.innerList);
  929.                 cElement("input", dclset.body.layout.innerList.kanban, {type:"checkbox", id:"DCL_title"});
  930.                 cElement("label", dclset.body.layout.innerList.kanban, {"for":"DCL_title",textContent:"갤러리 타이틀 표시"});
  931.                 dclset.body.layout.innerList.sidebar = cElement("li", dclset.body.layout.innerList);
  932.                 cElement("input", dclset.body.layout.innerList.sidebar, {type:"checkbox", id:"DCL_sidebar"});
  933.                 cElement("label", dclset.body.layout.innerList.sidebar, {"for":"DCL_sidebar",textContent:"사이드바 표시"});
  934.                 dclset.body.layout.innerList.best = cElement("li", dclset.body.layout.innerList);
  935.                 cElement("input", dclset.body.layout.innerList.best, {type:"checkbox", id:"DCL_best"});
  936.                 cElement("label", dclset.body.layout.innerList.best, {"for":"DCL_best",textContent:"갤러리 박스 표시"});
  937.  
  938.             dclset.body.wideLayout = cElement("div", dclset.body);
  939.             cElement("h3", dclset.body.wideLayout, "와이드 레이아웃");
  940.             dclset.body.wideLayout.innerList = cElement("ul", dclset.body.wideLayout);
  941.             dclset.body.wideLayout.innerList.info = cElement("li", dclset.body.wideLayout.innerList);
  942.             cElement("div", dclset.body.wideLayout.innerList.info, "본문 영역을 오른쪽에 표시하여 화면을 넓게 사용합니다.");
  943.             dclset.body.wideLayout.innerList.wide = cElement("li", dclset.body.wideLayout.innerList);
  944.             cElement("input", dclset.body.wideLayout.innerList.wide, {type:"checkbox", id:"DCL_wide"});
  945.             cElement("label", dclset.body.wideLayout.innerList.wide, {"for":"DCL_wide",textContent:"와이드 레이아웃 사용"});
  946.             dclset.body.wideLayout.innerList.wideWidth = cElement("li", dclset.body.wideLayout.innerList,{className:'indent'});
  947.             cElement("label", dclset.body.wideLayout.innerList.wideWidth, {"for":"DCL_wideWidth", textContent:"본문 폭"});
  948.             cElement("input", dclset.body.wideLayout.innerList.wideWidth, {type:"text", id:"DCL_wideWidth", className:"number", size:"4"});
  949.             cElement(null, dclset.body.wideLayout.innerList.wideWidth, "px");
  950.  
  951.             dclset.body.pageTitle = cElement("div", dclset.body);
  952.             cElement("h3", dclset.body.pageTitle, "페이지 제목 변경");
  953.             dclset.body.pageTitle.innerList = cElement("ul", dclset.body.pageTitle);
  954.                 dclset.body.pageTitle.innerList.info = cElement("li", dclset.body.pageTitle.innerList);
  955.                 cElement("div", dclset.body.pageTitle.innerList.info, "페이지 제목을 변경합니다.");
  956.                 cElement("div", dclset.body.pageTitle.innerList.info, "{G} : 갤러리 이름 {P} : 페이지 {T} : 게시물 제목 {W} : 작성자");
  957.                 dclset.body.pageTitle.innerList.modTitle = cElement("li", dclset.body.pageTitle.innerList);
  958.                 cElement("input", dclset.body.pageTitle.innerList.modTitle, {type:"checkbox", id:"DCL_modTitle"});
  959.                 cElement("label", dclset.body.pageTitle.innerList.modTitle, {"for":"DCL_modTitle",textContent:"페이지 제목 변경"});
  960.                 dclset.body.pageTitle.innerList.modTitle.innerList = cElement("ul", dclset.body.pageTitle.innerList.modTitle);
  961.                     dclset.body.pageTitle.innerList.modTitle.innerList.listTitle = cElement("li", dclset.body.pageTitle.innerList.modTitle.innerList);
  962.                     cElement("label", dclset.body.pageTitle.innerList.modTitle.innerList.listTitle, {"for":"DCL_listTitle",textContent:"목록"});
  963.                     cElement("input", dclset.body.pageTitle.innerList.modTitle.innerList.listTitle, {type:"text", id:"DCL_listTitle", placeholder:"{G} - {P} 페이지"});
  964.                     dclset.body.pageTitle.innerList.modTitle.innerList.articleTitle = cElement("li", dclset.body.pageTitle.innerList.modTitle.innerList);
  965.                     cElement("label", dclset.body.pageTitle.innerList.modTitle.innerList.articleTitle, {"for":"DCL_articleTitle",textContent:"본문"});
  966.                     cElement("input", dclset.body.pageTitle.innerList.modTitle.innerList.articleTitle, {type:"text", id:"DCL_articleTitle", placeholder:"{T} ({W}) - {G} 페이지"});
  967.  
  968.             dclset.body.listSet = cElement("div", dclset.body);
  969.             cElement("h3", dclset.body.listSet, "목록 양식");
  970.             dclset.body.listSet.innerList = cElement("ul", dclset.body.listSet);
  971.                 dclset.body.listSet.innerList.info = cElement("li", dclset.body.listSet.innerList);
  972.                 cElement("div", dclset.body.listSet.innerList.info, "목록에 표시할 항목을 선택합니다.");
  973.                 dclset.body.listSet.innerList.listNumber = cElement("li", dclset.body.listSet.innerList);
  974.                 cElement("input", dclset.body.listSet.innerList.listNumber, {type:"checkbox", id:"DCL_listNumber"});
  975.                 cElement("label", dclset.body.listSet.innerList.listNumber, {"for":"DCL_listNumber",textContent:"게시물 번호"});
  976.                 dclset.body.listSet.innerList.listDate = cElement("li", dclset.body.listSet.innerList);
  977.                 cElement("input", dclset.body.listSet.innerList.listDate, {type:"checkbox", id:"DCL_listDate"});
  978.                 cElement("label", dclset.body.listSet.innerList.listDate, {"for":"DCL_listDate",textContent:"날짜"});
  979.                 dclset.body.listSet.innerList.listTime = cElement("li", dclset.body.listSet.innerList);
  980.                 cElement("input", dclset.body.listSet.innerList.listTime, {type:"checkbox", id:"DCL_listTime"});
  981.                 cElement("label", dclset.body.listSet.innerList.listTime, {"for":"DCL_listTime",textContent:"날짜 옆에 시간도 표시"});
  982.                 dclset.body.listSet.innerList.listNick = cElement("li", dclset.body.listSet.innerList);
  983.                 cElement("input", dclset.body.listSet.innerList.listNick, {type:"checkbox", id:"DCL_listNick"});
  984.                 cElement("label", dclset.body.listSet.innerList.listNick, {"for":"DCL_listNick",textContent:"닉네임 전체 표시"});
  985.                 dclset.body.listSet.innerList.listCount = cElement("li", dclset.body.listSet.innerList);
  986.                 cElement("input", dclset.body.listSet.innerList.listCount, {type:"checkbox", id:"DCL_listCount"});
  987.                 cElement("label", dclset.body.listSet.innerList.listCount, {"for":"DCL_listCount",textContent:"조회수"});
  988.                 dclset.body.listSet.innerList.listRecom = cElement("li", dclset.body.listSet.innerList);
  989.                 cElement("input", dclset.body.listSet.innerList.listRecom, {type:"checkbox", id:"DCL_listRecom"});
  990.                 cElement("label", dclset.body.listSet.innerList.listRecom, {"for":"DCL_listRecom",textContent:"추천수"});
  991.                 dclset.body.listSet.innerList.listComment = cElement("li", dclset.body.listSet.innerList);
  992.                 cElement("input", dclset.body.listSet.innerList.listComment, {type:"checkbox", id:"DCL_listComment"});
  993.                 cElement("label", dclset.body.listSet.innerList.listComment, {"for":"DCL_listComment",textContent:"댓글이 없을 때도 댓글 수를 표시"});
  994.                 dclset.body.listSet.innerList.commentColor = cElement("li", dclset.body.listSet.innerList);
  995.                 cElement("input", dclset.body.listSet.innerList.commentColor, {type:"checkbox", id:"DCL_commentColor"});
  996.                 cElement("label", dclset.body.listSet.innerList.commentColor, {"for":"DCL_commentColor",textContent:"유동닉 색상 사용"});
  997.                 dclset.body.listSet.innerList.commentColorType = cElement("li", dclset.body.listSet.innerList,{className:'indent'});
  998.                 cElement("label", dclset.body.listSet.innerList.commentColorType, {"for":"DCL_commentColorType", textContent:"변경할 색상: "});
  999.                 dclset.body.listSet.innerList.commentColorType.selector = cElement("select", dclset.body.listSet.innerList.commentColorType, {id:"DCL_commentColorType"});
  1000.                     cElement("option", dclset.body.listSet.innerList.commentColorType.selector, {id:"DCL_commentColorForg",value:"fg",textContent:"글자색"});
  1001.                     cElement("option", dclset.body.listSet.innerList.commentColorType.selector, {id:"DCL_commentColorBacg",value:"bg",textContent:"배경색"});
  1002.                     cElement("option", dclset.body.listSet.innerList.commentColorType.selector, {id:"DCL_commentColorGcon",value:"gc",textContent:"갤러콘"});
  1003.  
  1004.             dclset.body.menuSet = cElement("div", dclset.body);
  1005.             cElement("h3", dclset.body.menuSet, "메뉴");
  1006.             dclset.body.menuSet.innerList = cElement("ul", dclset.body.menuSet);
  1007.                 dclset.body.menuSet.innerList.info = cElement("li", dclset.body.menuSet.innerList);
  1008.                 cElement("div", dclset.body.menuSet.innerList.info, "메뉴의 위치와 표시할 항목을 선택하고 순서를 바꿉니다.");
  1009.                 dclset.body.menuSet.innerList.menu = cElement("li", dclset.body.menuSet.innerList);
  1010.                 dclset.body.menuSet.innerList.menu.selector = cElement("select", dclset.body.menuSet.innerList.menu, {id:"DCL_menuPos"});
  1011.                     cElement("option", dclset.body.menuSet.innerList.menu.selector, {id:"DCL_menuPosTop",value:"top",textContent:"위쪽"});
  1012.                     cElement("option", dclset.body.menuSet.innerList.menu.selector, {id:"DCL_menuPosLeft",value:"left",textContent:"왼쪽"});
  1013.                 cElement("input", dclset.body.menuSet.innerList.menu, {type:"text", id:"DCL_menuList", "size":"23"});
  1014.                 cElement("input", dclset.body.menuSet.innerList.menu, {type:"button", value:"즐겨찾기 링크 관리..."}, function() { dclset.body.menuSet.mdiwrap.style.display=dclset.body.mdibg.style.display="block"; });
  1015.                
  1016.                 dclset.body.menuSet.mdiwrap = cElement("div", dclset.body.menuSet, {className:"DCL_set_mdi"});
  1017.                 dclset.body.menuSet.mdihead = cElement("div", dclset.body.menuSet.mdiwrap, {className:"head"});
  1018.                     cElement("button", dclset.body.menuSet.mdihead, {textContent:"닫기"}, function() { dclset.body.menuSet.mdiwrap.style.display=dclset.body.mdibg.style.display="none"; });
  1019.                     cElement("h2", dclset.body.menuSet.mdihead, {textContent:"즐겨찾기 링크 관리"});
  1020.                 dclset.body.menuSet.mdibody = cElement("div", dclset.body.menuSet.mdiwrap, {className:"body"});
  1021.                     dclset.body.menuSet.mdibody.info = cElement("div", dclset.body.menuSet.mdibody);
  1022.                     cElement("label", dclset.body.menuSet.mdibody.info, {for:"DCL_linkList", innerHTML:"자주 가는 갤러리나 웹 사이트를 등록하여 메뉴에 링크를 생성합니다.<br />표시 이름@갤러리 주소 or http:// 주소<br />표시 이름@@갤러리 주소 or http:// 주소 (새 창에 열기)"});
  1023.                     dclset.body.menuSet.mdibody.linkList = cElement("div", dclset.body.menuSet.mdibody, {id:"linkList"});
  1024.                     cElement("textarea", dclset.body.menuSet.mdibody.linkList, {id:"DCL_linkList"});
  1025.                 dclset.body.menuSet.mdifoot = cElement("div", dclset.body.menuSet.mdiwrap, {className:"foot"});
  1026.                     cElement("input", dclset.body.menuSet.mdifoot, {type:"submit", value:"닫기"}, function() { dclset.body.menuSet.mdiwrap.style.display=dclset.body.mdibg.style.display="none"; });
  1027.  
  1028.                 dclset.body.menuSet.innerList.info = cElement("li", dclset.body.menuSet.innerList);
  1029.                 cElement("div", dclset.body.menuSet.innerList.info, {className:"small", textContent:"/로 구분해서 입력하고, 메뉴를 위쪽으로 설정한 경우 |로 구분해서 순서대로 좌측 메뉴, 우측 메뉴, 프로필 메뉴를 입력합니다."});
  1030.                 cElement("div", dclset.body.menuSet.innerList.info, {className:"small copyable", textContent:"설정 : 디시라이트 설정 버튼 / 로그인 : 로그인/아웃 버튼 / 갤로그 : 갤로그 버튼 / 갤러리 : 갤러리 메뉴 토글 / 목록 : 다중 목록 토글 / 와이드 : 와이드 모드 토글 / 상단 : 상단 기본 메뉴 토글 / 타이틀 : 갤러리 타이틀 토글 / 박스 : 갤러리 박스 토글 / 베스트 : 일간 베스트 게시물 보기 / 개념글 : 개념글 보기 / 즐겨찾기 : 즐겨찾기 링크 / 현재갤 : 현재 갤러리 링크 / 글쓰기 : 글쓰기 / 구분선 : 구분선"});
  1031.                 cElement("div", dclset.body.menuSet.innerList.info, {className:"small", textContent:"즐겨찾기 링크는 따로따로 입력할 수도 있습니다."});
  1032.                 cElement("div", dclset.body.menuSet.innerList.info, {className:"small", textContent:"예) 미연시/게시판/김유식"});
  1033.  
  1034.             dclset.body.multiPage = cElement("div", dclset.body);
  1035.             cElement("h3", dclset.body.multiPage, "멀티 페이지");
  1036.             dclset.body.multiPage.innerList = cElement("ul", dclset.body.multiPage);
  1037.                 dclset.body.multiPage.innerList.info = cElement("li", dclset.body.multiPage.innerList);
  1038.                 cElement("div", dclset.body.multiPage.innerList.info, "한번에 여러 페이지를 로드합니다.");
  1039.                 dclset.body.multiPage.innerList.page = cElement("li", dclset.body.multiPage.innerList);
  1040.                 cElement("input", dclset.body.multiPage.innerList.page, {type:"checkbox", id:"DCL_page"});
  1041.                 cElement("label", dclset.body.multiPage.innerList.page, {"for":"DCL_page",textContent:"멀티 페이지 사용"});
  1042.                 dclset.body.multiPage.innerList.pageCount = cElement("li", dclset.body.multiPage.innerList,{className:'indent'});
  1043.                 cElement("label", dclset.body.multiPage.innerList.pageCount, {"for":"DCL_pageCount",textContent:"한 번에 "});
  1044.                 cElement("input", dclset.body.multiPage.innerList.pageCount, {type:"text", className:"number", size:"2", id:"DCL_pageCount"});
  1045.                 cElement(null, dclset.body.multiPage.innerList.pageCount, "페이지 로드");
  1046.                
  1047.             dclset.body.easyView = cElement("div", dclset.body);
  1048.             cElement("h3", dclset.body.easyView, "바로보기");
  1049.             dclset.body.easyView.innerList = cElement("ul", dclset.body.easyView);
  1050.                 dclset.body.easyView.innerList.info = cElement("li", dclset.body.easyView.innerList);
  1051.                 cElement("div", dclset.body.easyView.innerList.info, "게시물 리스트에서 페이지 이동 없이 본문을 봅니다.");
  1052.                 dclset.body.easyView.innerList.layerLink = cElement("li", dclset.body.easyView.innerList);
  1053.                 cElement("input", dclset.body.easyView.innerList.layerLink, {type:"checkbox", id:"DCL_layerLink"});
  1054.                 cElement("label", dclset.body.easyView.innerList.layerLink, {"for":"DCL_layerLink",textContent:"바로보기 사용 (링크 연결)"});
  1055.                 dclset.body.easyView.innerList.layerReply = cElement("li", dclset.body.easyView.innerList);
  1056.                 cElement("input", dclset.body.easyView.innerList.layerReply, {type:"checkbox", id:"DCL_layerReply"});
  1057.                 cElement("label", dclset.body.easyView.innerList.layerReply, {"for":"DCL_layerReply",textContent:"댓글 링크 연결"});
  1058.                 dclset.body.easyView.innerList.layerSingle = cElement("li", dclset.body.easyView.innerList);
  1059.                 cElement("input", dclset.body.easyView.innerList.layerSingle, {type:"checkbox", id:"DCL_layerSingle"});
  1060.                 cElement("label", dclset.body.easyView.innerList.layerSingle, {"for":"DCL_layerSingle",textContent:"단독 레이어 사용"});
  1061.                 dclset.body.easyView.innerList.layerResize = cElement("li", dclset.body.easyView.innerList);
  1062.                 cElement("input", dclset.body.easyView.innerList.layerResize, {type:"checkbox", id:"DCL_layerResize"});
  1063.                 cElement("label", dclset.body.easyView.innerList.layerResize, {"for":"DCL_layerResize",textContent:"높이 자동 조절"});
  1064.                 dclset.body.easyView.innerList.layerImage = cElement("li", dclset.body.easyView.innerList);
  1065.                 cElement("input", dclset.body.easyView.innerList.layerImage, {type:"checkbox", id:"DCL_layerImage"});
  1066.                 cElement("label", dclset.body.easyView.innerList.layerImage, {"for":"DCL_layerImage",textContent:"이미지"});
  1067.                 dclset.body.easyView.innerList.layerThumb = cElement("li", dclset.body.easyView.innerList);
  1068.                 cElement("input", dclset.body.easyView.innerList.layerThumb, {type:"checkbox", id:"DCL_layerThumb"});
  1069.                 cElement("label", dclset.body.easyView.innerList.layerThumb, {"for":"DCL_layerThumb",textContent:"이미지 섬네일화"});
  1070.  
  1071.                 dclset.body.easyView.innerList.thumbProp = cElement("li", dclset.body.easyView.innerList,{className:'indent'});
  1072.                 cElement(null, dclset.body.easyView.innerList.thumbProp, "섬네일 크기 ");
  1073.                 cElement("input", dclset.body.easyView.innerList.thumbProp, {type:"text", className:"number", size:"3", id:"DCL_thumbWidth"});
  1074.                 cElement(null, dclset.body.easyView.innerList.thumbProp, "× ");
  1075.                 cElement("input", dclset.body.easyView.innerList.thumbProp, {type:"text", className:"number", size:"3", id:"DCL_thumbHeight"});
  1076.  
  1077.                 dclset.body.easyView.innerList.layerText = cElement("li", dclset.body.easyView.innerList);
  1078.                 cElement("input", dclset.body.easyView.innerList.layerText, {type:"checkbox", id:"DCL_layerText"});
  1079.                 cElement("label", dclset.body.easyView.innerList.layerText, {"for":"DCL_layerText",textContent:"본문"});
  1080.                 dclset.body.easyView.innerList.layerTextLinkAlwaysNewTab = cElement("li", dclset.body.easyView.innerList);
  1081.                 cElement("input", dclset.body.easyView.innerList.layerTextLinkAlwaysNewTab, {type:"checkbox", id:"DCL_layerTextLinkAlwaysNewTab"});
  1082.                 cElement("label", dclset.body.easyView.innerList.layerTextLinkAlwaysNewTab, {"for":"DCL_layerTextLinkAlwaysNewTab",textContent:"본문 링크 새 탭 열기"});
  1083.                 dclset.body.easyView.innerList.layerComment = cElement("li", dclset.body.easyView.innerList);
  1084.                 cElement("input", dclset.body.easyView.innerList.layerComment, {type:"checkbox", id:"DCL_layerComment"});
  1085.                 cElement("label", dclset.body.easyView.innerList.layerComment, {"for":"DCL_layerComment",textContent:"댓글"});
  1086.                 dclset.body.easyView.innerList.simpleWrite = cElement("li", dclset.body.easyView.innerList);
  1087.                 cElement("input", dclset.body.easyView.innerList.simpleWrite, {type:"checkbox", id:"DCL_simpleWrite"});
  1088.                 cElement("label", dclset.body.easyView.innerList.simpleWrite, {"for":"DCL_simpleWrite",textContent:"간단 글쓰기"});
  1089.                
  1090.             dclset.body.blockContent = cElement("div", dclset.body);
  1091.             cElement("h3", dclset.body.blockContent, "컨텐츠 차단");
  1092.             dclset.body.blockContent.innerList = cElement("ul", dclset.body.blockContent);
  1093.                 dclset.body.blockContent.innerList.info = cElement("li", dclset.body.blockContent.innerList);
  1094.                 cElement("div", dclset.body.blockContent.innerList.info, "게시물의 이미지나 동영상 등을 미리 차단합니다.");
  1095.                 dclset.body.blockContent.innerList.hide = cElement("li", dclset.body.blockContent.innerList);
  1096.                 cElement("input", dclset.body.blockContent.innerList.hide, {type:"checkbox", id:"DCL_hide"});
  1097.                 cElement("label", dclset.body.blockContent.innerList.hide, {"for":"DCL_hide",textContent:"컨텐츠 차단 사용"});
  1098.                 dclset.body.blockContent.innerList.hideImg = cElement("li", dclset.body.blockContent.innerList);
  1099.                 cElement("input", dclset.body.blockContent.innerList.hideImg, {type:"checkbox", id:"DCL_hideImg"});
  1100.                 cElement("label", dclset.body.blockContent.innerList.hideImg, {"for":"DCL_hideImg",textContent:"이미지 차단"});
  1101.                 dclset.body.blockContent.innerList.hideMov = cElement("li", dclset.body.blockContent.innerList);
  1102.                 cElement("input", dclset.body.blockContent.innerList.hideMov, {type:"checkbox", id:"DCL_hideMov"});
  1103.                 cElement("label", dclset.body.blockContent.innerList.hideMov, {"for":"DCL_hideMov",textContent:"동영상 차단"});
  1104.                 dclset.body.blockContent.innerList.info.keyCmd = cElement("li", dclset.body.blockContent.innerList);
  1105.                 cElement("div", dclset.body.blockContent.innerList.info.keyCmd, {className:"small", textContent:"Delete/Esc : 전체 차단"});
  1106.                 cElement("div", dclset.body.blockContent.innerList.info.keyCmd, {className:"small", textContent:"Insert/~ : 전체 차단해제"});
  1107.                
  1108.             dclset.body.autoForm = cElement("div", dclset.body);
  1109.             cElement("h3", dclset.body.autoForm, "자동입력");
  1110.             dclset.body.autoForm.innerList = cElement("ul", dclset.body.autoForm);
  1111.                 dclset.body.autoForm.innerList.info = cElement("li", dclset.body.autoForm.innerList);
  1112.                 cElement("div", dclset.body.autoForm.innerList.info, "로그인하지 않은 상태에서 글을 쓸 때 입력 폼을 자동으로 채웁니다.");
  1113.                 dclset.body.autoForm.innerList.autoForm = cElement("li", dclset.body.autoForm.innerList);
  1114.                 cElement("input", dclset.body.autoForm.innerList.autoForm, {type:"checkbox", id:"DCL_autoForm"});
  1115.                 cElement("label", dclset.body.autoForm.innerList.autoForm, {"for":"DCL_autoForm",textContent:"자동입력 사용"});
  1116.                 dclset.body.autoForm.innerList.autoNamePw = cElement("li", dclset.body.autoForm.innerList,{className:'indent'});
  1117.                 cElement("label", dclset.body.autoForm.innerList.autoNamePw, {"for":"DCL_autoName",textContent:"이름 "});
  1118.                 cElement("input", dclset.body.autoForm.innerList.autoNamePw, {type:"text", size:"6", id:"DCL_autoName"});
  1119.                 cElement("label", dclset.body.autoForm.innerList.autoNamePw, {"for":"DCL_autoPassword",textContent:"비밀번호 "});
  1120.                 cElement("input", dclset.body.autoForm.innerList.autoNamePw, {type:"text", size:"6", id:"DCL_autoPassword"});
  1121.                
  1122.             dclset.body.setEtc = cElement("div", dclset.body);
  1123.             cElement("h3", dclset.body.setEtc, "로그인 및 쿠키");
  1124.             dclset.body.setEtc.innerList = cElement("ul", dclset.body.setEtc);
  1125.                 dclset.body.setEtc.innerList.longExpires = cElement("li", dclset.body.setEtc.innerList);
  1126.                 cElement("input", dclset.body.setEtc.innerList.longExpires, {type:"checkbox", id:"DCL_longExpires"});
  1127.                 cElement("label", dclset.body.setEtc.innerList.longExpires, {"for":"DCL_longExpires",textContent:"브라우저를 닫아도 로그인을 유지"});
  1128.                 dclset.body.setEtc.innerList.cookieDelete = cElement("li", dclset.body.setEtc.innerList);
  1129.                 cElement("input", dclset.body.setEtc.innerList.cookieDelete, {type:"button", value:"로그인 쿠키 초기화"}, cookieDelete);
  1130.                
  1131.             dclset.body.setStore = cElement("div", dclset.body);
  1132.             cElement("h3", dclset.body.setStore, "저장소");
  1133.             dclset.body.setStore.innerList = cElement("ul", dclset.body.setStore);
  1134.                 dclset.body.setStore.innerList.storeLocal = cElement("li", dclset.body.setStore.innerList);
  1135.                 cElement("input", dclset.body.setStore.innerList.storeLocal, {type:"radio", name:"DCL_store", value:'Local', id:"DCL_storeLocal"});
  1136.                 cElement("label", dclset.body.setStore.innerList.storeLocal, {"for":"DCL_storeLocal",textContent:"로컬 저장소"});
  1137.                 cElement("div", dclset.body.setStore.innerList.storeLocal, {className:'indent', textContent:"로컬 저장소는 HTML5 Web Storage를 사용하는 저장소이며 모든 브라우저에서 사용할 수 있습니다. 도메인별로 저장되므로 접속 도메인이 다른 경우 설정이 공유되지 않습니다."});
  1138.                 dclset.body.setStore.innerList.storeGoogle = cElement("li", dclset.body.setStore.innerList);
  1139.                 cElement("input", dclset.body.setStore.innerList.storeGoogle, {type:"radio", name:"DCL_store", value:'Google', id:"DCL_storeGoogle"});
  1140.                 cElement("label", dclset.body.setStore.innerList.storeGoogle, {"for":"DCL_storeGoogle",textContent:"Google Sync 저장소"});
  1141.                 cElement("div", dclset.body.setStore.innerList.storeGoogle, {className:'indent', textContent:"Google Sync 저장소는 Google Chrome에서만 사용할 수 있는 Google 계정 종속 자동 동기화 저장소입니다. 도메인이 달라도 설정이 공유됩니다."});
  1142.                 dclset.body.setStore.innerList.storeGM = cElement("li", dclset.body.setStore.innerList);
  1143.                 cElement("input", dclset.body.setStore.innerList.storeGM, {type:"radio", name:"DCL_store", value:'GM', id:"DCL_storeGM"});
  1144.                 cElement("label", dclset.body.setStore.innerList.storeGM, {"for":"DCL_storeGM",textContent:"GreaseMonkey 저장소"});
  1145.                 cElement("div", dclset.body.setStore.innerList.storeGM, {className:'indent', textContent:"GreaseMonkey 저장소는 GreaseMonkey API를 사용하는 저장소입니다. Firefox에서는 설정에 따라 동기화를 사용할 수도 있습니다. 도메인이 달라도 설정이 공유됩니다."});
  1146. /*              dclset.body.setStore.innerList.storeGallog = cElement("li", dclset.body.setStore.innerList);
  1147.                 cElement("input", dclset.body.setStore.innerList.storeGallog, {type:"radio", name:"DCL_store", value:'Gallog', id:"DCL_storeGallog", disabled:"disabled"});
  1148.                 cElement("label", dclset.body.setStore.innerList.storeGallog, {"for":"DCL_storeGallog",textContent:"갤로그 저장소"});*/
  1149.  
  1150.                 dclset.body.setStore.innerList.dataManage = cElement("li", dclset.body.setStore.innerList);
  1151.                 cElement("input", dclset.body.setStore.innerList.dataManage, {type:"button", value:"내보내기"}, SET.exportJson);
  1152.                 cElement("input", dclset.body.setStore.innerList.dataManage, {type:"button", value:"가져오기"}, SET.importJson);
  1153.                 cElement("input", dclset.body.setStore.innerList.dataManage, {type:"button", value:"초기화"}, SET.reset);
  1154.  
  1155. /*          dclset.body.manageGallog = cElement("div", dclset.body);
  1156.             cElement("h3", dclset.body.manageGallog, "갤로그");
  1157.             dclset.body.manageGallog.innerList = cElement("ul", dclset.body.manageGallog);
  1158.  
  1159.                 dclset.body.manageGallog.innerList.resetData = cElement("li", dclset.body.manageGallog.innerList);
  1160.                 cElement("input", dclset.body.manageGallog.innerList.resetData, {type:"button", id:'DCL_resetGallog', value:"갤로그 초기화"}, SET.resetGallog);
  1161.                 cElement("input", dclset.body.manageGallog.innerList.resetData, {type:"button", id:'DCL_resetAll', value:"모든 게시물 삭제"}, SET.resetAll);*/
  1162.  
  1163.             dclset.body.betaLab = cElement("div", dclset.body);
  1164.             cElement("h3", dclset.body.betaLab, "실험실");
  1165.             dclset.body.betaLab.innerList = cElement("ul", dclset.body.betaLab);
  1166.                 dclset.body.betaLab.innerList.apiRead = cElement("li", dclset.body.betaLab.innerList);
  1167.                 cElement("input", dclset.body.betaLab.innerList.apiRead, {type:"checkbox", id:"DCL_apiRead"});
  1168.                 cElement("label", dclset.body.betaLab.innerList.apiRead, {"for":"DCL_apiRead",textContent:"API로 읽기"});
  1169.                 cElement("div", dclset.body.betaLab.innerList.apiRead, {className:'indent', textContent:"게시물 IP필터를 사용하려면 활성화해야 합니다."});
  1170. /*              dclset.body.betaLab.innerList.autoBad = cElement("li", dclset.body.betaLab.innerList);
  1171.                 cElement("input", dclset.body.betaLab.innerList.autoBad, {type:"checkbox", id:"DCL_autoBad"});
  1172.                 cElement("label", dclset.body.betaLab.innerList.autoBad, {"for":"DCL_autoBad",textContent:"자동 나쁜글"});
  1173.                 cElement("div", dclset.body.betaLab.innerList.autoBad, {className:'indent', textContent:"필터로 차단된 게시물을 발견하면 자동으로 나쁜글로 신고합니다."});*/
  1174.  
  1175.             dclset.body.dclInfo = cElement("div", dclset.body);
  1176.             cElement("h3", dclset.body.dclInfo, "DCinside Lite r"+R_VERSION);
  1177.             dclset.body.dclInfo.innerList = cElement("ul", dclset.body.dclInfo);
  1178.                 dclset.body.dclInfo.innerList.updUse = cElement("li", dclset.body.dclInfo.innerList);
  1179.                 cElement("input", dclset.body.dclInfo.innerList.updUse, {type:"checkbox", id:"DCL_updUse"});
  1180.                 cElement("label", dclset.body.dclInfo.innerList.updUse, {"for":"DCL_updUse",textContent:"업데이트 알림"});
  1181.  
  1182.                 dclset.body.dclInfo.innerList.info = cElement("li", dclset.body.dclInfo.innerList);
  1183.                 dclset.body.dclInfo.innerList.info.copyright = cElement("div", dclset.body.dclInfo.innerList.info);
  1184.                 cElement(null, dclset.body.dclInfo.innerList.info.copyright, "제작 : ");
  1185.                 cElement("a", dclset.body.dclInfo.innerList.info.copyright, {href:"http://gallog.dcinside.com/hkyuwon", target:"_blank", textContent:"디시인사이드 고정닉 축"});
  1186.                 dclset.body.dclInfo.innerList.info.kasugano = cElement("div", dclset.body.dclInfo.innerList.info);
  1187.                 cElement(null, dclset.body.dclInfo.innerList.info.kasugano, "수정 : ");
  1188.                 cElement("a", dclset.body.dclInfo.innerList.info.kasugano, {href:"http://kasugano.tistory.com/", target:"_blank", textContent:"koreapyj"});
  1189.                 cElement(null, dclset.body.dclInfo.innerList.info.kasugano, " ");
  1190.                 cElement("a", dclset.body.dclInfo.innerList.info.kasugano, {href:"https://github.com/koreapyj/dcinside_lite/graphs/contributors", target:"_blank", textContent:"외"});
  1191.                 dclset.body.dclInfo.innerList.info.github = cElement("div", dclset.body.dclInfo.innerList.info);
  1192.                 cElement("a", dclset.body.dclInfo.innerList.info.github, {href:"https://github.com/koreapyj/dcinside_lite", target:"_blank", textContent:"GitHub"});
  1193.                 cElement("div", dclset.body.dclInfo.innerList.info, {className:"small br", textContent:"이 스크립트는 자유 소프트웨어 라이센스를 따르지 않습니다. 이 스크립트의 저작권은 디시인사이드 고정닉 축에게 있습니다. 이 스크립트는 원 저작자의 허락을 받지 않고 수정되었으며, 원 저작자의 문제 제기시 배포는 중단됩니다. 이 스크립트의 버전 1.5.5 이후 변경사항은 Public Domain으로 배포됩니다."});
  1194.  
  1195.             dclset.foot = cElement("div", dclset.wrap, {className:"foot"});
  1196.                 cElement("input", dclset.foot, {type:"submit", value:"완료"}, SET.save);
  1197.  
  1198.             $id('DCL_storeGoogle').disabled = !(BROWSER.chrome && BROWSER.chrome.storage);
  1199.             $id('DCL_storeGM').disabled = !(BROWSER.greasemonkey);
  1200.             if('Notification' in window) {
  1201.                 if (Notification.permission === "denied") {
  1202.                     $id('DCL_notification').disabled = true;
  1203.                     cElement("p", dclset.body.notification.innerList.enabled, {id:'DCL_notificationDenied',textContent:"알림이 차단되어 있어서 사용할 수 없습니다. 브라우저 설정에서 알림을 허용해 주세요.",style:'margin-left: 1.5em; font-size: 11px; color: red;'});
  1204.                 }
  1205.                 else {
  1206.                     $id('DCL_notification').addEventListener('change', function(e) {
  1207.                         if(!$id('DCL_notification').checked)
  1208.                             return;
  1209.                         if(Notification.permission==="granted") {
  1210.                             return;
  1211.                         }
  1212.                         else {
  1213.                             $id('DCL_notification').checked=false;
  1214.                             Notification.requestPermission(function (permission) {
  1215.                                 if (permission === "granted") {
  1216.                                     $id('DCL_notification').checked=true;
  1217.                                     return;
  1218.                                 }
  1219.                                 else if(!$id('DCL_notificationDenied')) {
  1220.                                     $id('DCL_notification').disabled = true;
  1221.                                     cElement("p", dclset.body.notification.innerList.enabled, {id:'DCL_notificationDenied',textContent:"알림이 차단되어 있어서 사용할 수 없습니다. 브라우저 설정에서 알림을 허용해 주세요.",style:'margin-left: 1.5em; font-size: 11px; color: red;'});
  1222.                                     return;
  1223.                                 }
  1224.                             });
  1225.                         }
  1226.                     });
  1227.                 }
  1228.             }
  1229.             else {
  1230.                 $id('DCL_notification').disabled = true;
  1231.                 cElement("p", dclset.body.notification.innerList.enabled, {id:'DCL_notificationDenied',textContent:"알림을 사용할 수 없는 브라우저입니다.",style:'margin-left: 1.5em; font-size: 11px; color: red;'});
  1232.             }
  1233.         }
  1234.  
  1235.  
  1236.         $id("DCL_set_wrap").style.display = "block";
  1237.         if(!MODE.settingsv2) {
  1238.             $id("DCL_set_bg").style.display = "block";
  1239.             document.body.style.overflow = "hidden";
  1240.             $id("DCL_set").scrollTop=0;
  1241.         }
  1242.  
  1243.         SET.innerElement = dclset;
  1244.         SET.write();
  1245.     },
  1246.     resetAll : function() {
  1247.         simpleRequest('http://gallog.dcinside.com/inc/_mainGallog.php?page=1&gid=' + _GID + '&_=' + time(),
  1248.             function(r) {
  1249.                 var endPage = r.responseText.match(/\.\.\[([0-9]+)\]/g);
  1250.                 var endRPage = Number(endPage[1].replace(/[^0-9]/g,''));
  1251.                 var gallogQueue = [];
  1252.                 var gallQueue = [];
  1253.                 endPage = Number(endPage[0].replace(/[^0-9]/g,''));
  1254.                 console.log('gallog post end page = ' + endPage);
  1255.                 console.log('gallog reply end page = ' + endRPage);
  1256.                 try
  1257.                 {
  1258.                     var asyncCallback_delete = function() {
  1259.                         var asyncCount = gallQueue.length;
  1260.                         var errorCount = 0;
  1261.                         var errorList = [];
  1262.                         for(i=0;i<gallQueue.length;i++) {
  1263.                             simpleRequest(MODE.prefix+'/board/delete/?id='+gallQueue[i].id+'&no='+gallQueue[i].no, function(r) {
  1264.                                 try
  1265.                                 {
  1266.                                     var rBody = r.responseText.match(/(<div id="dgn_gallery_wrap"[\s\S]*)(\<\!\-\- \/\/dgn_gallery_wrap \-\-\>|<\/body>)/)[1].toDomElement();
  1267.                                     if(delForm = rBody.querySelector('form#delete')) {
  1268.                                         simpleRequest('/forms/delete_submit',function(r) {
  1269.                                                 if((reply = r.responseText.split('||')).length>1) {
  1270.                                                     if(reply[0] != 'true') {
  1271.                                                         console.log(gallQueue[i]);
  1272.                                                         console.log(reply[1]);
  1273.                                                         errorCount++;
  1274.                                                         errorList.push({'id':gallQueue[i].id,'no':gallQueue[i].no,'reason':reply[1]});
  1275.                                                     }
  1276.                                                 }
  1277.                                                 else {
  1278.                                                     console.log(gallQueue[i]);
  1279.                                                     console.log(r.responseText);
  1280.                                                     errorCount++;
  1281.                                                     errorList.push({'id':gallQueue[i].id,'no':gallQueue[i].no,'reason':r.responseText});
  1282.                                                 }
  1283.                                             },'POST',{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},formWalk(delForm));
  1284.                                     } else if(delForm = rBody.querySelector('form#password_confirm')) {
  1285.                                         console.log(gallQueue[i]);
  1286.                                         console.log('password protected!');
  1287.                                         errorCount++;
  1288.                                         errorList.push({'id':gallQueue[i].id,'no':gallQueue[i].no,'reason':'password protected'});
  1289.                                     }
  1290.                                 }
  1291.                                 catch (e)
  1292.                                 {
  1293.                                     console.log('처리 중 오류 : ' + e.message);
  1294.                                     console.log(r.responseText);
  1295.                                     errorList.push({'id':gallQueue[i].id,'no':gallQueue[i].no,'reason':r.responseText});
  1296.                                 }
  1297.  
  1298.                                 asyncCount--;
  1299.  
  1300.                                 if($('#DCL_resetAll')) {
  1301.                                     $('#DCL_resetAll').disabled = true;
  1302.                                     $('#DCL_resetAll').value = '게시물 삭제 중...(' + asyncCount + ' 페이지 남음)';
  1303.                                 }
  1304.                                 if(asyncCount<=0) {
  1305.                                     if($('#DCL_resetAll')) {
  1306.                                         $('#DCL_resetAll').disabled = true;
  1307.                                         $('#DCL_resetAll').value = '완료';
  1308.                                         if(errorList.length>0) {
  1309.                                             cElement('a',[$('#DCL_resetAll'),'next'],{href:'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(errorList)),'download':'gallog_article_error.json',innerHTML:'삭제되지 않은 게시물 JSON'});
  1310.                                             alert('게시물 삭제가 완료되었으나, 일부 삭제되지 않은 게시물이 있습니다. "삭제되지 않은 게시물 JSON"을 눌러서 목록을 확인할 수 있습니다.');
  1311.                                         }
  1312.                                         else
  1313.                                             alert('게시물 삭제가 완료되었습니다.');
  1314.                                     }
  1315.                                 }
  1316.                             });
  1317.                         }
  1318.                     };
  1319.                     var asyncCallback = function() {
  1320.                         var asyncCount = gallogQueue.length;
  1321.                         var errorCount = 0;
  1322.                         for(i=0;i<gallogQueue.length;i++) {
  1323.                             simpleRequest('http://gallog.dcinside.com' + gallogQueue[i],function(rg) {
  1324.                                 try
  1325.                                 {
  1326.                                     var gallInfo = rg.responseText.match(/window\.open\("http:\/\/gall\.dcinside\.com\/list\.php\?id=([^&]+)&no=([0-9]+)"\);/);
  1327.                                     gallQueue.push({'id':gallInfo[1],'no':gallInfo[2]});
  1328.                                     asyncCount--;
  1329.  
  1330.                                     if($('#DCL_resetAll')) {
  1331.                                         $('#DCL_resetAll').disabled = true;
  1332.                                         $('#DCL_resetAll').value = '게시물 번호 가져오는 중...(' + asyncCount + ' 페이지 남음)';
  1333.                                     }
  1334.                                     if(asyncCount<=0) {
  1335.                                         if($('#DCL_resetAll')) {
  1336.                                             $('#DCL_resetAll').disabled = true;
  1337.                                             $('#DCL_resetAll').value = '완료';
  1338.                                         }
  1339.                                         cElement('a',[$('#DCL_resetAll'),'next'],{href:'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(gallQueue)),'download':'gallog_article.json',innerHTML:'게시물 JSON'});
  1340.                                         if(confirm('게시물 삭제가 준비되었습니다.\n\n이 행동은 되돌릴 수 없습니다. 계속하시겠습니까?'))
  1341.                                             asyncCallback_delete();
  1342.                                     }
  1343.                                 }
  1344.                                 catch (e)
  1345.                                 {
  1346.                                     asyncCount--;
  1347.  
  1348.                                     if($('#DCL_resetAll')) {
  1349.                                         $('#DCL_resetAll').disabled = true;
  1350.                                         $('#DCL_resetAll').value = '게시물 번호 가져오는 중...(' + asyncCount + ' 페이지 남음)';
  1351.                                     }
  1352.                                     if(asyncCount<=0) {
  1353.                                         if($('#DCL_resetAll')) {
  1354.                                             $('#DCL_resetAll').disabled = true;
  1355.                                             $('#DCL_resetAll').value = '완료';
  1356.                                         }
  1357.                                         cElement('a',[$('#DCL_resetAll'),'next'],{href:'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(gallQueue)),'download':'gallog_article.json',innerHTML:'게시물 JSON'});
  1358.                                         if(confirm('게시물 삭제가 준비되었습니다.\n\n이 행동은 되돌릴 수 없습니다. 계속하시겠습니까?'))
  1359.                                             asyncCallback_delete();
  1360.                                     }
  1361.                                     errorCount++;
  1362.                                     console.log('오류\n\n' + e.message + '\n(게시물이 이미 삭제되었을 가능성이 있습니다)');
  1363.                                 }
  1364.                             },null,null,null,function(e){
  1365.                                 asyncCount--;
  1366.  
  1367.                                 if($('#DCL_resetAll')) {
  1368.                                     $('#DCL_resetAll').disabled = true;
  1369.                                     $('#DCL_resetAll').value = '게시물 번호 가져오는 중...(' + asyncCount + ' 페이지 남음)';
  1370.                                 }
  1371.                                 if(asyncCount<=0) {
  1372.                                     if($('#DCL_resetAll')) {
  1373.                                         $('#DCL_resetAll').disabled = true;
  1374.                                         $('#DCL_resetAll').value = '완료';
  1375.                                     }
  1376.                                     cElement('a',[$('#DCL_resetAll'),'next'],{href:'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(gallQueue)),'download':'gallog_article.json',innerHTML:'게시물 JSON'});
  1377.                                     if(confirm('게시물 삭제가 준비되었습니다.\n\n이 행동은 되돌릴 수 없습니다. 계속하시겠습니까?'))
  1378.                                         asyncCallback_delete();
  1379.                                 }
  1380.                                 errorCount++;
  1381.                                 console.log('오류\n\n' + e.message);
  1382.                             });
  1383.                         }
  1384.                     }
  1385.                     var asyncCount = endPage;
  1386.                     for(i=endPage+1;--i;) {
  1387.                         simpleRequest('http://gallog.dcinside.com/inc/_mainGallog.php?page=' + i + '&gid=' + _GID + '&_=' + time(),function(rg) {
  1388.                             var listTable = rg.responseText.match(/<table width="750" border="0" cellspacing="0" cellpadding="0">([\s\S]*?)<\/table>/im)[1];
  1389.                             var listItems = listTable.match(/document\.location\.href="\/inc\/_mainGallog\.php\?gid=jaewhi&page=[0-9]+&rpage=[0-9]*&lno=[0-9]+&rView=2";/g);
  1390.                             var j;
  1391.                             for(j=0;j<listItems.length;j++) {
  1392.                                 gallogQueue.push(listItems[j].match(/"([^"]+)"/)[1]);
  1393. /*                              simpleRequest('http://gallog.dcinside.com' + listItems[j].match(/"([^"]+)"/)[1],function(rgitem) {
  1394.                                     var articleInfo = rgitem.responseText.match(/window\.open\("http:\/\/gall\.dcinside\.com\/list\.php\?id=([^&]+)&no=([0-9]+)"\);/);
  1395.                                 });
  1396.                                 break;*/
  1397.                             }
  1398.                             asyncCount--;
  1399.  
  1400.                             if($('#DCL_resetAll')) {
  1401.                                 $('#DCL_resetAll').disabled = true;
  1402.                                 $('#DCL_resetAll').value = '게시물 목록 읽는 중...(' + asyncCount + ' 페이지 남음)';
  1403.                             }
  1404.                             if(asyncCount<=0) {
  1405.                                 if($('#DCL_resetAll')) {
  1406.                                     $('#DCL_resetAll').disabled = true;
  1407.                                     $('#DCL_resetAll').value = '완료';
  1408.                                 }
  1409.                                 asyncCallback();
  1410.                             }
  1411.                         });
  1412.                     }
  1413.                 }
  1414.                 catch (e)
  1415.                 {
  1416.                     alert('오류: ' + e.message + '\r\n' + '작업이 중지되었습니다.');
  1417.                 }
  1418.             });
  1419.     },
  1420.     write : function() {
  1421.         var input,value;
  1422.         for(var i in P) {
  1423.             if(P.hasOwnProperty(i)) {
  1424.                 value = P[i];
  1425.                 input = $id("DCL_" + i);
  1426.                 if(!input) {
  1427.                     if(!(input = $id("DCL_" + i + value)))
  1428.                         input = cElement("input", SET.innerElement.body, {type:"hidden", id:"DCL_"+i});
  1429.                 }
  1430.                 if(input.type === "checkbox" || input.type === "radio") {
  1431.                     input.checked = value;
  1432.                 } else {
  1433.                     input.value = value;
  1434.                 }
  1435.             }
  1436.         }
  1437.     },
  1438.     importJson : function() {
  1439.         importedP = JSON.parse(prompt('내보냈던 설정을 붙여넣으세요.'));
  1440.         for(var i in importedP) {
  1441.             if(importedP.hasOwnProperty(i))
  1442.                 P[i] = importedP[i];
  1443.         }
  1444.         SET.write();
  1445.         alert('설정을 가져왔습니다.');
  1446.     },
  1447.     exportJson : function() {
  1448.         prompt('아래 내용을 복사해서 보관하세요.', JSON.stringify(P));
  1449.     },
  1450.     load : function(nochrome) {
  1451.         var num = ["loadAtList","loadAtView","loadAtWrite","notification","notificationInterval","filter","blockN","blockNA","blockNR","allowStyle","showLabel","modTitle","header","title","sidebar","pageWidth","wide","wideWidth","listNumber","listDate","listCount","listRecom","listComment","listTime","listNick","best","simpleWrite","page","pageCount","layerImage","layerText","layerTextLinkAlwaysNewTab","layerComment","layerThumb","layerLink","layerReply","layerSingle","layerResize","thumbWidth","thumbHeight","hide","hideImg","hideMov","autoForm","updUse","updDev","longExpires","commentColor","syncStore","apiRead","autoBad"];
  1452.         if(BROWSER.chrome && BROWSER.chrome.storage && nochrome!==true) {
  1453.             chrome.storage.sync.get(null,function(items) {
  1454.                 for(key in items) {
  1455.                     if(P.version != "" && P.version < 15001 && key == "menuList")
  1456.                         continue;
  1457.                     if(P.hasOwnProperty(key)) {
  1458.                         if(items[key]=="undefined" || typeof(items[key])=="undefined") {
  1459.                             P[key]="";
  1460.                             continue;
  1461.                         }
  1462.                         P[key] = items[key];
  1463.                     }
  1464.                 }
  1465.                 for(i=0,l=num.length ; i<l ; i+=1) {
  1466.                     P[num[i]] = Number(P[num[i]]);
  1467.                 }
  1468.                
  1469.                 if(P.version === "")
  1470.                     return SET.load(true);
  1471.                
  1472.                 P.store = 'Google';
  1473.                 if(localStorage['version'])
  1474.                     localStorage.clear();
  1475.                
  1476.                 if(BROWSER.chrome && !BROWSER.chrome.google)
  1477.                     SET.update();
  1478.                 if(P.version !== VERSION) {
  1479.                     alert("처음 사용하셨거나 업데이트 되었습니다.\n메뉴의 [설정] 버튼을 눌러 설정을 확인하세요.\n\n설정을 완료하면 이 알림창은 나타나지 않습니다.\n\n※광고가 게시물을 가리는 경우 애드블록을 사용하세요.");
  1480.                     addStyle("li#DCL_setBtn {color:#c00 !important ; font-weight:bold !important ; text-decoration:blink}");
  1481.                 }
  1482.  
  1483.                 DCINSIDE_LITE();
  1484.             });
  1485.             return;
  1486.         }
  1487.  
  1488.         if(BROWSER.greasemonkey && nochrome!==true) {
  1489.  
  1490.             var keys = GM_listValues();
  1491.             var items = {};
  1492.             for(i in keys) {
  1493.                 key = keys[i];
  1494.                 items[key] = GM_getValue(key);
  1495.  
  1496.                 if(P.version != "" && P.version < 15001 && key == "menuList")
  1497.                     continue;
  1498.                 if(P.hasOwnProperty(key)) {
  1499.                     if(items[key]=="undefined" || typeof(items[key])=="undefined") {
  1500.                         P[key]="";
  1501.                         continue;
  1502.                     }
  1503.                     P[key] = items[key];
  1504.                 }
  1505.             }
  1506.             for(i=0,l=num.length ; i<l ; i+=1) {
  1507.                 P[num[i]] = Number(P[num[i]]);
  1508.             }
  1509.  
  1510.             if(P.version === "")
  1511.                 return SET.load(true);
  1512.  
  1513.             P.store = 'GM';
  1514.             if(localStorage['version'])
  1515.                 localStorage.clear();
  1516.  
  1517.             SET.update();
  1518.             if(P.version !== VERSION) {
  1519.                 alert("처음 사용하셨거나 업데이트 되었습니다.\n메뉴의 [설정] 버튼을 눌러 설정을 확인하세요.\n\n설정을 완료하면 이 알림창은 나타나지 않습니다.\n\n※광고가 게시물을 가리는 경우 애드블록을 사용하세요.");
  1520.                 addStyle("li#DCL_setBtn {color:#c00 !important ; font-weight:bold !important ; text-decoration:blink}");
  1521.             }
  1522.  
  1523.             DCINSIDE_LITE();
  1524.  
  1525.             return;
  1526.         }
  1527.  
  1528.         if(BROWSER.localStorage && !BROWSER.dataMigration) {
  1529.             for(var i = 0; i < localStorage.length; i++)
  1530.             {
  1531.                 key = localStorage.key(i);
  1532.                 if(P.version != "" && P.version < 15001 && key == "menuList")
  1533.                     continue;
  1534.                 if(P.hasOwnProperty(key)) {
  1535.                     if(localStorage[key]=="undefined" || typeof(localStorage[key])=="undefined") {
  1536.                         P[key]=""
  1537.                         continue;
  1538.                     }
  1539.                     P[key] = localStorage[key];
  1540.                 }
  1541.             }
  1542.             for(i=0,l=num.length ; i<l ; i+=1) {
  1543.                 P[num[i]] = Number(P[num[i]]);
  1544.             }
  1545.  
  1546.         } else {
  1547.             var cookie = /(?:^|; )dcinsidelitesetting=([^;]*)/.exec(document.cookie);
  1548.             if(cookie) {
  1549.                 cookie = unescape(cookie[1]).split("\b");
  1550.                 for(var i=0,l=cookie.length ; i<l ; i+=2) {
  1551.                     if(P.version != "" && P.version < 15001 && cookie[i] == "menuList")
  1552.                         continue;
  1553.                     if(P.hasOwnProperty(cookie[i])) {
  1554.                         P[cookie[i]] = cookie[i+1];
  1555.                     }
  1556.                 } // boolean 이나 number 을 형변환
  1557.                 for(i=0,l=num.length ; i<l ; i+=1) {
  1558.                     P[num[i]] = Number(P[num[i]]);
  1559.                 }
  1560.             }
  1561.  
  1562.             if(BROWSER.dataMigration)
  1563.             {
  1564.                 SET.call();
  1565.                 SET.save();
  1566.                 location.reload();
  1567.                 return ;
  1568.             }
  1569.         }
  1570.         P.store = 'Local';
  1571.         if(BROWSER.chrome && !BROWSER.chrome.google)
  1572.             SET.update();
  1573.         if(P.version !== VERSION) {
  1574.             alert("처음 사용하셨거나 업데이트 되었습니다.\n메뉴의 [설정] 버튼을 눌러 설정을 확인하세요.\n\n설정을 완료하면 이 알림창은 나타나지 않습니다.\n\n※광고가 게시물을 가리는 경우 애드블록을 사용하세요.");
  1575.             addStyle("li#DCL_setBtn {color:#c00 !important ; font-weight:bold !important ; text-decoration:blink}");
  1576.         }
  1577.         DCINSIDE_LITE();
  1578.     },
  1579.     update : function() {
  1580.         if(P.updUse && !BROWSER.msie) {
  1581.             simpleRequest(
  1582.                 "https://lite.dcmys.kr/updatec"+(P["updDev"]==1?'_unstable':'') + "?v=" + time(),
  1583.                 function(response) {
  1584.                     nVer = parseInt(response.responseText.split('<>')[0]);
  1585.                     if(response.responseText.split('<>')[1]!=undefined) {
  1586.                         nVerDesc = response.responseText.split('<>')[1];
  1587.                         nVerDesc = nVerDesc.replace(/<br>/gi, "\n");
  1588.                         dText = "\n\n이 업데이트의 변경 사항\n" + nVerDesc + "\n";
  1589.                     }
  1590.                     if(R_VERSION < nVer) {
  1591.                         if(confirm("새 버전이 있습니다(" + nVer + ")" + dText + "\n업데이트하시겠습니까?")) {
  1592.                             document.body.innerHTML = '<form action="https://github.com/koreapyj/dcinside_lite/releases/download/' + nVer + '/dcinside_lite.zip" method="get"><div style="margin: 10px;">업데이트를 진행할 경우 이 버전으로 돌아올 수 없습니다. 계속하시겠습니까?<br /><input type="submit" style="padding-left: 5px; padding-right: 5px; margin: 3px; border: 2px solid black;" value="예" onclick="alert(\'새 버전 설치 후 새로고침하면 설치가 완료됩니다.\');" /><input type="button" style="padding-left: 6px; padding-right: 6px; padding-top: 1px; padding-bottom: 1px; margin: 2px; border: 1px solid black;" value="아니오" /></div></form>';
  1593.                         }
  1594.                     }
  1595.                 }
  1596.             );
  1597.         }
  1598.     },
  1599.     save : function() {
  1600.         var input;
  1601.         var dataStr='';
  1602.  
  1603.         if(!$id("DCL_menuList").value.match(/설정/))
  1604.             return alert("메뉴 항목에 [설정] 버튼이 없으므로 설정을 저장할 수 없습니다.");
  1605.  
  1606.         P.store = document.querySelector('input[name="DCL_store"]:checked').value;
  1607.         P.syncStore = null;
  1608.  
  1609.         if(BROWSER.chrome && BROWSER.chrome.storage) {
  1610.             if(P.store != 'Google')
  1611.                 chrome.storage.sync.clear();
  1612.             else
  1613.                 localStorage.clear();
  1614.         }
  1615.         if(BROWSER.greasemonkey) {
  1616.             if(P.store != 'GM')
  1617.                 GM_clearStorage();
  1618.             else
  1619.                 localStorage.clear();
  1620.         }
  1621.         for(var i in P) {
  1622.             if(P.hasOwnProperty(i)) {
  1623.                 if(!(input = $id("DCL_" + i))) {
  1624.                     console.log('SET.save: "DCL_' + i + '" element not exists');
  1625.                     continue;
  1626.                 }
  1627.                 if(input.nodeName === "INPUT") {
  1628.                     if(input.type === "checkbox") {
  1629.                         P[i] = input.checked?1:0;
  1630.                         setValue(i,input.checked);
  1631.                         dataStr+=i+'='+Number(input.checked)+'&';
  1632.                     } else if(cSearch(input,"DCL_number")) {
  1633.                         P[i] = input.value;
  1634.                         setValue(i,Number(input.value));
  1635.                         dataStr+=i+'='+Number(input.value)+'&';
  1636.                     } else {
  1637.                         P[i] = input.value;
  1638.                         setValue(i,input.value);
  1639.                         dataStr+=i+'='+encodeURIComponent(input.value)+'&';
  1640.                     }
  1641.                 } else if(input.nodeName === "SELECT") {
  1642.                     P[i] = input.value;
  1643.                     setValue(i,input.value);
  1644.                     dataStr+=i+'='+encodeURIComponent(input.value)+'&';
  1645.                 } else if(input.nodeName === "TEXTAREA") {
  1646.                     value = input.value.replace(/^(?:\r?\n)+|(?:\r?\n)+$|(?:\r?\n)+(?=\r?\n)|\r/g,"");
  1647.                     P[i] = value;
  1648.                     setValue(i,value);
  1649.                     dataStr+=i+'='+encodeURIComponent(value)+'&';
  1650.                 }
  1651.             }
  1652.         }
  1653.         P['version'] = VERSION;
  1654.         setValue("version",VERSION);
  1655.         dataStr+='version='+encodeURIComponent(VERSION)+'&';
  1656.  
  1657.         if(BROWSER.chrome && BROWSER.chrome.storage && P.store == 'Google') {
  1658.             console.log(P);
  1659.             chrome.storage.sync.set(P,function() {
  1660.                 if (err=chrome.runtime.lastError) {
  1661.                     alert('설정을 저장하던 중 심각한 오류가 발생하였습니다.\n\n자세한 내용은 콘솔을 참고하십시오.');
  1662.                     console.log(err.message);
  1663.                 }
  1664.             });
  1665.         }
  1666.         if(BROWSER.dataMigration)
  1667.             document.cookie = "dcinsidelitesetting=;path=/;";
  1668.        
  1669.         if(MODE.settings)
  1670.             window.close();
  1671.         else
  1672.             location.reload();
  1673.         return;
  1674.     },
  1675.     reset : function() {
  1676.         if(!confirm("설정을 초기화하겠습니까?")) {
  1677.             return;
  1678.         }
  1679.         if(BROWSER.chrome && BROWSER.chrome.storage) {
  1680.             if(P.store == 'Google')
  1681.                 chrome.storage.sync.clear();
  1682.             else
  1683.                 localStorage.clear();
  1684.         }else if(BROWSER.greasemonkey) {
  1685.             if(P.store == 'GM') {
  1686.                 GM_clearStorage();
  1687.             }
  1688.             else
  1689.                 localStorage.clear();
  1690.         }else if(BROWSER.localStorage) {
  1691.             localStorage.clear();
  1692.         } else {
  1693.             document.cookie = "dcinsidelitesetting=;path=/;";
  1694.         }
  1695.         location.reload();
  1696.     },
  1697.     close : function() {
  1698.         $id("DCL_set_wrap").style.display = "none";
  1699.         $id("DCL_set_bg").style.display = "none";
  1700.         document.body.style.overflow = "auto";
  1701.     }
  1702.  
  1703.     };
  1704.  
  1705.     function titleFunc() {
  1706.         if(P.modTitle) {
  1707.             var title,titleP,titleT,titleW;
  1708.             if(MODE.write) {
  1709.                 title = P.listTitle;
  1710.                 titleP = "글쓰기";
  1711.                 titleT = "";
  1712.                 titleW = "";
  1713.             } else if(MODE.list) {
  1714.                 title = P.listTitle;
  1715.                 titleP = PAGE + (P.page&&P.pageCount>1?"~"+P.pageCount:"");
  1716.                 titleT = "";
  1717.                 titleW = "";
  1718.             } else {
  1719.                 title = P.articleTitle;
  1720.                 titleP = "";
  1721.                 titleT = document.title.substr(0, document.title.lastIndexOf(' - '));//$id("titleShare").textContent.replace(/^\s+|\s+$/g,"");
  1722.                 titleW = document.getElementsByName('author')[0].content; //$id("titleShare").parentNode.parentNode.rows[MODE.article?0:2].cells[2].textContent.replace(/^\s+|\s+$/g,"");
  1723.             }
  1724.             document.title = title.replace(/\{G\}/g,GALLERY).replace(/\{P\}/g,titleP).replace(/\{T\}/g,titleT).replace(/\{W\}/g,titleW);
  1725.         }
  1726.     }
  1727.  
  1728.     // 기능 사용 버튼 추가
  1729.     function menuFunc() {
  1730.         var css =
  1731.             "#dgn_gall_top_wrap { z-index: 99; }" +
  1732.             "div#DCL_menuDiv {position:relative; margin:0 auto; z-index:100}" +
  1733.             "div#DCL_menuWrap {position: fixed; background-color:#fff ; z-index:100}" +
  1734.             "li.DCL_menuOn {color:#000 !important}"+
  1735.             ".hidden {display:none;}";
  1736.        
  1737.         if(P.menuPos === "top") {
  1738.             css +=
  1739.                 "html > body { padding-top: 46px; max-width:"+P.pageWidth+"px; width: 100%; }" +
  1740.                 "div#DCL_menuDiv {font-family: " + P.fontList + "; top: 0; left: 0; right: 0; width: auto; height: 46px; background: white; border-bottom: 1px solid rgba(0,0,0,0.15); position: fixed;}" +
  1741.                 "div#DCL_menuDiv a {text-decoration: none;}" +
  1742.                 "div#DCL_menuWrap {position: relative; margin: 0 auto; border: 0; background: transparent; max-width:"+P.pageWidth+"px; width: 100%; height: 46px;}" +
  1743.                 "div#DCL_menuWrap:before {content: 'DCinside Lite r" + R_VERSION + "'; display: block; position: absolute; z-index: -1; left: 0; right: 0; margin: 0 auto; text-align: center; color: black; line-height: 46px; opacity: .15;}" +
  1744.                 "h2#DCL_menuTitle {float: right; height: 46px;}" +
  1745.                 "h2#DCL_menuTitle > img.DCL_profileImage {display: block; box-sizing: border-box; margin-top: 3px; width: 40px; height: 40px; border: 2px solid white; border-radius: 20px; transition: all .15s;}" +
  1746.                 "h2#DCL_menuTitle:hover > img.DCL_profileImage {border-color: #5b7ce5;}" +
  1747.                 "h2#DCL_menuTitle > a," +
  1748.                 "h2#DCL_menuTitle > em {display: none;}" +
  1749.                 "ul.DCL_menuUl {overflow: hidden;}" +
  1750.                 "ul#DCL_menuUlLeft {float: left;}" +
  1751.                 "ul#DCL_menuUlRight {float: right;}" +
  1752.                 "ul#DCL_menuUlSub {position: absolute; top: 50px; right: -10px; background: white; padding: 10px 0; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 4px 0px; width: 180px; overflow: visible; display: none;}" +
  1753.                 "ul#DCL_menuUlSub:hover {display: block;}" +
  1754.                 "ul#DCL_menuUlSub:before {content: ''; position: absolute; right: 103px; top: -10px; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid rgba(0, 0, 0, 0.1); z-index: 0;}" +
  1755.                 "ul#DCL_menuUlSub > li:first-of-type {position: absolute; right: 104px; top: -9px; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 9px solid white; z-index: 1;}" +
  1756.                 "ul#DCL_menuUlSub > li:not(:first-of-type) > a {display: block; padding: 5px 20px;}" +
  1757.                 "ul#DCL_menuUlSub > li:not(:first-of-type) > a.DCL_menuSep {font-size: 0; cursor: default; border-bottom: 1px solid #eee; height: 0; padding: 5px 0 0 0; margin: 0 0 5px 0;}" +
  1758.                 "ul#DCL_menuUlSub > li:not(:first-of-type) > a.DCL_profile {font-size: 14px;}" +
  1759.                 "ul#DCL_menuUlSub > li:not(:first-of-type) > a.DCL_profile > em {color: #aaa; font-size: 12px; display: block;}" +
  1760.                 "ul#DCL_menuUlSub > li:not(:first-of-type):hover > a:not(.DCL_menuSep)," +
  1761.                 "ul#DCL_menuUlSub > li:not(:first-of-type):hover > a.DCL_profile > em{background-color: #5b7ce5; color: white;}" +
  1762.  
  1763.                 "ul.DCL_menuUl > li {display: block; float: left; height: 46px; line-height: 46px; font-size: 13px;}" +
  1764.                 "ul.DCL_menuUl > li > a {display: block; height: 46px; padding: 0px 14px; border-bottom: 4px solid #5b7ce5; transition: all .15s ease-in-out;}" +
  1765.                 "ul.DCL_menuUl > li > a:hover {color: #5b7ce5;}" +
  1766.                 "ul.DCL_menuUl > li > a:hover," +
  1767.                 "ul.DCL_menuUl > li > a.DCL_linkThis {height: 42px;}" +
  1768.                 "ul.DCL_menuUl > li > a.DCL_menuSep {display: none;}" +
  1769.                
  1770.                 "div#DCL_writeBtn { float: right; margin: 7px 0 7px 15px; }" +
  1771.                 "div#DCL_writeBtn > a { padding: 8px 15px; display: inline-block; background-color: #5b7ce5; background-image: linear-gradient(0deg,#5b7ce5,#6987e8); border: 1px solid #2049cf; color: white; border-radius: 3px; box-sizing: border-box; }" +
  1772.                 "";
  1773.         } else {
  1774.             css +=
  1775.                 "html > body {padding-left: 190px; padding-right: 10px;}" +
  1776.                 "div#DCL_menuDiv {font-family: " + P.fontList + ";}" +
  1777.                 "div#DCL_menuWrap {top: 0; left: 0; bottom: 0; background-color: white; width: 180px; margin-left: 0px; box-shadow: 0 2px 10px rgba(0,0,0,.2); color: black;}" +
  1778.                 "ul.DCL_menuUl {border-color: #ddd; border-style: solid; border-width: 0; border-bottom: 1px dotted #ddd;}" +
  1779.                 "ul.DCL_menuUl > li {}" +
  1780.                 "ul.DCL_menuUl > li > a {display: block; line-height: 15px; padding: 10px 20px; font-size: 12px; text-align: left; cursor: pointer; white-space: nowrap; box-sizing: border-box; text-decoration: none;}" +
  1781.                 "ul.DCL_menuUl > li > a:hover {background: #eee;}" +
  1782.                 "ul.DCL_menuUl > li > a.DCL_menuSep {font-size: 0; height: 0; padding: 0; border-bottom: 1px dotted #ddd;}" +
  1783.                 "ul.DCL_menuUl > li > a.DCL_linkThis {position: relative; font-weight: bold;}" +
  1784.                 "ul.DCL_menuUl > li > a.DCL_linkThis:after {display: block; content: '›'; float: right; font-weight: normal; font-size: 15px; position: absolute; right: 20px; top: 0; line-height: 35px;}" +
  1785.     //          "div#DCL_menuWrap:after {content: 'DCinside Lite r" + R_VERSION + "'; display: block; line-height: 15px; padding: 10px 20px; font-size: 12px; text-align: left; cursor: default; white-space: nowrap; color: #aaa;}" +
  1786.                 "h2#DCL_menuTitle:before {content: ''; display: block; position: fixed; top: 0; left: 0; width: inherit; height: inherit; background-color: #E7E7EA; background-image: url('http://zzbang.dcinside.com/" + _ID + "_temp.jpg'); background-position: center; background-size: cover; z-index: -1;}" +
  1787.                 "h2#DCL_menuTitle {box-sizing: border-box; padding: 55px 10px 0 20px; text-align: left; width: inherit; height: 95px; cursor: default; font-size: 15px; font-weight: normal; color: white; background-image: linear-gradient(rgba(0,0,0,.0),rgba(0,0,0,.9)); background-size: 100% 60%; background-repeat: no-repeat; background-position: bottom; z-index: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}" +
  1788.                 "h2#DCL_menuTitle > img.DCL_profileImage {float: left; width: 40px; height: 40px; margin-right: 7px; background-size: cover; border: 2px solid white; border-radius: 20px; box-sizing: border-box; margin-top: -7px; margin: -7px 7px 0 -10px;}" +
  1789.                 "h2#DCL_menuTitle > a {color: inherit; font-size: 15px; cursor: pointer; text-decoration: none;}" +
  1790.                 "h2#DCL_menuTitle > a:hover {text-decoration: underline;}" +
  1791.                 "h2#DCL_menuTitle > a > img.userType {margin-left: 3px;}" +
  1792.                 "h2#DCL_menuTitle > em {display: block; font-size: 12px; font-weight: normal; color: #ccc;}" +
  1793.                 "ul#DCL_menuUl:after {content: ''; display: block; clear: both; width: 0; height: 0; overflow: hidden;}" +
  1794.                 "ul#DCL_linkUl {border-top: 1px dotted #ddd;}" +
  1795.  
  1796.                 "div#DCL_writeBtn { display: none; }" +
  1797.                 "";
  1798.         }
  1799.         addStyle(css);
  1800.  
  1801.         var menuDiv = cElement("div",[document.body,0],{id:"DCL_menuDiv"});
  1802.         var menuWrap = cElement("div",menuDiv,{id:"DCL_menuWrap"});
  1803.        
  1804.         if(P.simpleWrite)
  1805.             cElement('a',cElement("div",menuWrap,{id:"DCL_writeBtn"}),{href:MODE.prefix+'/board/write/?id='+_ID,textContent:'글쓰기'},function(e) { openSimpleWriteForm(); e.preventDefault(); });
  1806.         var profileH2=cElement("h2",menuWrap,{id:"DCL_menuTitle",textContent:GALLERY.replace(/\(.+?\)/,'')+" 갤러리"},DCINSIDE_LITE.funcList.refresh);
  1807.  
  1808.         // 즐겨찾기 링크 정리
  1809.         var linkList = new Array();
  1810.         if(P.linkList) {
  1811.             var regexp = /(?:(\[현재갤\])|([^@]+)(@{1,2})((https?:\/\/)?.+))(?:\n|$)/ig;
  1812.             var exec,href,className,li,a,g_flg=new Array();
  1813.             while( (exec=regexp.exec(P.linkList)) ) {
  1814.                 switch(exec[1]) {
  1815.                     case '[현재갤]':
  1816.                         if(g_flg[_ID])
  1817.                             break;
  1818.                         linkList[GALLERY] = {};
  1819.                         linkList[GALLERY].href = MODE.prefix+"/board/lists/?id=" + _ID;
  1820.                         linkList[GALLERY].className = "DCL_linkThis";
  1821.                         break;
  1822.                     default:
  1823.                         linkList[exec[2]] = {};
  1824.                         if(exec[5]) {
  1825.                             linkList[exec[2]].href = exec[4];
  1826.                             linkList[exec[2]].className = "DCL_linkHttp";
  1827.                         } else {
  1828.                             linkList[exec[2]].href = MODE.prefix+"/board/lists/?id=" + exec[4];
  1829.                             linkList[exec[2]].className = exec[4]===_ID?"DCL_linkThis":"";
  1830.                             g_flg[exec[4]]=true;
  1831.                         }
  1832.                         linkList[exec[2]].target = exec[3].length === 2?"_blank":"";
  1833.                 }
  1834.             }
  1835.         }
  1836.  
  1837.         var menuList = P.menuList.split("|");
  1838.         var menuUlId = ["menuUlLeft","menuUlRight","menuUlSub"];
  1839.  
  1840.         for(var mlc=0;mlc<menuList.length && mlc < 3;mlc+=1) {
  1841.             if(menuList[mlc]=='')
  1842.                 continue;
  1843.             var menuUl = cElement("ul",menuWrap,{id:"DCL_"+menuUlId[mlc]});
  1844.             if(P.menuPos!=="top" || menuUlId[mlc]!=="menuUlSub")
  1845.                 menuUl.className="DCL_menuUl";
  1846.             else
  1847.                 cElement("li",menuUl);
  1848.             menuList[mlc] = menuList[mlc].split("/");
  1849.             for(var j=0,l=menuList[mlc].length ; j<l ; j+=1) {
  1850.                 var flag = menuList[mlc][j];
  1851.                 if(flag === "설정") {
  1852.                     cElement("a",cElement("li",menuUl),{textContent:"설정",id:"DCL_setBtn"},SET.call);
  1853.                 } else if(flag === "로그인") {
  1854.                     cElement("a",cElement("li",menuUl,{className:"DCL_menuLogin"}),{textContent:_GID?"로그아웃":"로그인"},DCINSIDE_LITE.funcList.login);
  1855.                 } else if(flag === "갤로그") {
  1856.                     cElement("a",cElement("li",menuUl,{className:"DCL_menuGallog"}),{textContent:"갤로그",id:"DCL_profile",href:_GID?"//gallog.dcinside.com/"+_GID:'',target:"_blank"},DCINSIDE_LITE.funcList.gallog);
  1857.                 } else if(flag === "갤러리") {
  1858.                     cElement("a",cElement("li",menuUl),{textContent:"갤러리",href:"//gall.dcinside.com/",target:"_blank"});
  1859.                 } else if(flag === "목록") {
  1860.                     cElement("a",cElement("li",menuUl),{textContent:"멀티 페이지",className:P.page?"DCL_menuOn":""},DCINSIDE_LITE.funcList.page);
  1861.                 } else if(flag === "와이드") {
  1862.                     cElement("a",cElement("li",menuUl),{textContent:"와이드 레이아웃",className:P.wide?"DCL_menuOn":""},DCINSIDE_LITE.funcList.wide);
  1863.                 } else if(flag === "상단") {
  1864.                     cElement("a",cElement("li",menuUl),{textContent:"상단 메뉴",className:P.header?"DCL_menuOn":""},DCINSIDE_LITE.funcList.header);
  1865.                 } else if(flag === "타이틀") {
  1866.                     cElement("a",cElement("li",menuUl),{textContent:"갤러리 타이틀",className:P.title?"DCL_menuOn":""},DCINSIDE_LITE.funcList.title);
  1867.                 } else if(flag === "박스") {
  1868.                     cElement("a",cElement("li",menuUl),{textContent:"갤러리 박스",className:P.best?"DCL_menuOn":""},DCINSIDE_LITE.funcList.best);
  1869.                 } else if(flag === "베스트") {
  1870.                     cElement("a",cElement("li",menuUl),"일간베스트",DCINSIDE_LITE.funcList.ilbeview);
  1871.                 } else if(flag === "개념글") {
  1872.                     cElement("a",cElement("li",menuUl),"개념글",DCINSIDE_LITE.funcList.favview);
  1873.                 } else if(flag === "글쓰기"){
  1874.                     cElement("a",cElement("li",menuUl),"글쓰기",DCINSIDE_LITE.funcList.write);
  1875.                 } else if(flag === "즐겨찾기") {
  1876.                     for(flag in linkList) {
  1877.                         if(typeof linkList[flag].href === "undefined")
  1878.                             continue;
  1879.                         var link = cElement("a",cElement("li",menuUl),{href:linkList[flag].href,target:linkList[flag].target,className:linkList[flag].className,textContent:flag});
  1880.                         if(linkList[flag].className!="DCL_linkHttp")
  1881.                             link.addEventListener("click",function(e){ePrevent(e); $("a.DCL_linkThis").className=''; this.className="DCL_linkThis"; softLoad(this.href);});
  1882.                     }
  1883.                 } else if(flag === "구분선") {
  1884.                     cElement("a",cElement("li",menuUl),{textContent:"구분선",className:"DCL_menuSep"});
  1885.                 } else if(typeof linkList[flag] !== "undefined"){
  1886.                     var link = cElement("a",cElement("li",menuUl),{href:linkList[flag].href,target:linkList[flag].target,className:linkList[flag].className,textContent:flag});
  1887.                     if(linkList[flag].className == "DCL_linkThis")
  1888.                         link.addEventListener("click",function(e){ePrevent(e); softLoad(this.href);});
  1889.                 }
  1890.             }
  1891.         }
  1892.        
  1893.         var target = $('span.f_l > a',1);
  1894.         for(i=target.length;i--;) {
  1895.             target[i].addEventListener("click", function(e) { ePrevent(e); softLoad(this.href); });
  1896.         }
  1897.  
  1898.         if(P.menuPos === "top") {
  1899.             $id("DCL_menuTitle").textContent = "";
  1900.             $id("DCL_menuTitle").removeEventListener("click",DCINSIDE_LITE.funcList.refresh);
  1901.             cElement("img",[$id("DCL_menuTitle"),0],{src:"http://dcimg1.dcinside.com/glogProfileView.php?gid=26b2c223e4c221ac3e&type=main&mode=GL&dummyCode=242872037",className:"DCL_profileImage",alt:"프로필"});
  1902.         }
  1903.  
  1904.         if(_GID) {
  1905.             simpleRequest("http://gallog.dcinside.com/" + _GID, function(e) {
  1906.                 var gallogHtml = e.responseText;
  1907.                 var nick = gallogHtml.match(/id='pfNickView'>(.+?)<\/span>/)[1];
  1908.                 if(isFNick = nick.match(/<U>(.+?)<\/U>/)) {
  1909.                     nick = isFNick[1];
  1910.                     isFNick = true;
  1911.                 }
  1912.                 var pfImg = gallogHtml.match(/<img src="([^"]+)" width="[^"]+" id="ProfileImg"/)[1];
  1913.                 var bgImg = gallogHtml.match(/background-image:url\('([^ ]+) \?>'\);"><\/div>/)[1];
  1914.                 $id("DCL_menuTitle").textContent = "";
  1915.                 cElement("img",[$id("DCL_menuTitle"),0],{src:pfImg,className:"DCL_profileImage",alt:"프로필"});
  1916.                 var glog = cElement("a",$id("DCL_menuTitle"),{href:"//gallog.dcinside.com/" + _GID,target:"_blank",textContent:nick});
  1917.                 cElement("img",glog,{src:isFNick?"//wstatic.dcinside.com/gallery/skin/gallog/g_fix.gif":"http://wstatic.dcinside.com/gallery/skin/gallog/g_default.gif",className:"userType"});
  1918.                 cElement("em",$id("DCL_menuTitle"),_GID);
  1919.                 if(bgImg) addStyle("h2#DCL_menuTitle:before {background-image: url('" + bgImg + "') !important;}");
  1920.                 $id("DCL_menuTitle").removeEventListener("click",DCINSIDE_LITE.funcList.refresh);
  1921.  
  1922.                 if(P.menuPos === "top" && $id("DCL_profile")) {
  1923.                     $id("DCL_profile").className = "DCL_profile";
  1924.                     $id("DCL_profile").textContent = nick;
  1925.                     cElement("img",$id("DCL_profile"),{src:isFNick?"//wstatic.dcinside.com/gallery/skin/gallog/g_fix.gif":"http://wstatic.dcinside.com/gallery/skin/gallog/g_default.gif",className:"userType"});
  1926.                     cElement("em",$id("DCL_profile"),"갤로그 가기");
  1927.                 }
  1928.             },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"});
  1929.         }
  1930.  
  1931.         if(P.menuPos === "top" && $id("DCL_menuUlSub")) {
  1932.             document.body.addEventListener("click",DCINSIDE_LITE.funcList.menuclose);
  1933.         }
  1934.  
  1935.         addStyle(''
  1936.                     + 'form#DCL_writeForm input { -webkit-appearance: none; border-radius: 0; }'
  1937.                     + 'form#DCL_writeForm { position: fixed; width: 640px; height: 480px; max-width: 100%; max-height: 100%; background-color: white; box-shadow: 0 0 3px black; bottom: 60px; right: 30px; z-index: 120; padding-top: 111px; padding-bottom: 41px; box-sizing: border-box; }'
  1938.                     + 'form#DCL_writeForm.DCL_writeHasAttach { padding-bottom: 124px; }'
  1939.                     + 'form#DCL_writeForm * { font-family: "Segoe UI", "Meiryo UI", "Malgun Gothic", "Dotum", sans-serif; }'
  1940.  
  1941.                     + '@media (max-width: 670px) {'
  1942.                         + 'form#DCL_writeForm { right: 0; }'
  1943.                     + '}'
  1944.  
  1945.                     + '@media (max-height: 605px) {'
  1946.                         + 'form#DCL_writeForm { bottom: 0; }'
  1947.                     + '}'
  1948.  
  1949.                     + 'div#DCL_writeFormTitle { background-color: #444; color: white; font-size: 15px; font-weight: normal; padding: 10px; }'
  1950.                     + 'div#DCL_writeFormTitle:after { content: ""; display: block; clear: both; }'
  1951.                     + 'div#DCL_writeFormTitle > h1 { float: left; font-size: 15px; font-weight: normal; margin: 0 5px; }'
  1952.                     + 'div#DCL_writeFormTitle > ul { list-style-type: none; float: right; }'
  1953.                     + 'div#DCL_writeFormTitle > ul > li > a { padding: 0; color: white; display: block; }'
  1954.  
  1955.                     + 'div#DCL_writeInfoDiv { position: absolute; top: 0; left: 0; right: 0; }'
  1956.                     + 'div#DCL_writeInfoDiv > div[name="name"] { font-weight: bold; }'
  1957.                     + 'div#DCL_writeInfoDiv > input,'
  1958.                     + 'div#DCL_writeInfoDiv > div[name="name"] { display: block; width: 100%; border: 0; border-bottom: 1px solid #aaa; padding: 10px; font-size: 13px; height: 38px; box-sizing: border-box; }'
  1959.                     + 'div#DCL_writeInfoDiv > input[name="name"] { border-right: 1px solid #aaa; }'
  1960.                     + 'div#DCL_writeInfoDiv > input[name="name"],'
  1961.                     + 'div#DCL_writeInfoDiv > input[name="password"] { float: left; width: 50%; }'
  1962. //box-shadow: 0 0 0 2px rgba(91, 124, 229,.5);
  1963.                     + 'form#DCL_writeForm > textarea,'
  1964.                     + 'form#DCL_writeForm > div.textarea { width: 100%; height: 100%; padding: 10px; border: 0; font-size: 13px; font-weight: normal; box-sizing: border-box; resize: none; overflow-y: scroll; }'
  1965.                     + 'form#DCL_writeForm > textarea { display: none; }'
  1966.  
  1967.                     + 'ul#DCL_writeAttach { position: absolute; right: 0; bottom: 41px; left: 0; background-color: #EEE; border-top: 1px solid #bbb; padding: 10px; list-style: none; white-space: nowrap; }'
  1968.                     + 'ul#DCL_writeAttach > li { position: relative; display: inline-block; width: 60px; height: 60px; overflow: hidden; border: 1px solid #bbb; margin-right: 10px; }'
  1969.                     + 'ul#DCL_writeAttach > li > img { position: absolute; left: 50%; top: 50%; height: 100%; width: auto; transform: translate(-50%,-50%); }'
  1970.                     + 'ul#DCL_writeAttach > li > div { background-color: black; position: absolute; top: 0; right: 0; color: white; width: 15px; height: 15px; text-align: center; line-height: 15px; font-size: 15px; opacity: .5; cursor: pointer; }'
  1971.                     + 'ul#DCL_writeAttach > li > div:hover { opacity: .9; }'
  1972.  
  1973.                     + 'div#DCL_writeBottomDiv { position: absolute; bottom: 0; left: 0; right: 0; height: 41px; border-top: 1px solid #aaa; background-color: #eee; padding: 3px; box-sizing: border-box; }'
  1974.                     + 'div#DCL_writeBottomDiv > input[type="button"],'
  1975.                     + 'div#DCL_writeBottomDiv > input[type="submit"] { font-size: 13px; line-height: 20px; padding: 3px 20px; border-radius: 3px; margin: 3px; background-color: white; background-image: linear-gradient(0deg,#eee,#fff); border: 1px solid #aaa; float: right; }'
  1976.                     + 'div#DCL_writeBottomDiv > input[type="submit"] { background-color: #5b7ce5; background-image: linear-gradient(0deg,#5b7ce5,#6987e8); border: 1px solid #2049cf; color: white; }'
  1977.                     + 'div#DCL_writeBottomDiv > input[type="submit"]:disabled { background-color: #889fec; background-image: linear-gradient(0deg,#889fec,#95aaee); border-color: #7b95ea; }'
  1978.                     + 'div#DCL_writeBottomDiv > a { border-radius: 3px; font-weight: normal; color: blue; font-size: 12px; line-height: 20px; margin: 3px; padding: 3px; display: inline-block; }'
  1979.                     + 'div#DCL_writeBottomDiv a:focus,'
  1980.                     + 'div#DCL_writeBottomDiv input[type=submit]:focus{ box-shadow: 0 0 0 2px rgba(91, 124, 229,.5); outline: none;}'
  1981.  
  1982.                     + 'div#DCL_writeBottomDiv > ul { display: inline-block; height: 28px; margin: 3px; }'
  1983.                     + 'div#DCL_writeBottomDiv > ul > li { display: inline-block; }'
  1984.                     + 'div#DCL_writeBottomDiv > ul > li > a { cursor: default; height: 26px; border: 1px solid transparent; border-radius: 3px; line-height: 26px; text-align: center; font-size: 13px; display: inline-block; padding: 0 10px; font-weight: normal; text-decoration: none; }'
  1985.  
  1986.                     + 'div#DCL_writeBottomDiv > ul > li > a:hover { border-color: #aaa; background-image: linear-gradient(0deg,#eee,#fff); }'
  1987.                     + 'div#DCL_writeBottomDiv > ul > li > a:focus { background-color: #fafafa; }'
  1988.  
  1989.                     + 'div#DCL_writeBottomDiv > ul > li > a.DCL_editor_bold { font-weight: bold; }'
  1990.                     + 'div#DCL_writeBottomDiv > ul > li > a.DCL_editor_italic { font-style: italic; }'
  1991.                     + 'div#DCL_writeBottomDiv > ul > li > a.DCL_editor_strike { text-decoration: line-through; }'
  1992.                     + 'div#DCL_writeBottomDiv > ul > li > a.DCL_editor_underline { text-decoration: underline; }'
  1993.  
  1994.                     + 'div.DCL_dropzoneDiv { pointer-events: none; position: absolute; top: 35px; bottom: 0; left: 0; right: 0; background-color: rgba(128,128,128,.5); visibility: hidden; }'
  1995.                     + 'div.DCL_dropzoneDiv > span { position: relative; display: block; height: 100%; width: 100%; text-align: center; color: white; font-size: 30px; text-shadow: -1px -1px 0 #777,1px -1px 0 #777,-1px 1px 0 #777,1px 1px 0 #777; }'
  1996.                     + 'div.DCL_dropzoneDiv > span:before { content: "여기에 사진을 끌어놓으세요"; display: inline-block; position: relative; top: 50%; transform: translateY(-50%); }'
  1997.                     + 'div.DCL_dropzoneDiv > span:after { display: inline-block; content: ""; position: absolute; border: 10px dashed white; top: 30px; left: 30px; right: 30px; bottom: 30px; }'
  1998.             );
  1999.  
  2000.         // 간단 글쓰기 폼
  2001.         if(P.simpleWrite && $('span.f_r > a:last-child')) {
  2002.             $('span.f_r > a:last-child').addEventListener('click', function(e) {
  2003.                 openSimpleWriteForm();
  2004.                 ePrevent(e);
  2005.             });
  2006.         }
  2007.     }
  2008.  
  2009.     function openSimpleWriteForm() {
  2010.         simpleRequest(MODE.prefix+'/board/write/?id=' + _ID, function(e) {
  2011.             function uploadCallback(e) {
  2012.                 var r = JSON.parse(e.responseText)['files'];
  2013.                 writeForm.imgHtml='';
  2014.                 for(i=0;i<r.length;i++) {
  2015.                     if(r[i].error)
  2016.                         alert(r[i].error);
  2017.                     if(!r[i].url)
  2018.                         continue;
  2019.                    
  2020.                     if(!$('ul#DCL_writeAttach')) {
  2021.                         cElement('ul',[writeForm,0],{id:'DCL_writeAttach'});
  2022.                         writeForm.classList.add('DCL_writeHasAttach');
  2023.                     }
  2024.                     attachbox = cElement('li', $('ul#DCL_writeAttach'));
  2025.                     attachViewer.add(r[i].url,cElement('img',attachbox,{src:r[i].url}));
  2026.                     cElement('div',attachbox,{textContent:'×'},function() {
  2027.                         removeElement(this.parentNode);
  2028.                         if(!$('ul#DCL_writeAttach > *')) {
  2029.                             if(uStat = $('input[name="upload_status"]'))
  2030.                                 uStat.value='N';
  2031.                             removeElement($('ul#DCL_writeAttach'));
  2032.                             writeForm.classList.remove('DCL_writeHasAttach');
  2033.                         }
  2034.                     });
  2035.                     cElement('input',attachbox,{type:'hidden',name:'file_write[][file_no]',value:r[i].file_temp_no});
  2036.                     attachbox = null;
  2037.  
  2038.                     if(uStat = $('input[name="upload_status"]'))
  2039.                         uStat.value='Y';
  2040.                 }
  2041.                 writeForm.querySelector('div.textarea').innerHTML = writeForm.imgHtml + writeForm.querySelector('div.textarea').innerHTML;
  2042.                 $('div#DCL_writeBottomDiv input[type="submit"]').disabled=null;
  2043.             }
  2044.            
  2045.             DCINSIDE_LITE.checkLoginStatus(e.responseText);
  2046.  
  2047.             if(writeForm = $('form#DCL_writeForm')) removeElement(writeForm);
  2048.             var writeBody = e.responseText.match(/(<div id="dgn_gallery_wrap"[\s\S]*)<\/body>/)[1].toDomElement();
  2049.             var writeForm = cElement('form',[document.body,0],{id:'DCL_writeForm',action:'http://gall.dcinside.com/forms/article_submit',method:'post'/*,enctype:'multipart/form-data'*/});
  2050.             var writeInfoDiv = cElement('div',writeForm,{id:'DCL_writeInfoDiv'});
  2051.                 var writeFormTitle = cElement('div',writeInfoDiv,{id:'DCL_writeFormTitle'});
  2052.                     cElement('h1',writeFormTitle,{textContent:'간단 글쓰기'});
  2053.                     var writeFormButtons = cElement('ul',writeFormTitle);
  2054.                         cElement('a',cElement('li',writeFormButtons),{textContent:'×'},function(){ if(confirm('작성하신 내용이 손실됩니다.\n\n계속하시겠습니까?')) removeElement(writeForm); });
  2055.  
  2056.                 for(var i=(target = writeBody.querySelector('form#write').querySelectorAll('input[type="hidden"]')).length;i--;) {
  2057.                     cElement('input',writeInfoDiv,{type:'hidden',name:target[i].name,value:target[i].value});
  2058.                 }
  2059.                
  2060.                 if((gallog_url = writeBody.querySelector('#favorite_gallog_img')) && (gallog_id = gallog_url.href.match(/http:\/\/gallog\.dcinside\.com\/(.+)/))) {
  2061.                     cElement('div',writeInfoDiv,{textContent:gallog_id[1],name:'name'});
  2062.                 } else {
  2063.                     var autoName = cElement('input',writeInfoDiv,{type:'text',name:'name',placeholder:'닉네임',required:'required'});
  2064.                     var autoPassword = cElement('input',writeInfoDiv,{type:'password',name:'password',placeholder:'비밀번호',required:'required'});
  2065.  
  2066.                     // 자동입력
  2067.                     if(P.autoForm) {
  2068.                         if(autoName) {
  2069.                             autoName.value = P.autoName;
  2070.                             autoName.style.background = "#FAFFBD";
  2071.                             autoName.addEventListener("keydown", function() { this.style.background = ""; });
  2072.                         }
  2073.                         if(autoPassword) {
  2074.                             autoPassword.value = P.autoPassword;
  2075.                             autoPassword.style.background = "#FAFFBD";
  2076.                             autoPassword.addEventListener("keydown", function() { this.style.background = ""; });
  2077.                         }
  2078.                     }
  2079.                    
  2080.                     if((ipAddr = writeForm.querySelector('input[name="user_ip"]').value))
  2081.                         cElement('style',writeForm,{type:'text/css',innerHTML:'form#DCL_writeForm > div.textarea:empty:before { content: "IP: ' + ipAddr.replace(/[0-9]+\.[0-9]+$/, '***.***') + '"; display: block; color: silver; cursor: text; }'});
  2082.                 }
  2083.                 cElement('input',writeInfoDiv,{type:'text',name:'subject',placeholder:'제목',required:'required'}).focus();
  2084.                
  2085.             cElement('textarea',writeForm,{name:'memo',required:'required'});
  2086.             writeFormEditor = cElement('div',writeForm,{className:'textarea','contenteditable':'true'});
  2087.  
  2088.             var attachViewer = new Viewer();
  2089.             attachViewer.clear();
  2090.  
  2091.             var writeBottomDiv = cElement('div',writeForm,{id:'DCL_writeBottomDiv'});
  2092.                 var writeToolbox = cElement('ul',writeBottomDiv);
  2093. /*                  cElement('a',cElement('li',writeToolbox),{title:'굵게',textContent:'B',className:'DCL_editor_bold'});
  2094.                     cElement('a',cElement('li',writeToolbox),{title:'기울임',textContent:'I',className:'DCL_editor_italic'});
  2095.                     cElement('a',cElement('li',writeToolbox),{title:'취소선',textContent:'S',className:'DCL_editor_strike'});
  2096.                     cElement('a',cElement('li',writeToolbox),{title:'밑줄',textContent:'U',className:'DCL_editor_underline'});*/
  2097.  
  2098.                     cElement('a',cElement('li',writeToolbox),{title:'파일 열기',textContent:'사진 추가...',href:'http://gall.dcinside.com'+MODE.prefix+'/board/write/?id='+_ID},function(e) { e.preventDefault(); $('input#DCL_fileSelectDlg').click(); });
  2099.                    
  2100.                 cElement('a',writeBottomDiv,{href:MODE.prefix+'/board/write/?id='+_ID,textContent:'기본 글쓰기 화면 열기',target:'_blank'});
  2101.  
  2102.                 cElement('input',writeBottomDiv,{type:'submit',value:'작성'},function(e){
  2103.                     e.preventDefault();
  2104.                     this.disabled='disabled';
  2105.                     simpleRequest("/block/block",
  2106.                         function(r) {
  2107.                             if(writeForm.querySelector('input[name="block_key"]'))
  2108.                                 writeForm.querySelector('input[name="block_key"]').value = r.responseText;
  2109.                             else
  2110.                                 cElement('input',writeInfoDiv,{type:'hidden',name:'block_key',value:r.responseText});
  2111.                             writeForm.querySelector('textarea').value = writeForm.querySelector('div.textarea').innerHTML;
  2112.                             var data = formWalk(writeForm);
  2113.                             data = data.slice(0,data.length-1);
  2114.                             bfloc = location.toString();
  2115.                             history.pushState(bfloc, '로드 중...', 'http://'+location.innerhost+MODE.prefix+'/board/write/?id='+_ID);
  2116.                             simpleRequest('/forms/article_submit',function(r) {
  2117.                                 history.pushState(bfloc, bfloc, bfloc);
  2118.                                 if((reply = r.responseText.split('||')).length>1) {
  2119.                                     if(reply[0] == 'true') {
  2120.                                         attachViewer = null;
  2121.                                         softLoad(MODE.prefix+'/board/lists/?id='+_ID);
  2122.                                         removeElement(writeForm);
  2123.                                     }
  2124.                                     else {
  2125.                                         alert(reply[1]);
  2126.                                         $('div#DCL_writeBottomDiv input[type="submit"]').disabled=null;
  2127.                                     }
  2128.                                 }
  2129.                                 else
  2130.                                     alert(r.responseText);
  2131.                             },'POST',{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest","Referer":'http://'+location.innerhost+MODE.prefix+'/board/write/?id='+_ID},data);
  2132.                         },
  2133.                         "POST",{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},
  2134.                             ''
  2135.                         + 'ci_t=' + writeForm.querySelector('input[name="ci_t"]').value + '&'
  2136.                         + 'id=' + writeForm.querySelector('input[name="id"]').value + '&'
  2137.                         + 'block_key=' + writeForm.querySelector('input[name="block_key"]').value
  2138.                     );
  2139.                 },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"});
  2140.  
  2141.             var fileSelectDlg = cElement('input',writeForm,{type:'file',id:'DCL_fileSelectDlg','multiple':'multiple'})
  2142.             fileSelectDlg.style.display='none';
  2143.             fileSelectDlg.addEventListener('change',function(e) {
  2144.                 $('div#DCL_writeBottomDiv input[type="submit"]').disabled='disabled';
  2145.                 fileUpload(e.target.files,writeForm.querySelector('input[name="r_key"]')?writeForm.querySelector('input[name="r_key"]').value:null,uploadCallback);
  2146.             });
  2147.            
  2148.             var dropzoneDiv = cElement('div',writeForm,{className:'DCL_dropzoneDiv'});
  2149.             cElement('span', dropzoneDiv);
  2150.  
  2151.             writeForm.addEventListener("dragover", function(e) {
  2152.                 e.stopPropagation();
  2153.                 e.preventDefault();
  2154.                 e.dataTransfer.dropEffect = 'copy';
  2155.                 dropzoneDiv.style.visibility = 'visible';
  2156.             });
  2157.             writeForm.addEventListener("dragleave", function(e) {
  2158.                 dropzoneDiv.style.visibility = null;
  2159.             });
  2160.             writeForm.addEventListener("drop", function(e) {
  2161.                 e.stopPropagation();
  2162.                 e.preventDefault();
  2163.                 dropzoneDiv.style.visibility = null;
  2164.  
  2165.                 if(e.dataTransfer.files.length>0) {
  2166.                     $('div#DCL_writeBottomDiv input[type="submit"]').disabled='disabled';
  2167.                     fileUpload(e.dataTransfer.files,writeForm.querySelector('input[name="r_key"]')?writeForm.querySelector('input[name="r_key"]').value:null,uploadCallback);
  2168.                 }
  2169.             });
  2170.         });
  2171.  
  2172.         function fileUpload(files,r_key,callback) {
  2173.             function filePush(f) {
  2174.                 _this.segments[this.idx]+=f.target.result + '\r\n';
  2175.                 _this.now--;
  2176.                 isDone();
  2177.             }
  2178.  
  2179.             function isDone() {
  2180.                 if(_this.now>0) return;
  2181.                 done();
  2182.             }
  2183.  
  2184.             function done() {
  2185. /*              bfloc = location.toString();
  2186.                 history.pushState(bfloc, '로드 중...', 'http://gall.dcinside.com/upload/image?xssDomain=dcinside.com');*/
  2187.                 try {
  2188.                     xmlhttpRequest({
  2189. //                      binary:true,    // Fuck you Gecko 31
  2190.                         method:'POST',
  2191.                         url:'http://upimg.dcinside.com/upimg_file.php?id='+_ID,
  2192.                         onload:function(e) { return callback(e); },
  2193.                         headers:{'Accept':'application/json, text/javascript, */*; q=0.01','Referer':'http://gall.dcinside.com/upload/image?xssDomain=dcinside.com','Content-Type':'multipart/form-data; boundary='+_this.boundary},
  2194.                         data:("--" + _this.boundary + "\r\n" + _this.segments.join("--" + _this.boundary + "\r\n") + "--" + _this.boundary + "--\r\n").toBlob(),
  2195.                         timeout:30000,
  2196.                         ontimeout:function(e) { console.log('Upload timeout!'); console.log(e); },
  2197.                         onerror:function(e) { console.log('Upload Error!'); console.log(e); }
  2198.                     });
  2199.                 } catch(e) {
  2200.                     console.log(e);
  2201.                     return;
  2202.                 }
  2203.             }
  2204.  
  2205.             var _this = this;
  2206.             this.now = 0;
  2207.             this.boundary = "----DCLiteFormBoundary" + Date.now().toString(16);
  2208.             this.segments = [];
  2209.             this.segments.push('Content-Disposition: form-data; name="r_key"\r\n\r\n'+r_key+'\r\n');
  2210.  
  2211.             for(i=files.length;i--;) {
  2212.                 f = files[i];
  2213.                 reader = new FileReader();
  2214.                 reader.idx = this.segments.length;
  2215.                 reader.onload = filePush;
  2216.                 this.segments.push('Content-Disposition: form-data; name="files[]"; filename="' + f.name.replace(/[\s\=\\"]/g,'\\$0') + '"\r\nContent-Type: ' + f.type + '\r\n\r\n');
  2217.                 this.now++;
  2218.                 reader.readAsBinaryString(f);
  2219.             }
  2220.         }
  2221.     }
  2222.  
  2223.     function wideFunc() {
  2224.         cToggle(document.body,"DCL_wideOn");
  2225.         if(MODE.write) {
  2226.             return;
  2227.         } else if(!wideFunc.init) {
  2228.             wideFunc.init = true;
  2229.             addStyle("body.DCL_wideOn {padding-right:"+P.wideWidth+"px}");
  2230.  
  2231.             if(MODE.article || MODE.comment) {
  2232.                 addStyle(
  2233.                     "div#DCL_wideDiv {width:"+P.pageWidth+"px ; margin:0 auto}" +
  2234.                     "div#DCL_wideDiv > table, div#DCL_wideDiv > table:nth-of-type(2)>tbody>tr>td>table:nth-of-type(3)>tbody>tr:nth-of-type(2)>td>table {width:"+P.pageWidth+"px !important}" +
  2235.                     "body.DCL_wideOn > div#DCL_wideDiv {height:0}" +
  2236.                     "body.DCL_wideOn > div#DCL_wideDiv > table {margin-left:"+P.pageWidth+"px ; width:"+P.wideWidth+"px !important}" +
  2237.                     "body.DCL_wideOn > div#DCL_wideDiv #bgRelaBig * {max-width:"+P.wideWidth+"px !important}" +
  2238.                     "body.DCL_wideOn > div#DCL_wideDiv > table:nth-of-type(2)>tbody>tr>td>table:nth-of-type(3)>tbody>tr:nth-of-type(2)>td>table {width:"+P.wideWidth+"px !important}" +
  2239.                     "body.DCL_wideOn > br {display:none}"
  2240.                 );
  2241.  
  2242.                 var table = $("body > table:not(#TB,1)");
  2243.                 var div = cElement("div",[table[0],"prev"],{id:"DCL_wideDiv"});
  2244.                 for(var i=0,l=table.length ; i<l ; i+=1) {
  2245.                     div.appendChild(table[i]);
  2246.                 }
  2247.             }
  2248.         }
  2249.     }
  2250.  
  2251.     // 목록에 적용
  2252.     function listFunc(p) {
  2253.         var tbody = $id("list_table").tBodies[p];
  2254.         var rows = tbody.rows;
  2255.  
  2256.         tbody.setAttribute("DCL_tbody",p);
  2257.         var tbodyBtn = cElement("p",rows[0].cells[0],{className:"DCL_tbodyBtn"});
  2258.         cElement("span",tbodyBtn,(p+PAGE)+" 페이지",function(){pageLoad(p);});
  2259.         cElement("span",tbodyBtn,"글닫기",function(){Layer.close(p);});
  2260.  
  2261.         var a = tbody.querySelectorAll("tr > td:nth-of-type(3) a");
  2262.         for(var i=0,l=a.length ; i<l ; i+=1) {
  2263.             a[i].href = a[i].href.replace(/([?&]page=)\d+/,"$1"+PAGE);
  2264.         }
  2265.        
  2266.         // TR loop
  2267.         var trs = tbody.querySelectorAll('tr');
  2268.         for(i=0,l=trs.length;i<l;i++) {
  2269.             if(P.listTime && (date = trs[i].querySelector('.t_date'))) {
  2270.                 if(date.title!='') {
  2271.                     if(MODE.api) {
  2272.                         w_date = date.title;
  2273.                         if(dv = w_date.match(/([0-9]{4}\.[0-9]{2}\.[0-9]{2}) ([0-9]{1,2}:[0-9]{2}):[0-9]{2}/)) {
  2274.                             now = new Date();
  2275.                             ymd_d = now.getFullYear() + '.' + ((month=now.getMonth()+1)>9?month:'0'+month) + '.' + ((date_v=now.getDate())>9?date_v:'0'+date_v);
  2276.                             if(ymd_d == dv[1])
  2277.                                 w_date = dv[1] + ' ' + dv[2];
  2278.                             else
  2279.                                 w_date = dv[1];
  2280.                         }
  2281.                         date.textContent = w_date;
  2282.                         eRemove(date,'title');
  2283.                     }
  2284.                     else {
  2285.                         date.textContent = date.title;
  2286.                         eRemove(date,'title');
  2287.                     }
  2288.                 }
  2289.             }
  2290.             if(P.listNick && (writer = trs[i].querySelector('.t_writer:not([user_id=""]) > span:first-of-type'))) {
  2291.                 if(writer.title!='') {
  2292.                     writer.textContent = writer.title;
  2293.                     if(!(writer.title = writer.parentNode.getAttribute('user_id')))
  2294.                         eRemove(writer,'title');
  2295.                 }
  2296.             }
  2297.         }
  2298.  
  2299.         var pager = $id('dgn_btn_paging').children;
  2300.         for(i=0,l=pager.length;i<l;i++) {
  2301.             pager[i].addEventListener("click",function(e) { ePrevent(e); softLoad(this.href); },false);
  2302.         }
  2303.  
  2304.         removeEventListenerAll($id("search_input"), $id("search_btn"));
  2305.         $id("search_input").addEventListener("keypress",function(e) { if(e.keyCode == 13) doSearch(e); });
  2306.         $id("search_btn").addEventListener("click",doSearch);
  2307.     }
  2308.  
  2309.     function doSearch(e) {
  2310.         ePrevent(e);
  2311.         softLoad(MODE.prefix+"/board/lists/?id=" + _ID + "&s_type=" + $id("search_type").value + "&s_keyword=" + $id("search_input").value);
  2312.     }
  2313.  
  2314.     // 다중 목록
  2315.     function pageFunc(mode) {
  2316.         if( P.pageCount < 2) {
  2317.             return;
  2318.         }
  2319.  
  2320.         var list = $id("dgn_btn_paging").getElementsByClassName("on")[0].nextElementSibling;
  2321.         for(var i=1,l=P.pageCount ; i<l ; i+=1) { // 페이징 목록에 다중 목록 스타일 추가
  2322.             if (!list) return;
  2323.             cAdd(list,"DCL_pageLink");
  2324.             list = list.nextElementSibling;
  2325.             if(!mode) {
  2326.                 cElement("tbody",$id("list_table"),{innerHTML:"<tr><td colspan='6' class='DCL_tbodyTitle'></td></tr>",className:"list_thead"});
  2327.                 pageLoad(i);
  2328.             }
  2329.         }
  2330.     }
  2331.  
  2332.     // 목록 데이터 로드
  2333.     function pageLoad(p) {
  2334.         Layer.close(p);
  2335.         var tbody = $id("list_table").tBodies[p];
  2336.         var cell = tbody.rows[0].cells[0];
  2337.  
  2338.         var exception_mode=parseQuery(location.search).exception_mode;
  2339.         var s_type=parseQuery(location.search).s_type;
  2340.         var s_keyword=parseQuery(location.search).s_keyword;
  2341.         var search_pos=parseQuery(location.search).search_pos;
  2342.         if(parseQuery(location.search).page)
  2343.             PAGE=parseInt(parseQuery(location.search).page);
  2344.         else
  2345.             PAGE=1;
  2346.        
  2347.         var buttons = $('div.btn_bottom a[href^="'+MODE.prefix+'/board/"], div.btn_bottom a[href^="http://gall.dcinside.com'+MODE.prefix+'/board/"]',1);
  2348.         for(i=buttons.length;i--;) {
  2349.             buttons[i].href = buttons[i].href.replace(/([?&]id=)[^&]+/,'$1'+_ID);
  2350.         }
  2351.  
  2352.         cell.innerHTML = "<span class='DCL_tbodyLoad'>읽는 중... ("+(p+PAGE)+" 페이지)</span>";
  2353.  
  2354.         if(MODE.api) {
  2355.             console.log('API load!');
  2356.             if(!MODE.api.count) {
  2357.                 try {
  2358.                     MODE.api.count = $('tbody.list_thead tr.tb a[href^="/board/view/?id='+_ID+'&no="]',1).length;
  2359.                 } catch(e) {
  2360.                     MODE.api = false;
  2361.                     console.log('API: Unable to get count - fallback to html parse');
  2362.                     return;
  2363.                 }
  2364.             }
  2365.             if(!MODE.api.lastpage) {
  2366.                 MODE.api.lastpage = $('a.b_next:last-child')?$('a.b_next:last-child').href.match(/page=([0-9]+)/)[1]:$('#dgn_btn_paging a.on:last-child').textContent;
  2367.                 console.log('lastpage : ' + MODE.api.lastpage);
  2368.             }
  2369.             var pC = MODE.api.count;
  2370.             var pc_page = p+PAGE;
  2371.             var start = Math.floor((pc_page-1)*pC/25+1);
  2372.             var end = Math.ceil((pc_page*pC-1)/25);
  2373.             var pageData = [];
  2374.             var noticeData = [];
  2375.             var noticed = false;
  2376.             var api_callback = function(r,notice) {
  2377.                 var resp = JSON.parse(r.responseText);
  2378.                 if(resp[0].result === false) {
  2379.                     MODE.api = false;
  2380.                     cell.innerHTML = "";
  2381.                     cElement("span",cell,{textContent:"읽기 실패 (API Load Error)",className:"DCL_tbodyLoad"},function(){pageLoad(p);});
  2382.                     console.log('API Load Error! - fallback to html parse');
  2383.                     console.log(resp[0].result);
  2384.                     pageLoad(p);
  2385.                     return;
  2386.                 }
  2387. //              MODE.api = true;
  2388.  
  2389.                 try {
  2390.                     skip = (pc_page-1)*pC%25;
  2391.                     if(!noticed && notice) {
  2392.                         noticeData = resp[0].gall_list;
  2393.                         noticed = true;
  2394.                     }
  2395.                     else {
  2396.                         if(!pageData.length) {
  2397.                             pageData = resp[0].gall_list;
  2398.                         }
  2399.                         else if(pageData[0].no == resp[0].gall_list[0].no) {
  2400.                             console.log('API: Err: no is same');
  2401.                             return;
  2402.                         }
  2403.                         else if(pageData[0].no > resp[0].gall_list[0].no) {
  2404.                             pageData = pageData.concat(resp[0].gall_list);
  2405.                         } else {
  2406.                             pageData = resp[0].gall_list.concat(pageData);
  2407.                         }
  2408.                     }
  2409.  
  2410.                     if((dCount = pageData.length) >= pC && noticed) {
  2411.                         tbody.innerHTML = "<tr><td colspan='6' class='DCL_tbodyTitle'></td></tr>";
  2412.                         var createRow = function(rowData) {
  2413.                             tr = cElement('tr',tbody,{className:'tb'});
  2414.                            
  2415.                             w_date = rowData.date_time;
  2416.                             if(rowData.date_time.match(/[0-9]{1,2}:[0-9]{1,2}/)) {
  2417.                                 now = new Date();
  2418.                                 w_date = now.getFullYear() + '.' + ((month=now.getMonth()+1)>9?month:'0'+month) + '.' + ((date=now.getDate())>9?date:'0'+date) + ' ' + rowData.date_time;
  2419.                             }
  2420.  
  2421.                             ipstr = ipaddr = null;
  2422.                             if(ipaddr = rowData.ip.match(/^(\d{1,3}\.\d{1,3})/)) {
  2423.                                 ipstr = ipaddr[1] + '.***.***';
  2424.                                 ipaddr = ipaddr[1] + '.0.0';
  2425.                             }
  2426.  
  2427.                             cElement('td',tr,{className:'t_notice',textContent:(rowData.img_icon=='notice'?'공지':rowData.no)});
  2428.                             cElement('td',tr,{className:'t_subject',style:'text-overflow:ellipsis; overflow:hidden; white-space:nowrap; padding:2px;'});
  2429.                             cElement('td',tr,{className:'t_writer user_layer','user_ip':ipstr,'user_id':rowData.user_id,'user_name':rowData.name,'style':'cursor:pointer;'});
  2430.                             cElement('td',tr,{className:'t_date',textContent:w_date});
  2431.                             cElement('td',tr,{className:'t_hits',textContent:rowData.hit});
  2432.                             cElement('td',tr,{className:'t_hits',textContent:rowData.recommend});
  2433.  
  2434.                             viewUrl = '/board/view/?id='+_ID+'&no='+rowData.no+'&page='+pc_page;
  2435.                             commentViewUrl = '/board/comment_view/?id='+_ID+'&no='+rowData.no+'&page='+pc_page;
  2436.                             userIcon = 'http://wstatic.dcinside.com/gallery/skin/gallog/';
  2437.                             switch(rowData.member_icon) {
  2438.                             case '1':
  2439.                                 userIcon+='g_fix.gif';
  2440.                                 break;
  2441.                             case '2':
  2442.                                 userIcon+='g_default.gif';
  2443.                                 break;
  2444.                             default:
  2445.                                 userIcon = '';
  2446.                                 break;
  2447.                             }
  2448.  
  2449.                             imgIconPostfix = '';
  2450.                             switch(rowData.recommend_icon) {
  2451.                             case 'Y':
  2452.                                 imgIconPostfix = 'b';
  2453.                                 break;
  2454.                             default:
  2455.                                 imgIconPostfix = 'n';
  2456.                             }
  2457.  
  2458.                             imgIcon = '';
  2459.                             switch(rowData.img_icon) {
  2460.                             case 'Y':
  2461.                                 imgIcon = 'icon_pic_'+imgIconPostfix;
  2462.                                 break;
  2463.                             case 'N':
  2464.                                 imgIcon = 'icon_txt_'+imgIconPostfix;
  2465.                                 break;
  2466.                             case 'notice':
  2467.                                 imgIcon = 'icon_notice';
  2468.                                 break;
  2469.                             }
  2470.  
  2471.                             cElement('a',tr.cells[1],{href:viewUrl,innerHTML:rowData.subject,style:'max-width:90%; overflow:hidden; vertical-align:middle;',className:imgIcon});
  2472.                             commLink = cElement('a',tr.cells[1],{href:commentViewUrl});
  2473.                             if(rowData.total_comment>0)
  2474.                                 cElement('em',commLink,'['+rowData.total_comment+(rowData.total_voice>0?'/'+rowData.total_voice:'')+']');
  2475.  
  2476.                             if(ipstr) {
  2477.                                 ipspan = cElement('span',tr.cells[2],{title:ipstr,textContent:rowData.name});
  2478.  
  2479.                                 var color = ipColorize(ipstr);
  2480.                                 if (P.commentColorType=="bg")
  2481.                                     tr.cells[2].style.backgroundColor = color;
  2482.                                 else if(P.commentColorType=="fg")
  2483.                                     ipspan.style.color = color;
  2484.                                 else if(P.commentColorType=="gc")
  2485.                                     cElement('span', tr.cells[2], {textContent:"■",className:'right_nick'}).style.color = color;
  2486.                             }
  2487.                             else
  2488.                                 cElement('span',tr.cells[2],{title:rowData.name,textContent:rowData.name});
  2489.  
  2490.                             if(rowData.user_id)
  2491.                                 cElement('img', cElement('a',tr.cells[2],{className:'right_nick',href:'http://gallog.dcinside.com/'+rowData.user_id,target:'_blank'}), {src:userIcon,title:rowData.user_id+'('+(rowData.member_icon==1?'고정닉':'갤로거')+') : 갤로그로 이동합니다.', height:'15'});
  2492.                         }
  2493.  
  2494.                         if(noticeData.length > 0) {
  2495.                             for(i=0;i<noticeData.length;i++) {
  2496.                                 noticeData[i].img_icon = 'notice';
  2497.                                 createRow(noticeData[i]);
  2498.                             }
  2499.                         }
  2500.                         for(i=0;i<dCount && i<skip+pC-1;i++) {
  2501.                             if(i<skip-1)
  2502.                                 continue;
  2503.                             createRow(pageData[i]);
  2504.                         }
  2505.  
  2506.                         if(p===0) {
  2507.                             var paging_s = parseInt((pc_page-1)/20) * 20 + 1;
  2508.                             var pager = $id('dgn_btn_paging');
  2509.                             pager.innerHTML = '';
  2510.                             if(paging_s > 1) {
  2511.                                 cElement('span', cElement('a',pager,{href:'/board/lists/?id='+_ID+'&page=1'+(exception_mode?'&exception_mode='+exception_mode:''),className:'b_prev'}), {className:'arrow_4',innerHTML:'맨처음'});
  2512.                                 cElement('span', cElement('a',pager,{href:'/board/lists/?id='+_ID+'&page='+(paging_s-1)+(exception_mode?'&exception_mode='+exception_mode:''),className:'b_prev'}), {className:'arrow_3',textContent:'다음'});
  2513.                             }
  2514.                             for(c=0;c<20 && (pager_page = paging_s+c) <= MODE.api.lastpage;c++) {
  2515.                                 if(pager_page==pc_page)
  2516.                                     cElement('a',pager,{href:'',className:'on',textContent:pager_page});
  2517.                                 else
  2518.                                     cElement('a',pager,{href:'/board/lists/?id='+_ID+'&page='+pager_page+(exception_mode?'&exception_mode='+exception_mode:''),textContent:pager_page});
  2519.                             }
  2520.                             if(pager_page < MODE.api.lastpage) {
  2521.                                 cElement('span', cElement('a',pager,{href:'/board/lists/?id='+_ID+'&page='+(paging_s+20)+(exception_mode?'&exception_mode='+exception_mode:''),className:'b_next'}), {className:'arrow_1',textContent:'다음'});
  2522.                                 cElement('span', cElement('a',pager,{href:'/board/lists/?id='+_ID+'&page='+MODE.api.lastpage+(exception_mode?'&exception_mode='+exception_mode:''),className:'b_next'}), {className:'arrow_2',innerHTML:'맨뒤&nbsp;&nbsp;'});
  2523.                             }
  2524.                             if(P.page)
  2525.                                 pageFunc(true);
  2526.                         }
  2527.  
  2528.                         listFunc(p);
  2529.                         Layer.add(p);
  2530.                         if(P.filter) {
  2531.                             Filter.article(tbody);
  2532.                         }
  2533.                         if(typeof s_keyword == "undefined")
  2534.                             $id("search_input").value = '';
  2535.                     }
  2536.                 } catch(e) {
  2537.                     MODE.api = false;
  2538.                     cell.innerHTML = "";
  2539.                     cElement("span",cell,{textContent:"읽기 실패 (API Load Error)",className:"DCL_tbodyLoad"},function(){pageLoad(p);});
  2540.                     console.log('API Load Error! - fallback to html parse');
  2541.                     console.log(e);
  2542.                     pageLoad(p);
  2543.                     return;
  2544.                 }
  2545.             };
  2546.  
  2547.             if(!pC || !start || !end) {
  2548.                 MODE.api = false;
  2549.                 pageLoad(p);
  2550.                 console.log('API Load Error! - fallback to html parse');
  2551.                 return;
  2552.             }
  2553.  
  2554.             if(pc_page=='1' && !s_keyword && !exception_mode) {
  2555.                 simpleRequest('http://m.dcinside.com/api/redirect.php?hash=' + btoa(
  2556.                     'http://m.dcinside.com/api/gall_list.php'+
  2557.                     '?id='+
  2558.                     _ID+
  2559.                     '&page='+(start-1)+
  2560.                     '&notice=1'+
  2561.                     '&app_id=blM1T09mWjRhQXlZbE1ML21xbkM3QT09'), function(r) { api_callback(r,1); },'GET',{'Accept':'text/json'});
  2562.             } else {
  2563.                 noticed = true;
  2564.             }
  2565.  
  2566.             for(;start++<=end;) {
  2567.                 simpleRequest('http://m.dcinside.com/api/redirect.php?hash=' + btoa(
  2568.                     'http://m.dcinside.com/api/gall_list.php'+
  2569.                     '?id='+
  2570.                     _ID+
  2571.                     '&page='+(start-1)+
  2572.                     (s_type!=null?'&s_type='+s_type.substr(7):'')+
  2573.                     (s_keyword!=null?'&ser_Val='+s_keyword:'')+
  2574.                     (search_pos!=null?'&ser_pos='+search_pos:'')+
  2575.                     (exception_mode!=null?'&'+exception_mode+'=1':'')+
  2576.                     '&app_id=blM1T09mWjRhQXlZbE1ML21xbkM3QT09'), api_callback,'GET',{'Accept':'text/json'});
  2577.             }
  2578.         }
  2579.         else {     
  2580.             simpleRequest(MODE.prefix+"/board/lists/?id="+_ID+"&page="+(p+PAGE)+(s_type!=null?'&s_type='+s_type:'')+(s_keyword!=null?'&s_keyword='+s_keyword:'')+(exception_mode!=null?'&exception_mode='+exception_mode:'')+(search_pos!=null?'&search_pos='+search_pos:''),
  2581.                 function(response) {
  2582.                     var text = response.responseText;
  2583.                     DCINSIDE_LITE.checkLoginStatus(text);
  2584.                     var startPos = text.indexOf("<tr onmouseover=\"this.style.backgroundColor='#eae9f7';\" onmouseout=\"this.style.backgroundColor='';\" class=\"tb\">");
  2585.                     var html = text.substring(startPos,text.indexOf("</tbody>"));
  2586.                     if(html) {
  2587.                         if((g_title=text.match(/<span class="tit">([^<]+)<\/span>/)) && g_title[1]) {
  2588.                             $('.gallery_title .tit').textContent = GALLERY = document.title = g_title[1];
  2589.                             titleFunc();
  2590.                         }
  2591.                         tbody.innerHTML = "<tr><td colspan='6' class='DCL_tbodyTitle'></td></tr>" + (startPos!="-1"?html:'');
  2592.                         if(p===0) {
  2593.                             $id('dgn_btn_paging').innerHTML = text.replace(/\n/g, '').match(/<!-- btn_paging -->[^<]+<div id=\"dgn_btn_paging\">(.*)<\/div>[^<]+<!-- \/\/btn_paging -->/)[1];
  2594.                             if(P.page)
  2595.                                 pageFunc(true);
  2596.                         }
  2597.  
  2598.                         listFunc(p);
  2599.                         Layer.add(p);
  2600.                         if(P.filter) {
  2601.                             Filter.article(tbody);
  2602.                         }
  2603.                         if(typeof s_keyword == "undefined")
  2604.                             $id("search_input").value = '';
  2605.                     } else {
  2606.                         cell.innerHTML = "";
  2607.                         cElement("span",cell,{textContent:"읽기 실패 ("+(p+PAGE)+" 페이지)",className:"DCL_tbodyLoad"},function(){pageLoad(p);});
  2608.                     }
  2609.                 },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"}
  2610.             );
  2611.         }
  2612.         if(!P.notificationInterval)
  2613.             DCINSIDE_LITE.checkAlert();
  2614.     }
  2615.  
  2616.     // 필터 ; 차단 or 강조
  2617.     var Filter = {
  2618.  
  2619.     init : function() {
  2620.         Filter.inited = true;
  2621.  
  2622.         var bN = P.blockN;
  2623.         var bAN = P.blockAN;
  2624.         var bAT = P.blockAT;
  2625.         var bAI = P.blockAI;
  2626.         var aAN = P.allowAN;
  2627.         var aAT = P.allowAT;
  2628.         var aAI = P.allowAI;
  2629.         var bA = bAN || bAT || bAI || aAN || aAT || aAI;
  2630.         Filter.bN = bN;
  2631.         Filter.bA = bA;
  2632.  
  2633.         if(bN || bA) {
  2634.             addStyle(
  2635.                 "tr.DCL_blockArticle {display:none}" +
  2636.                 "tr.DCL_blockArticle td.DCL_nameMatch, " +
  2637.                 "tr.DCL_blockArticle span.DCL_titleMatch {color:#c00}" +
  2638.                 "tr.DCL_blockArticleAtAll {display:none}" +
  2639.                 "tbody.DCL_showArticle > tr.DCL_blockArticle {display:table-row ; background-color:#eee}" +
  2640.                 "tbody.DCL_showArticle > tr.DCL_blockArticle+tr {display:table-row}" +
  2641.                 "p.DCL_blockArticleP {float:right}" +
  2642.                 "p.DCL_blockArticleP > span {margin-right:10px ; font:8pt 돋움}" +
  2643.                 "p.DCL_blockArticleP > span.DCL_blockTotal {font-weight:bold ; font-size:9pt ; cursor:pointer}"
  2644.             );
  2645.             if(P.allowStyle) {
  2646.                 addStyle("tr.DCL_allowArticle td.DCL_nameMatch, tr.DCL_allowArticle span.DCL_titleMatch {font-weight:bold !important ; color:#36c !important");
  2647.             }
  2648.  
  2649.             Filter.bNA = P.blockNA;
  2650.             if(P.blockNR) {
  2651.                 var date = new Date();
  2652.                 date.setDate(date.getDate()-P.blockNR);
  2653.                 Filter.bNR = date.getFullYear() + "/" + (100+date.getMonth()+1).toString(10).substr(1) + "/" + (100+date.getDate()).toString(10).substr(1);
  2654.             } else {
  2655.                 Filter.bNR = false;
  2656.             }
  2657.             bAN = Filter.name(bAN);
  2658.             Filter.bAN = bAN[0];
  2659.             Filter.bANid = bAN[1];
  2660.             Filter.bAT = Filter.title(bAT);
  2661.             Filter.bAI = Filter.ip(bAI);
  2662.             aAN = Filter.name(aAN);
  2663.             Filter.aAN = aAN[0];
  2664.             Filter.aANid = aAN[1];
  2665.             Filter.aAT = Filter.title(aAT);
  2666.             Filter.aAI = Filter.ip(aAI);
  2667.         }
  2668.  
  2669.         var bCN = P.blockCN;
  2670.         var bCT = P.blockCT;
  2671.         var bCI = P.blockCI;
  2672.         var aCN = P.allowCN;
  2673.         var aCT = P.allowCT;
  2674.         var aCI = P.allowCI;
  2675.         var bC = bCN || bCT || bCI || aCN || aCT || aCI;
  2676.         Filter.bC = bC;
  2677.  
  2678.         if(bC)
  2679.             addStyle(
  2680.                 "tr.DCL_blockComment {display:none}" +
  2681.                 "tr.DCL_blockComment td.DCL_nameMatch, " +
  2682.                 "tr.DCL_blockComment span.DCL_titleMatch, " +
  2683.                 "tr.DCL_blockComment em.DCL_ipMatch {color:#c00 !important}" +
  2684.                 "table.DCL_showComment tr.DCL_blockComment {display:table-row ; background-color:#f0f0f0}" +
  2685.                 "p.DCL_blockCommentP {margin:5px 0 ; padding:3px ; ; background-color:#e9e9e9 ; text-align:right}" +
  2686.                 "p.DCL_blockCommentP > span {margin-right:10px ; font:8pt 돋움}" +
  2687.                 "p.DCL_blockCommentP > span.DCL_blockTotal {font-weight:bold ; font-size:9pt ; cursor:pointer}" +
  2688.                 ".comment-table > tr:empty {display:none}"
  2689.             );
  2690.             if(P.allowStyle) {
  2691.                 addStyle("tr.DCL_allowComment td.DCL_nameMatch, tr.DCL_allowComment span.DCL_titleMatch {font-weight:bold !important ; color:#36c !important");
  2692.             }
  2693.  
  2694.             bCN = Filter.name(bCN);
  2695.             Filter.bCN = bCN[0];
  2696.             Filter.bCNid = bCN[1];
  2697.             Filter.bCT = Filter.title(bCT);
  2698.             Filter.bCI = Filter.ip(bCI);
  2699.             aCN = Filter.name(aCN);{
  2700.             Filter.aCN = aCN[0];
  2701.             Filter.aCNid = aCN[1];
  2702.             Filter.aCT = Filter.title(aCT);
  2703.             Filter.aCI = Filter.ip(aCI);
  2704.         }
  2705.     },
  2706.     ip : function(value) {
  2707.         if(value===null)
  2708.             return '';
  2709.  
  2710.         var regex = '';
  2711.         patterns = value.split("\n");
  2712.         for(i=0;i<patterns.length;i++) {
  2713.             pattern = patterns[i].split('/');
  2714.  
  2715.             if(pattern.length!=2 || !/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(pattern[0]) || !/^[0-9]+$/.test(pattern[1]))
  2716.                 continue;
  2717.  
  2718.             var ips = 1 << (16-pattern[1]);
  2719.             var startip = ip2long(pattern[0]) >> 16;
  2720.             for(j=0;j<ips;j++) {
  2721.                 regex+=long2ip((startip+j) << 16).replace(/\.0\.0$/g, '.\\*\\*\\*.\\*\\*\\*').replace(/\./g, '\\.') + '|';
  2722.             }
  2723.         }
  2724.         if(regex=='')
  2725.             return '';
  2726.  
  2727.         regex = new RegExp('(' + regex.substr(0,regex.length-1) + ')');
  2728.         return regex;
  2729.     },
  2730.     name : function(value) {
  2731.         if(value===null)
  2732.             return '';
  2733.         value = value.split("\n");
  2734.         var normal = [];
  2735.         var id = [];
  2736.         var name;
  2737.         for(var i=0,l=value.length ; i<l ; i+=1) {
  2738.             name = value[i];
  2739.             if(name !== "") {
  2740.                 if(name.charAt(0) === "#") {
  2741.                     id.push(name);
  2742.                 } else {
  2743.                     normal.push(name);
  2744.                 }
  2745.             }
  2746.         }
  2747.         normal = normal.length ? (new RegExp("^("+normal.join("\n").replace(/([\/()\[\]{}.|$\^])/g,"\\$1").replace(/\n/g,"|").replace(/\\\\/g,"[backslash]").replace(/([^\\]|^)([*+?])/g,"$1.$2").replace(/\[backslash\]/g,"\\\\")+")$")) : null;
  2748.         id = id.length ? (new RegExp("^("+id.join("\n").replace(/([\/()\[\]{}.|$\^])/g,"\\$1").replace(/\n/g,"|").replace(/\\\\/g,"[backslash]").replace(/([^\\]|^)([*+?])/g,"$1.$2").replace(/\[backslash\]/g,"\\\\").replace(/\\\(null\\\)/g,"")+")$")) : null;
  2749.         return [normal,id];
  2750.     },
  2751.     title : function(value) {
  2752.         return value ? (new RegExp(("("+value.replace(/([\/()\[\]{}?+.|$\^])/g,"\\$1").replace(/\n/g,"|")+")").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"g")) : null;
  2753.     },
  2754.     article : function(tbody) {
  2755.         if(!Filter.inited) {
  2756.             Filter.init();
  2757.         }
  2758.         if(!Filter.bN && !Filter.bA) {
  2759.             return;
  2760.         }
  2761.  
  2762.         var rows = tbody.rows;
  2763.         var noticeCnt = 0;
  2764.         var articleCnt = 0;
  2765.         var titleCnt = 0;
  2766.         var blockCnt = {};
  2767.  
  2768.         var i=1,l=rows.length;
  2769.         if(Filter.bN) {
  2770.             var bNA = Filter.bNA;
  2771.             var bNR = Filter.bNR;
  2772.             for( ; rows[i].cells[0].textContent.indexOf("공지") !== -1 ; i++) {
  2773.                 if( (!bNR || rows[i].cells[3].textContent.replace(/^\s+|\s+$/g,"") <= bNR) && (!bNA || rows[i].cells[2].textContent.replace(/^\s+|\s+$/g,"") === "운영자") ) {
  2774.                     cAdd(rows[i],"DCL_blockArticle");
  2775.                     noticeCnt += 1;
  2776.                 }
  2777.             }
  2778.         }
  2779.  
  2780.         if(Filter.bA) {
  2781.             var bAN = Filter.bAN;
  2782.             var bANid = Filter.bANid;
  2783.             var bAT = Filter.bAT;
  2784.             var bAI = Filter.bAI;
  2785.             var aAN = Filter.aAN;
  2786.             var aANid = Filter.aANid;
  2787.             var aAT = Filter.aAT;
  2788.             var aAI = Filter.aAI;
  2789.             var cells,name,idC,title,titleC;
  2790.             for( ; i<l ; i++) {
  2791.                 cells = rows[i].cells;
  2792.                 name = cells[2].getAttribute('user_name');
  2793.                 idC =  "#" + cells[2].getAttribute('user_id');
  2794.                 ip = cells[2].getAttribute('user_ip');
  2795.                 title = cells[1].children[1];
  2796.                 titleC = title.innerHTML;
  2797.  
  2798.                 if(aAN && aAN.test(name) || aANid && idC && aANid.test(idC)) {
  2799.                     cAdd(rows[i],"DCL_allowArticle");
  2800.                     cAdd(cells[2],"DCL_nameMatch");
  2801.                 } else if(aAI && aAI.test(ip)) {
  2802.                     cAdd(rows[i],"DCL_allowArticle");
  2803.                     cAdd(cells[2],"DCL_ipMatch");
  2804.                 } else if(aAT && aAT.test(titleC)) {
  2805.                     cAdd(rows[i],"DCL_allowArticle");
  2806.                     title.innerHTML = titleC.replace(aAT,"<span class='DCL_titleMatch'>$1</span>");
  2807.                 } else if(bAN && bAN.test(name) || bANid && idC && bANid.test(idC)) {
  2808.                     if(P.showLabel)
  2809.                         cAdd(rows[i],"DCL_blockArticle");
  2810.                     else
  2811.                         cAdd(rows[i],"DCL_blockArticleAtAll");
  2812.                     cAdd(cells[2],"DCL_nameMatch");
  2813.                     articleCnt += 1;
  2814.                     if(blockCnt[name]) {
  2815.                         blockCnt[name] += 1;
  2816.                     } else {
  2817.                         blockCnt[name] = 1;
  2818.                     }
  2819.                 } else if(bAI && bAI.test(ip)) {
  2820.                     if(P.showLabel)
  2821.                         cAdd(rows[i],"DCL_blockArticle");
  2822.                     else
  2823.                         cAdd(rows[i],"DCL_blockArticleAtAll");
  2824.                     cAdd(cells[2],"DCL_nameMatch");
  2825.                     articleCnt += 1;
  2826.                     if(blockCnt[ip]) {
  2827.                         blockCnt[ip] += 1;
  2828.                     } else {
  2829.                         blockCnt[ip] = 1;
  2830.                     }
  2831.                 } else if(bAT && bAT.test(titleC)) {
  2832.                     cAdd(rows[i],"DCL_blockArticle");
  2833.                     title.innerHTML = titleC.replace(bAT,"<span class='DCL_titleMatch'>$1</span>");
  2834.                     articleCnt += 1;
  2835.                     titleCnt += 1;
  2836.                 }
  2837.             }
  2838.         }
  2839.  
  2840.         if(noticeCnt || (articleCnt && P.showLabel)) {
  2841.             var p = cElement("p",rows[0].cells[0],{className:"DCL_blockArticleP"});
  2842.  
  2843.             if(noticeCnt) {
  2844.                 cElement("span",p,"공지("+noticeCnt+")");
  2845.             }
  2846.             if(articleCnt && P.showLabel) {
  2847.                 for(i in blockCnt) {
  2848.                     if(blockCnt.hasOwnProperty(i)) {
  2849.                         cElement("span",p,i+"("+blockCnt[i]+")");
  2850.                     }
  2851.                 }
  2852.             }
  2853.             if(titleCnt) {
  2854.                 cElement("span",p,"제목("+titleCnt+")");
  2855.             }
  2856.  
  2857.             cElement("span",p,{className:"DCL_blockTotal",textContent:"전체["+(noticeCnt+(P.showLabel?articleCnt:0))+"]"},function(){cToggle(tbody,"DCL_showArticle");});
  2858.         }
  2859.     },
  2860.     comment : function(table) {
  2861.         if(!Filter.inited) {
  2862.             Filter.init();
  2863.         }
  2864.         if(!Filter.bC) {
  2865.             return;
  2866.         }
  2867.  
  2868.         var bCN = Filter.bCN;
  2869.         var bCNid = Filter.bCNid;
  2870.         var bCT = Filter.bCT;
  2871.         var bCI = Filter.bCI;
  2872.         var aCN = Filter.aCN;
  2873.         var aCNid = Filter.aCNid;
  2874.         var aCT = Filter.aCT;
  2875.         var aCI = Filter.aCI;
  2876.  
  2877.         var rows = table.rows;
  2878.         var commentCnt = 0;
  2879.         var titleCnt = 0;
  2880.         var blockCnt = {};
  2881.  
  2882.         var cells,name,idC,title,titleC;
  2883.         var fMode = MODE.article || MODE.comment;
  2884.         for(var i=0,l=rows.length ; i<l ; i+=(fMode?4:1)) {
  2885.             cells = rows[i].cells;
  2886.             name = cells[0].getAttribute('user_name');
  2887.             idC =  "#" + cells[0].getAttribute('user_id');
  2888.             ip = cells[1].getElementsByTagName("em")[0].textContent;
  2889.             title = cells[1].getElementsByTagName("div")[0] || cells[1];
  2890.             titleC = title.textContent.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  2891.             if(aCN && aCN.test(name) || aCNid && idC && aCNid.test(idC)) {
  2892.                 cAdd(rows[i],"DCL_allowComment");
  2893.                 cAdd(cells[0],"DCL_nameMatch");
  2894.             } else if(aCI && aCI.test(ip)) {
  2895.                 cAdd(rows[i],"DCL_allowComment");
  2896.                 cAdd(cells[1].getElementsByTagName("em")[0],"DCL_ipMatch");
  2897.             } else if(aCT && aCT.test(titleC)) {
  2898.                 cAdd(rows[i],"DCL_allowComment");
  2899.                 title.removeChild(title.firstChild);
  2900.                 cElement("span",[title,0],{innerHTML:titleC.replace(aCT,"<span class='DCL_titleMatch'>$1</span>")});
  2901.             } else if(bCN && bCN.test(name) || bCNid && idC && bCNid.test(idC)) {
  2902.                 cAdd(rows[i],"DCL_blockComment");
  2903.                 if(fMode) {
  2904.                     cAdd(rows[i+1],"DCL_blockComment");
  2905.                     cAdd(rows[i+2],"DCL_blockComment");
  2906.                     cAdd(rows[i+3],"DCL_blockComment");
  2907.                 }
  2908.                 cAdd(cells[0],"DCL_nameMatch");
  2909.                 commentCnt += 1;
  2910.                 if(blockCnt[name]) {
  2911.                     blockCnt[name] += 1;
  2912.                 } else {
  2913.                     blockCnt[name] = 1;
  2914.                 }
  2915.             } else if(bCI && bCI.test(ip)) {
  2916.                 cAdd(rows[i],"DCL_blockComment");
  2917.                 cAdd(cells[1].getElementsByTagName("em")[0],"DCL_ipMatch");
  2918.                 commentCnt += 1;
  2919.                 if(blockCnt[ip]) {
  2920.                     blockCnt[ip] += 1;
  2921.                 } else {
  2922.                     blockCnt[ip] = 1;
  2923.                 }
  2924.             } else if(bCT && bCT.test(titleC)) {
  2925.                 cAdd(rows[i],"DCL_blockComment");
  2926.                 title.removeChild(title.firstChild);
  2927.                 cElement("span",[title,0],{innerHTML:titleC.replace(bCT,"<span class='DCL_titleMatch'>$1</span>")});
  2928.                 commentCnt += 1;
  2929.                 titleCnt += 1;
  2930.             }
  2931.         }
  2932.  
  2933.         var p = table.nextElementSibling;
  2934.         if(p && cSearch(p,"DCL_blockCommentP")) {
  2935.             p.parentNode.removeChild(p);
  2936.         }
  2937.         if(titleCnt || (commentCnt && P.showLabel)) {
  2938.             p = cElement("p",[table,"next"],{className:"DCL_blockCommentP"});
  2939.  
  2940.             for(i in blockCnt) {
  2941.                 if(blockCnt.hasOwnProperty(i) && P.showLabel) {
  2942.                     cElement("span",p,i+"("+blockCnt[i]+")");
  2943.                 }
  2944.             }
  2945.             if(titleCnt) {
  2946.                 cElement("span",p,"내용("+titleCnt+")");
  2947.             }
  2948.  
  2949.             cElement("span",p,{className:"DCL_blockTotal",textContent:"전체["+(P.showLabel?commentCnt:titleCnt)+"]"},function(){cToggle(table,"DCL_showComment");});
  2950.         }
  2951.     }
  2952.     };
  2953.  
  2954.     // 게시물 바로보기
  2955.     function Layer(t,r,mode) {
  2956.         if(!Layer.inited) {
  2957.             Layer.init();
  2958.             Layer.inited = true;
  2959.         }
  2960.  
  2961.         var tbody = $id("list_table").tBodies[t];
  2962.         this.row = tbody.rows[r];
  2963.         cAdd(this.row,"DCL_layerTr");
  2964.        
  2965.         this.div = cElement("div",cElement('td', cElement('tr', [tbody.rows[r],"next"]), {colSpan:6}),{className:"DCL_layerDiv"});
  2966.  
  2967.         this.mode = mode?mode:"normal";
  2968.         this.t = t;
  2969.         this.r = r;
  2970.         this.no = parseQuery(this.row.cells[1].children[1].href).no;
  2971.         this.viewer = new Viewer();
  2972.         this.comment_page = 1;
  2973.         this.comment_count= 0;
  2974.         if(this.row.cells[1].children[2].children[0] && (cnt = this.row.cells[1].children[2].children[0].textContent.match(/([0-9]+)(?:\/([0-9]+))?/)))
  2975.             this.comment_count=cnt[1];
  2976.  
  2977.         this.call();
  2978.     }
  2979.     Layer.init = function() {
  2980.         var width = P.pageWidth;
  2981.         var css =
  2982.             "tr.DCL_layerTr > td {border-width:2px 0 1px ; border-style:solid ; border-color:#000}" +
  2983.             "tr.DCL_layerTr > td" + (P.listNumber?":first-child":":nth-child(2)") + " {border-left-width:2px ; border-radius:5px 0 0 0}" +
  2984.             "tr.DCL_layerTr > td:nth-child("+(P.listRecom?"6":P.listCount?"5":P.listDate?"4":"3")+") {border-right-width:2px ; border-radius:0 5px 0 0}" +
  2985.             "tr.DCL_layerTr + tr > td {border-style:solid; background:none; border-width:0 2px 2px 2px !important; border-radius:0 0 5px 5px; text-align: left !important;}" +
  2986.  
  2987.             "div.DCL_layerDiv {position:relative ; width: 100%; padding: 0; border-bottom:0; word-wrap:break-word; overflow:auto; }" +
  2988.             ".con_substance > *," +
  2989.             "#dgn_gallery_left .list_table tbody.list_thead td > div table td {font-family: Gulim, sans-serif; font-size: 13px; line-height: 24px; color: #1e1e1e; font-weight: normal; border:0; text-align: left;}" +
  2990.  
  2991.             "p.DCL_layerTop {font:8pt Tahoma,돋움 ; color:#666; padding: 3px}" +
  2992.             "p.DCL_layerTop:not(:only-child) {border-bottom:1px solid #666 ; padding-bottom:2px}" +
  2993.             "p.DCL_layerBottom {border-top:1px solid #666 ; padding: 3px ; font:8pt Tahoma,돋움 ; color:#666}" +
  2994.             "a.DCL_layerBtn {margin-right:5px ; cursor:pointer; text-decoration:none; color:#666;}" +
  2995.             "a.DCL_layerBtn:hover {color:#000}" +
  2996.             "span.DCL_layerBtn {margin-right:5px ; cursor:pointer;}" +
  2997.             "span.DCL_layerBtn:hover {color:#000}" +
  2998.             "span.DCL_layerLoad {color:#999 ; text-decoration:blink}" +
  2999.             "span.DCL_layerData {margin-left:5px ; color:#333}" +
  3000.             "span.DCL_layerFile {margin-left:5px ; color:#333}" +
  3001.             "span.DCL_layerFile > a {display:none ; margin-left:5px ; color:#999 ; text-decoration:underline}" +
  3002.             "span.DCL_layerFile:hover > a {display:inline}" +
  3003.             "span.DCL_layerFile > a:hover {color:#000}" +
  3004.             "span.DCL_layerEtc { float: right; font-size: 9px; margin: 0 3px; }" +
  3005.  
  3006.             "div.DCL_layerContent {margin:5px 0}" +
  3007.             "ul.DCL_layerImage {margin-bottom:5px}" +
  3008.             "ul.DCL_layerFlash iframe {border: 0}" +
  3009.             "ul.DCL_layerFlash > li {margin-bottom:5px}" +
  3010.             "div.DCL_layerText * {max-width:"+(width-40)+"px}" + // scroll20 + td10 + layerDiv10
  3011.             "div.DCL_layerText > .con_substance { padding: 0 10px; font-size: 13px; font-family: 굴림; }" +
  3012.             "div.DCL_layerText > .con_substance table { height: auto !important; }" +
  3013.            
  3014.             "div.DCL_layerCommentTitle { border-top:1px solid #999; border-bottom:1px solid #999; padding:2px 5px; font:13px 돋움; background-color:#eee !important; text-align:left; visibility:visible; width:auto; height:auto; }" +
  3015.  
  3016.             "table.DCL_layerComment {width:100% ; border-collapse:collapse ; table-layout:fixed; text-align: left !important;}" +
  3017.             "table.DCL_layerComment tr:hover {background-color:#f0f0f0}" +
  3018.             "table.DCL_layerComment tr.DCL_layerCommentMore td { font-size: 9pt !important; }" +
  3019.             "table.DCL_layerComment tr.DCL_layerCommentMore td a { font-weight: bold; }" +
  3020.             "table.DCL_layerComment td { height: auto; vertical-align: middle !important;}" +
  3021.             "table.DCL_layerComment td:first-child { padding-left: 5px; }" +
  3022.             "table.DCL_layerComment td:last-child { padding-right: 5px; }" +
  3023.             "table.DCL_layerComment td {border-bottom:1px solid #ccc !important; text-align: left !important;}" +
  3024.             "table.DCL_layerComment td.com_name {width:120px; font:13px 굴림 !important;}" +
  3025.             "table.DCL_layerComment td.com_text {width:auto; font:13px 굴림 !important; line-height: 22px !important;}" +
  3026.             "table.DCL_layerComment td.com_chat {width:10px}" +
  3027.             "table.DCL_layerComment td.com_ip {width:110px; font:8pt Tahoma !important;}" +
  3028.             "table.DCL_layerComment td.com_btn {width:12px}" +
  3029.             "table.DCL_layerComment td.com_btn > img {cursor:pointer}" +
  3030.             "table.DCL_layerComment span.line {display:none}" +
  3031.             "table.DCL_layerComment span.num2 {margin-left:1em ; font:8pt Tahoma ; color:#999}" +
  3032.  
  3033.             "div.DCL_layerContent + p.DCL_replyP {border-top:1px solid #666 ; padding-top:5px}" +
  3034.             "p.DCL_replyP {position:relative ; margin:5px 0 ; padding:0 150px 0 115px}" +
  3035.             "p.DCL_replyP.DCL_LoggedIn {padding:0 70px 0 5px}" +
  3036.             "p.DCL_replyP > input { outline-offset: 0px; border:1px solid #999; height: 27px; }" +
  3037.             "p.DCL_replyP > input[type=text], " +
  3038.             "p.DCL_replyP > input[type=password]{ line-height: 13px; font-size: 13px; font-family: Gulim, sans-serif; padding: 5px; box-sizing: border-box; border-radius: 3px; }" +
  3039.             "p.DCL_replyP > input[type=button] { width: auto; padding: 6px 17px; display: inline-block; background-color: #5b7ce5; background-image: linear-gradient(0deg,#5b7ce5,#6987e8); border: 1px solid #2049cf; color: white; border-radius: 3px; box-sizing: border-box; }" +
  3040.             "p.DCL_replyP > input[type=button]:focus { box-shadow: 0 0 0 2px rgba(91, 124, 229,.5); }" +
  3041.             "p.DCL_replyP > input[type=text]:focus," +
  3042.             "p.DCL_replyP > input[type=password]:focus { border:1px solid #666; }" +
  3043.             "input.DCL_replyName {position:absolute; bottom: 0; left: 5px; width: 105px; }" +
  3044.             "input.DCL_replyMemo2 {position:relative; width:100%}" +
  3045.             "input.DCL_replyPassword {position:absolute ; bottom:0 ; right:70px ; width:75px}" +
  3046.             "input.DCL_replySubmit {position: absolute; bottom: 0; right: 5px; width:35px ;}" + // height:20px !important ; font:8pt 돋움; padding: 0;}" +
  3047.  
  3048.             "tr.DCL_layerActive > td, tr.DCL_layerActive+tr > td { border-bottom-color: #333 !important; }" +
  3049.             "";
  3050.  
  3051.         if(P.layerThumb) {
  3052.             var tw = P.thumbWidth;
  3053.             var th = P.thumbHeight;
  3054.             css +=
  3055.                 "div.DCL_layerContent img {max-width:" + tw + "px; max-height:" + th + "px}" +
  3056.                 "ul.DCL_layerImage > li {float:left ; width:" + tw + "px ; height:" + th + "px ; margin:5px ; background-color:#f5f5f5 ; border:1px solid #999"+(BROWSER.opera?"":" ; text-align:center")+"}" + // opera 버그
  3057.                 "ul.DCL_layerImage > li > img {background-color:#fff}" +
  3058.                 "ul.DCL_layerImage:after {content:'' ; display:block ; clear:both ; width:0 ; height:0 ; overflow:hidden}";
  3059.         } else {
  3060.             css +=
  3061.                 "ul.DCL_layerImage > li {margin-bottom:10px}" +
  3062.                 "ul.DCL_layerImage > li > img {max-width:"+(width-42)+"px ; border:1px solid #999}"; // scroll20 + td10 + layerDiv10 + border2
  3063.         }
  3064.  
  3065.         if(MODE.list) {
  3066.             css +=
  3067.                 "body.DCL_wideOn tr.DCL_layerActive > td {height:"+(BROWSER.chrome?44:50)+"px ; border-width:2px 0 ; border-style:solid ; border-radius:0 ; background-color:#f5f5f5}" +
  3068.                 "body.DCL_wideOn tr.DCL_layerActive > td:first-child {border-left-width:2px ; border-radius:5px 0 0 5px}" +
  3069.                 "body.DCL_wideOn tr.DCL_layerActive + tr > td {border-width:0 ; height:0}"+
  3070.                 "body.DCL_wideOn div.DCL_layerActive {position:absolute ; margin:-50px 0 0 "+(width-5)+"px ; width:"+(P.wideWidth-20)+"px ; min-height:50px ; "+(P.layerResize?"max-height:"+(document.documentElement.clientHeight-10)+"px ; ":"") + "padding:3px 8px ; border:2px solid #333 ; border-radius:0 5px 5px 5px}" +
  3071.                 "body.DCL_wideOn div.DCL_layerActive ul.DCL_layerImage > li > img {max-width:"+(P.wideWidth-42)+"px}" + // scroll20 + layerDiv20 + border2
  3072.                 "body.DCL_wideOn div.DCL_layerActive div.DCL_layerText * {max-width:"+(P.wideWidth-40)+"px}"; // scroll20 + layerDiv20
  3073.         }
  3074.  
  3075.         if(P.layerResize) {
  3076.             var resize = document.documentElement.clientHeight-(P.menuPos==="top"?46:0);
  3077.             css += "div.DCL_layerDiv {max-height:"+(resize-34)+"px}";
  3078.             if(MODE.list) {
  3079.                 css += "body.DCL_wideOn div.DCL_layerActive {max-height:"+(resize-10)+"px}";
  3080.             }
  3081.         }
  3082.  
  3083.         addStyle(css);
  3084.     };
  3085.  
  3086.     Layer.list = {};
  3087.     Layer.add = function(t) {
  3088.         if(!Layer.list[t]) {
  3089.             Layer.list[t] = {};
  3090.         }
  3091.         var rows = $id("list_table").tBodies[t].rows;
  3092.         var img,a,link;
  3093.         for(var i=1,l=rows.length ; i<l ; i++) {
  3094.             targetA=rows[i].cells[1].children;
  3095.             if(!targetA[1])
  3096.                 cElement('a', rows[i].cells[1], {href:targetA[0].href.replace("view", "comment_view")},Layer.toggle);
  3097.             cElement('a', [rows[i].cells[1],0], {href:targetA[0].href,className:targetA[0].className,innerHTML:"&nbsp;"});
  3098.             targetA[1].className = "";
  3099.  
  3100.             img = targetA[0];
  3101.             a = targetA[1];
  3102.             comment = targetA[2];
  3103.             if(P.layerLink) {
  3104.                 a.addEventListener("click",Layer.toggle,false);
  3105.             } else {
  3106.                 img.addEventListener("click",Layer.toggle,false);
  3107.             }
  3108.             comment.addEventListener("click",Layer.toggle,false);
  3109.             if(P.layerReply && (link=rows[i].cells[2].getElementsByTagName("a")[1])) {
  3110.                 link.addEventListener("click",Layer.toggle,false);
  3111.             }
  3112.         }
  3113.     };
  3114.     Layer.toggle = function(e) {
  3115.         ePrevent(e);
  3116.  
  3117.         var target = e.currentTarget;
  3118.         var row = target.parentNode.parentNode;
  3119.         var mode;
  3120.         if(target.href.match(/comment_view/)===null) {
  3121.             mode = "normal";
  3122.         } else {
  3123.             mode = "comment";
  3124.         }
  3125.  
  3126.         var t = row.parentNode.getAttribute("DCL_tbody");
  3127.         var r = row.sectionRowIndex;
  3128.         var layer = Layer.list[t][r];
  3129.         if(layer) {
  3130.             if(layer.mode === mode) {
  3131.                 layer.close();
  3132.             } else {
  3133.                 layer.close();
  3134.                 Layer.create(t,r,mode);
  3135.             }
  3136.         } else {
  3137.             Layer.create(t,r,mode);
  3138.         }
  3139.     };
  3140.     Layer.create = function(t,r,mode) {
  3141.         Layer.list[t][r] = new Layer(t,r,mode);
  3142.     };
  3143.     Layer.close = function(t) {
  3144.         var layers = Layer.list[t];
  3145.         for(var i in layers) {
  3146.             if(layers.hasOwnProperty(i)) {
  3147.                 layers[i].close();
  3148.             }
  3149.         }
  3150.     };
  3151.  
  3152.     Layer.prototype.call = function() {
  3153.         var layer = this;
  3154.         var div = this.div;
  3155.         var row = this.row;
  3156.         var viewer = this.viewer;
  3157.  
  3158.         viewer.clear();
  3159.  
  3160.         div.innerHTML = "";
  3161.         var btns = cElement("p",div,{className:"DCL_layerTop"});
  3162.         cElement("span",btns,{textContent:"닫기",className:"DCL_layerBtn"},function(){layer.close();});
  3163.         var loadSpan = cElement("span",btns,{className:"DCL_layerLoad",textContent:"읽는 중..."});
  3164.  
  3165.         var now = Layer.now;
  3166.         if(now && now !== this) {
  3167.             var offset = row.getBoundingClientRect().top;
  3168.             if(P.layerSingle) {
  3169.                 now.close();
  3170.             } else {
  3171.                 now.blur();
  3172.             }
  3173.             SCROLL.scrollTop += row.getBoundingClientRect().top - offset;
  3174.         }
  3175.         cAdd(row,"DCL_layerActive");
  3176.         cAdd(div,"DCL_layerActive");
  3177.         cAdd(document.body,"DCL_layerOn");
  3178.         Layer.now = this;
  3179.        
  3180.         var topMenu = document.createDocumentFragment(); { // 레이어 상단 메뉴
  3181.             var topBtn = cElement("p",topMenu,{className:"DCL_layerTop"});
  3182.             cElement("span",topBtn,{textContent:"닫기",className:"DCL_layerBtn"},function(){layer.close();});
  3183.             cElement("span",topBtn,{textContent:"새로고침",className:"DCL_layerBtn"},function(){layer.call();});
  3184.         }
  3185.  
  3186.         var bottomMenu = document.createDocumentFragment(),bottomBtn; { // 레이어 하단 메뉴
  3187.             bottomBtn = cElement("p",bottomMenu,{className:"DCL_layerBottom"});
  3188.             cElement("span",bottomBtn,{textContent:"닫기",className:"DCL_layerBtn"},function(){layer.close();});
  3189.             cElement("span",bottomBtn,{textContent:"새로고침",className:"DCL_layerBtn"},function(){layer.call();});
  3190.             cElement("a",bottomBtn,{textContent:"신고",href:"/singo/singo_write/?id=singo&singourl="+encodeURIComponent('http://'+location.host+MODE.prefix+'/board/view/?id='+_ID+"&no="+layer.no)+"&gallname="+encodeURIComponent(GALLERY),target:"_blank",className:"DCL_layerBtn"});
  3191.             cElement("a",bottomBtn,{textContent:"수정",href:MODE.prefix+"/board/modify/?id="+_ID+"&no="+layer.no+"&s_url="+encodeURIComponent('/list.php?id='+_ID),className:"DCL_layerBtn",target:"_blank"});
  3192.             cElement("a",bottomBtn,{textContent:"삭제",href:MODE.prefix+"/board/delete/?id="+_ID+"&no="+layer.no+"&s_url="+encodeURIComponent('/list.php?id='+_ID),className:"DCL_layerBtn"},function(e) {
  3193.                 e.preventDefault();
  3194.                 simpleRequest(MODE.prefix+'/board/delete/?id='+_ID+'&no='+layer.no, function(r) {
  3195.                     var rBody = r.responseText.match(/(<div id="dgn_gallery_wrap"[\s\S]*)(\<\!\-\- \/\/dgn_gallery_wrap \-\-\>|<\/body>)/)[1].toDomElement();
  3196.  
  3197.                     if(delForm = rBody.querySelector('form#delete')) {
  3198.                         if(!confirm('삭제된 게시물은 복구할 수 없습니다.\n\n게시물을 삭제하시겠습니까?'))
  3199.                             return;
  3200.                         simpleRequest('/forms/delete_submit',function(r) {
  3201.                                 if((reply = r.responseText.split('||')).length>1) {
  3202.                                     if(reply[0] == 'true')
  3203.                                         softLoad(MODE.prefix+'/board/lists/?id='+_ID);
  3204.                                     else
  3205.                                         alert(reply[1]);
  3206.                                 }
  3207.                                 else
  3208.                                     alert(r.responseText);
  3209.                             },'POST',{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},formWalk(delForm));
  3210.                     } else if(delForm = rBody.querySelector('form#password_confirm')) {
  3211.                         if(!(delForm.querySelector('input[name="password"]').value=prompt('삭제된 게시물은 복구할 수 없습니다.\n\n게시물을 삭제하려면 비밀번호를 입력해 주세요.')))
  3212.                             return;
  3213.                        
  3214.                         simpleRequest('/forms/delete_password_submit',function(r) {
  3215.                                 if((reply = r.responseText.split('||')).length>1) {
  3216.                                     if(reply[0] == 'true') {
  3217.                                         cElement('input',delForm,{type:'hidden',name:'key',value:reply[1]});
  3218.                                         simpleRequest('/forms/delete_submit',function(r) {
  3219.                                             if((reply = r.responseText.split('||')).length>1) {
  3220.                                                 if(reply[0] == 'true')
  3221.                                                     softLoad(MODE.prefix+'/board/lists/?id='+_ID);
  3222.                                                 else
  3223.                                                     alert(reply[1]);
  3224.                                             }
  3225.                                             else
  3226.                                                 alert(r.responseText);
  3227.                                         },'POST',{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},formWalk(delForm));
  3228.                                     }
  3229.                                     else
  3230.                                         alert(reply[1]);
  3231.                                 }
  3232.                                 else
  3233.                                     alert(r.responseText);
  3234.                             },'POST',{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},formWalk(delForm));
  3235.                     }
  3236.                 },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"});
  3237.             });
  3238.             cElement("span",bottomBtn,{className:"DCL_layerLoad"});
  3239.         }
  3240.         var docFrag = document.createDocumentFragment();
  3241.         var commFrag = document.createDocumentFragment();
  3242.         var readytogo = (layer.mode!=='comment'?(P.layerComment?2:1):1);
  3243.         if(layer.mode!=='comment') {
  3244.             simpleRequest(MODE.prefix+"/board/view/?id="+_ID+"&no="+this.no,
  3245.                 function(response) {
  3246.                     if(!Layer.list[layer.t][layer.r]) {
  3247.                         return;
  3248.                     }
  3249.                     readytogo--;
  3250.                     var text = response.responseText.replace(/^\s+/,"");
  3251.                     if(text.substr(0,9) === "<!DOCTYPE") {
  3252.                         text = text.substring(text.indexOf("<!-- dgn_content_de  -->"),text.lastIndexOf("<!-- //dgn_content_de -->"));
  3253.  
  3254.                         var imgHTML = text.substring(text.indexOf("<!-- con_substance -->"),text.indexOf("<!-- //con_substance -->"));
  3255.                         if(!imgHTML) { // 삭제된 게시물
  3256.                             loadSpan.textContent = "삭제된 글입니다.";
  3257.                             return;
  3258.                         }
  3259.  
  3260.                         if(layer.mode === "normal" && (P.layerText || P.layerImage)) {
  3261.                             var contentDiv = cElement("div",docFrag,{className:"DCL_layerContent"});
  3262.  
  3263.                             if(P.layerImage) {/*
  3264.                                 var imgReg = /src=[\"\']*(http:\/\/[a-z0-9]+.dcinside.com\/viewimage\.php\?[^\"\' ]+)/g;
  3265.                                 var imgExec = imgReg.exec(imgHTML);
  3266.                                 if(imgExec) {
  3267.                                     var imgUl = cElement("ul",contentDiv,{className:"DCL_layerImage"});
  3268.                                     var imgLi;
  3269.                                     var img,src;
  3270.                                     do {
  3271.                                         src = imgExec[1] || imgExec[2];
  3272.                                         imgLi = cElement("li",imgUl);
  3273.                                         img = cElement("img",imgLi,{src:src});
  3274.                                         viewer.add(src,img);
  3275.                                     } while( (imgExec=imgReg.exec(imgHTML)) );
  3276.  
  3277.                                 }*/
  3278.  
  3279.                                 var flashReg = /src=\'(http:\/\/mediafile\.dcinside\.com[^\']+)|insertFlash\(\"(http:\/\/flvs\.daum\.net[^\"]+)\", (\d+), (\d+)/g;
  3280.                                 var flashExec = flashReg.exec(imgHTML);
  3281.                                 var iframeReg = /width=\"(\d+)\"[^>]+height=\"(\d+)\"[^>]+src=\"(http:\/\/videofarm\.daum\.net[^\"]+)\"/g;
  3282.                                 var iframeExec = iframeReg.exec(imgHTML);
  3283.                                 if(flashExec || iframeExec) {
  3284.                                     var flashUl = cElement("ul",contentDiv,{className:"DCL_layerFlash"});
  3285.                                     if(flashExec) {
  3286.                                         var flashLi;
  3287.                                         do {
  3288.                                             flashLi = cElement("li",flashUl);
  3289.                                             cElement("object",flashLi,{type:"application/x-shockwave-flash",data:flashExec[1]||flashExec[2],width:flashExec[3]||400,height:flashExec[4]||300});
  3290.                                         } while( (flashExec=flashReg.exec(imgHTML)) );
  3291.                                     }
  3292.                                     if(iframeExec) {
  3293.                                         var iframeLi;
  3294.                                         do {
  3295.                                             flashLi = cElement("li",flashUl);
  3296.                                             cElement("iframe",flashLi,{src:iframeExec[3],width:iframeExec[1]||400,height:iframeExec[2]});
  3297.                                         } while( (iframeExec=iframeReg.exec(imgHTML)) );
  3298.                                     }
  3299.                                 }
  3300.                             }
  3301.  
  3302.                             if(P.layerText) {
  3303.                                 var bfloc = document.location.toString();
  3304.         //                      history.pushState(bfloc, '로드 중...', 'http://'+location.innerhost+'/board/view/?id='+_ID+'&no='+Layer.now.no);
  3305.                                 var DivHtml = text.substring(text.indexOf("<!-- con_substance -->"),text.lastIndexOf('<!-- //con_substance -->'));
  3306.                                 DivHtml= DivHtml.replace(/(<|<\/)(iframe|script)[^>]+>/g, "");
  3307.  
  3308.                                 var textDiv = cElement("div",contentDiv,{className:"DCL_layerText",innerHTML:DivHtml});
  3309.                                 var textImgs = getImgs(textDiv);
  3310.                                 var textImg;
  3311.                                 var imagePopUrl = "http://image.dcinside.com/viewimagePop.php";
  3312.                                 for(var i=0,l=textImgs.length ; i<l ; i+=1) {
  3313.                                     textImg = textImgs[i];
  3314.  
  3315.                                     if(P.albumFullsize) {
  3316.                                         var urlContainers = [textImg.getAttribute('onclick')];
  3317.  
  3318.                                         if(textImg.parentNode && textImg.parentNode.tagName=="A")
  3319.                                             urlContainers = urlContainers.concat([textImg.parentNode.getAttribute('onclick'),textImg.parentNode.getAttribute('href')]);
  3320.  
  3321.                                         origUrl = '';
  3322.                                         for(j=urlContainers.length;j--;) {
  3323.                                             if(urlContainers[j]!==null && (url = urlContainers[j].match(/http:\/\/image\.dcinside\.com[^,\'\"\s]+/))) {
  3324.                                                 origUrl = url[0];
  3325.                                             }
  3326.                                         }
  3327.                            
  3328.                                         if (origUrl == '') {
  3329.                                             origUrl = textImg.src.replace(/http:\/\/dcimg[0-9]\.dcinside\.com\/viewimage\.php(.+)$/g, "http://image.dcinside.com/viewimage.php$1");
  3330.                                         }
  3331.                                     } else {
  3332.                                         origUrl = textImg.src;
  3333.                                     }
  3334.  
  3335.                                     if(textImg.parentNode) {
  3336.                                         if(textImg.parentNode.tagName=="A") {
  3337.                                             nImg = cElement("img", [textImg.parentNode,"next"], {src:textImg.src});
  3338.                                             textImg.parentNode.parentNode.removeChild(textImg.parentNode);
  3339.                                             textImg = nImg;
  3340.                                         }
  3341.                                         else {
  3342.                                             nImg = cElement("img", [textImg,"next"], {src:textImg.src});
  3343.                                             textImg.parentNode.removeChild(textImg);
  3344.                                             textImg = nImg;
  3345.                                         }
  3346.                                     }
  3347.  
  3348.                                     eRemove(textImg,"width");
  3349.                                     eRemove(textImg,"height");
  3350.                                     eRemove(textImg,"href");
  3351.                                     eRemove(textImg,"onclick");
  3352.                                     eRemove(textImg,"onclick");
  3353.  
  3354.                                     viewer.add(origUrl.replace("viewimagePop.php", "viewimage.php"),textImg);
  3355.                                 }
  3356.                                 autoLink(textDiv);
  3357.                                
  3358.                                 if (P.layerTextLinkAlwaysNewTab) {
  3359.                                     var linkList = textDiv.getElementsByTagName("a");
  3360.                                     for (var i=0;i<linkList.length;i+=1) {
  3361.                                         linkList[i].setAttribute("target", "_blank");
  3362.                                     }
  3363.                                 }
  3364.         //                      history.pushState(bfloc, bfloc, bfloc);
  3365.                             }
  3366.  
  3367.                             if(P.hide) {
  3368.                                 Hide.apply(contentDiv);
  3369.                             }
  3370.                         }
  3371.                 //      var ipReg = /(?:IP Address : (\d+\.\d+\.\*\*\*\.\*\*\*))?<br \/>(\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}) <br \/>/g;
  3372.                         var ipReg = /<li class="li_ip">[\s\n]*(\d+\.\d+)(\.\*\.\*)[\s\n]*<\/li>/g;
  3373.                         var dateReg = /<li><b>(\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2})<\/b><\/li>/g;
  3374.                         var recommUpReg = /<span id="recommend_view_up">(\d+)<\/span>/g;
  3375.                         var recommDownReg = /<span id="recommend_view_down"><span class="t_black">(\d+)<\/span><\/span>/g;
  3376.                         var ipExec,ip,time;
  3377.                         while( (ipExec=ipReg.exec(text)) ) {
  3378.                             ip = ipExec[1]+'.***.***';//+ipExec[2];
  3379.                         }
  3380.                         while( (dateExec=dateReg.exec(text)) ) {
  3381.                             time = dateExec[1];
  3382.                         }
  3383.                         while( (recommUpExec=recommUpReg.exec(text)) ) {
  3384.                             recomm_up = recommUpExec[1];
  3385.                         }
  3386.                         while( (recommDownExec=recommDownReg.exec(text)) ) {
  3387.                             recomm_down = recommDownExec[1];
  3388.                         }
  3389.                        
  3390.                         cElement('span',topBtn,{textContent:'[ 시간 '+time+(ip?' / IP '+ip:'')+(typeof recomm_up!='undefined'?' / 추천 '+recomm_up:'')+(typeof recomm_down!='undefined'?' / 비추 '+recomm_down:'')+' ]',className:'DCL_layerData'});
  3391.  
  3392.                         var fileReg = /\t<ul class="appending_file"[^>]+>(.+)<\/ul>/m;
  3393.                         var file = fileReg.exec(response.responseText.replace(/\n/g,''));
  3394.                         if(file) {
  3395.                             file = file[1].split("</li><li");
  3396.                             fileReg = /<a.*href=\"(.+)\".*>(.+)?<\/a>/;
  3397.                             var fileExec;
  3398.                             var fileHTML = "";
  3399.                             var attachviewer = new Viewer();
  3400.                             l=file.length;
  3401.                             attach = cElement("span",topBtn,{className:"DCL_layerFile",textContent:"첨부파일("+l+")"});
  3402.                             for(var i=0; i<l ; i+=1) {
  3403.                                 fileExec = fileReg.exec(file[i]);
  3404.                                 attachviewer.add(fileExec[1], cElement("a",attach,{href:fileExec[1],textContent:fileExec[2]||" "}));
  3405.         //                      fileHTML += "<a href='"+fileExec[1]+"'>"+fileExec[2]+"</a>";
  3406.                             }
  3407.                         }
  3408.  
  3409. //                      cElement("span",topBtn,{className:"DCL_layerEtc",textContent:"●●●"});
  3410.                         var commentCount = text.match(/comment_page\('([0-9]+)'\);/);
  3411.                         if(commentCount && commentCount[1])
  3412.                             layer.comment_count = commentCount[1];
  3413.                         else
  3414.                             layer.comment_count = 0;
  3415.  
  3416.                         if(readytogo>0) return;
  3417.                         div.innerHTML = "";
  3418.                         div.appendChild(topMenu);
  3419.                         div.appendChild(docFrag);
  3420.                         div.appendChild(commFrag);
  3421.                         div.appendChild(bottomMenu);
  3422.  
  3423.                         $('div.DCL_layerCommentTitle').textContent = "댓글 " + layer.comment_count + "개";
  3424.                         if(layer.row.cells[1].children[2].children[0])
  3425.                             layer.row.cells[1].children[2].children[0].textContent = "["+layer.comment_count+"]";
  3426.  
  3427.                         if(Layer.now === layer)layer.focus();
  3428.                     } else { // 로드 에러
  3429.                         cElement("span",[btns,1],{textContent:"새로고침",className:"DCL_layerBtn"},function(){layer.call();});
  3430.                         loadSpan.textContent = "읽기 실패";
  3431.                     }
  3432.                 },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"}
  3433.             );
  3434.         }
  3435.        
  3436.         if(P.layerComment || layer.mode === "comment") {
  3437.             cElement("span",topBtn,{textContent:"댓글",className:"DCL_layerBtn"},function(){rMemo.focus();});
  3438.  
  3439.             var bfloc = document.location.toString();
  3440.             simpleRequest('/comment/view',
  3441.                 function(response) {
  3442.                     readytogo--;
  3443.  
  3444.                     cElement('div',commFrag,{className:'DCL_layerCommentTitle',textContent:'댓글 0개'});
  3445.  
  3446.                     commFrag.appendChild(commentCallback(response));
  3447.  
  3448.                     var replyP = cElement("p",commFrag/*[commentTable,"next"]*/,{className:"DCL_replyP"+(_GID?' DCL_LoggedIn':'')});
  3449.                     var rMemo = cElement("input",replyP,{type:"text",className:"DCL_replyMemo2"});
  3450.                     rMemo.addEventListener("keypress",function(e){if(e.keyCode===13){layer.reply();}},false);
  3451.                     layer.rMemo = rMemo;
  3452.                     if(!_GID) {
  3453.                         var rName = cElement("input",[replyP,0],{type:"text",className:"DCL_replyName"}); // name
  3454.                         var rPassword = cElement("input",replyP,{type:"password",className:"DCL_replyPassword"}); // password
  3455.                         rPassword.addEventListener("keypress",function(e){if(e.keyCode===13){layer.reply();}},false);
  3456.                         if(P.autoForm) {
  3457.                             rName.value = P.autoName;
  3458.                             rPassword.value = P.autoPassword;
  3459.                         }
  3460.                     }
  3461.                     cElement("input",replyP,{type:"button",className:"DCL_replySubmit",value:"작성"},function(){layer.reply();});
  3462.  
  3463.                     if(Layer.now === layer) {
  3464.                         layer.focus();
  3465.                     }
  3466.                     if(readytogo>0) return;
  3467.                     div.innerHTML = "";
  3468.                     div.appendChild(topMenu);
  3469.                     div.appendChild(docFrag);
  3470.                     div.appendChild(commFrag);
  3471.                     div.appendChild(bottomMenu);
  3472.  
  3473.                     $('div.DCL_layerCommentTitle').textContent = "댓글 " + layer.comment_count + "개";
  3474.                     if(layer.row.cells[1].children[2].children[0])
  3475.                         layer.row.cells[1].children[2].children[0].textContent = "["+layer.comment_count+"]";
  3476.  
  3477.                     if(Layer.now === layer)layer.focus();
  3478.                 },
  3479.                 "POST",
  3480.                 {"Accept":"text/html,application/xhtml+xml,application/xml,*/*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},'id='+_ID+'&no='+Layer.now.no+'&comment_page=1&ci_t='+csrf_token());
  3481.  
  3482.             function commentCallback(response) {
  3483.                 var commFrag = document.createDocumentFragment();
  3484.                 commentText=response.responseText.replace(/<\/td><tr>/g, '</td></tr>');
  3485.                 var ci = commentText.lastIndexOf("<table class=\"gallery_re_contents\">");
  3486.                 var si = commentText.indexOf("<tr class=\"reply_line\">",ci);
  3487.                 var ei = commentText.indexOf("</table>",ci);
  3488.  
  3489.                 if(si > -1 && ei > -1 && si < ei) {
  3490.                     var commentTable = cElement("table",commFrag,{className:"DCL_layerComment"});
  3491.                     var colgroup = cElement('colgroup',commentTable);
  3492.                     var proc = document.createDocumentFragment();
  3493.                     var procTable = cElement("table",proc,{innerHTML:commentText.substring(si,ei)});
  3494.                     var rows = procTable.rows;
  3495.                     var lc = 4;
  3496.                     var btn,onclick;
  3497.                     var name,cc=0;
  3498.                     var reg1 = /del_comment_orgin\(\'([^\']+)\',\'[^\']+\',\'[^\']+\',\'\',\'([^\']+)\'\);/;
  3499.                     var reg2 = /del_comment\(\'([^\']+)\',\'[^\']+\',\'[^\']+\',\'\'\);/;
  3500.                     var reg3 = /nomember_comment\((\d+)\);/;
  3501.                     var pwreg = "\"></input>[^<]*<a href=\"javascript:;\" onClick=\"javascript:re_delete\\((\\d+),\\d+,'[^']+',\\d+,'([^']+)'\\);";
  3502.                     var delExec;
  3503.  
  3504.                     cElement('col',colgroup,{style:'width: 120px;'});
  3505.                     cElement('col',colgroup,{style:'width: auto;'});
  3506.                     cElement('col',colgroup,{style:'width: 110px;'});
  3507.                     cElement('col',colgroup,{style:'width: 20px;'});
  3508.  
  3509.                     for(var i=0,l=rows.length ; i<l ; i+=4) {
  3510.                         ip=null;
  3511.                         var ipReg = /(\d+\.\d+)(\.\*\.\*)/g;
  3512.                         if(rows[i].cells[1].getElementsByClassName('etc_ip')[0]){
  3513.                             while( (ipExec=ipReg.exec(rows[i].cells[1].getElementsByClassName('etc_ip')[0].textContent)) ) {
  3514.                                 ip = ipExec[1]+'.***.***';//+ipExec[2];
  3515.                             }
  3516.                             rows[i].cells[1].getElementsByClassName('etc_ip')[0].textContent='';
  3517.                         }                                  
  3518.                         if( (delbox=rows[i].cells[3].children[0]) && (onclick=delbox.getAttribute("href")) ) {
  3519.                             delbox = delbox.children[0];
  3520.                             if( delExec=reg3.exec(onclick) ) {
  3521.                                 delbox.setAttribute("DCL_del_no",delExec[1]);
  3522.                                 delbox.setAttribute("DCL_del_orgin",delExec[2]?delExec[2]:null);
  3523.                                 delExec=(new RegExp("re_password_" + delExec[1]+pwreg)).exec(response.responseText);
  3524.                                 delbox.setAttribute("DCL_del_password",1);
  3525.                             }
  3526.                             else if( !(delExec=reg1.exec(onclick)) && !(delExec=reg2.exec(onclick)) ) {
  3527.                                 console.log('삭제 버튼 없음');
  3528.                             }
  3529.                             delbox.addEventListener("click",function(e){ layer.delComment(e);});
  3530.                         }
  3531.                         else { delbox=null; }
  3532.  
  3533.                         name    = rows[i].cells[0].innerHTML;
  3534.                         value   = rows[i].cells[1].innerHTML;
  3535.                         date    = rows[i].cells[2].textContent;
  3536.                         ktr = cElement('tr', commentTable);
  3537.                         tnm = cElement('td', ktr, {innerHTML:name,className:'com_name','user_name':rows[i].cells[0].getAttribute('user_name'),'user_id':rows[i].cells[0].getAttribute('user_id')});
  3538.                         comtxt = cElement('td', ktr, {innerHTML:value,className:'com_text'});
  3539.                         cElement('em', comtxt, {textContent:ip});
  3540.                         cElement('td', ktr, {innerHTML:date,className:'com_ip'});
  3541.                         btn = cElement('td', ktr, {className:'com_btn'});
  3542.                         if(delbox)btn.appendChild(delbox);
  3543.  
  3544.                         if (ip && P.commentColor) {
  3545.                             var color = ipColorize(ip);
  3546.                             if (P.commentColorType=="bg")
  3547.                                 ktr.style.backgroundColor = color;
  3548.                             else if(P.commentColorType=="fg")
  3549.                                 tnm.style.color = color;
  3550.                             else if(P.commentColorType=="gc")
  3551.                                 cElement('span', tnm, "■").style.color = color;
  3552.                         }
  3553.                        
  3554.                         if(P.hide) {
  3555.                             Hide.apply(comtxt);
  3556.                         }
  3557.                     }
  3558.                     l/=3;
  3559.  
  3560.                     if(P.filter) {
  3561.                         Filter.comment(commentTable);
  3562.                     }
  3563.                     if(l < layer.comment_count) {
  3564.                         var loadPrevTd = cElement('td',cElement('tr',[commentTable,0],{className:'DCL_layerCommentMore'}),{colspan:4});
  3565.                         cElement('a',loadPrevTd,{href:'',textContent:'이전 댓글 불러오기...'},function(e) {
  3566.                             e.preventDefault();
  3567.                             layer.comment_page++;
  3568.                             var _this = this.parentNode;
  3569.                             _this.textContent = '로드 중...';
  3570.                             simpleRequest('/comment/view',
  3571.                                 function(response) {
  3572.                                     removeElement(_this);
  3573.                                     layer.div.insertBefore(commentCallback(response),$('.DCL_layerComment'));
  3574.                                 },
  3575.                                 "POST",
  3576.                                 {"Accept":"text/html,application/xhtml+xml,application/xml,*/*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},'id='+_ID+'&no='+layer.no+'&comment_page='+layer.comment_page+'&ci_t='+csrf_token());
  3577.                         });
  3578.                     }
  3579.                 }
  3580.                 return commFrag;
  3581.             }
  3582.         }
  3583.     };
  3584.     Layer.prototype.focus = function() {
  3585.         var top = this.row.getBoundingClientRect().top - (P.menuPos==="top"?22:0);
  3586.         var bottom = this.div.getBoundingClientRect().bottom;
  3587.         var height = document.documentElement.clientHeight;
  3588.         if(top<0 || bottom-top>height) { // layer 의 top 이 현재 화면 영역 위로 올라간 경우
  3589.             SCROLL.scrollTop += top;
  3590.         } else if(bottom > height) { // layer 의 bottom 이 현재 화면 영역 아래로 내려간 경우
  3591.             SCROLL.scrollTop += bottom - height;
  3592.         }
  3593.     };
  3594.     Layer.prototype.blur = function() {
  3595.         if(Layer.now !== this) {
  3596.             return;
  3597.         }
  3598.         cRemove(this.row,"DCL_layerActive");
  3599.         cRemove(this.div,"DCL_layerActive");
  3600.         Layer.now = null;
  3601.         cRemove(document.body,"DCL_layerOn");
  3602.     };
  3603.     Layer.prototype.close = function() {
  3604.         this.blur();
  3605.         cRemove(this.row,"DCL_layerTr");
  3606.         this.div.parentNode.parentNode.removeChild(this.div.parentNode);
  3607.         delete Layer.list[this.t][this.r];
  3608.     };
  3609.     Layer.prototype.reply = function(){
  3610.         var memo = this.rMemo;
  3611.         if(!memo.value) {
  3612.             alert("댓글 내용을 입력하세요.");
  3613.             memo.focus();
  3614.             return;
  3615.         }
  3616.         var data = "id="+_ID+"&no="+this.no+"&memo="+encodeURIComponent(memo.value)+'&ci_t='+csrf_token();
  3617.         if(!_GID) {
  3618.             var rName = memo.previousSibling;
  3619.             var rPassword = memo.nextSibling;
  3620.             if(!rName.value) {
  3621.                 alert("이름을 입력하세요.");
  3622.                 rName.focus();
  3623.                 return;
  3624.             }
  3625.             if(!rPassword.value) {
  3626.                 alert("비밀번호를 입력하세요.");
  3627.                 rPassword.focus();
  3628.                 return;
  3629.             }
  3630.             data += "&name="+encodeURIComponent(rName.value)+"&password="+encodeURIComponent(rPassword.value);
  3631.         }
  3632.  
  3633.         this.div.lastChild.lastChild.textContent = "댓글 등록 중...";
  3634.         var layer = this;
  3635.  
  3636.         var bfloc = document.location.toString();
  3637.         history.pushState(bfloc, '로드 중...', 'http://'+location.innerhost+MODE.prefix+'/board/view/?id='+_ID+'&no='+Layer.now.no);     //리퍼러로 갑질할때 대비용
  3638.         simpleRequest("/forms/comment_submit",
  3639.             function(response) {
  3640.                 layer.div.lastChild.lastChild.textContent = "";
  3641.                 if(response.status != 200) {
  3642.                     alert("댓글 등록 중 오류가 발생했습니다.\n\n" + response.statusText);
  3643.                     return;
  3644.                 }
  3645.  
  3646.                 var res = /^([^|]+)\|\|(.+)$/.exec(response.responseText);
  3647.                 if(!res) {
  3648.                     layer.call();
  3649.                     return;
  3650.                 }
  3651.                 if(res[1] === "false") {
  3652.                     alert("댓글 등록 중 오류가 발생했습니다.\n\n" + res[2]);
  3653.                     return;
  3654.                 }
  3655.                 layer.call();
  3656.             },
  3657.             "POST",
  3658.             {"Accept":"text/html,application/xhtml+xml,application/xml,*/*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest","Referer":'http://'+location.innerhost+MODE.prefix+'/board/view/?id='+_ID+'&no='+Layer.now.no},
  3659.             data
  3660.         );
  3661.         history.pushState(bfloc, bfloc, bfloc);
  3662.     };
  3663.     Layer.prototype.delComment = function(e) {
  3664.         var btn = e.target;
  3665.         var password = null;
  3666.         if(btn.getAttribute("DCL_del_password")) {
  3667.             password = prompt("비밀번호를 입력하세요.","");
  3668.             if(!password) {
  3669.                 return;
  3670.             }
  3671.         }
  3672.         if(!confirm("댓글을 삭제하겠습니까?")) {
  3673.             return;
  3674.         }
  3675.  
  3676.         this.div.lastChild.lastChild.textContent = "댓글 삭제 중...";
  3677.         var layer = this;
  3678.         var data = "ci_t=" + csrf_token() + "&id=" + _ID + "&no=" + Layer.now.no + "&p_no=" + Layer.now.no + "&re_no=" + btn.getAttribute("DCL_del_no") + "&orgin_no=" + btn.getAttribute("DCL_del_orgin") + "&password=" + password;
  3679.  
  3680.         simpleRequest(
  3681.             "/forms/comment_delete_submit",
  3682.             function(response) {
  3683.                 layer.div.lastChild.lastChild.textContent = "";
  3684.                 if(response.status != 200) {
  3685.                     alert("댓글 삭제 중 오류가 발생했습니다.\n\n" + response.statusText);
  3686.                     return;
  3687.                 }
  3688.  
  3689.                 var res = /^([^|]+)\|\|(.+)$/.exec(response.responseText);
  3690.                 if(!res) {
  3691.                     layer.call();
  3692.                     return;
  3693.                 }
  3694.                 if(res[1] === "false") {
  3695.                     alert("댓글 삭제 중 오류가 발생했습니다.\n\n" + res[2]);
  3696.                     return;
  3697.                 }
  3698.                 layer.call();
  3699.             },
  3700.             "POST",
  3701.             {"Accept":"text/html,application/xhtml+xml,application/xml,*/*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},
  3702.             data
  3703.         );
  3704.     };
  3705.  
  3706.     // 이미지 뷰어
  3707.     function Viewer() {
  3708.         this.list = [];
  3709.     }
  3710.     Viewer.init = function() {
  3711.         var box,img,btn,indexSpan,ratioSpan;
  3712.         var index,height,width,x,y,ratio,moved,downed,wheeled;
  3713.         var open,load,error,close,down,up,contextmenu,move,remove,key,wheel,fit,zoom,position;
  3714.  
  3715.         open = function(i) {
  3716.             var list = Viewer.list;
  3717.             if(i < 0) {
  3718.                 i = 0;
  3719.             } else if(i > list.length-1) {
  3720.                 i = list.length - 1;
  3721.             }
  3722.             if(i === index) {
  3723.                 return;
  3724.             }
  3725.             Viewer.on = true;
  3726.             index = i;
  3727.             indexSpan.textContent = "[" + (index+1) + "/" + (list.length) + "]";
  3728.             height=width=x=y=ratio=deg=0;
  3729.             box.style.display = "block";
  3730.             imgbox.style.visibility = "hidden";
  3731.             img.style.transform="rotate(0deg)";
  3732.             eRemove(img,"width");
  3733.             eRemove(img,"height");
  3734.             img.src = list[i];
  3735.             box.style.cursor = "progress";
  3736.         };
  3737.         load = function() {
  3738.             height = img.height;
  3739.             width = img.width;
  3740.             indexSpan.textContent = "[" + (index+1) + "/" + (Viewer.list.length) + "]"
  3741.             sizeSpan.textContent = width + "x" + height;
  3742.             addrSpan.href = img.src;
  3743.             addrSpan.textContent = img.src.toString().substr(7,20)+"...";
  3744.             fit();
  3745.             imgbox.style.visibility = "visible";
  3746.             box.style.cursor = "crosshair";
  3747.         };
  3748.         error = function() {
  3749.             indexSpan.textContent = "[" + (index+1) + "/" + (Viewer.list.length) + "]";
  3750.             box.style.cursor = "not-allowed";
  3751.         };
  3752.         close = function() {
  3753.             box.style.display = "none";
  3754.             img.src = "";
  3755.             index = null;
  3756.             moved = false;
  3757.             downed = false;
  3758.             wheeled = false;
  3759.             Viewer.on = false;
  3760.             cRemove(document.body,"DCL_hideMovAll");
  3761.             remove();
  3762.         };
  3763.         down = function(e) {
  3764.             if(e.button !== 0) {
  3765.                 return;
  3766.             }
  3767.             moved = false;
  3768.             downed = true;
  3769.             wheeled = false;
  3770.             if(e.target.parentNode.id === "DCL_viewerImg") {
  3771.                 x = e.clientX;
  3772.                 y = e.clientY;
  3773.                 document.addEventListener("mousemove",move,false);
  3774.                 document.addEventListener("mouseout",remove,false);
  3775.             }
  3776.             ePrevent(e);
  3777.         };
  3778.         up = function(e) {
  3779.             if(e.button === 2 && e.target.parentNode.id !== "DCL_viewerImg" && e.target.tagName !== "A") {
  3780.                 zoom(1);
  3781.             }
  3782.             if(e.button === 0 && !moved && !wheeled) {
  3783.     //          close();
  3784.             }
  3785.             moved = false;
  3786.             downed = false;
  3787.             wheeled = false;
  3788.             remove();
  3789.         };
  3790.         contextmenu = function(e) {
  3791.             if(e.target.tagName !== "A" && e.target.parentNode.id !== "DCL_viewerImg") {
  3792.                 ePrevent(e);
  3793.             }
  3794.         };
  3795.         move = function(e) {
  3796.             position(imgbox.getBoundingClientRect().left+e.clientX-x,imgbox.getBoundingClientRect().top+e.clientY-y);
  3797.             x = e.clientX;
  3798.             y = e.clientY;
  3799.             moved = true;
  3800.         };
  3801.         remove = function() {
  3802.             document.removeEventListener("mousemove",move,false);
  3803.             document.removeEventListener("mouseout",remove,false);
  3804.         };
  3805.         key = function(e) {
  3806.             if(!Viewer.on) {
  3807.                 return;
  3808.             }
  3809.             var code = e.keyCode;
  3810.             var rect = imgbox.getBoundingClientRect();
  3811.             var width = document.documentElement.clientWidth;
  3812.             var height = document.documentElement.clientHeight;
  3813.             if(code === 8 || code === 33 || code === 37 || code === 38) { // 다음 이미지
  3814.                 open(index-1);
  3815.             } else if(code === 34 ||code === 39 || code === 40) { // 이전 이미지
  3816.                 open(index+1);
  3817.             } else if(code === 36) { // home
  3818.                 open(0);
  3819.             } else if(code === 35) { // end
  3820.                 open(Viewer.list.length - 1);
  3821.             } else if(code === 13) { // enter
  3822.                 //nothing to do
  3823.                 return;
  3824.             } else if(code === 107 || code === 187) { // +
  3825.                 zoom("+");
  3826.             } else if(code === 109 || code === 189) { // -
  3827.                 zoom("-");
  3828.             } else if(code === 27) { // esc
  3829.                 close();
  3830.             } else {
  3831.                 return;
  3832.             }
  3833.             ePrevent(e);
  3834.         };
  3835.         wheel = function(e) {
  3836.             wheeled = true;
  3837.             var up = e.detail<0 || e.wheelDelta>0; // FF&Opera<0,Chrome>0
  3838.  
  3839.             if(e.altKey || downed) {
  3840.                 var r = ratio;
  3841.                 if(up) {
  3842.                     r = (Math.floor(ratio*10)+1)/10;
  3843.                 } else {
  3844.                     r = (Math.ceil(ratio*10)-1)/10;
  3845.                 }
  3846.                 zoom(r);
  3847.                 remove();
  3848.             } else {
  3849.                 if(up) {
  3850.                     open(index-1);
  3851.                 } else {
  3852.                     open(index+1);
  3853.                 }
  3854.             }
  3855.             ePrevent(e);
  3856.         };
  3857.         fit = function() {
  3858.             var ch = document.documentElement.clientHeight;
  3859.             var cw = document.documentElement.clientWidth;
  3860.             zoom(Math.min(1,ch/height,cw/width));
  3861.             position((cw-width*ratio)/2,(ch-height*ratio)/2);
  3862.         };
  3863.         zoom = function(r) {
  3864.             if(r === "+") {
  3865.                 r = (Math.floor(ratio*10)+1)/10;
  3866.             } else if(r === "-") {
  3867.                 r = (Math.ceil(ratio*10)-1)/10;
  3868.             }
  3869.             if(r < 0.1) {
  3870.                 r = 0.1;
  3871.             } else if(r > 3) {
  3872.                 r = 3;
  3873.             }
  3874.             if(r === ratio) {
  3875.                 return;
  3876.             }
  3877.             ratio = r;
  3878.  
  3879.             var rect = imgbox.getBoundingClientRect();
  3880.             var x_ = rect.left + rect.width/2 - width*ratio/2;
  3881.             var y_ = rect.top + rect.height/2 - height*ratio/2;
  3882.             img.height = Math.round(height*ratio);
  3883.             img.width = Math.round(width*ratio);
  3884.             ratioSpan.textContent = "확대/축소: " + Math.round(ratio*100) + "%";
  3885.             position(x_,y_);
  3886.         };
  3887.         rotate = function(r) {
  3888.             if(r === "r") {
  3889.                 deg = (deg+90+360)%360;
  3890.             } else if(r === "l") {
  3891.                 deg = (deg-90+360)%360;
  3892.             }
  3893.             img.style.transform="rotate(" + deg + "deg)";/*
  3894.             var irect = img.getBoundingClientRect();
  3895.  
  3896.             var rect = imgbox.getBoundingClientRect();
  3897.             var x_ = rect.left + rect.width/2 - irect.width/2;
  3898.             var y_ = rect.top + rect.height/2 - irect.height/2;
  3899.             imgbox.style.height = irect.height + "px";
  3900.             imgbox.style.width = irect.width + "px";
  3901.             position(x_,y_);*/
  3902.         };
  3903.         position = function(x_,y_) {
  3904.             var rect = imgbox.getBoundingClientRect();
  3905.             var mw = document.documentElement.clientWidth - rect.width;
  3906.             var mh = document.documentElement.clientHeight - rect.height;
  3907.             if(x_ !== false) {
  3908.                 if(0 > mw) {
  3909.                     if(x_ < mw) {
  3910.                         x_ = mw;
  3911.                     } else if(x_ > 0) {
  3912.                         x_ = 0;
  3913.                     }
  3914.                 } else {
  3915.                     if(x_ > mw) {
  3916.                         x_ = mw;
  3917.                     } else if(x_ < 0) {
  3918.                         x_ = 0;
  3919.                     }
  3920.                 }
  3921.                 imgbox.style.left = Math.round(x_) + "px";
  3922.             }
  3923.  
  3924.             if(y_ !== false) {
  3925.                 if(0 > mh) {
  3926.                     if(y_ < mh) {
  3927.                         y_ = mh;
  3928.                     } else if(y_ > 0) {
  3929.                         y_ = 0;
  3930.                     }
  3931.                 } else {
  3932.                     if(y_ > mh) {
  3933.                         y_ = mh;
  3934.                     } else if(y_ < 0) {
  3935.                         y_ = 0;
  3936.                     }
  3937.                 }
  3938.                 imgbox.style.top = Math.round(y_) + "px";
  3939.             }
  3940.         };
  3941.  
  3942.         addStyle(
  3943.             "div#DCL_viewerDiv {position:fixed; overflow:hidden ; top:0 ; left:0 ; width:100% ; height:100% ; z-index:121; display:none}" +
  3944.             "div#DCL_viewerBack {position:fixed; top:0 ; left:0 ; width:100% ; height:100% ; background-color:#000 ; opacity:0.8}" +
  3945.             "div#DCL_viewerImg {position:absolute; display: inline-block; }" +
  3946.             "div#DCL_viewerImg > img { cursor:all-scroll; }" +
  3947.             "div#DCL_viewerBtn {position:absolute; bottom: 0px; left: 0px; right: 0px; }" +
  3948.             "div#DCL_viewerBtn > div { opacity: .9; transition: opacity .15s ease-in-out; margin: 0 auto 20px auto; text-align: center; background-color: #292929; width: 408px; height: 72px; border-radius: 36px; cursor: default; overflow: hidden; box-shadow: 0 0 50px black; background-image: linear-gradient(0deg, #222, #333); }" +
  3949.             "div#DCL_viewerBtn > div > span:first-of-type { margin-left: 16px; }" +
  3950.             "div#DCL_viewerBtn > div > span:last-of-type { margin-right: 16px; }" +
  3951.             "div#DCL_viewerBtn > div > span { float: left; margin: 16px 8px; width: 40px; height: 40px; background-color: white; border-radius: 20px; background-repeat: no-repeat; background-position: center; color: transparent; background-size: 25px; opacity: 0.5; }" +
  3952.             "div#DCL_viewerBtn > div > span:hover { opacity: 1; }" +
  3953.             "div#DCL_viewerExif { opacity: .9; transition: opacity .15s ease-in-out; position: absolute; top: 20px; left: 20px; cursor: default; }" +
  3954.             "div#DCL_viewerExif > span { font-family: " + P.fontList + "; font-size: 12pt; color: white; text-shadow:0px 0px 10px #000; display: block; }" +
  3955.             "div#DCL_viewerExif > span > a { font-family: " + P.fontList + "; font-size: 12pt; color: white; cursor: pointer; }" +
  3956.             "div#DCL_viewerBtnBack, div#DCL_viewerBtnForward {position: absolute; top: 50%; height: 100px; line-height: 100px; font-size: 70px; font-family: Tahoma; z-index: 9999989999; background-color: white; color: black; opacity: 0.5; padding: 5px 10px 15px 10px; margin-top: -50px; cursor: pointer}" +
  3957.             "div#DCL_viewerBtnBack {left: 0;  border-radius: 0 10px 10px 0;}" +
  3958.             "div#DCL_viewerBtnForward {right: 0; border-radius: 10px 0 0 10px;}" +
  3959.             "body.DCL_hideMovAll object, body.DCL_hideMovAll embed {visibility:hidden}" // 이미지 뷰어 사용시 object 가 가리는 것 방지 (일일이 wmode 를 부여할 수는 없음)
  3960.         );
  3961.  
  3962.         document.addEventListener("keydown",key,false);
  3963.  
  3964.         box = cElement("div",document.body,{id:"DCL_viewerDiv"});
  3965.         box.addEventListener("mousedown",down,false);
  3966.         box.addEventListener("mouseup",up,false);
  3967.         box.addEventListener("DOMMouseScroll",wheel,false);
  3968.         box.addEventListener("mousewheel",wheel,false);
  3969.         box.addEventListener("contextmenu",contextmenu,false);
  3970.         box.addEventListener("click",ePrevent,false);
  3971.  
  3972.         cElement("div",box,{id:"DCL_viewerBack"},close);
  3973.  
  3974.         imgbox = cElement("div",box,{id:"DCL_viewerImg"});
  3975.         img = cElement("img",imgbox);
  3976.         img.addEventListener("load",load,false);
  3977.         img.addEventListener("error",error,false);
  3978.         img.addEventListener("dragstart",ePrevent,false);
  3979.  
  3980.         btnct = cElement("div",box,{id:"DCL_viewerBtn"});
  3981.         btnct.addEventListener("mousedown",ePrevent,false); // drag 방지
  3982.         btnct.addEventListener("mouseup",ePrevent,false); // 닫기 방지
  3983.         btn = cElement("div",btnct);
  3984.         btn.addEventListener("mouseover",function() { exif.style.opacity = btn.style.opacity = 0.9; },false);
  3985.         btn.addEventListener("mouseout",function() { exif.style.opacity = btn.style.opacity = 0; },false);
  3986.  
  3987.         cElement("span",btn,{textContent:"이전",style:"background-image: url('data:image/gif;base64," + BASE64.viewerPrev + "');"},function(){open(index-1);});
  3988.         cElement("span",btn,{textContent:"다음",style:"background-image: url('data:image/gif;base64," + BASE64.viewerNext + "');"},function(){open(index+1);});
  3989.         cElement("span",btn,{textContent:"확대",style:"background-image: url('data:image/gif;base64," + BASE64.viewerZoomin + "');"},function(){zoom("+");});
  3990.         cElement("span",btn,{textContent:"축소",style:"background-image: url('data:image/gif;base64," + BASE64.viewerZoomout + "');"},function(){zoom("-");});
  3991.         cElement("span",btn,{textContent:"왼쪽으로 회전",style:"background-image: url('data:image/gif;base64," + BASE64.viewerRotateL + "');"},function(){rotate("l");});
  3992.         cElement("span",btn,{textContent:"오른쪽으로 회전",style:"background-image: url('data:image/gif;base64," + BASE64.viewerRotateR + "');"},function(){rotate("r");});
  3993.     //  cElement("span",btn,"원본",function(){zoom(1);});
  3994.     //  cElement("span",btn,"창맞춤",fit);
  3995.         cElement("span",btn,{textContent:"닫기",style:"background-image: url('data:image/gif;base64," + BASE64.viewerClose + "');"},close);
  3996.  
  3997.         exif = cElement("div", box, {id:"DCL_viewerExif"});
  3998.         exif.addEventListener("mouseover",function() { exif.style.opacity = btn.style.opacity = 0.9; },false);
  3999.         exif.addEventListener("mouseout",function() { exif.style.opacity = btn.style.opacity = 0; },false);
  4000.         urlSpan = cElement("span",exif, "파일 주소: ");
  4001.         addrSpan = cElement("a", urlSpan, {target:"_blank"});
  4002.         indexSpan = cElement("span",urlSpan,"[0/0]");
  4003.         ratioSpan = cElement("span",exif,"확대/축소: 100%");
  4004.         infoSpan = cElement("span",exif,"이미지 정보: ");
  4005.         sizeSpan = cElement("span",infoSpan,"로드 중...");
  4006.  
  4007.         backbtn = cElement("div",box,{id:"DCL_viewerBtnBack",textContent:"‹"},function(){open(index-1);});
  4008.         fwdbtn  = cElement("div",box,{id:"DCL_viewerBtnForward",textContent:"›"},function(){open(index+1);});
  4009.  
  4010.         Viewer.open = open;
  4011.         Viewer.inited = true;
  4012.  
  4013.     };
  4014.     Viewer.prototype.add = function(src,obj) {
  4015.         var i = this.list.length;
  4016.     //  현재의 과학기술로는 URL 분석이 불가능하여 주석을 걸어 둔다. 2013년 8월 8일.
  4017.         if(P.albumFullsize)
  4018.             src = src.replace(/http:\/\/dcimg1\.dcinside\.com\/viewimage\.php(.+)$/g, "http://image.dcinside.com/viewimage.php$1");
  4019.         this.list[i] = src;
  4020.         cAdd(obj,"DCL_viewerItem");
  4021.         obj.addEventListener("click",ePrevent,false);
  4022.         obj.addEventListener("click",function(instance){return function(){instance.run(i);};}(this),false);
  4023.     };
  4024.     Viewer.prototype.run = function(i) {
  4025.         if(!Viewer.inited) {
  4026.             Viewer.init();
  4027.         }
  4028.         cAdd(document.body,"DCL_hideMovAll");
  4029.         Viewer.on = true;
  4030.         Viewer.list = this.list;
  4031.         Viewer.open(i);
  4032.     };
  4033.     Viewer.prototype.clear = function() {
  4034.         this.list.length = 0;
  4035.     };
  4036.  
  4037.     // 이미지 & 동영상 차단
  4038.     var Hide = {
  4039.  
  4040.     apply : function(obj) {
  4041.         if(!Hide.init) {
  4042.             addStyle(
  4043.                 "span.DCL_hideImgBtn, span.DCL_hideMovBtn {position:absolute ; width:25px ; height:14px ; cursor:pointer ; opacity:0.8 ; z-index:100}" +
  4044.                 "span.DCL_hideImgBtn:hover, span.DCL_hideMovBtn:hover {opacity:1 !important}" +
  4045.                 "span.DCL_hideImgBtn {background-image:url('data:image/png;base64,"+BASE64.hideImg+"')}" +
  4046.                 "span.DCL_hideMovBtn {background-image:url('data:image/png;base64,"+BASE64.hideMov+"')}" +
  4047.                 "span.DCL_hideOff {background-image:url('data:image/png;base64,"+BASE64.hideOff+"')}" +
  4048.  
  4049.                 "span.DCL_hideImgBtn {visibility:hidden ; margin-left:-25px}" +
  4050.                 ".DCL_hideImg:hover + span.DCL_hideImgBtn {visibility:visible}" +
  4051.                 "span.DCL_hideImgBtn:hover {visibility:visible}" +
  4052.                 ".DCL_hideImg.DCL_hideOn {visibility:hidden}" +
  4053.                 "span.DCL_hideImgBtn.DCL_hideOn {visibility:visible}" +
  4054.  
  4055.                 "span.DCL_hideMovBtn {opacity:0.5 ; margin:-14px 0 0 -25px}" +
  4056.                 "a + span.DCL_hideMovBtn.DCL_hideOff {margin-left:-60px}" +
  4057.                 ".DCL_hideMov:hover + span.DCL_hideMovBtn {opacity:0.8}" +
  4058.                 ".DCL_hideMov:hover + a + a + span.DCL_hideMovBtn {opacity:0.8}" +
  4059.                 ".DCL_hideMov.DCL_hideOn {display:none}" +
  4060.                 "span.DCL_hideMovBtn.DCL_hideOn {opacity:0.8 ; position:relative ; display:block ; margin:0}" +
  4061.  
  4062.     //          "p.DCL_hideBtns {margin-bottom:10px}" +
  4063.                 "p.DCL_hideBtns > span {display:inline-block ; width:30px ; height:17px ; margin:3px ; cursor:pointer ; opacity:0.5}" +
  4064.                 "span.DCL_viewAll {background-image:url('data:image/png;base64,"+BASE64.viewAll+"')}" +
  4065.                 "span.DCL_hideAll {background-image:url('data:image/png;base64,"+BASE64.hideAll+"')}" +
  4066.                 "p.DCL_hideBtns > span:hover {opacity:1}"
  4067.             );
  4068.             document.addEventListener("keydown",Hide.keydown,false);
  4069.             Hide.init = true;
  4070.         }
  4071.  
  4072.         var btns = [];
  4073.         var index = Hide.list.length;
  4074.         Hide.list[index] = btns;
  4075.         var i,l,btn,className;
  4076.  
  4077.         var imgs = getImgs(obj);
  4078.         if(imgs.length) {
  4079.             if(P.hideImg) {
  4080.                 className = "DCL_hideOn";
  4081.             } else {
  4082.                 className = "DCL_hideOff";
  4083.             }
  4084.             var img;
  4085.             for(i=0,l=imgs.length ; i<l ; i+=1) {
  4086.                 img = imgs[i];
  4087.                 cAdd(img,"DCL_hideImg "+className);
  4088.                 btn = cElement("span",[img,"next"],{className:"DCL_hideImgBtn "+className},Hide.receive);
  4089.                 btns.push(btn);
  4090.             }
  4091.         }
  4092.  
  4093.         var movies = [];
  4094.         var objects = obj.getElementsByTagName("object");
  4095.         for(i=0,l=objects.length ; i<l ; i+=1) {
  4096.             if(objects[i].id !== "mx") { // 기본 플래쉬 광고 예외
  4097.                 movies.push(objects[i]);
  4098.             }
  4099.         }
  4100.         var embeds = obj.getElementsByTagName("embed");
  4101.         for(i=0,l=embeds.length ; i<l ; i+=1) {
  4102.             if(embeds[i].parentNode.nodeName !== "OBJECT") {
  4103.                 movies.push(embeds[i]);
  4104.             }
  4105.         }
  4106.         if(movies.length) {
  4107.             if(P.hideMov) {
  4108.                 className = "DCL_hideOn";
  4109.             } else {
  4110.                 className = "DCL_hideOff";
  4111.             }
  4112.             var movie,next;
  4113.             for(i=0,l=movies.length ; i<l ; i+=1) {
  4114.                 movie = movies[i];
  4115.                 cAdd(movie,"DCL_hideMov "+className);
  4116.                 btn = cElement("span",null,{className:"DCL_hideMovBtn "+className},Hide.receive);
  4117.                 btns.push(btn);
  4118.  
  4119.                 next = movie.nextSibling;
  4120.                 while(next && next.nodeName==="A" && getComputedStyle(next,null).getPropertyValue("-moz-binding").indexOf("chrome://adblockplus/") !== -1) { // Firefox 에서 Adblock Plus 차단 버튼(탭)을 사용하는 경우
  4121.                     next = next.nextSibling;
  4122.                 }
  4123.                 movie.parentNode.insertBefore(btn,next);
  4124.             }
  4125.         }
  4126.  
  4127.         if(btns.length && !cSearch(obj, "com_text")) { // 버튼 넣기
  4128.             var allP = cElement("p",[obj,0],{className:"DCL_hideBtns"});
  4129.             cElement("span",allP,{className:"DCL_viewAll"},function(){Hide.all(index,true);});
  4130.             cElement("span",allP,{className:"DCL_hideAll"},function(){Hide.all(index,false);});
  4131.         }
  4132.     },
  4133.     list : [],
  4134.     keydown : function(e) {
  4135.         var tag = e.target.nodeName;
  4136.         if(tag === "INPUT" || tag === "TEXTAREA" || Viewer.on || e.target.className == "textarea") {
  4137.             return;
  4138.         }
  4139.         var code = e.keyCode;
  4140.         var flag = (code===45||code===192)?true : (code===46||code===27)?false : null;
  4141.         if(flag !== null) {
  4142.             for(var i=0,l=Hide.list.length ; i<l ; i+=1) {
  4143.                 Hide.all(i,flag);
  4144.             }
  4145.             ePrevent(e);
  4146.         }
  4147.     },
  4148.     all : function(index,flag) {
  4149.         var btns = Hide.list[index];
  4150.         for(var i=0,l=btns.length ; i<l ; i+=1) {
  4151.             Hide.toggle(btns[i],flag);
  4152.         }
  4153.     },
  4154.     receive : function(e) {
  4155.         ePrevent(e);
  4156.         var btn = e.target;
  4157.         Hide.toggle(btn,cSearch(btn,"DCL_hideOn"));
  4158.     },
  4159.     toggle : function(btn,flag) {
  4160.         if(flag === cSearch(btn,"DCL_hideOff")) {
  4161.             return;
  4162.         }
  4163.         var obj = btn.previousSibling;
  4164.         while(obj && obj.nodeName==="A" && getComputedStyle(obj,null).getPropertyValue("-moz-binding").indexOf("chrome://adblockplus/") !== -1) {
  4165.             obj = obj.previousSibling;
  4166.         }
  4167.  
  4168.         if(flag) {
  4169.             cSwitch(obj,"DCL_hideOn","DCL_hideOff");
  4170.             cSwitch(btn,"DCL_hideOn","DCL_hideOff");
  4171.         } else {
  4172.             cSwitch(obj,"DCL_hideOff","DCL_hideOn");
  4173.             cSwitch(btn,"DCL_hideOff","DCL_hideOn");
  4174.         }
  4175.     }
  4176.  
  4177.     };
  4178.  
  4179.     function LongCookie() {
  4180.         var expires = new Date();
  4181.         var domain = location.host.substr(location.host.indexOf('.'));
  4182.         var cookie = /(?:^|; )PHPSESSID=([^;]*)/.exec(document.cookie);
  4183.         expires.setDate( expires.getDate() + 30 );
  4184.         document.cookie = 'PHPSESSID='+cookie[1]+'; path=/; domain='+domain+'; expires='+expires.toGMTString()+';';
  4185.     }
  4186.  
  4187.     function csrf_token() {
  4188.         return document.cookie.match(/ci_c=([^;]+)(;|$)/)[1];
  4189.     }
  4190.  
  4191.     function cookieDelete() {
  4192.         var expires = new Date();
  4193.         var domain = location.host.substr(location.host.indexOf('.'));
  4194.         var cookie = /(?:^|; )PHPSESSID=([^;]*)/.exec(document.cookie);
  4195.         expires.setDate( expires.getDate() - 1 );
  4196.         document.cookie = 'PHPSESSID=; path=/; domain='+domain+'; expires='+expires.toGMTString()+';';
  4197.         document.cookie = 'PHPSESSID=; path=/; domain='+location.host+'; expires='+expires.toGMTString()+';';
  4198.         alert('초기화되었습니다.');
  4199.         location.reload();
  4200.     }
  4201.  
  4202.     function shortkey(e) {
  4203.         if(e.target.tagName != "BODY")
  4204.             return;
  4205.  
  4206.         // . => 190
  4207.         // n =>  78
  4208.         // r =>  82
  4209.  
  4210.         if(e.keyCode == 190) {
  4211.             ePrevent(e);
  4212.             pageLoad(parseInt($('p.DCL_tbodyBtn').firstChild.textContent)-1);
  4213.         } else if(e.keyCode == 78) {
  4214.             if(P.simpleWrite)
  4215.                 openSimpleWriteForm();
  4216.             else
  4217.                 location.href = MODE.prefix+"/board/write/?id=" + _ID;
  4218.         }
  4219.     }
  4220.  
  4221.     // 실제 실행
  4222.     function DCINSIDE_LITE() {
  4223.         if(BROWSER.iphone)
  4224.             cElement('meta',document.head,{'name':'viewport','content':'width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1'});
  4225.         if(MODE.settings)
  4226.             return SET.call();
  4227.  
  4228.         if(!P.loadAtWrite && MODE.write)
  4229.             return;
  4230.         if(!P.loadAtView && (MODE.article || MODE.comment))
  4231.             return;
  4232.  
  4233.         if(P.fontOverride === 1)
  4234.             addStyle('* { font-family: ' + P.fontList + ' !important; }');
  4235.  
  4236.         addStyle(
  4237.             '* { -webkit-text-size-adjust: none; }' +
  4238.             ".banner_box, #dgn_footer, #dgn_gallery_right_detail { display:none !important; }" +
  4239.             "#dgn_gallery_right { " + (P.sidebar?'':'display:none !important; ') + "background-color: #F4F4F4; position: absolute; right: 0; }" +
  4240.             '#dgn_gallery_detail, .gallery_re_contents, #dgn_gallery_left .gallery_box, .re_gall_box_5, #dgn_gallery_list, .re_gall_box_5, .re_input { width: 100% !important; }' +
  4241.             "#dgn_gallery_left { width: 100% !important; box-sizing: border-box; "+(P.sidebar?"padding-right: 260px; ":"float: none; ")+"}" +
  4242.             '.menu_bg iframe, #dgn_globalmenu { width: 100% !important;}' +
  4243.             '#dgn_globalmenu .menu_bg > div { position: static !important; }' +
  4244.             '#dgn_gallery_left .gallery_box { box-sizing: border-box; }' +
  4245.             '.re_textarea { width: '+(P.pageWidth-350)+'px !important;}' +
  4246.  
  4247.             '#dgn_gallery_detail { position: static; margin: 20px 0 0 0; }' +
  4248.             '.appending_file { width:'+(P.pageWidth-10)+'px !important; }' +
  4249.             '.resize_bar > div { left: 50px !important; }' +
  4250.  
  4251.             '#dgn_gallery_left .gallery_title { display: '+(P.title?"block":"none")+'; position: static; height: auto; }' +
  4252.             '#dgn_gallery_left .gallery_title h1 { position: static; }' +
  4253.  
  4254.             "#dgn_gallery_left .gallery_box { display: " + (P.best?"block":"none") + "; " + (P.title?"":"top: 0px !important;") + "}" +
  4255.             "#dgn_gallery_left .gallery_box {position: static !important; margin-bottom: 10px; "+(!MODE.list?'':'height: 175px !important;')+"}" +
  4256.             "#dgn_gallery_left .gallery_list {position: static !important; padding: 0 !important;}" +
  4257.             "#dgn_gallery_left .list_table {margin-top: 0px;}" +
  4258.             "#dgn_gallery_left .con_lately :after {clear:both; content: \" \";}" +
  4259.             "#dgn_gallery_left .select_div { width: 100% !important; margin: 0 auto !important; }" +
  4260.             "#dgn_gallery_left .select_div ul { z-index: 1000; }" +
  4261.  
  4262.             "#dgn_popup_4 { top: 0px !important; }" +
  4263.             "#dgn_gallery_write { top: 0px !important; }" +
  4264.  
  4265.             "#dgn_header_gall, #dgn_gallery_wrap, #dgn_gallery_write {width:100% !important; margin: 0 auto !important; background: none !important;}" +
  4266.             ".con_substance *, #writeForm * { max-width: 100%; }" +
  4267.  
  4268.             "#dgn_content_write .write_gall_box_1:after { clear: both; content: ' '; display: block; }" +
  4269.  
  4270.             ".con_substance {word-wrap:break-word}" +
  4271.             ".con_substance > span div[id^='dc_imgFree_'] {display:none !important}" +
  4272.             ".con_substance div[id^='dc_image_'] {top:auto !important; left:3px !important; bottom:25px}" +
  4273.             ".con_substance img[id^='paranimg_m_'] {border:none !important}" +
  4274.             ".re_gall_box_1 .con_substance .DCL_viewerItem {margin-left: -10px;}" +
  4275.  
  4276.             "#list_table {table-layout:fixed; clear:both; font-family: Tahoma, sans-serif; border-collapse: separate; border-spacing: 0; }" +
  4277.             "#list_table > * > tr > td," +
  4278.             "#list_table > * > tr > th {overflow:hidden; height: 26px !important; vertical-align: middle; }" +
  4279.             "#list_table > * > tr > td.t_date { line-height: normal !important; }" +
  4280.             "#list_table > colgroup > col:nth-child(1) {width:"+(P.listNumber?72:0)+"px;}" +
  4281.             "#list_table > colgroup > col:nth-child(2) {width:100%;}" +
  4282.             "#list_table > colgroup > col:nth-child(3) {width:125px;}" +
  4283.             "#list_table > colgroup > col:nth-child(4) {width:"+(P.listDate?110:0)+"px;}" +
  4284.             "#list_table > colgroup > col:nth-child(5) {width:"+(P.listCount?35:0)+"px;}" +
  4285.             "#list_table > colgroup > col:nth-child(6) {width:"+(P.listRecom?35:0)+"px;}" +
  4286.             "#list_table tbody.list_thead .tb td { padding-top: 3px !important; padding-bottom: 0; }" +
  4287.             "#list_table tbody.list_thead > tr > td > a:first-child { padding: 0 !important; width: 23px !important; text-decoration: none; }" +
  4288.             "#list_table tbody.list_thead > tr.tb:hover { background-color: #eae9f7; }" +
  4289.  
  4290.             "#list_table tbody.list_thead > tr > td.t_writer { white-space: nowrap; }" +
  4291.             "#list_table tbody.list_thead > tr > td.t_writer span:first-of-type { max-width: 100%; display: inline-block; margin-right: -17px; padding-right: 14px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; }" +
  4292.  
  4293.             "#reply1 {width:auto !important}" +
  4294.             "table.comment-table {table-layout:fixed; text-align: left !important;}" +
  4295.             "table.comment-table > colgroup {display:none}" +
  4296.             "table.comment-table td {line-height: 22px;}" +
  4297.             "table.comment-table td.com_name {width:120px}" +
  4298.             "table.comment-table td.com_text {width:auto; text-align: left !important;}" +
  4299.             "table.comment-table td.com_chat {width:10px}" +
  4300.             "table.comment-table td.com_ip {width:110px ; font:8pt Tahoma}" +
  4301.             "table.comment-table td.com_btn {width:12px}" +
  4302.             "td.com_text > div {display:inline}" +
  4303.             "td.com_text > em {color: #999; font-size: 11px !important; border-left: 0px solid #999; padding-left: 3px; margin-left: 1px;}" +
  4304.  
  4305.             "#soea_areast { margin-left: "+(0-(P.pageWidth/2+150))+"px !important; }" +
  4306.             ".ad_left_wing_list_top, " +
  4307.             ".ad_left_wing_con_top { left: -150px !important; }" +
  4308.  
  4309.             ".best_img, .hit_img, .issue_img, .con_img { background-color: white; background-image: url('data:image/png;base64,"+BASE64.transparentBg+"'); text-align: center; display: table-cell; vertical-align: middle; }" +
  4310.             ".best_img img { width: auto; height: auto; max-width: 123px; max-height: 92px; }" +
  4311.             ".hit_img img { width: auto; height: auto; max-width: 220px; max-height: 120px; }" +
  4312.             ".issue_img img { width: auto !important; height: auto !important; max-width: 105px; max-height: 67px; }" +
  4313.             ".con_img img { width: auto; height: auto; max-width: 85px; max-height: 60px; }" +
  4314.  
  4315.             // 로딩 오류시
  4316.             "#dgn_wrap {width:100% !important;}" +
  4317.             "#testDiv > table[width='200'], #right_div {display:none}" +
  4318.             "a[href^='javascript:mobile_direct'] { display: none; }"
  4319.             );
  4320.  
  4321.         addStyle(
  4322.             "td.DCL_tbodyTitle {text-align: left !important; padding: 0; background-color:#eee ; border-top:1px solid #dbdbdb}" +
  4323.             "td.DCL_tbodyTitle > p:after {content:'' ; display:block ; clear:both ; width:0 ; height:0 ; overflow:hidden}" +
  4324.             "p.DCL_tbodyBtn {float:left; margin-top:0;margin-bottom:0;}" +
  4325.             "p.DCL_tbodyBtn > span {font:9pt Tahoma,돋움 ; color:#333 ; margin:5px ; cursor:pointer}" +
  4326.             "a.DCL_pageLink {color:#fa0 !important}" +
  4327.             "span.DCL_tbodyLoad {margin:5px ; font:9pt Tahoma,돋움}" +
  4328.  
  4329.             "p#DCL_writeBtn {text-align:left}" +
  4330.             "p#DCL_writeBtn > span {border:1px solid #bbb ; border-radius:3px ; padding:2px 7px 3px ; font:8pt Tahoma,돋움 ; background-color:#f9f9f9 ; cursor:pointer}" +
  4331.  
  4332.             ".DCL_viewerItem {cursor:pointer}"
  4333.             );
  4334.  
  4335.         if(P.listComment) {
  4336.             addStyle("#list_table .t_subject > a:empty:after {color: #6E6E6E; font-size: 11px; margin-left: 5px; font-family: '굴림',Gulim; content:'[0]'}");
  4337.         }
  4338.  
  4339.         // API읽기
  4340.         if(P.apiRead)
  4341.             MODE.api = {};
  4342.  
  4343.         // 쿠키 연장
  4344.         if(P.longExpires)
  4345.             LongCookie();
  4346.  
  4347.         // body에 클래스 추가
  4348.         if(!P.header && $id("dgn_header_gall")!==null) {
  4349.             $id("dgn_header_gall").style.display = "none";
  4350.         }
  4351.  
  4352.         if(P.wide) {
  4353.             wideFunc();
  4354.         }
  4355.         // 브라우저 타이틀 변경
  4356.         titleFunc();
  4357.  
  4358.         // 메뉴 생성
  4359.         menuFunc();
  4360.  
  4361.         if(title = $('#dgn_gallery_left .gallery_title h1 a.fc_5b')) {
  4362.             title.addEventListener('click', function(e) { ePrevent(e); softLoad(MODE.prefix+"/board/lists/?id="+_ID); });
  4363.         }
  4364. /*
  4365.         if($('#dgn_gallery_left .gallery_title > h1')) {
  4366.             $('#dgn_gallery_left .gallery_title > h1').innerHTML = '';
  4367.             var title = cElement('a', $('#dgn_gallery_left .gallery_title > h1'), {href:MODE.prefix+"/board/lists/?id="+_ID}, function(e) { ePrevent(e); softLoad(MODE.prefix+"/board/lists/?id="+_ID); });
  4368.             cElement('span', title, {textContent:GALLERY,className:"gallery_name"});
  4369.             cElement(null, title, " ");
  4370.             cElement('span', title, {textContent:"갤러리",className:"gallery_str"});
  4371.         }*/
  4372.  
  4373.         // 글쓰기 모드
  4374.         if(MODE.write) {
  4375.             if($id("edit_buts")!==null) {
  4376.                 var editTd = $id("edit_buts").parentNode.parentNode.lastElementChild;
  4377.                 editTd.innerHTML = "";
  4378.                 var editP = cElement("p",editTd,{id:"DCL_writeBtn"});
  4379.             }
  4380.             var editVisual = $id("editVisual");
  4381.             var editNomal = $id("editNomal");
  4382.  
  4383.             // 자동입력
  4384.             if(P.autoForm) {
  4385.                 var autoName = $id("name");
  4386.                 var autoPassword = $id("password");
  4387.                 if(autoName) {
  4388.                     autoName.value = P.autoName;
  4389.                     autoName.style.background = "#FAFFBD";
  4390.                     autoName.addEventListener("keydown", function() { this.style.background = ""; });
  4391.                 }
  4392.                 if(autoPassword) {
  4393.                     autoPassword.value = P.autoPassword;
  4394.                     autoPassword.style.background = "#FAFFBD";
  4395.                     autoPassword.addEventListener("keydown", function() { this.style.background = ""; });
  4396.                 }
  4397.             }
  4398.            
  4399.             if(_ID!='singo') {
  4400.                 // 글제목 길이 제한 없애기
  4401.                 eRemove($id("subject"),"maxLength");
  4402.             }
  4403.  
  4404.             // 페이지를 벗어날 때 확인
  4405.             window.addEventListener("beforeunload",
  4406.                 function(e) {
  4407.                     if($id("zb_waiting").style.visibility !== "visible") {
  4408.                         ePrevent(e);
  4409.                         return "현재 페이지에서 나가시겠습니까?";
  4410.                     }
  4411.                 },
  4412.             false);
  4413.  
  4414.         } else if(MODE.singo) {
  4415.             // 자동입력
  4416.             if(P.autoForm) {
  4417.                 var autoName = $id("nonmember_id");
  4418.                 var autoPassword = $id("nonmember_password");
  4419.                 if(autoName) {
  4420.                     autoName.value = P.autoName;
  4421.                     autoName.style.background = "#FAFFBD";
  4422.                     autoName.addEventListener("keydown", function() { this.style.background = ""; });
  4423.                 }
  4424.                 if(autoPassword) {
  4425.                     autoPassword.value = P.autoPassword;
  4426.                     autoPassword.style.background = "#FAFFBD";
  4427.                     autoPassword.addEventListener("keydown", function() { this.style.background = ""; });
  4428.                 }
  4429.             }
  4430.  
  4431.             if(parseQuery(location.search).gallname && parseQuery(location.search).singourl) {
  4432.                 $id('singo_gallery').value = decodeURIComponent(parseQuery(location.search).gallname);
  4433.                 $id('singo_url').value = decodeURIComponent(parseQuery(location.search).singourl);
  4434.                 $id('singo_menu').focus();
  4435.             }
  4436.             else
  4437.                 $id('singo_gallery').focus();
  4438.         } else {
  4439.             // 글쓰기 이외 모드
  4440.  
  4441.             // 본문보기 모드
  4442.             if(MODE.article) {
  4443.                 var bgRelaBig = $(".s_write");
  4444.  
  4445.                 // 본문 내 이미지 작업
  4446.                 var articleImgs = getImgs(bgRelaBig);
  4447.                 if(articleImgs.length) {
  4448.                     var viewer = new Viewer();
  4449.                     var img;
  4450.                     for(var i=0,l=articleImgs.length ; i<l ; i+=1) {
  4451.                         var vtarget = '';
  4452.                         img = articleImgs[i];
  4453.  
  4454.  
  4455.                         if(P.albumFullsize) {
  4456.                             var urlContainers = [img.getAttribute('onclick')];
  4457.  
  4458.                             if(img.parentNode && img.parentNode.tagName=="A")
  4459.                                 urlContainers = urlContainers.concat([img.parentNode.getAttribute('onclick'),img.parentNode.getAttribute('href')]);
  4460.  
  4461.                             for(j=urlContainers.length;j--;) {
  4462.                                 if(urlContainers[j]!==null && (url = urlContainers[j].match(/http:\/\/image\.dcinside\.com[^,\'\"\s]+/))) {
  4463.                                     vtarget = url[0];
  4464.                                 }
  4465.                             }
  4466.                            
  4467.                             if (vtarget == '') {
  4468.                                 vtarget = img.src.replace(/http:\/\/dcimg[0-9]\.dcinside\.com\/viewimage\.php(.+)$/g, "http://image.dcinside.com/viewimage.php$1");
  4469.                             }
  4470.                         } else {
  4471.                             vtarget = img.src;
  4472.                         }
  4473.  
  4474.                         if(img.parentNode.tagName=="A") {
  4475.                             nImg = cElement("img", [img.parentNode,"next"], {src:img.src});
  4476.                             img.parentNode.parentNode.removeChild(img.parentNode);
  4477.                             img = nImg;
  4478.                         }
  4479.                         else {
  4480.                             nImg = cElement("img", [img,"next"], {src:img.src});
  4481.                             img.parentNode.removeChild(img);
  4482.                             img = nImg;
  4483.                         }
  4484.  
  4485.                         eRemove(img,"href");
  4486.                         eRemove(img,"onclick");
  4487.                         eRemove(img,"onclick");
  4488.                         eRemove(img,"onload");
  4489.                         eRemove(img,"width");
  4490.                         eRemove(img,"height");
  4491.  
  4492.                         viewer.add(vtarget.replace("viewimagePop.php", "viewimage.php"),img);
  4493.                     }
  4494.                 }
  4495.  
  4496.                 if(P.hide) {
  4497.                     Hide.apply(bgRelaBig);
  4498.                 }
  4499.                 autoLink(bgRelaBig);
  4500.             }
  4501.            
  4502.             if(MODE.list) {
  4503.                 cElement('script',document.body,{type:'text/javascript',innerHTML:'$(document).off("focus", "img, a");'});
  4504.                 cElement('script',document.head,{type:'text/javascript',src:'http://gall.dcinside.com/_js/voice_reple.js'});
  4505.                 cElement('link',document.head,{type:'text/css',rel:'stylesheet',href:'http://nstatic.dcinside.com/dgn/gallery/css/voicereply/voicereply.css'});
  4506.                 ilbeView();
  4507.                 document.addEventListener("keydown",shortkey,false);
  4508.                 window.onpopstate = function(e) {
  4509.                     softLoad(e.state,1);
  4510.                 };
  4511.             }
  4512.  
  4513.             // 코멘트가 있는 경우
  4514.             if(MODE.article || MODE.comment) {
  4515.                 if(P.autoForm) {
  4516.                     var autoName = $id("name");
  4517.                     var autoPassword = $id("password");
  4518.                     var autoMemo = $id("memo");
  4519.                     if(autoName) {
  4520.                         autoName.value = P.autoName;
  4521.                         autoName.style.background = "";
  4522.                     }
  4523.                     if(autoPassword) {
  4524.                         autoPassword.value = P.autoPassword;
  4525.                         autoPassword.style.background = "";
  4526.                     }
  4527.                     if(autoMemo) {
  4528.                         autoMemo.value = "";
  4529.                         autoMemo.style.background = "";
  4530.                     }
  4531.                 }
  4532.             }
  4533.  
  4534.             var list_table = $("thead.list_thead").parentNode;
  4535.             var thead = $("thead.list_thead");
  4536.  
  4537.             if($("tbody.list_thead")===null) {
  4538.                 var tbody = cElement("tbody",[thead,"next"],{className:'list_thead'});
  4539.                 tbody.innerHTML=thead.innerHTML;
  4540.                 thead.innerHTML="";
  4541.                 thead.appendChild(tbody.rows[0]);
  4542.             }
  4543.             else
  4544.                 var tbody = $("tbody.list_thead");
  4545.  
  4546.             for(i=tbody.childNodes.length-1;i--;) {
  4547.                 if(tbody.childNodes[i].tagName !=="TR") {
  4548.                     continue;
  4549.                 }
  4550.                 eRemove(tbody.childNodes[i],"onmouseover");
  4551.                 eRemove(tbody.childNodes[i],"onmouseout");
  4552.                 eRemove(tbody.childNodes[i],"style");
  4553.             }
  4554.             var tbody_h = tbody.innerHTML;
  4555.             tbody.innerHTML = '';
  4556.             tbody.innerHTML = tbody_h;
  4557.            
  4558.             var tr = cElement("tr",[tbody,0]);
  4559.             list_table.id = "list_table";
  4560.             cElement("td",tr,{className:"DCL_tbodyTitle",colSpan:"6"});
  4561.  
  4562.             listFunc(0);
  4563.             Layer.add(0);
  4564.  
  4565.             if(P.page) {
  4566.                 pageFunc();
  4567.             }
  4568.  
  4569.             // 필터
  4570.             if(P.filter) {
  4571.                 Filter.article($id("list_table").tBodies[0]);
  4572.                 if(MODE.article || MODE.comment) {
  4573.                     var com_tab = $id("gallery_re_contents");
  4574.                     Filter.comment(com_tab);
  4575.                     var com_tab_timer;
  4576.                     com_tab.addEventListener("DOMNodeInserted",function(){clearTimeout(com_tab_timer);com_tab_timer=setTimeout(function(){Filter.comment(com_tab);},100);},false);
  4577.                 }
  4578.             }
  4579.         }
  4580.  
  4581.         Layer.init();
  4582.  
  4583.         addStyle(   '@media screen and (max-width: ' + (P.sidebar?'960px':'700px') + ') {'
  4584.                             + '#dgn_globalmenu { position: static; }'
  4585.                             + '#dgn_globalmenu .top_ad_box,'
  4586.                             + '#dgn_gall_top .top_m,'
  4587.                             + '#dgn_gall_top .top_banner { display: none; }'
  4588.                             + '#dgn_gall_top .top_search { position: static; }'
  4589.                             + '#dgn_gall_top .top_box { position: static; width: 100%; padding-top: 18px; padding-bottom: 10px; height: auto; }'
  4590.                             + '#dgn_gall_top .top_box > * { float: left; margin: 0 10px; }'
  4591.                             + '#dgn_gall_top_wrap.glist #dgn_gall_top { height: auto; }'
  4592.                             + '#dgn_gall_top .top_box:after { content: ""; display: block; clear: both; }'
  4593.                             + 'div#DCL_menuWrap:before { display: none; }'
  4594.                             + 'div.list_table { border: none !important; }'
  4595.                             + '#list_table,'
  4596.                             + '#list_table > tbody { display: block; }'
  4597.                             + '#list_table > thead,'
  4598.                             + '#list_table > colgroup { display: none; }'
  4599.                             + '#list_table > tbody > tr:first-of-type:after { content: ""; display: block; clear: both; }'
  4600.                             + '#list_table > tbody > tr:first-of-type > td { display: block; padding: 5px; }'
  4601.                             + '#list_table > tbody > tr:first-of-type > td:after { content: ""; display: block; clear: both; }'
  4602.                             + '#list_table > tbody > tr { display: block; }'
  4603.                             + '#list_table > tbody > tr.DCL_blockArticle { display: none; }'
  4604.                             + '#list_table > tbody.DCL_showArticle > tr.DCL_blockArticle { display: block; background-color: #EEE; }'
  4605.                             + '#list_table > tbody > tr > td { display: block; height: initial !important; }'
  4606.                             + '#list_table > tbody > tr > td:nth-of-type(3) { border-right: 1px solid #ddd; border-left: 1px solid #ddd; padding: 0 7px !important; }'
  4607.                             + '#list_table > tbody > tr.tb > td:nth-of-type(5),'
  4608.                             + '#list_table > tbody > tr.tb > td:nth-of-type(6) { display: none; }'
  4609.                             + '#list_table > tbody > tr > td:nth-of-type(2) { border-left: 0; font-size: 16px !important; }'
  4610.                             + '#list_table > tbody > tr.tb { padding: 10px; border-bottom: 1px solid #ddd; }'
  4611.                             + '#list_table > tbody > tr.tb > td { display: inline; border-bottom: none !important; padding: 0; margin: 0; line-height: initial !important; }'
  4612.                             + '#list_table > tbody > tr.tb > td:first-of-type { display: none; }'
  4613.                             + 'div.DCL_layerDiv { max-height: none !important; }'
  4614.                             + 'div.DCL_layerActive,'
  4615.                             + 'tr.DCL_layerActive > td,'
  4616.                             + 'tr.DCL_layerActive+tr > td { border-top: none; }'
  4617.                             + 'tr.DCL_layerTr > td { border-top: none !important; }'
  4618.                             + 'tr.DCL_layerActive { border-top: 2px solid black; }'
  4619.                             + 'tr.DCL_layerActive { border-left: 2px solid black; border-right: 2px solid black; box-sizing: border-box; border-top-left-radius: 5px; border-top-right-radius: 5px; }'
  4620.                             + 'table.DCL_layerComment { display: block; }'
  4621.                             + 'table.DCL_layerComment > caption { display: block; font: inherit; }'
  4622.                             + 'table.DCL_layerComment > tr { display: block; border-bottom: 1px solid #ddd; position: relative; padding: 10px 28px 25px 10px; }'
  4623.                             + 'table.DCL_layerComment > tr > td { display: inline; border-bottom: none !important; height: auto !important; }'
  4624.                             + 'table.DCL_layerComment > tr > td:nth-of-type(1) { position: absolute; bottom: 5px; left: 5px; }'
  4625.                             + 'table.DCL_layerComment > tr > td:nth-of-type(3) { position: absolute; bottom: 5px; right: 0px; }'
  4626.                             + 'table.DCL_layerComment > tr > td:nth-of-type(4) { position: absolute; top: 10px; right: 5px; }'
  4627.  
  4628.                             + 'div.DCL_layerContent img { max-width: 100% !important; }'
  4629.  
  4630.                             + 'div#dgn_gallery_left { padding-right: 0; }'
  4631.                             + 'div#dgn_gallery_left .bottom_search { max-width: 100%; overflow: hidden; }'
  4632.  
  4633.                             + 'div#dgn_gallery_right { position: static; float: none; width: 100%; }'
  4634.                             + 'div#dgn_gallery_right .box_con .con_concept li { text-align: left; }'
  4635.                             + 'div#dgn_gallery_right > * { width: 250px; display: block; margin: 0 auto; }'
  4636.  
  4637.                             + '#dgn_gallery_left .bottom_search { padding-bottom: 102px !important; }'
  4638.                             + '#dgn_gallery_left .bottom_search * { max-width: 100%; }'
  4639.                             + '#dgn_gallery_left .bottom_search .box_select { position: relative; box-sizing: border-box; padding: 0 46px 0 30% !important; margin: 0 !important; min-height: 27px; border: 3px solid #607ee9; }'
  4640.                             + '#dgn_gallery_left .bottom_search .box_select span { display: block; }'
  4641.                             + '#dgn_gallery_left .bottom_search .box_select span.btn_down { position: absolute; left: 0; width: 30%; }'
  4642.                             + '#dgn_gallery_left .bottom_search .s_b_box { background-color: transparent; padding-right: 46px; box-sizing: border-box; }'
  4643.                             + '#dgn_gallery_left .bottom_search .s_b_btn { position: absolute; right: 0; }'
  4644.                             + '#dgn_gallery_left .bottom_search .s_b_box .box_select .btn_down a { width: 100%; background-position: right 10px center; box-sizing: border-box; }'
  4645.                             + '#dgn_gallery_left .select_div ul { width: 90px !important; left: 2px !important; }'
  4646.                         + '}'
  4647.  
  4648.                         + '@media screen and (max-width: 640px), screen and (max-height: 660px) {'
  4649.                             + 'div.DCL_set_wrap { top: 0; left: 0; margin: 0; width: 100%; height: 100%; overflow-y: scroll; }'
  4650.                             + 'div.DCL_set_wrap > div.body { height: auto; overflow-y: auto; }'
  4651.                             + 'div.DCL_set_wrap > div.foot > input[type="submit"] { position: absolute; top: 0; right: 0; }'
  4652.                             + 'div.DCL_set_wrap > div.head > button { position: absolute; left: 0; top: 5px; }'
  4653.                             + 'div.DCL_set_mdi { top: 40px; left: 0; margin: 0; width: 100%; }'
  4654.                             + 'div.DCL_set_wrap > div.head > h2 { text-align: center; }'
  4655.                         + '}'
  4656.                         + '');
  4657.                        
  4658.         if(P.notificationInterval)
  4659.             DCINSIDE_LITE.checkAlert();
  4660.  
  4661.         if(MODE.api)
  4662.             softLoad(location.href);
  4663.     }
  4664.  
  4665.     DCINSIDE_LITE.funcList = {
  4666.         login : function(){location.href="http://dcid.dcinside.com/join/log"+(_GID?"out":"in")+".php?s_url="+encodeURIComponent(location.href);},
  4667.         gallog : function(e) {
  4668.                     if(!_GID) {
  4669.                         ePrevent(e);
  4670.                         if(confirm("로그인을 하지 않은 상태입니다.\n로그인 하시겠습니까?")) {
  4671.                             location.href = "http://dcid.dcinside.com/join/login.php?s_url="+encodeURIComponent(location.href);
  4672.                         }
  4673.                     }
  4674.                 },
  4675.         page : function() {
  4676.                     setValue("page",!P.page);
  4677.                     cToggle(this,"DCL_menuOn");
  4678.                     var list_table = $id("list_table");
  4679.                     var tbody = list_table.tBodies;
  4680.                     if(P.page) {
  4681.                         pageFunc();
  4682.                     } else {
  4683.                         for(var i=tbody.length-1 ; i>0 ; i-=1) {
  4684.                             Layer.close(i);
  4685.                             list_table.removeChild(tbody[i]);
  4686.                         }
  4687.                     }
  4688.                 },
  4689.         wide : function() {
  4690.                     setValue("wide",!P.wide);
  4691.                     cToggle(this,"DCL_menuOn");
  4692.                     wideFunc();
  4693.                 },
  4694.         header : function() {
  4695.                     setValue("header",!P.header);
  4696.                     cToggle(this,"DCL_menuOn");
  4697.                     $id("dgn_header_gall").style.display = P.header?"block":"none";
  4698.                 },
  4699.         title : function() {
  4700.                     setValue("title",!P.title);
  4701.                     cToggle(this,"DCL_menuOn");
  4702.                     $(".gallery_title").style.display = P.title?"block":"none";
  4703.                 },
  4704.         best : function() {
  4705.                     setValue("best",!P.best);
  4706.                     cToggle(this,"DCL_menuOn");
  4707.                     $(".gallery_box").style.display = P.best?"block":"none";
  4708.                 },
  4709.         ilbeview : function(){
  4710.                     softLoad(MODE.prefix+"/board/lists/?id="+_ID+"&exception_mode=best");
  4711.                 },
  4712.         favview : function(){
  4713.                     softLoad(MODE.prefix+"/board/lists/?id="+_ID+"&exception_mode=recommend");
  4714.                 },
  4715.         refresh : function(){
  4716.                     softLoad(MODE.prefix+"/board/lists/?id="+_ID);
  4717.                 },
  4718.         menutoggle : function(){
  4719.                     if($id("DCL_menuUlSub").style.display!=="block")
  4720.                         $id("DCL_menuUlSub").style.display="block";
  4721.                     else
  4722.                         $id("DCL_menuUlSub").style.display=null;
  4723.                 },
  4724.         menuclose : function(e){
  4725.                     if(e.target === $("h2#DCL_menuTitle > img.DCL_profileImage"))
  4726.                         return DCINSIDE_LITE.funcList.menutoggle();
  4727.                     $id("DCL_menuUlSub").style.display=null;
  4728.                 },
  4729.         write: function(){
  4730.             if(P.simpleWrite)
  4731.                 openSimpleWriteForm();
  4732.             else
  4733.                 location.href = 'http://gall.dcinside.com'+MODE.prefix+'/board/write/?id='+_ID;
  4734.         }
  4735.     };
  4736.  
  4737.     DCINSIDE_LITE.checkAlert = function() {
  4738.         if(!_GID)
  4739.             return;
  4740.         var notice_no = /(?:^|; )notice_no=([^;]*)/.exec(document.cookie);
  4741.         simpleRequest('http://gall.dcinside.com/api/alram_push/notify_comment_alram?_='+time(), function(e) {
  4742.             if(P.notificationInterval)
  4743.                 setTimeout(DCINSIDE_LITE.checkAlert, P.notificationInterval * 1000);
  4744.             var noti = JSON.parse(e.responseText);
  4745.             if(!noti[0])
  4746.                 return;
  4747.             noti = noti[0];
  4748.             if(noti['member_division'] === 'Y') {
  4749.                 var regex = new RegExp('<tr class="reply_line">([^]+?<td class="retime">'+noti['reply_update'].replace(/\-/g, '.')+'</td>)','g');
  4750.                 simpleRequest('/comment/view',
  4751.                     function(detail) {
  4752.                         var popup;
  4753.                         if(!(comment = regex.exec(detail.responseText))) {
  4754.                             comment = new Array();
  4755.                             comment[1] = detail.responseText;
  4756.                         }
  4757.                         var userids = comment[1].match(/user_id='([^']*?)'/g);
  4758.                         var usernames = comment[1].match(/user_name='([^']*?)'/g);
  4759.                         var replies = comment[1].match(/<td class="reply">([^]*?)(?:<span class="etc_ip">([^<]*?)<\/span>)?<\/td>/g);
  4760.                         userid = userids[userids.length-1].match(/user_id='([^']*)'/);
  4761.                         username = usernames[usernames.length-1].match(/user_name='([^']*)'/);
  4762.                         reply = replies[replies.length-1].match(/<td class="reply">([^]*?)(?:<span class="etc_ip">([^<]*?)<\/span>)?<\/td>/);
  4763.  
  4764.                         popup = new Notification(username[1].replace(/\n/g,'') + (reply[2]?'('+reply[2].replace(/\.\*\.\*/,'.***.***')+')':(userid[1]?'('+userid[1]+')':'')),{'body':(reply[1]?reply[1].replace(/\n/g,''):'새 댓글이 달렸습니다.')});
  4765.                         popup.onclick = function() { window.open('http://gall.dcinside.com/'+noti['gallery_id']+'/'+noti['gallery_no']); };
  4766.                         setTimeout(function() { popup.close(); }, 7000);
  4767.                     },
  4768.                     "POST",
  4769.                     {"Accept":"text/html,application/xhtml+xml,application/xml,*/*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},'id='+noti['gallery_id']+'&no='+noti['gallery_no']+'&comment_page=1&ci_t='+csrf_token());
  4770.             }
  4771.         },'GET',{'Accept':'application/json,text/javascript,*/*','Content-Type':'application/json','X-Via':'DCLite/'+R_VERSION,'X-Requested-With':'XMLHttpRequest'});
  4772.     };
  4773.  
  4774.     DCINSIDE_LITE.checkLoginStatus = function(html) {
  4775.         var oGID = _GID;
  4776.         _GID = html.match(/<li class="pic_galler"><a href="http:\/\/gallog\.dcinside\.com\/([^"]+)" id="favorite_gallog_img"><\/a><\/li>/);
  4777.         _GID = (_GID!=null?_GID[1]:false);
  4778.         console.log('checkLoginStatus:' + _GID);
  4779.  
  4780.         if(oGID == _GID) // 변경사항이 없으면
  4781.             return;
  4782.  
  4783.         if(P.menuPos === "top") {
  4784.             $id("DCL_menuTitle").textContent = "";
  4785.             cElement("img",[$id("DCL_menuTitle"),0],{src:"http://dcimg1.dcinside.com/glogProfileView.php?gid=26b2c223e4c221ac3e&type=main&mode=GL&dummyCode=242872037",className:"DCL_profileImage",alt:"프로필"});
  4786.         }
  4787.         if(btnLogin = $('.DCL_menuLogin > a'))
  4788.             btnLogin.textContent = _GID?"로그아웃":"로그인";
  4789.         if(btnGallog = $('.DCL_menuGallog')) {
  4790.             btnGallog.innerHTML = '';
  4791.             cElement("a",btnGallog,{textContent:"갤로그",id:"DCL_profile",href:_GID?"//gallog.dcinside.com/"+_GID:'',target:"_blank"},DCINSIDE_LITE.funcList.gallog);
  4792.  
  4793.             if(_GID) {
  4794.                 simpleRequest("http://gallog.dcinside.com/" + _GID, function(e) {
  4795.                     var gallogHtml = e.responseText;
  4796.                     var nick = gallogHtml.match(/id='pfNickView'>(.+?)<\/span>/)[1];
  4797.                     if(isFNick = nick.match(/<U>(.+?)<\/U>/)) {
  4798.                         nick = isFNick[1];
  4799.                         isFNick = true;
  4800.                     }
  4801.                     var pfImg = gallogHtml.match(/<img src="([^"]+)" width="[^"]+" id="ProfileImg"/)[1];
  4802.                     var bgImg = gallogHtml.match(/background-image:url\('([^ ]+) \?>'\);"><\/div>/)[1];
  4803.                     $id("DCL_menuTitle").textContent = "";
  4804.                     cElement("img",[$id("DCL_menuTitle"),0],{src:pfImg,className:"DCL_profileImage",alt:"프로필"});
  4805.                     var glog = cElement("a",$id("DCL_menuTitle"),{href:"//gallog.dcinside.com/" + _GID,target:"_blank",textContent:nick});
  4806.                     cElement("img",glog,{src:isFNick?"//wstatic.dcinside.com/gallery/skin/gallog/g_fix.gif":"http://wstatic.dcinside.com/gallery/skin/gallog/g_default.gif",className:"userType"});
  4807.                     cElement("em",$id("DCL_menuTitle"),_GID);
  4808.                     if(bgImg) addStyle("h2#DCL_menuTitle:before {background-image: url('" + bgImg + "') !important;}");
  4809.                     $id("DCL_menuTitle").removeEventListener("click",DCINSIDE_LITE.funcList.refresh);
  4810.  
  4811.                     if(P.menuPos === "top" && $id("DCL_profile")) {
  4812.                         $id("DCL_profile").className = "DCL_profile";
  4813.                         $id("DCL_profile").textContent = nick;
  4814.                         cElement("img",$id("DCL_profile"),{src:isFNick?"//wstatic.dcinside.com/gallery/skin/gallog/g_fix.gif":"http://wstatic.dcinside.com/gallery/skin/gallog/g_default.gif",className:"userType"});
  4815.                         cElement("em",$id("DCL_profile"),"갤로그 가기");
  4816.                     }
  4817.                 },'GET',{"Accept":"text/html,application/xhtml+xml,application/xml,*/*"});
  4818.             }
  4819.         }
  4820.     }
  4821.  
  4822.     function ilbeView() {
  4823.         // 일베 이미지 뷰어 등록
  4824.         if($('.best_img img',1).length<1) {
  4825.             setTimeout(ilbeView, 100);
  4826.             return;
  4827.         }
  4828.         var ilbeImg = $('.best_img img, .hit_img img, .issue_img img, .con_img img',1);
  4829.         var viewer = new Viewer();
  4830.         for(i=ilbeImg.length;ilbeImg[--i];) {
  4831.             viewer.add(ilbeImg[i].src,ilbeImg[i]);
  4832.         }
  4833.     }
  4834.  
  4835.     function time() {
  4836.         var dVal = new Date();
  4837.         return parseInt(dVal.getTime()/1000);
  4838.     }
  4839.  
  4840.     var ip2long = function(a,b,c,d){for(c=b=0;d=a.split('.')[b++];c+=d>>8|b>4?NaN:d*(1<<-8*b))d=parseInt(+d&&d);return c};
  4841.     var long2ip = function(a){return 1<<-1<=a&&a<4294967296&&[a>>>24,255&a>>>16,255&a>>>8,255&a].join('.')};
  4842.  
  4843.     // 실행 ; 미지원 브라우저, 알 수 없는 상태, 내부 iframe 에서는 실행 안함
  4844.     if(BROWSER && MODE && !$id('DCL_menuDiv')) {
  4845.         location.innerhost = location.host;
  4846.         if(window === window.top) {
  4847.             SET.load();
  4848.         }
  4849.     }
  4850. })();
Add Comment
Please, Sign In to add comment