Skip to content

Commit

Permalink
Merge branch 'release/1.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nodaguti committed Dec 6, 2014
2 parents b77edd6 + 9ffd9ef commit 8778d1e
Show file tree
Hide file tree
Showing 38 changed files with 1,830 additions and 321 deletions.
18 changes: 14 additions & 4 deletions chaika/chrome/content/chaika/bbsmenu/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var Page = {
var browser = ChaikaCore.browser.getBrowserWindow();
if(browser && browser.document.getElementById("viewFoxAge2chSidebar")){
document.getElementById("viewFoxAge2chMenu").hidden = false;
document.getElementById('viewFoxAge2chMenu-separator').hidden = false;
}
},

Expand Down Expand Up @@ -244,7 +245,8 @@ var SearchBox = {
Notification.removeAll();
Notification.info('検索中');

let promise = ChaikaSearch.getPlugin(this.getSearchMode()).search(aSearchStr);
let plugin = ChaikaSearch.getPlugin(this.getSearchMode());
let promise = plugin.search(ChaikaCore.io.escapeHTML(aSearchStr));

promise.then(this._showResults, this._onError)
.then(null, this._onError);
Expand All @@ -258,7 +260,9 @@ var SearchBox = {

results.forEach((board) => {
let boardItem = document.createElement('board');
boardItem.setAttribute('title', board.title);
let boardTitle = ChaikaCore.io.unescapeHTML(board.title);

boardItem.setAttribute('title', boardTitle);
boardItem.setAttribute('url', board.url || '');
boardItem.setAttribute('type', board.type || ChaikaBoard.BOARD_TYPE_PAGE);

Expand All @@ -270,9 +274,15 @@ var SearchBox = {

board.threads.forEach((thread) => {
let threadItem = document.createElement('thread');
let threadTitle = ChaikaCore.io.unescapeHTML(thread.title);

if(thread.post){
threadTitle += ' [' + thread.post + ']';
}

threadItem.setAttribute('url', thread.url);
threadItem.setAttribute('title', thread.title + ' [' + (thread.post || '-') + ']');
threadItem.setAttribute('boardName', board.title);
threadItem.setAttribute('title', threadTitle);
threadItem.setAttribute('boardName', boardTitle);

boardItem.appendChild(threadItem);
});
Expand Down
91 changes: 55 additions & 36 deletions chaika/chrome/content/chaika/bbsmenu/page.xul
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,89 @@
<?xml-stylesheet href="chrome://chaika/skin/bbsmenu/page.css" type="text/css"?>


<page id="bookmarksPanel" title="BBSMENU [chaika]" class="bbsmenuPage"
onload="Page.startup()" onunload="Page.shutdown()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<page id="bookmarksPanel"
title="BBSMENU [chaika]"
class="bbsmenuPage"
onload="Page.startup()"
onunload="Page.shutdown()"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/javascript" src="chrome://chaika/content/bbsmenu/page.js"/>
<script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js" />
<script type="application/javascript" src="chrome://chaika/content/bbsmenu/page.js" />

<popupset>
<menupopup id="searchModeMenu" />

<menupopup id="historyMenuContext"
style="-moz-binding:url(chrome://chaika/content/pageUtils.xml#itemContext)"/>
style="-moz-binding:url(chrome://chaika/content/pageUtils.xml#itemContext)" />

<menupopup id="treeContextMenu"
style="-moz-binding:url(chrome://chaika/content/pageUtils.xml#itemContext)"
onpopupshowing="return Tree.showContext(event)"/>
style="-moz-binding:url(chrome://chaika/content/pageUtils.xml#itemContext)"
onpopupshowing="return Tree.showContext(event)" />
</popupset>

<hbox align="center">
<textbox id="searchBox" value="" emptytext="" flex="1" type="search" timeout="2000"
oncommand="if(this.value === '') SearchBox.search('')"
onkeypress="if(event.keyCode == KeyEvent.DOM_VK_RETURN) SearchBox.search(this.value)">
<box><dropmarker popup="searchModeMenu" class="plain"/></box>
<textbox id="searchBox"
value=""
emptytext=""
flex="1"
type="search"
timeout="2000"
oncommand="if(this.value === '') SearchBox.search('')"
onkeypress="if(event.keyCode == KeyEvent.DOM_VK_RETURN) SearchBox.search(this.value)">
<box>
<dropmarker popup="searchModeMenu" class="plain" />
</box>
</textbox>

<menubar id="mainMenubar" class="plain">
<menu id="historyMenu" label="履歴" class="plain menu-iconic">
<menupopup style="-moz-binding:url(chrome://chaika/content/pageUtils.xml#historyMenuPopup)"
position="after_end" tooltiptext=""
itemContext="historyMenuContext"/>
position="after_end"
tooltiptext=""
itemContext="historyMenuContext" />
</menu>

<menu id="toolsMenu" label="ツール" class="plain menu-iconic">
<menupopup id="toolsMenuPopup" position="after_end">
<menuitem label="bbsmenu 更新" oncommand="BbsmenuUpdater.update()"/>
<menuseparator/>
<menuitem label="ログマネージャ" oncommand="Page.openLogManager()"/>
<menuitem label="データフォルダを開く" oncommand="Page.openDataFolder()"/>
<menuitem label="FoxAge2ch" id="viewFoxAge2chMenu"
hidden="true" oncommand="Page.viewFoxAge2ch()"/>
<menu label="ヘルプ">
<menupopup>
<menuitem label="リリースノート" oncommand="Page.openReleaseNotes()"/>
<menuitem label="トラブルシューティング情報" oncommand="Page.openSupport()"/>
<menuitem label="オンラインヘルプ" oncommand="Page.openOnlineHelp()"/>
</menupopup>
</menu>
<menuseparator/>
<menuitem label="オプション..." oncommand="Page.openSettings()"/>
<menuitem label="BBSMENU を更新" oncommand="BbsmenuUpdater.update()" />
<menuseparator />
<menuitem label="ログマネージャ..." oncommand="Page.openLogManager()" />
<menuitem label="データフォルダを開く" oncommand="Page.openDataFolder()" />
<menuseparator />
<menuitem label="リリースノート" oncommand="Page.openReleaseNotes()" />
<menuitem label="トラブルシューティング情報" oncommand="Page.openSupport()" />
<menuitem label="オンラインヘルプ" oncommand="Page.openOnlineHelp()" />
<menuseparator />
<menuitem label="FoxAge2ch を開く" id="viewFoxAge2chMenu"
hidden="true" oncommand="Page.viewFoxAge2ch()" />
<menuseparator id="viewFoxAge2chMenu-separator" hidden="true" />
<menuitem label="オプション..." oncommand="Page.openSettings()" />
</menupopup>
</menu>
</menubar>
</hbox>

<notificationbox id="notification"/>
<notificationbox id="notification" />

<tree id="bookmarks-view"
class="sidebar-placesTree bbsmenuTree"
hidecolumnpicker="true"
flex="1"
openedCategories=""
persist="openedCategories"
context="treeContextMenu">

<tree id="bookmarks-view" class="sidebar-placesTree bbsmenuTree" hidecolumnpicker="true" flex="1"
openedCategories="" persist="openedCategories"
context="treeContextMenu">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
<treecol id="title" flex="1" primary="true" hideheader="true" />
</treecols>
<treechildren id="bookmarks-view-children" class="sidebar-placesTreechildren" flex="1"
onclick="Tree.click(event)" ondblclick="Tree.click(event)"/>

<treechildren id="bookmarks-view-children"
class="sidebar-placesTreechildren"
flex="1"
onclick="Tree.click(event)"
ondblclick="Tree.click(event)" />

</tree>

</page>
20 changes: 19 additions & 1 deletion chaika/chrome/content/chaika/board/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Components.utils.import("resource://chaika-modules/ChaikaCore.js");
Components.utils.import("resource://chaika-modules/ChaikaBoard.js");
Components.utils.import("resource://chaika-modules/ChaikaDownloader.js");
Components.utils.import("resource://chaika-modules/ChaikaAboneManager.js");
Components.utils.import("resource://chaika-modules/ChaikaContentReplacer.js");

const Ci = Components.interfaces;
const Cc = Components.classes;
Expand Down Expand Up @@ -263,7 +264,7 @@ var BoardTree = {
}


//スレッドあぼーん処理
//スレッドあぼーん処理 および スレタイ置換
var enableHideAbone = ChaikaCore.pref.getBool('thread_hide_abone');
var threads = gBoard.itemsDoc.documentElement.getElementsByTagName('boarditem');

Expand All @@ -273,6 +274,8 @@ var BoardTree = {
//透明あぼーんの影響で最後の方は参照できなくなる
if(!thread) continue;


//スレッドあぼーん処理
let hitAboneData = ChaikaAboneManager.shouldAbone({
title: thread.getAttribute('title'),
date: thread.getAttribute('created'),
Expand All @@ -296,6 +299,21 @@ var BoardTree = {
thread.setAttribute('title', '***** ABONE ***** (' + hitAboneData.title + ')');
}
}


//スレタイ置換処理
let replacedThreadData = ChaikaContentReplacer.replace({
title: thread.getAttribute('title'),
date: thread.getAttribute('created'),
thread_url: thread.getAttribute('url'),
board_url: gBoard.url,
isThreadList: true,
isSubjectTxt: false
});

if(replacedThreadData){
thread.setAttribute('title', replacedThreadData.title);
}
}


Expand Down
60 changes: 39 additions & 21 deletions chaika/chrome/content/chaika/browser/browserMenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

<binding id="browserMenu" extends="chrome://global/content/bindings/popup.xml#popup">
<content>
<xul:arrowscrollbox orient="vertical" flex="1">
<children />
<xul:arrowscrollbox orient="vertical" flex="1" anonid="root" class="chaika-browser-menu-root">
<xul:menu label="あぼーん" anonid="abone">
<xul:menupopup>
<xul:menuitem label="名前" anonid="abone-name" />
Expand Down Expand Up @@ -87,6 +86,10 @@
<xul:menuseparator anonid="sidebar-sep" />

<xul:menuitem label="オプション..." anonid="open-settings"/>

<xul:menuseparator anonid="chaika-sep" class="chaika-shown-when-flattened" />

<children />
</xul:arrowscrollbox>
</content>

Expand Down Expand Up @@ -177,21 +180,28 @@
<method name="_getPlainURL">
<parameter name="aURI"/>
<body><![CDATA[
if(!(aURI instanceof Components.interfaces.nsIURI)){
aURI = Services.io.newURI(aURI, null, null).QueryInterface(Ci.nsIURI);
}
let spec = aURI instanceof Components.interfaces.nsIURI ? aURI.spec : aURI;
if(!this._isChaika(aURI)) return aURI;
// Google リダイレクタ対策
if(spec.contains('google') && spec.contains('/url?')){
spec = decodeURIComponent(spec.match(/url=([^&]*)/i)[1]);
}
var plainURL = aURI.path.substring(1).replace(/^thread\//, "");
let uri = Services.io.newURI(spec, null, null).QueryInterface(Ci.nsIURI);
plainURL = plainURL.replace("/test/read.html/", "/test/read.cgi/")
.replace("/test/mread.cgi/", "/test/read.cgi/");
if(!this._isChaika(uri)){
return uri;
}else{
let plainURL = uri.path.substring(1)
.replace(/^thread\//, "")
.replace("/test/read.html/", "/test/read.cgi/")
.replace("/test/mread.cgi/", "/test/read.cgi/");
try{
return Services.io.newURI(plainURL, null, null);
}catch(ex){
return null;
try{
return Services.io.newURI(plainURL, null, null);
}catch(ex){
return null;
}
}
]]></body>
</method>
Expand Down Expand Up @@ -305,6 +315,8 @@
const isOnThread = this._isThread(currentURI);
const isOnBoard = this._isBoard(currentURI);
this.ChaikaCore.logger.debug(gContextMenu);
const isContextMenu = !!gContextMenu;
const isTextSelected = isContextMenu && gContextMenu.isTextSelected;
const isOnBBSLink = isContextMenu && gContextMenu.onLink && this._isBBS(gContextMenu.linkURL);
Expand Down Expand Up @@ -338,19 +350,18 @@
<parameter name="aEvent"/>
<parameter name="aMiddleClicked"/>
<body><![CDATA[
var targetElement = aEvent.originalTarget;
var anonymousID = targetElement.getAttribute("anonid");
let targetElement = aEvent.originalTarget;
let anonymousID = targetElement.getAttribute("anonid");
let addTab = this.ChaikaCore.pref.getBool("browser.browsermenu.open_in_new_tab");
let disregardLimit = this.ChaikaCore.pref.getBool("browser.browsermenu.disregard_url_limit");
let selection = content.getSelection();
let selectedText = selection.toString();
var addTab = this.ChaikaCore.pref.getBool("browser.browsermenu.open_in_new_tab");
if(aMiddleClicked || aEvent.ctrlKey || aEvent.metaKey){
addTab = !addTab;
}
var disregardLimit = this.ChaikaCore.pref.getBool("browser.browsermenu.disregard_url_limit");
var selection = content.getSelection();
var selectedText = selection.toString();
switch(anonymousID){
case 'abone-name':
Expand Down Expand Up @@ -456,13 +467,20 @@
}
}
//メニューの項目を実行した時にサイドバー開閉コマンドが動作しないようにする
aEvent.stopPropagation();
//中クリックの場合にポップアップが閉じないのに対処する
if(aMiddleClicked){
let contextMenu = document.getElementById('contentAreaContextMenu');
let menupopup = this.parentNode.getElementsByTagName('menupopup')[0];
//コンテキストメニューの場合
contextMenu.hidePopup();
//ツールバーボタンの場合
if(menupopup){
menupopup.hidePopup();
}
Expand Down

0 comments on commit 8778d1e

Please sign in to comment.