Group Blog
 
<<
กันยายน 2552
 12345
6789101112
13141516171819
20212223242526
27282930 
 
24 กันยายน 2552
 
All Blogs
 
ปรับปรุง Longman Dictionary of Contemporary English 2009 ซ่อนจุดแบ่งพยางค์ (6.3)

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

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

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


เนื้อหาตอนนี้จะเป็นการเพิ่มโค้ดเพื่อให้ตัวเลือก Hide syllable dotsที่เพิ่มเข้ามาใช้งานได้



แสดงจุดแบ่งพยางค์

ซ่อนจุดแบ่งพยางค์



วิธีทำ
  1. เพิ่มตัวแปร(สีแดง)นี้เข้าไปที่หัวไฟล์  C:ProgramFilesLongmanLDOCE5chromeldoce5contentjsapplication.js

  2. // If true, hide the syllabledots in word
    var g_HideSyllableDots = false;

  3. เพิ่มโค้ดสีแดงนี้เข้าไปในฟังก์ชั่น prefInit

       g_Pref.SetIntPref("skpref.playlang", "0");
       updateTextSize();
       updateAutoPlay();
        
       try      {g_HideSyllableDots = g_Pref.GetBoolPref("skpref.hideSyllableDots"); }
       catch(e) { g_Pref.SetBoolPref("skpref.hideSyllableDots", false); }
       try      {g_DefaultScrollSpeed = g_Pref.GetIntPref("skpref.scrollspeed"); }
       catch(e) { g_Pref.SetIntPref("skpref.scrollspeed", 10); }
    }
  4. เพิ่มโค้ดสีแดงเข้าไปในฟังก์ชั่น createSimpleSearchSystem
      1. try{
                       var entry   =skTabManager.getFile(simpleSearchSystem.fsAz + "/config.cff",
                           index).GetData().GetWStringData();
                       entry = entry.replace(/^s*<?xml.+??>/, '');

                       var parser = new DOMParser();
                       var xmlDoc = parser.parseFromString(entry, "application/xml");
                       // Remove syllable dots from entry text
                       if (g_HideSyllableDots)
                           removeSyllableDots(xmlDoc);
                      var serializer = new XMLSerializer();
                       entry = serializer.serializeToString(xmlDoc);
          
                       //showObj(simpleSearchSystem)
                       if(simpleSearchSystem.note)

  5. เพิ่มฟั่งก์ชั่นนี้เข้าไปที่ท้ายไฟล์
// update g_HideSyllableDots
function showSyllableDots() {
    g_HideSyllableDots = g_Pref.GetBoolPref("skpref.hideSyllableDots");
}

// Remove Syllable Dots from entry text
function removeSyllableDots(xmlDoc) {
    try {
        var nodeHYPHENATION = xmlDoc.getElementsByTagName("HYPHENATION")[0];
        //first method: use regexp to replace syllable Dots
       //nodeHYPHENATION.childNodes[0].data =nodeHYPHENATION.childNodes[0].data.replace(/[???]/g, "");
        //second method: use <HWD><BASE> content to replace HYPHENATION content
       nodeHYPHENATION.childNodes[0].data =xmlDoc.getElementsByTagName("HWD")[0].getElementsByTagName("BASE")[0].childNodes[0].data;
    } catch (e) {
        alert( e );
    }
}
หลังจากแก้แล้ว เวลาเปลื่ยนตัวเลือกแล้วจะต้องปิดลองแมนแล้วเปิดใหม่เพื่อให้ตัวเลือกใหม่มีผล 



Create Date : 24 กันยายน 2552
Last Update : 24 กันยายน 2552 23:25:35 น. 0 comments
Counter : 461 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.