128 lines
3.3 KiB
XML
128 lines
3.3 KiB
XML
![]() |
<?xml version="1.0"?>
|
||
|
<!--
|
||
|
Zotero
|
||
|
Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA
|
||
|
http://chnm.gmu.edu/
|
||
|
-->
|
||
|
|
||
|
<!DOCTYPE bindings SYSTEM "chrome://scholar/locale/searchbox.dtd">
|
||
|
|
||
|
<bindings xmlns="http://www.mozilla.org/xbl"
|
||
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
||
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||
|
<binding id="zotero-search-textbox">
|
||
|
<implementation>
|
||
|
<property name="value"
|
||
|
onget="return document.getAnonymousNodes(this)[0].value"
|
||
|
onset="document.getAnonymousNodes(this)[0].value = val; return val"/>
|
||
|
<property name="mode">
|
||
|
<getter>
|
||
|
<![CDATA[
|
||
|
if (this.getAttribute('hasOptions')!='true'){
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
var button = this.id('textbox-button');
|
||
|
var menu = this.id(button.popup);
|
||
|
|
||
|
var selectedIndex = -1;
|
||
|
for (var i=0; i<menu.childNodes.length; i++){
|
||
|
if (menu.childNodes[i].getAttribute('checked')=='true'){
|
||
|
selectedIndex = i;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
switch (button.popup){
|
||
|
case 'textbox-fulltext-menu':
|
||
|
switch (selectedIndex){
|
||
|
case 0:
|
||
|
return false;
|
||
|
|
||
|
case 1:
|
||
|
return 'phraseBinary';
|
||
|
|
||
|
case 2:
|
||
|
return 'regexp';
|
||
|
|
||
|
case 3:
|
||
|
return 'regexpCS';
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
throw('Invalid search textbox popup');
|
||
|
]]>
|
||
|
</getter>
|
||
|
</property>
|
||
|
<method name="update">
|
||
|
<parameter name="condition"/>
|
||
|
<parameter name="mode"/>
|
||
|
<body>
|
||
|
<![CDATA[
|
||
|
var button = this.id('textbox-button');
|
||
|
|
||
|
switch (condition){
|
||
|
case 'fulltextContent':
|
||
|
button.popup = 'textbox-fulltext-menu';
|
||
|
button.setAttribute('popup', 'textbox-fulltext-menu');
|
||
|
var menu = this.id(button.popup);
|
||
|
this.setAttribute('hasOptions', true);
|
||
|
|
||
|
var selectedIndex = 0;
|
||
|
if (mode){
|
||
|
switch (mode){
|
||
|
case 'phrase':
|
||
|
selectedIndex = 0;
|
||
|
break;
|
||
|
|
||
|
case 'phraseBinary':
|
||
|
selectedIndex = 1;
|
||
|
break;
|
||
|
|
||
|
case 'regexp':
|
||
|
selectedIndex = 2;
|
||
|
break;
|
||
|
|
||
|
case 'regexpCS':
|
||
|
selectedIndex = 3;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
menu.childNodes[selectedIndex].setAttribute('checked', true);
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
this.setAttribute('hasOptions', false);
|
||
|
}
|
||
|
]]>
|
||
|
</body>
|
||
|
</method>
|
||
|
<method name="id">
|
||
|
<parameter name="id"/>
|
||
|
<body>
|
||
|
<![CDATA[
|
||
|
return document.getAnonymousNodes(this)[0].getElementsByAttribute('id',id)[0];
|
||
|
]]>
|
||
|
</body>
|
||
|
</method>
|
||
|
</implementation>
|
||
|
|
||
|
<content>
|
||
|
<xul:textbox xbl:inherits="flex">
|
||
|
<xul:popupset>
|
||
|
<xul:menupopup id="textbox-fulltext-menu">
|
||
|
<xul:menuitem type="radio" checked="true" label="&scholar.search.textModes.phrase;"/>
|
||
|
<xul:menuitem type="radio" label="&scholar.search.textModes.phraseBinary;"/>
|
||
|
<xul:menuitem type="radio" label="&scholar.search.textModes.regexp;"/>
|
||
|
<xul:menuitem type="radio" label="&scholar.search.textModes.regexpCS;"/>
|
||
|
</xul:menupopup>
|
||
|
</xul:popupset>
|
||
|
|
||
|
<xul:toolbarbutton id="textbox-button" type="menu"/>
|
||
|
</xul:textbox>
|
||
|
</content>
|
||
|
</binding>
|
||
|
</bindings>
|