发博文
正文 字体大小:

Longman 5朗文词典界面优化补丁(29)

(2009-11-10 17:19:45)
标签:

it

分类: Longman

29.让新增选项被选择后能够立即生效的修改

特别说明:这个系列的文章最初是发布在嬴政论坛的,是我的原创。在论坛终有一天帖子会沉下去,而且也不容易让网络上其他人搜索到。所以在博客上重发这个系列的优化补丁,希望有更多的人学习到修改的方法,更多的人能够参与进来,一起修改、完善Longman5词典。


补丁文件可以在我的网盘里面下载:
http://e.ys168.com/?orchidflower
http://orchidflower.ys168.com
http://cid-250b74500d66cf1a.skydrive.live.com/browse.aspx/LDOCE5


注意:%LONGMAN%代表词典安装的目录。

1. 修改:%LONGMAN%\LDOCE5\chrome\ldoce5\content\popup\popup_option.xul,增加函数调用:

 

...
                <radiogroup>
                    <label value="Scroll Speed" class="labelRadio"/>
                    <radio catid="scrollspeed" value="10" label="Slowest" class="skPref" action="winGM.updateScrollSpeed"/>
                    <radio catid="scrollspeed" value="20" label="Slower" class="skPref" action="winGM.updateScrollSpeed"/>
                    <radio catid="scrollspeed" value="30" label="Normal" class="skPref" action="winGM.updateScrollSpeed"/>
                    <radio catid="scrollspeed" value="40" label="Faster" class="skPref" action="winGM.updateScrollSpeed"/>
                    <radio catid="scrollspeed" value="60" label="Fastest" class="skPref" action="winGM.updateScrollSpeed"/>
                </radiogroup>
            </vbox>
            <spacer style="width: 1px; margin: 5px 5px 5px 5px;background-color: lightgray;"/>
            <vbox flex="1" class="borderMM">
                <label value="Display Options" class="labelRadio"/>
                <checkbox catid="hideSyllableDots" label="Hide syllable dots" class="skPref" action="winGM.updateSyllableDots"/>
                <checkbox catid="hidePronunciations" label="Hide Pronunciations" class="skPref" action="winGM.updatePronunciations"/>
                <checkbox catid="hideLogoPanel" label="Hide Logo Panel" class="skPref" action="winGM.showLogoPanel"/>
                <checkbox catid="hideRightPanel" label="Hide Right Panel" class="skPref" action="winGM.showRightPanel"/>
                <checkbox catid="showNavigationMenu" label="Show Navigation Menu" class="skPref"/>
                <checkbox catid="hideMeanings" label="Hide Word Meanings" class="skPref" action="winGM.updateMeanings"/>
                <checkbox catid="changeSYNOPPView" label="Change SYN/OPP view" class="skPref" action="winGM.updateChangeSYNOPPView"/>
                <checkbox catid="showInMaximalWindow" label="Show in maximal window" class="skPref"/>
                <checkbox catid="showOneEntryInDict" label="Show one entry in dict" class="skPref" action="winGM.updateOneEntryInDict"/>
                <checkbox catid="showOneEntryInCultureDict" label="Show one entry in culture dict" class="skPref" action="winGM.updateOneEntryInCultureDict"/>
                <checkbox catid="popupAndLWACanChangeSize" label="Popup font-size changeable" class="skPref" action="winGM.popupAndLWACanChangeSize"/>
                <checkbox catid="showSpellWordsInMenu" label="Show spell words in menu" class="skPref" action="winGM.updateShowSpellWordsInMenu"/>
...
2.更新滚动速度
function updateScrollSpeed() {
    try {
        var azList;
        var indexList;
        var searchSystemLi = ["dict","cultural_dict","activator_key","activator","popup","lwa"];
        g_DefaultScrollSpeed = g_Pref.GetIntPref("skpref.scrollspeed");
       
        for(var i =0; i<searchSystemLi.length; i++) {
            if(skGroups.group(searchSystemLi[i]).searchSystem != null ) {
                azList      = skGroups.group(searchSystemLi[i]).searchSystem.azList;
                indexList   = skGroups.group(searchSystemLi[i]).searchSystem.indexList;
               
                azList.scrollSpeed(g_DefaultScrollSpeed);
                indexList.scrollSpeed(g_DefaultScrollSpeed);
            }
        }
    } catch (e) {
        showMessage( e );
    }
}
3. 更新音节分隔符的显示与隐藏

// update g_HideSyllableDots
function updateSyllableDots() {
    g_HideSyllableDots = g_Pref.GetBoolPref("skpref.hideSyllableDots");
    var searchSystemLi = ["dict","cultural_dict","popup","lwa"];
    reloadAZList(searchSystemLi);
}

// reload azlist
function reloadAZList(searchSystemLi) {
    try {
        var azList;
        var selectedIndex;
        for(var i =0; i<searchSystemLi.length; i++){
            if(skGroups.group(searchSystemLi[i]).searchSystem != null ){
                azList      = skGroups.selectedGroup.searchSystem.azList;
                selectedIndex   = Number(azList.selectedIndex());
               
                azList.clearList();
                azList.placeInVlist(selectedIndex, null, null, true);   
            }
         
    } catch (e) { showMessage( e ); }
}
4. 更新音标的显示与隐藏

// udpate g_HidePronunciations
function updatePronunciations() {
    g_HidePronunciations = g_Pref.GetBoolPref("skpref.hidePronunciations");
    var searchSystemLi = ["dict","cultural_dict","popup","lwa"];
    reloadAZList(searchSystemLi);
}
5. 更新单词解释的显示与隐藏
// update g_hideMeaings
function updateMeanings() {
    g_HideMeanings = g_Pref.GetBoolPref("skpref.hideMeanings");
    var searchSystemLi = ["dict","cultural_dict","popup","lwa"];
    reloadAZList(searchSystemLi);
}
6. 更新同义词、反义词的显示样式

// update g_ChangeSYNOPPView
function updateChangeSYNOPPView() {
    g_ChangeSYNOPPView = g_Pref.GetBoolPref("skpref.changeSYNOPPView");
    var searchSystemLi = ["dict","popup","lwa"];
    reloadAZList(searchSystemLi);
}
7. 更新dict是否只显示一个词条
// update g_ShowOneEntryInDict and refresh azlist
function updateOneEntryInDict() {
    try {
        g_ShowOneEntryInDict = g_Pref.GetBoolPref("skpref.showOneEntryInDict");
        dictGroup = skGroups.group("dict");
        dictGroup.searchSystem.singleEntry = g_ShowOneEntryInDict;
        me = dictGroup.searchSystem;
        if (me.singleEntry) {
           lastIndex = 0;
           me.azList.singleEntry();
        } else {
            lastIndex = skTabManager.getSkTable(me.fsAz + "/files.skn").GetCount() - 1;
            me.azList.skVlist.collapScroll = "false";
        }
        me.azList.lastIndex(lastIndex);
        setTimeout("reloadAZList(['dict'])", 200);
    } catch (e) {
        showMessage( e );
    }
}
8. 更新culture_dict是否只显示一个词条
// update g_ShowOneEntryInCultureDict and refresh azList
function updateOneEntryInCultureDict() {
    try {
        g_ShowOneEntryInCultureDict = g_Pref.GetBoolPref("skpref.showOneEntryInCultureDict");
        dictGroup = skGroups.group("cultural_dict");
        dictGroup.searchSystem.singleEntry = g_ShowOneEntryInCultureDict;
        me = dictGroup.searchSystem;
        if (me.singleEntry) {
           lastIndex = 0;
           me.azList.singleEntry();
        } else {
            lastIndex = skTabManager.getSkTable(me.fsAz + "/files.skn").GetCount() - 1;
            me.azList.skVlist.collapScroll = "false";
        }
        me.azList.lastIndex(lastIndex);
        setTimeout("reloadAZList(['cultural_dict'])", 200);
    } catch (e) {
        showMessage( e );
    }
}
 

 

阅读 评论 收藏 转载 喜欢 打印举报
已投稿到:
  • 评论加载中,请稍候...

       

    验证码: 请点击后输入验证码 收听验证码

    发评论

    以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

      

    新浪BLOG意见反馈留言板 不良信息反馈 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正

    新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑

    新浪公司 版权所有