зеркало из https://github.com/mozilla/pjs.git
implement typedown feature
This commit is contained in:
Родитель
fe9b145470
Коммит
640b66585b
|
@ -6,6 +6,7 @@ var RDF = null;
|
|||
var gSubscribeDS = null;
|
||||
var gStatusBar = null;
|
||||
var gNameField = null;
|
||||
var gFolderDelimiter = ".";
|
||||
|
||||
function Stop()
|
||||
{
|
||||
|
@ -90,7 +91,7 @@ function SubscribeOnLoad()
|
|||
{
|
||||
dump("SubscribeOnLoad()\n");
|
||||
|
||||
gSubscribeTree = document.getElementById('subscribetree');
|
||||
gSubscribeTree = document.getElementById('subscribetree');
|
||||
gStatusBar = document.getElementById('statusbar-icon');
|
||||
gNameField = document.getElementById('namefield');
|
||||
|
||||
|
@ -127,6 +128,8 @@ function SubscribeOnLoad()
|
|||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
|
||||
gSubscribeDS = RDF.GetDataSource("rdf:subscribe");
|
||||
|
||||
gNameField.focus();
|
||||
}
|
||||
|
||||
function subscribeOK()
|
||||
|
@ -262,3 +265,54 @@ function RefreshList()
|
|||
dump("refresh list\n");
|
||||
}
|
||||
|
||||
function trackGroupInTree()
|
||||
{
|
||||
var portion = gNameField.value;
|
||||
selectNodeByName( portion );
|
||||
}
|
||||
|
||||
function selectNodeByName( aMatchString )
|
||||
{
|
||||
var lastDot = aMatchString.lastIndexOf(gFolderDelimiter);
|
||||
var nodeValue = lastDot != -1 ? aMatchString.substring(0, lastDot) : aMatchString;
|
||||
|
||||
var chain = aMatchString.split(gFolderDelimiter);
|
||||
if( chain.length == 1 ) {
|
||||
var node = getTreechildren(gSubscribeTree);
|
||||
if( !node )
|
||||
return;
|
||||
}
|
||||
else {
|
||||
var node = gSubscribeTree.getElementsByAttribute("name",nodeValue)[0];
|
||||
if( node.getAttribute("container") == "true" &&
|
||||
node.getAttribute("open") != "true" )
|
||||
node.setAttribute("open","true");
|
||||
node = getTreechildren(node);
|
||||
dump("*** node = " + node.nodeName + "\n");
|
||||
}
|
||||
|
||||
for( var i = 0; i < node.childNodes.length; i++ )
|
||||
{
|
||||
var currItem = node.childNodes[i];
|
||||
dump("*** chain = " + chain[chain.length-1] + "\n");
|
||||
if( !currItem.getAttribute("name").indexOf( aMatchString ) ) {
|
||||
gSubscribeTree.selectItem( currItem );
|
||||
gSubscribeTree.ensureElementIsVisible( currItem );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTreechildren( aTreeNode )
|
||||
{
|
||||
if( aTreeNode.childNodes )
|
||||
{
|
||||
for( var i = 0; i < aTreeNode.childNodes.length; i++ )
|
||||
{
|
||||
if( aTreeNode.childNodes[i].nodeName.toLowerCase() == "treechildren" )
|
||||
return aTreeNode.childNodes[i];
|
||||
}
|
||||
return aTreeNode;
|
||||
}
|
||||
return null;
|
||||
}
|
|
@ -56,7 +56,7 @@ Rights Reserved.
|
|||
|
||||
<rows>
|
||||
<row>
|
||||
<text class="label" value="&server.label;"/>
|
||||
<text class="label" value="&server.label;" for="serverMenu"/>
|
||||
<menulist oncommand="onServerClick(event);" id="serverMenu"
|
||||
rdf:datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
|
||||
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
|
||||
|
@ -72,8 +72,8 @@ Rights Reserved.
|
|||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<text class="label" id="foldertextlabel" value="..." for="name"/>
|
||||
<textfield id="namefield" flex="1"/>
|
||||
<text class="label" id="foldertextlabel" value="..." for="namefield"/>
|
||||
<textfield id="namefield" flex="1" oninput="trackGroupInTree();"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
Загрузка…
Ссылка в новой задаче