PageSourceSearch

https://sodomnoichi.com/js/main.js

js sodomnoichi.com collected 2026-10-07 17:52:14 UTC 32,551 bytes, 1,101 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opens = _____WB$wombat$assign$function_____("opens");
10// The cookie name to use for storing the blog-side comment session cookie.
11var mtCookieName = "mt_blog_user";
12var mtCookieDomain = ".bunch.m10.coreserver.jp";
13var mtCookiePath = "/";
14var mtCookieTimeout = 14400;
15
16
17function mtHide(id) {
18    var el = (typeof id == "string") ? document.getElementById(id) : id;
19    if (el) el.style.display = 'none';
20}
21
22
23function mtShow(id) {
24    var el = (typeof id == "string") ? document.getElementById(id) : id;
25    if (el) el.style.display = 'block';
26}
27
28
29function mtAttachEvent(eventName,func) {
30    var onEventName = 'on' + eventName;
31    var old = window[onEventName];
32    if( typeof old != 'function' )
33        window[onEventName] = func;
34    else {
35        window[onEventName] = function( evt ) {
36            old( evt );
37            return func( evt );
38        };
39    }
40}
41
42
43function mtFireEvent(eventName,param) {
44    var fn = window['on' + eventName];
45    if (typeof fn == 'function') return fn(param);
46    return;
47}
48
49if(!this.JSON){JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});};}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;
49function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};}}());
50
51var MT = window.MT || {};
52
53MT.cons = function () {
54  return {
55    LOG : 'log',
56    WARN : 'warn',
57    DEBUG : 'debug',
58    INFO : 'info',
59    ERR : 'error',
60    JSON : 'json'
61  };
62}();
63
64
65MT.core = function (o) {
66  var _debug = false;
67  
68  return {
69    
70    connect : function (url,respType,respHandler) {
71      var xh = mtGetXmlHttp();
72      if (!xh) return false;
73      
74      xh.onreadystatechange = function() {
75        if ( xh.readyState == 4 ) {
76          if ( xh.status && ( xh.status != 200 ) ) {
77            // error - ignore
78          } else {
79            switch (respType) {
80              case 'json':
81                respHandler(JSON.parse(xh.responseText));
82                break;
83                
84              case 'xml':
85                break;
86                
87              case 'text':
88                break;
89            }
90          }
91        }
92      };
93      
94      xh.open('GET',url);
95      xh.send(null);
96    },
97    
98    getEl : function (el) {
99      return MT.util.checkNodeType(el)==='element' ? id : (document.getElementById(el) || false);
100    },
101    
102    addEvent : function (el,type,func,obj) {
103      if(!obj && document.addEventListener) {
104        el.addEventListener(type,func,false);
105      } else if(obj && document.addEventListener) {
106        el.addEventListener(type,function () {
107          func.call(obj,event);
108        },false);
109      } else {
110        if(obj) {
111          el.attachEvent('on' + type,function () {
112            func.call(obj,event);
113          });
114        } else {
115          el.attachEvent('on' + type,function () {          
116            func.call(el,event);
117          });
118        }
119      }
120    },
121    
122    
123    log : function (level,msg) {
124      if(_debug && window.console) {
125        switch(level) {
126          case 'warn':
127          case 'debug':
128          case 'info':
129          case 'error':
130          case 'log':
131            console[level](msg);
132            break;
133            
134          default:
135            return false; 
136        }
137      } else {
138        return false;
139      }
140    }
141  }
142}();
143
144
145MT.util = function () {
146  return {
147    toggleVisibility : {
148      show : function () {
149        var i = arguments.length;
150        
151        while(i--) {
152          if(MT.util.checkNodeType(arguments[i])==='element') {
153            arguments[i].style.visibility = 'visible';
154          } else {
155            MT.core.getEl(arguments[i]).style.visibility = 'visible';
156          }
157        }
158      },
159      
160      hide : function () {
161        var i = arguments.length;
162        while(i--) {
163          if(MT.util.checkNodeType(arguments[i])==='element') {
164            arguments[i].style.visibility = 'hidden';
165          } else {
166            MT.core.getEl(arguments[i]).style.visibility = 'hidden';
167          }
168        }
169      }
170    },
171    
172    toggleDisplay : {
173      show : function () {
174        var i = arguments.length;
175        while(i--) {
176          if(MT.util.checkNodeType(arguments[i])==='element') {
177            arguments[i].style.display = '';
178          } else {
179            MT.core.getEl(arguments[i]).style.display = '';
180          }
181        }
182      },
183      
184      hide : function () {
185        var i = arguments.length;
186        while(i--) {
187          if(MT.util.checkNodeType(arguments[i])==='element') {
188            arguments[i].style.display = 'none';
189          } else {
190            MT.core.getEl(arguments[i]).style.display = 'none';
191          }
192        }
193      }
194    },
195    
196    
197    findDefiningParent : function (origin) {
198      if(MT.util.checkNodeType(origin)==='element') {
199        for(var node=origin.parentNode;node.parentNode;node=node.parentNode) {
200          if((node.hasAttribute && node.hasAttribute('id')) || node.getAttribute('id')) {
201            return node;
202          }
203        }
204      }
205      return false;
206    },
207    
208    
209    checkNodeType : function (obj) {
210      if (obj && obj.nodeName){
211        switch (obj.nodeType) {
212          case 1: return 'element';
213          case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
214        }
215      }
216    }
217  }
218}();
219
220
221(function () {
222  var M = MT.core,
223      c = MT.cons,
224      u = MT.util,
225      cache,
226      isLoading,
227      direction,
228      currentComments,
229      commentAnchor,
230      commentArrId,
231      commentsPerPage,
232      commentsTotalPages,
233      loadingIcon,
234      pageNum,
235      commentsOffset,
236      totalComments,
237      entryID,
238      commentContentDiv,
239      topNav,
240      nav,
241      currentCommentsSpan,
242      topCurrentCommentsSpan;
243            
244  M.addEvent(window,'load',_init);
245  
246  /**
247   * Initializes the class
248   * 
249   * @return void
250   */
251  function _init () {
252    if(!MT.entryCommentCount) {
253      return;
254    }
255    
256    _initializeVariables();
257    _setCommentOffset(false);
258    _checkForAnchor();
259		_setCurrentComments();
260    _toggleNavLinks();
261    _initializeEvents();
262  }
263  
264  
265  function _initializeVariables() {
266    cache = {};
267    isLoading = false;
268    commentAnchor = '';
269    commentArrId = '';
270    commentsPerPage = MT.commentsPerPage || 50;
271    currentComments = '';
272    direction = 'ascend';
273    entryID = MT.entryID;
274    totalComments = MT.entryCommentCount;
275    commentsTotalPages = Math.ceil(totalComments / commentsPerPage);
276    pageNum = 1;
277    
278    loadingIcon = "<img title='Loading...' src='http://bunch.m10.coreserver.jp/mt/mt-static/images/indicator.white.gif' alt='Loading' />";
279    
280    commentContentDiv = M.getEl("comments-content");
281    topNav = M.getEl("top-comment-nav");
282    nav = M.getEl("comment-nav");
283    
284    currentCommentsSpan = M.getEl("current-comments");
285    topCurrentCommentsSpan = M.getEl("top-current-comments");
286  }
287  
288  function _initializeEvents() {
289    if (commentsPerPage < totalComments) {
290      M.addEvent(nav,'click',_handleEvents);
291      M.addEvent(topNav,'click',_handleEvents);
292    }
293  }
294  
295  
296  function _checkForAnchor() {
297    var found = String(window.location.hash).match( /comment-(\d{1,6})/ );
298		
299		if (found) {
300		  M.log(c.DEBUG,found);
301			if (!Object.prototype.hasOwnProperty.call(M.getEl(found[0]), 'className')) {
302				if (_findIdMatch(found[1])) {
303    			pageNum = Math.floor(commentArrId / commentsPerPage) + 1;
304    			M.log(c.DEBUG,'Comment Array Id: ' + commentArrId);
305    			M.log(c.DEBUG,'Comments Per Page: ' + commentsPerPage);
306    			M.log(c.DEBUG,'Page Number: ' + pageNum);
307    			M.log(c.DEBUG,'Comment Offset: ' + _getCommentOffset());
308    			_updateComments();
309    		}
310			}
311		}
312  }
313  
314  
315  function _setCommentOffset() {
316    commentsOffset = commentsPerPage * (pageNum-1);
317  }
318  
319  
320  function _getCommentOffset() {
321    return commentsOffset;
322  }
323  
324  
325  function _handleEvents (e) {
326    var origin = e.target || e.srcElement,
327        parentId;
328        
329    // stupid IE
330    origin = origin.id && M.getEl(origin.id) || false;
331
332    if(origin) {
333      parentId = u.checkNodeType(origin.parentNode)==='element' && origin.parentNode.getAttribute('id') && origin.parentNode.id;
334    } else {
335      return false;
336    }
337    
338    switch(origin.nodeName) {
339      case 'A':
340        switch (parentId) {
341          case 'prev-comments':
342          case 'top-prev-comments':
343            if(e.preventDefault) {
344              e.preventDefault();
345            } else {
346              e.returnValue =	false;
347            }
348            if(!isLoading) {
349              _previousPage();
350            }
351            break;
352          case 'next-comments':
353          case 'top-next-comments':
354            if(e.preventDefault) {
355              e.preventDefault();
356            } else {
357              e.returnValue =	false;
358            }
359            if(!isLoading) {
360              _nextPage();
361            }
362            break;
363        }
364        break;
365    }
366  }
367  
368  
369  function _toggleNavLinks () {
370    M.log(c.DEBUG,M.getEl('top-prev-comments'));
371    if(pageNum <= commentsTotalPages && pageNum !== 1) {
372      u.toggleVisibility.show('prev-comments');
373      u.toggleVisibility.show('top-prev-comments');
374    }
375    
376    if(pageNum >= 1 && pageNum !== commentsTotalPages) {
377      u.toggleVisibility.show('next-comments');
378      u.toggleVisibility.show('top-next-comments');
379    }
380    
381    if(pageNum===1 || nav.style.visibility==='hidden') {
382      u.toggleVisibility.hide('prev-comments');
383      u.toggleVisibility.hide('top-prev-comments');
384    }
385    
386    if(pageNum===commentsTotalPages || nav.style.visibility==='hidden') {
387      u.toggleVisibility.hide('next-comments');
388      u.toggleVisibility.hide('top-next-comments');
389    }
390  }
391  
392  
393  function _nextPage () {
394    if(pageNum < commentsTotalPages) {
395      pageNum++;
396      _updateComments();
397    }
398  }
399  
400  
401  function _previousPage() {
402    if(pageNum > 1) {
403      pageNum--;
404      _updateComments();
405    }
406  }
407  
408  
409  function _findIdMatch (id) {
410    var len = MT.commentIds.length;
411    
412  	while (len--) {
413  		if (MT.commentIds[len] == id) {
414  			commentAnchor = "comment-" + id;
415  			commentArrId = len;
416  			return true;
417  		}
418  	}
419  	
420  	return false;
421  }
422  
423  
424  function _setCurrentComments() {
425    var commentsOnPage = pageNum != commentsTotalPages ? commentsOffset + commentsPerPage : totalComments;
426    
427    _setCurrentCommentsContent([commentsOffset+1," - ",commentsOnPage].join(''));
428  }
429  
430  
431  function _setCurrentCommentsContent(currentCommentsHTML) {
432    currentCommentsSpan.innerHTML = currentCommentsHTML;
433    topCurrentCommentsSpan.innerHTML = currentCommentsHTML;
434  }
435  
436  
437  function _setCommentContent(commentHTML) {
438    commentContentDiv.innerHTML = commentHTML;
439  }
440  
441  
442  function _updateComments() {
443    var comments, jsonUrl, cacheKey, offset;
444    isLoading = true;
445    _setCurrentCommentsContent(loadingIcon);
446    _setCommentOffset();
447
448    offset   = _getCommentOffset();
449    cacheKey = [direction, entryID, commentsPerPage, offset]
450        .join('-')
451        .replace(/[^a-zA-Z0-9-]/g, '');
452    jsonUrl  = [
453        "http://bunch.m10.coreserver.jp/mt/mt-comments.cgi?__mode=comment_listing&direction=",
454        direction,
455        "&entry_id=",
456        entryID,
457        "&limit=",
458        commentsPerPage,
459        "&offset=",
460        offset,
461        "&cacheKey=",
462        cacheKey,
463        "&jsonp=mtUpdateCommentsCallback",
464        "&ts=",
465        new Date().getTime()
466      ].join('');
467  	
468  	if (!commentAnchor) {
469      commentAnchor = "comments-content";
470    }
471
472    if(cache.hasOwnProperty(cacheKey)) {
473      _refreshComments(cache[cacheKey]);
474      isLoading = false;
475    } else {
476      var script = document.createElement('script');
477      script.src = jsonUrl;
478      (document.getElementsByTagName('head'))[0].appendChild(script);
479    }
480  }
481
482  window['mtUpdateCommentsCallback'] = function(json) {
483    cache[json.cacheKey] = json.comments;
484    _refreshComments(json.comments);
485    isLoading = false;
486  }
487  
488  
489  function _refreshComments(commentData) {
490    _setCommentContent(commentData);
491    _setCurrentComments();
492    window.location.hash = 'reset';
493    window.location.hash = commentAnchor;
494    _toggleNavLinks();
495  }
496})();
497
498
499function mtRelativeDate(ts, fds) {
500    var now = new Date();
501    var ref = ts;
502    var delta = Math.floor((now.getTime() - ref.getTime()) / 1000);
503
504    var str;
505    if (delta < 60) {
506        str = '直前';
507    } else if (delta <= 86400) {
508        // less than 1 day
509        var hours = Math.floor(delta / 3600);
510        var min = Math.floor((delta % 3600) / 60);
511        if (hours == 1)
512            str = '1 時間前';
513        else if (hours > 1)
514            str = '2 時間前'.replace(/2/, hours);
515        else if (min == 1)
516            str = '1 分前';
517        else
518            str = '2 分前'.replace(/2/, min);
519    } else if (delta <= 604800) {
520        // less than 1 week
521        var days = Math.floor(delta / 86400);
522        var hours = Math.floor((delta % 86400) / 3600);
523        if (days == 1)
524            str = '1 日前';
525        else if (days > 1)
526            str = '2 日前'.replace(/2/, days);
527        else if (hours == 1)
528            str = '1 時間前';
529        else
530            str = '2 時間前'.replace(/2/, hours);
531    }
532    return str ? str : fds;
533}
534
535
536function mtEditLink(entry_id, author_id) {
537    
538    
539}
540
541
542function mtCommentFormOnFocus() {
543    // if CAPTCHA is enabled, this causes the captcha image to be
544    // displayed if it hasn't been already.
545    mtShowCaptcha();
546}
547
548
549var mtCaptchaVisible = false;
550function mtShowCaptcha() {
551    var u = mtGetUser();
552    if ( u && u.is_authenticated ) return;
553    if (mtCaptchaVisible) return;
554    var div = document.getElementById('comments-open-captcha');
555    if (div) {
556        div.innerHTML = '';
557        mtCaptchaVisible = true;
558    }
559}
560
561
562
563var is_preview;
564var user;
565
566function mtSetUser(u) {
567    if (u) {
568        // persist this
569        user = u;
570        mtSaveUser();
571        // sync up user greeting
572        mtFireEvent('usersignin');
573    }
574}
575
576
577function mtEscapeJS(s) {
578    s = s.replace(/'/g, "&apos;");
579    return s;
580}
581
582
583function mtUnescapeJS(s) {
584    s = s.replace(/&apos;/g, "'");
585    return s;
586}
587
588
589function mtBakeUserCookie(u) {
590    var str = "";
591    if (u.name) str += "name:'" + mtEscapeJS(u.name) + "';";
592    if (u.url) str += "url:'" + mtEscapeJS(u.url) + "';";
593    if (u.email) str += "email:'" + mtEscapeJS(u.email) + "';";
594    if (u.is_authenticated) str += "is_authenticated:'1';";
595    if (u.profile) str += "profile:'" + mtEscapeJS(u.profile) + "';";
596    if (u.userpic) str += "userpic:'" + mtEscapeJS(u.userpic) + "';";
597    if (u.sid) str += "sid:'" + mtEscapeJS(u.sid) + "';";
598    str += "is_trusted:'" + (u.is_trusted ? "1" : "0") + "';";
599    str += "is_author:'" + (u.is_author ? "1" : "0") + "';";
600    str += "is_banned:'" + (u.is_banned ? "1" : "0") + "';";
601    str += "can_post:'" + (u.can_post ? "1" : "0") + "';";
602    str += "can_comment:'" + (u.can_comment ? "1" : "0") + "';";
603    str = str.replace(/;$/, '');
604    return str;
605}
606
607
608function mtUnbakeUserCookie(s) {
609    if (!s) return;
610
611    var u = {};
612    var m;
613    while (m = s.match(/^((name|url|email|is_authenticated|profile|userpic|sid|is_trusted|is_author|is_banned|can_post|can_comment):'([^']+?)';?)/)) {
614        s = s.substring(m[1].length);
615        if (m[2].match(/^(is|can)_/)) // boolean fields
616            u[m[2]] = m[3] == '1' ? true : false;
617        else
618            u[m[2]] = mtUnescapeJS(m[3]);
619    }
620    if (u.is_authenticated) {
621        u.is_anonymous = false;
622    } else {
623        u.is_anonymous = true;
624        u.can_post = false;
625        u.is_author = false;
626        u.is_banned = false;
627        u.is_trusted = false;
628    }
629    return u;
630}
631
632
633function mtGetUser() {
634    if (!user) {
635        var cookie = mtGetCookie(mtCookieName);
636        if (!cookie) return;
637        user = mtUnbakeUserCookie(cookie);
638        if (! user) {
639            user = {};
640            user.is_anonymous = true;
641            user.can_post = false;
642            user.is_author = false;
643            user.is_banned = false;
644            user.is_trusted = false;
645        }
646    }
647    return user;
648}
649
650
651var mtFetchedUser = false;
652
653function mtFetchUser(cb) {
654    if (!cb) cb = 'mtSetUser';
655    if ( ( cb == 'mtSetUser' ) && mtGetUser() ) {
656        var url = document.URL;
657        url = url.replace(/#.+$/, '');
658        url += '#comments-open';
659        location.href = url;
660    } else {
661        // we aren't using AJAX for this, since we may have to request
662        // from a different domain. JSONP to the rescue.
663        mtFetchedUser = true;
664        var u = mtGetUser();
665        var script = document.createElement('script');
666        var ts = new Date().getTime();
667        script.src = 'http://bunch.m10.coreserver.jp/mt/mt-comments.cgi?__mode=userinfo&blog_id=1&jsonp=' + cb + '&ts=' + ts + '&sid=' + u.sid;
668        (document.getElementsByTagName('head'))[0].appendChild(script);
669    }
670}
671
672function mtVerifySession(cb) {
673    if (!cb) return;
674    var script = document.createElement('script');
675    var ts = new Date().getTime();
676    var u = mtGetUser();
677    script.src = 'http://bunch.m10.coreserver.jp/mt/mt-comments.cgi?__mode=verify_session&blog_id=1&jsonp=' + cb + '&ts=' + ts + '&sid=' + u.sid;
678    (document.getElementsByTagName('head'))[0].appendChild(script);
679}
680
681
682
683function mtRememberMeOnClick(b) {
684    if (!b.checked)
685        mtClearUser(b.form);
686    return true;
687}
688
689
690
691var mtRequestSubmitted = false;
692function mtCommentOnSubmit(f) {
693    if (!mtRequestSubmitted) {
694        mtRequestSubmitted = true;
695
696        if (f.armor)
697            f.armor.value = 'c7f4178abb466d6cc6ebcf439671d71df57a1229';
698        if (f.bakecookie && f.bakecookie.checked)
699            mtSaveUser(f);
700
701        // disable submit buttons
702        if (f.preview_button) f.preview_button.disabled = true;
703        if (f.post) f.post.disabled = true;
704
705        var u = mtGetUser();
706        if ( !is_preview && ( u && u.is_authenticated ) ) {
707            // validate session; then submit
708            mtVerifySession('mtCommentSessionVerify');
709            return false;
710        }
711
712        return true;
713    }
714    return false;
715}
716
717function mtCommentSessionVerify(app_user) {
718    var f = document['comments_form'];
719    if ( app_user && app_user.verified ) {
720        f.submit();
721    } else {
722        alert('セッションの有効期限が切れています。再度サインインしてください。');
723        mtClearUser();
724        mtFireEvent('usersignin');
725
726    }
727}
728
729function mtUserOnLoad() {
730    var u = mtGetUser();
731
732    // if the user is authenticated, hide the 'anonymous' fields
733    // and any captcha input if already shown
734    if ( document.getElementById('comments-form')) {
735        if ( u && u.is_authenticated ) {
736            mtShow('comments-form');
737            mtHide('comments-open-data');
738            if (mtCaptchaVisible)
739                mtHide('comments-open-captcha');
740        } else {
741
742        }
743        if ( u && u.is_banned )
744            mtHide('comments-form');
745
746        // if we're previewing a comment, make sure the captcha
747        // field is visible
748        if (is_preview)
749            mtShowCaptcha();
750        else
751            mtShowGreeting();
752
753        // populate anonymous comment fields if user is cookied as anonymous
754        var cf = document['comments_form'];
755        if (cf) {
756            if (u && u.is_anonymous) {
757                if (u.email) cf.email.value = u.email;
758                if (u.name) cf.author.value = u.name;
759                if (u.url) cf.url.value = u.url;
760                if (cf.bakecookie)
761                    cf.bakecookie.checked = u.name || u.email;
762            } else {
763                if (u && u.sid && cf.sid)
764                    cf.sid.value = u.sid;
765            }
766            if (cf.post && cf.post.disabled)
767                cf.post.disabled = false;
768            if (cf.preview_button && cf.preview_button.disabled)
769                cf.preview_button.disabled = false;
770            mtRequestSubmitted = false;
771        }
772    }
773}
774
775
776
777
778function mtEntryOnLoad() {
779    var cf = document['comments_form'];
780    if (cf && cf.preview) cf.preview.value = '';
781    mtHide('trackbacks-info');
782    mtHide('comments-open');
783    mtFireEvent('usersignin');
784}
785
786function mtEntryOnUnload() {
787    if (mtRequestSubmitted) {
788        var cf = document['comments_form'];
789        if (cf) {
790            if (cf.post && cf.post.disabled)
791                cf.post.disabled = false;
792            if (cf.preview_button && cf.preview_button.disabled)
793                cf.preview_button.disabled = false;
794        }
795        mtRequestSubmitted = false;
796    }
797    return true;
798}
799
800mtAttachEvent('usersignin', mtUserOnLoad);
801
802
803
804function mtSignIn() {
805    var doc_url = document.URL;
806    doc_url = doc_url.replace(/#.+/, '');
807    var url = 'http://bunch.m10.coreserver.jp/mt/mt-cp.cgi?__mode=login&blog_id=1';
808    if (is_preview) {
809        if ( document['comments_form'] ) {
810            var entry_id = document['comments_form'].entry_id.value;
811            url += '&entry_id=' + entry_id;
812        } else {
813            url += '&return_url=http%3A%2F%2Fbunch.m10.coreserver.jp%2Fbasic%2F';
814        }
815    } else {
816        url += '&return_url=' + encodeURIComponent(doc_url);
817    }
818    mtClearUser();
819    location.href = url;
820}
821
822function mtSignInOnClick(sign_in_element) {
823    var el;
824    if (sign_in_element) {
825        // display throbber
826        el = document.getElementById(sign_in_element);
827        if (!el)  // legacy MT 4.x element id
828            el = document.getElementById('comment-form-external-auth');
829    }
830    if (el)
831        el.innerHTML = 'サインインします... <span class="status-indicator">&nbsp;</span>';
832
833    mtClearUser(); // clear any 'anonymous' user cookie to allow sign in
834    mtSignIn();
835    return false;
836}
837
838function mtSetUserOrLogin(u) {
839    if (u && u.is_authenticated) {
840        mtSetUser(u);
841    } else {
842        // user really isn't logged in; so let's do this!
843        mtSignIn();
844    }
845}
846
847
848function mtSignOut(entry_id) {
849    mtClearUser();
850    var doc_url = document.URL;
851    doc_url = doc_url.replace(/#.+/, '');
852    var url = 'http://bunch.m10.coreserver.jp/mt/mt-cp.cgi?__mode=logout&static=0&blog_id=1';
853    if (is_preview) {
854        if ( document['comments_form'] ) {
855            var entry_id = document['comments_form'].entry_id.value;
856            url += '&entry_id=' + entry_id;
857        } else {
858            url += '&return_url=http%3A%2F%2Fbunch.m10.coreserver.jp%2Fbasic%2F';
859        }
860    } else {
861        url += '&return_url=' + encodeURIComponent(doc_url);
862    }
863    location.href = url;
864}
865
866
867function mtSignOutOnClick() {
868    mtSignOut();
869    return false;
870}
871
872
873
874function mtShowGreeting() {
875
876    mtShowCaptcha();
877
878}
879
880
881
882function mtReplyCommentOnClick(parent_id, author) {
883    mtShow('comment-form-reply');
884
885    var checkbox = document.getElementById('comment-reply');
886    var label = document.getElementById('comment-reply-label');
887    var text = document.getElementById('comment-text');
888
889    // Populate label with new values
890    var reply_text = '\<a href=\"#comment-__PARENT__\" onclick=\"location.href=this.href; return false\"\>__AUTHOR__からのコメント\<\/a\>に返信';
891    reply_text = reply_text.replace(/__PARENT__/, parent_id);
892    reply_text = reply_text.replace(/__AUTHOR__/, author);
893    label.innerHTML = reply_text;
894
895    checkbox.value = parent_id; 
896    checkbox.checked = true;
897    try {
898        // text field may be hidden
899        text.focus();
900    } catch(e) {
901    }
902
903    mtSetCommentParentID();
904}
905
906
907function mtSetCommentParentID() {
908    var checkbox = document.getElementById('comment-reply');
909    var parent_id_field = document.getElementById('comment-parent-id');
910    if (!checkbox || !parent_id_field) return;
911
912    var pid = 0;
913    if (checkbox.checked == true)
914        pid = checkbox.value;
915    parent_id_field.value = pid;
916}
917
918
919function mtSaveUser(f) {
920    // We can't reliably store the user cookie during a preview.
921    if (is_preview) return;
922
923    var u = mtGetUser();
924
925    if (f && (!u || u.is_anonymous)) {
926        if ( !u ) {
927            u = {};
928            u.is_authenticated = false;
929            u.can_comment = true;
930            u.is_author = false;
931            u.is_banned = false;
932            u.is_anonymous = true;
933            u.is_trusted = false;
934        }
935        if (f.author != undefined) u.name = f.author.value;
936        if (f.email != undefined) u.email = f.email.value;
937        if (f.url != undefined) u.url = f.url.value;
938    }
939
940    if (!u) return;
941
942    var cache_period = mtCookieTimeout * 1000;
943
944    // cache anonymous user info for a long period if the
945    // user has requested to be remembered
946    if (u.is_anonymous && f && f.bakecookie && f.bakecookie.checked)
947        cache_period = 365 * 24 * 60 * 60 * 1000;
948
949    var now = new Date();
950    mtFixDate(now);
951    now.setTime(now.getTime() + cache_period);
952
953    var cmtcookie = mtBakeUserCookie(u);
954    mtSetCookie(mtCookieName, cmtcookie, now, mtCookiePath, mtCookieDomain,
955        location.protocol == 'https:');
956}
957
958
959function mtClearUser() {
960    user = null;
961    mtDeleteCookie(mtCookieName, mtCookiePath, mtCookieDomain,
962        location.protocol == 'https:');
963}
964
965
966function mtSetCookie(name, value, expires, path, domain, secure) {
967    if (domain && ( domain.match(/^\.?localhost$/) || domain.match(/^[0-9\.]+$/) ))
968        domain = null;
969    var curCookie = name + "=" + encodeURIComponent(value) +
970        (expires ? "; expires=" + expires.toGMTString() : "") +
971        (path ? "; path=" + path : "") +
972        (domain ? "; domain=" + domain : "") +
973        (secure ? "; secure" : "");
974    document.cookie = curCookie;
975}
976
977
978function mtGetCookie(name) {
979    var prefix = name + '=';
980    var c = document.cookie;
981    var cookieStartIndex = c.indexOf(prefix);
982    if (cookieStartIndex == -1)
983        return '';
984    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
985    if (cookieEndIndex == -1)
986        cookieEndIndex = c.length;
987    var this_cookie = c.substring(cookieStartIndex + prefix.length, cookieEndIndex);
988    if ( this_cookie.match(/\%u/i) ) {
989        return '';
990    }
991    return decodeURIComponent( this_cookie );
992}
993
994
995function mtDeleteCookie(name, path, domain, secure) {
996    if (mtGetCookie(name)) {
997        if (domain && domain.match(/^\.?localhost$/))
998            domain = null;
999        document.cookie = name + "=" +
1000            (path ? "; path=" + path : "") +
1001            (domain ? "; domain=" + domain : "") +
1002            (secure ? "; secure" : "") +
1003            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
1004    }
1005}
1006
1007function mtFixDate(date) {
1008    var skew = (new Date(0)).getTime();
1009    if (skew > 0)
1010        date.setTime(date.getTime() - skew);
1011}
1012
1013
1014function mtGetXmlHttp() {
1015    if ( !window.XMLHttpRequest ) {
1016        window.XMLHttpRequest = function() {
1017            var types = [
1018                "Microsoft.XMLHTTP",
1019                "MSXML2.XMLHTTP.5.0",
1020                "MSXML2.XMLHTTP.4.0",
1021                "MSXML2.XMLHTTP.3.0",
1022                "MSXML2.XMLHTTP"
1023            ];
1024
1025            for ( var i = 0; i < types.length; i++ ) {
1026                try {
1027                    return new ActiveXObject( types[ i ] );
1028                } catch( e ) {}
1029            }
1030
1031            return undefined;
1032        };
1033    }
1034    if ( window.XMLHttpRequest )
1035        return new XMLHttpRequest();
1036}
1037
1038// BEGIN: fast browser onload init
1039// Modifications by David Davis, DWD
1040// Dean Edwards/Matthias Miller/John Resig
1041// http://dean.edwards.name/weblog/2006/06/again/?full#comment5338
1042
1043function mtInit() {
1044    // quit if this function has already been called
1045    if (arguments.callee.done) return;
1046
1047    // flag this function so we don't do the same thing twice
1048    arguments.callee.done = true;
1049
1050    // kill the timer
1051    // DWD - check against window
1052    if ( window._timer ) clearInterval(window._timer);
1053
1054    // DWD - fire the window onload now, and replace it
1055    if ( window.onload && ( window.onload !== window.mtInit ) ) {
1056        window.onload();
1057        window.onload = function() {};
1058    }
1059
1060
1061
1062}
1063
1064/* for Mozilla/Opera9 */
1065if (document.addEventListener) {
1066    document.addEventListener("DOMContentLoaded", mtInit, false);
1067}
1068
1069/* for Internet Explorer */
1070/*@cc_on @*/
1071/*@if (@_win32)
1072if (!document.addEventListener){
1073  document.write("<script id=__ie_onload defer src=//:><\/script>");
1074  var script = document.getElementById("__ie_onload");
1075  script.onreadystatechange = function() {
1076      if (this.readyState == "complete") {
1077          mtInit(); // call the onload handler
1078      }
1079  };
1080}
1081/*@end @*/
1082
1083/* for Safari */
1084if (/WebKit/i.test(navigator.userAgent)) { // sniff
1085    _timer = setInterval(function() {
1086        if (/loaded|complete/.test(document.readyState)) {
1087            mtInit(); // call the onload handler
1088        }
1089    }, 10);
1090}
1091
1092/* for other browsers */
1093window.onload = mtInit;
1094
1095// END: fast browser onload init
1096
1097
1098
1099
1100
1101}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.