Group Blog
 
<<
ตุลาคม 2552
 
 123
45678910
11121314151617
18192021222324
25262728293031
 
12 ตุลาคม 2552
 
All Blogs
 
ปรับปรุง Longman Dictionary of Contemporary English 2009 เพิ่มปุ่มลัด (8)

longmanการแก้ไขลองแมนตอนนี้และตอนต่อๆไปได้มาจากเว็บบล็อกของชาวจีนท่านหนึ่งสามารถเข้าไปดูได้ที่

//blog.sina.com.cn/s/blog_538a1d910100fasq.html~type=v5_one&label=rela_nextarticle

ไฟล์ที่ได้รับการแก้ไขแล้วสามารถดาว์นโหลดได้ที่ //orchidflower.ys168.com
ขอขอบคุณเจ้าของบล็อกที่อนุญาติให้นำมาเผยแพร่ต่อ เนื้อหาของตอนนี้จะต่างจากต้นฉบับอยู่เล็กน้อย

เนื้อหาตอนนี้จะเป็นการเพิ่มโค้ดเพื่อให้สร้างปุ่มลัด
รายการปุ่มลัดที่สร้าง

ESC
ขยายขนาดวินโดว์ให้เล็กที่สุด
F1
ซ่อนแผงสั่งงานด้านขวา
F2
ซ่อนแบนเนอร์
F3or Ctrl+F เปิดหน้าต่างค้นหาคำในหน้าหลัก
F4 เปิดหน้าต่างAdvanced Search
F12 เปิดหน้าต่างMy Dictionary
Ctrl+BackQuote
เปิดหน้าต่าง Practice Your Pronunciation
Alt+BackQuote เปิดหน้าต่างMy Note
Ctrl+1
เปิดหน้าต่าง dict
Ctrl+2
เปิดหน้าต่าง culture dict
Ctrl+3
เปิดหน้าต่าง Activator
Ctrl+4
เปิดหน้าต่าง Grammar
Ctrl+5
เปิดหน้าต่าง Exercises
Ctrl+6
เปิดหน้าต่าง Vocabulary Trainer
Ctrl+7
เปิดหน้าต่าง Teacher Resources
Ctrl+8
เปิดหน้าต่าง Popup Dictionary
Ctrl+9
เปิดหน้าต่าง Writing Assitant
Ctrl+0
กลับหน้าเมนูหลัก
Ctrl+Left or Shift +Wheel Up
ย้อนกลับตามรายการคำที่เคยค้นหา
Ctrl+Right or Shift+Wheel Down
เดินหน้าตามรายการคำที่เคยค้นหา
Ctrl+Upor Ctrl+Pg Up or Ctrl+Wheel Up ย้อนกลับตามรายการคำหลัก
Ctrl+Downor Ctrl Pg Down or Ctrl+Wheel Down เดินหน้าตามรายการคำหลัก
Tab
ออกเสียงคำปัจจุบัน (ต้องเลือกออปชั่นออกเสียงอัตโนมัติ)


    วิธีทำ
    1. เพิ่มโค้ดเข้าไปในไฟล์ C:/ProgramFiles/Longman/LDOCE5/chrome/ldoce5/content/overlay/dict.xul
    2.        <linkbox label="PRONUNCIATION" type="pronunciation"
                 css="chrome://ldoce5/skin/data/pronpractice.css">
                 <external_link id="ext_link_practiceprounciation" label="Practice your pronunciation"type="pron_practice"/>
             </linkbox>

              .......
              .......

              <linkbox label="USERNOTES" type="usernote">
                 <external_linkid="ext_link_addnote" class="enabled" label="Add a note"type="add_note" onclick="callNote(event, true);"/>
                 <external_link class="enabled" label="View note"type="view_note"onclick="callNote(event, false);"/>
             </linkbox>
    3. เพิ่มโค้ดเข้าไปในไฟล์  C:/ProgramFiles/Longman/LDOCE5/chrome/ldoce5/content/js/shortcut.js
    4.            if (e.type=="keydown") {
                   if(opt['disable_in_input']) { //Don't enable shortcut keys in Input,Textarea fields
                        varelement;
                       if(e.target) element=e.target;
                       else if(e.srcElement)element=e.srcElement;
                       if(element.nodeType==3)element=element.parentNode;

                       if(element.tagName == 'INPUT' ||element.tagName =='TEXTAREA') return;
                    }
         
                    //Find Which key is pressed
                    if (e.keyCode) code = e.keyCode;
                    else if (e.which) code = e.which;
                    var character= String.fromCharCode(code).toLowerCase();
                
                    if(code ==188) character=","; //If the user presses , when the type is onkeydown
                    if(code ==190) character="."; //If the user presses , when the type is onkeydown
                 }
                 else if (e.type=="DOMMouseScroll") { // Added by Orchidflower, processDOMMouseScroll event
                     //Find Which key is pressed
                     if (e.detail>0) code = 202; //wheeldown
                     else           code = 201; //wheelup
                     character = "";
                 }

                 ......
                 ......

                        //SpecialKeys - and their codes
                 varspecial_keys = {
                    'wheelup': 201,
                     'wheeldown': 202,
                     'backquote': 192,
                    'esc':27,
                    'escape':27,
                    'tab':9,
                    'space':32,
                    'return':13,
                    'enter':13,

                    .............
                    ............

                 this.all_shortcuts[shortcut_combination] = {
                 'callback':func,
                 'target':ele,
                 'event': opt['type']
              };
              //Attachthe function with the event
             if(ele.addEventListener) { ele.addEventListener(opt['type'], func, false);
                                        ele.addEventListener("DOMMouseScroll", func, false); }  // addlistener to process mouse wheel
              elseif(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
              elseele['on'+opt['type']] = func;
    5. เพิ่มโค้ดเข้าไปในไฟล์ C:/ProgramFiles/Longman/LDOCE5/chrome/ldoce5/content/js/application.js
        • เพิ่ม Global Varible ที่หัวไฟล์
      // Max entries in dictionary
      varg_MaxEntriesInDict;
        • เพิ่มฟังก์ชั่นเข้าไปที่ท้ายไฟล์
      // replay the pronunciationof current selected word
      functionreplaySound() {
         try {
             var skVlist = skGroups.selectedGroup.searchSystem.azList.skVlist;
             var skItem = skVlist.selectedItem;
             if (skItem)
                 autoplay(skItem);
         }
         catch (e) {
             alert( e );
         }
      }

      // find text incurrent window ( called by short cut key: ctrl+f, f3)
      function findtext(){
         try
         {


             var focusedWindow =this.window.document.commandDispatcher.focusedWindow;
             focusedWindow.find();
             //BrowserFind();
         }
         catch (e)
         {
             alert( e );
         }
      }

      // Open practicepronunciation window (called by shortcut key: ctrl+`)
      functionopenPracticeProunciation() {
         try {
             document.getElementById("ext_link_practiceprounciation").show();
         }
         catch (e) {
             alert( e );
         }
      }

      // Open Add Notewindow (called by shortcut key: alt+`)
      functionopenAddNote() {
         try {
             document.getElementById("ext_link_addnote").click();
         }
         catch (e) {
             alert( e );
         }
      }

      // Switch topreviousword
      functionpreviousWord() {
         try {
             if (g_CurrentMode!='dict' &&g_CurrentMode!='cultural_dict'&& g_CurrentMode!='culture_dict')  return;
             var azList      =skGroups.selectedGroup.searchSystem.azList;
             var indexList   =skGroups.selectedGroup.searchSystem.indexList;
             var selectedIndex   = Number(azList.selectedIndex());
             var maxElement      =g_MaxEntriesInDict;
             vartargetId       = selectedIndex - 1;
             if(targetId<0)        targetId = 0;
             if (targetId>maxElement)  targetId = maxElement;
             if (targetId == selectedIndex)  return;
             azList.placeInVlist(targetId, null, null,true);    
         } catch (e) {
             alert( e );
         }
      }

      // Switch to nextword
      function nextWord(){
         try {
             if (g_CurrentMode!='dict' &&g_CurrentMode!='cultural_dict'&& g_CurrentMode!='culture_dict')  return;
             var azList      =skGroups.selectedGroup.searchSystem.azList;
             var indexList   =skGroups.selectedGroup.searchSystem.indexList;
             var selectedIndex   = Number(azList.selectedIndex());
             var maxElement      =g_MaxEntriesInDict;
             vartargetId       = selectedIndex + 1;
             if(targetId<0)        targetId = 0;
             if (targetId>maxElement)  targetId = maxElement;
             if (targetId == selectedIndex)  return;
             azList.placeInVlist(targetId, null, null,true);    
         } catch (e) {
             alert( e );
         }
      }
        • ฟังก์ชั่น app_init
            
                   var dictGroup = skGroups.group("dict");
             activateGroup(document.getElementById('dictionary-btn'));
             // Get Max entries in dictionary
             g_MaxEntriesInDict =skTabManager.getSkTable(skGroups.selectedGroup.searchSystem.fsAz +"/files.skn").GetCount() - 1;
             // Check whether to display navigation menu
             try
             {
                 if (!g_Pref.GetBoolPref("skpref.showNavigationMenu"))  //shownavigation menu
                     setTimeout( "showWOD()", 5 );
                 else{         // hidenavigation menu
                     setMode('home');
                 }
             } catch(e)
             {
                 g_Pref.SetBoolPref("skpref.showNavigationMenu", false);
                 setTimeout( "showWOD()", 5 );
             }

             // Add short key to main window
              shortcut.add("f1", showRightPanel );
             shortcut.add("f2", showLogoPanel );
             shortcut.add("ctrl+backquote", openPracticeProunciation );
             shortcut.add("alt+backquote", openAddNote );
             shortcut.add("f3", findtext );
             shortcut.add("ctrl+f", findtext );
             shortcut.add("tab", replaySound );
             shortcut.add("esc", function() {window.minimize();} );
             shortcut.add("ctrl+up", previousWord );
             shortcut.add("ctrl+pageup", previousWord );
             shortcut.add("ctrl+wheelup", previousWord );
             shortcut.add("ctrl+down", nextWord );
             shortcut.add("ctrl+pagedown", nextWord );
             shortcut.add("ctrl+wheeldown", nextWord );
             shortcut.add("ctrl+left", function() {goHistory.navigTo(-1);} );
             shortcut.add("shift+wheelup", function() {goHistory.navigTo(-1);} );
             shortcut.add("ctrl+right", function() {goHistory.navigTo(1);} );
             shortcut.add("shift+wheeldown", function() {goHistory.navigTo(1);} );
             shortcut.add("ctrl+1", function() {setMode('dict');} );
             shortcut.add("ctrl+2", function() {setMode('culture_dict');} );
             shortcut.add("ctrl+3", function() {setMode('activator');} );
             shortcut.add("ctrl+4", function() {setMode('grammar');} );
             shortcut.add("ctrl+5", function() {setMode('exercises');} );
             shortcut.add("ctrl+6", function() {setMode('vt');} );
             shortcut.add("ctrl+7", function() {setMode('tr');} );
             shortcut.add("ctrl+8", function() {setMode('popup');} );
             shortcut.add("ctrl+9", function() {setMode('lwa');} );
             shortcut.add("ctrl+0", function() {setMode('home');} );
             shortcut.add("f4", function(){document.getElementById("advsearch-btn").click();} );
             shortcut.add("f12", function() {openPopup(POPUP_OPTION);} );





    Create Date : 12 ตุลาคม 2552
    Last Update : 12 ตุลาคม 2552 20:54:34 น. 0 comments
    Counter : 678 Pageviews.

    ชื่อ : * blog นี้ comment ได้เฉพาะสมาชิก
    Comment :
      *ส่วน comment ไม่สามารถใช้ javascript และ style sheet
     

    anchan42
    Location :


    [ดู Profile ทั้งหมด]

    ฝากข้อความหลังไมค์
    Rss Feed

    ผู้ติดตามบล็อก : 1 คน [?]




    Friends' blogs
    [Add anchan42's blog to your web]
    Links
     

     Pantip.com | PantipMarket.com | Pantown.com | © 2004 BlogGang.com allrights reserved.