svnno****@sourc*****
svnno****@sourc*****
2010年 2月 25日 (木) 20:25:22 JST
Revision: 839 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=839 Author: rsk Date: 2010-02-25 20:25:22 +0900 (Thu, 25 Feb 2010) Log Message: ----------- expack: - JavaScriptãä¸é¨ãªãã¡ã¯ã¿ãªã³ã°ã Modified Paths: -------------- p2ex/trunk/iv2.php p2ex/trunk/js/basic.js p2ex/trunk/js/subject.js p2ex/trunk/lib/sb_header.inc.php -------------- next part -------------- Modified: p2ex/trunk/iv2.php =================================================================== --- p2ex/trunk/iv2.php 2010-02-24 15:41:59 UTC (rev 838) +++ p2ex/trunk/iv2.php 2010-02-25 11:25:22 UTC (rev 839) @@ -726,7 +726,7 @@ // 32400 = 9*60*60 (·â³) $time2date = sprintf('floor((%s + 32400) / 86400)', $db->quoteIdentifier('time')); } - $orderBy .= sprintf('%s %s, %s ', $time2date, $sort, $db->quoteIdentifier('uri')); + $orderBy = sprintf('%s %s, %s ', $time2date, $sort, $db->quoteIdentifier('uri')); if ($order == 'date_uri') { $orderBy .= $sort; } else { Modified: p2ex/trunk/js/basic.js =================================================================== --- p2ex/trunk/js/basic.js 2010-02-24 15:41:59 UTC (rev 838) +++ p2ex/trunk/js/basic.js 2010-02-25 11:25:22 UTC (rev 839) @@ -1,8 +1,9 @@ -/* p2 - î{JavaScriptt@C */ +/* rep2 - î{JavaScriptt@C */ +var rep2 = { 'util': {}, 'info': {}, 'menu': {}, 'read': {}, 'subject': {} }; + // TuEBhEð|bvAbv·é -function OpenSubWin(inUrl, inWidth, inHeight, boolS, boolR, boolW) -{ +rep2.util.openSubWindow = function (inUrl, inWidth, inHeight, boolS, boolR, boolW) { var proparty3rd = "width=" + inWidth + ",height=" + inHeight + ",scrollbars=" + boolS + ",resizable=1"; SubWin = window.open(inUrl,"",proparty3rd); if (boolR == 1) { @@ -13,11 +14,12 @@ return SubWin; } return false; -} +}; +var OpenSubWin = rep2.util.openSubWindow; + // HTMLhL gÌ^CgðZbg·é -function setWinTitle() -{ +rep2.util.setWindowTitle = function () { if (top != self) { try { top.document.title = self.document.title; @@ -25,21 +27,12 @@ // ½àµÈ¢ } } -} +}; +var setWinTitle = rep2.util.setWindowTitle; + // DOMIuWFNgðæ¾ -function p2GetElementById(id) -{ - if (document.getElementById) { - return (document.getElementById(id)); - } else if (document.all) { - return (document.all[id]); - } else if (document.layers) { - return (document.layers[id]); - } else { - return false; - } -} +var p2GetElementById = document.getElementById; // XMLHttpRequest IuWFNgðæ¾ function getXmlHttp() @@ -68,8 +61,7 @@ function getResponseTextHttp(objHTTP, url, nc) { if (nc) { - var now = new Date(); - url = url + '&' + nc + '=' + now.getTime(); // LbV ñðp + url = url + '&' + nc + '=' + (new Date()).getTime(); // LbV ñðp } objHTTP.open('GET', url, false); objHTTP.send(null); Modified: p2ex/trunk/js/subject.js =================================================================== --- p2ex/trunk/js/subject.js 2010-02-24 15:41:59 UTC (rev 838) +++ p2ex/trunk/js/subject.js 2010-02-25 11:25:22 UTC (rev 839) @@ -2,20 +2,11 @@ * rep2expack - XêpJavaScript */ -// {{{ GLOBALS - -if (typeof rep2 === 'undefined') { - rep2 = {}; -} - -rep2.subject = {}; - -// }}} // {{{ rep2.subject.setWindowTitle() rep2.subject.setWindowTitle = function () { - if (sb_vars.shinchaku_ari) { - window.top.document.title = '' + sb_vars.ptitle; + if (rep2.subject.properties.shinchaku_ari) { + window.top.document.title = '' + rep2.subject.properties.page_title; } else { if (window.top != window.self) { window.top.document.title = window.self.document.title; @@ -27,42 +18,48 @@ // {{{ rep2.subject.changeNewAllColor() rep2.subject.changeNewAllColor = function () { - $('#smynum1, #smynum2, a.un_a').css('color', sb_vars.ttcolor); + $('#smynum1, #smynum2, a.un_a').css('color', rep2.subject.properties.ttcolor); }; // }}} // {{{ rep2.subject.changeUnReadColor() rep2.subject.changeUnReadColor = function (idnum) { - $('#un' + idnum).css('color', sb_vars.ttcolor); + $('#un' + idnum).css('color', rep2.subject.properties.ttcolor); } // }}} // {{{ rep2.subject.changeThreadTitleColor() rep2.subject.changeThreadTitleColor = function (idnum) { - $('#tt' + idnum + ', #to' + idnum).css('color', sb_vars.ttcolor_v); + $('#tt' + idnum + ', #to' + idnum).css('color', rep2.subject.properties.ttcolor_v); }; // }}} // {{{ rep2.subject.deleteLog() rep2.subject.deleteLog = function (qeury, from) { - return deleLog(qeury, sb_vars.pop_size[0], sb_vars.pop_size[1], 'subject', from); + var width = rep2.subject.properties.pop_size[0]; + var height = rep2.subject.properties.pop_size[1]; + return deleLog(qeury, width, height, 'subject', from); }; // }}} // {{{ rep2.subject.setFavorite() rep2.subject.setFavorite = function (query, favdo, from) { - return setFavJs(query, favdo, sb_vars.pop_size[0], sb_vars.pop_size[1], 'subject', from); + var width = rep2.subject.properties.pop_size[0]; + var height = rep2.subject.properties.pop_size[1]; + return setFavJs(query, favdo, width, height, 'subject', from); }; // }}} // {{{ rep2.subject.openSubWindow() rep2.subject.openSubWindow = function (url) { - return OpenSubWin(url + '&popup=1', sb_vars.pop_size[0], sb_vars.pop_size[1], 0, 0); + var width = rep2.subject.properties.pop_size[0]; + var height = rep2.subject.properties.pop_size[1]; + return rep2.util.openSubWindow(url + '&popup=1', width, height, 0, 0); }; // }}} @@ -122,17 +119,19 @@ // {{{ $(document).ready() $(document).ready(function(){ - rep2.subject.setWindowTitle(); - rep2.subject.resizeTitleCell(); + var _ = rep2.subject; + _.setWindowTitle(); + _.resizeTitleCell(); + // ÅßÇñ¾Xð $('.threadlist td.tc a[href$="&offrec=true"]').click(function(){ - return rep2.subject.offRecent(this); + return _.offRecent(this); }); // îñEChE\¦ $('.threadlist td.to a.info').click(function(){ - return rep2.subject.openSubWindow(this.href.toString()); + return _.openSubWindow(this.href); }); // URL©çhost-bbs-keyðo·é³K\» @@ -144,28 +143,23 @@ if (!window.confirm('OðíµÜ·©H')) { return false; } - return rep2.subject.deleteLog(re.exec($(this).attr('href'))[1], this); + return _.deleteLog(re.exec(this.href)[1], this); }); $('.threadlist td.tu').find('a.un, a.un_a').click(function(){ - return rep2.subject.deleteLog(re.exec($(this).attr('href'))[1], this); + return _.deleteLog(re.exec(this.href)[1], this); }); // ÍÍðwèµÄ³XðJ¬|bvAbvj [ var hover = function (event) { - rep2.subject.showMotoLsPopUp(event, this); + _.showMotoLsPopUp(event, this); }; // Xbh^Cg̶FðÏX - var generator = function (id, midoku_ari) { - if (midoku_ari) { - return (function(){ - rep2.subject.changeThreadTitleColor(id); - rep2.subject.changeUnReadColor(id); - }); - } else { - return (function(){ - rep2.subject.changeThreadTitleColor(id); - }); + var click = function () { + var id = this.id.substring(2); + _.changeThreadTitleColor(id); + if ($(this).hasClass('midoku_ari')) { + _.changeUnReadColor(id); } }; @@ -176,7 +170,7 @@ self.hover(hover, hideMotoLsPopUp); } else { self.attr('title', self.text()); - self.click(generator(self.attr('id').substring(2), self.hasClass('midoku_ari'))); + self.click(click); } }) Modified: p2ex/trunk/lib/sb_header.inc.php =================================================================== --- p2ex/trunk/lib/sb_header.inc.php 2010-02-24 15:41:59 UTC (rev 838) +++ p2ex/trunk/lib/sb_header.inc.php 2010-02-25 11:25:22 UTC (rev 839) @@ -220,9 +220,9 @@ <script type="text/javascript" src="js/jquery-1.4.1.min.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript"> //<![CDATA[ - var sb_vars = { + rep2.subject.properties = { 'shinchaku_ari': {$shinchaku_attayo_json}, - 'ptitle': {$ptitle_json}, + 'page_title': {$ptitle_json}, 'ttcolor': {$JSTYLE['sb_ttcolor']}, 'ttcolor_v': {$JSTYLE['thre_title_color_v']}, 'pop_size': [{$JSTYLE['info_pop_size']}]