JS traditional to simplified

Source: Internet
Author: User
<A href = '#' Id = 'stranlink'> to </a>

// Simulates the simplified and traditional Conversion Function plug-ins in the Language Pack!
VaR default_isft = 0 // whether the default is traditional, 0-simplified, 1-traditional
VaR stranit_delay = 20 // translation delay in milliseconds (this is designed to make the webpage appear smoothly first)
// Convert text
Function strantext (txt, Toft, chgtxt)
{
If (txt = "" | TXT = NULL) Return ""
Toft = NULL? Bodyisft: Toft
If (chgtxt) TXT = TXT. Replace (Toft? "Jane": "fan"), (Toft? "Fan": "jian "))
If (Toft) {return traditionalized (txt )}
Else {return simplized (txt )}
}
// Convert the object and use recursion to strip the object to the text layer by layer.
Function stranbody (fobj)
{
If (typeof (fobj) = "object") {var OBJ = fobj. childnodes}
Else
{
VaR tmptxt = stranlink_obj.innerhtml.tostring ()
If (tmptxt. indexof ("") <0)
{
Bodyisft = 1
Stranlink_obj.innerhtml = strantext (tmptxt, 0, 1)
Stranlink. Title = strantext (stranlink. Title, 0, 1)
}
Else
{
Bodyisft = 0
Stranlink_obj.innerhtml = strantext (tmptxt, 1, 1)
Stranlink. Title = strantext (stranlink. Title, 1, 1)
}
Setcookie (jf_cn, bodyisft, 7)
VaR OBJ = Document. Body. childnodes
}
For (VAR I = 0; I <obj. length; I ++)
{
VaR oo = obj. Item (I)
If ("| BR | HR | textarea |". indexof ("|" + oo. tagname + "|")> 0 | oo = stranlink_obj) continue;
If (oo. title! = "" & Oo. title! = NULL) Oo. Title = strantext (oo. Title );
If (oo. alt! = "" & Oo. alt! = NULL) Oo. Alt = strantext (oo. alt );
If (oo. tagname = "input" & oo. value! = "" & Oo. type! = "Text" & oo. type! = "Hidden") Oo. value = strantext (oo. value );
If (oo. nodetype = 3) {oo. Data = strantext (oo. Data )}
Else stranbody (OO)
}
}
Function jtpystr ()
{
Return 'bao Bei Yu Pu Peng Bian change arguing about the production of Binbin pig and Bin pig dial pot platinum barrier Bu xiangshen silkworm residue miserable can Cang Po toilet side volume test Layer Mixing CHAN Yan winding shovel Interpretation the treasure farm tasted the treasure factory Chang chuche che Chen linting support said Cheng Chi shame tooth Chong insect domain Xiao Ji silk ugly cupboard kitchen Chu Foundation storage touch chuanchuang hammer pure CI Cong scallions from the cluster together to handle the mistake to carry a loan to bear a single letter of death when the dang Dao prayer guide stealing Deng enemy Lamp di di Dian fishing tune stacking Ding ding dong frozen douxiao reading gambling plating forging broken satin against the team of tons of blunt wins goose amount evil ele. Er bait send penalty valve Fan Rice visit spinning fly waste Fen FENG Yu Feng Fu negative bind the calcium cap dry catch stalk gangang gang pick pig Ge chromium to Gong Gou structure purchase enough Gu Guan gui Si guigui yao Huang lie Hui ruined bribery party will stew get goods curse attack Machine Product hunger and hunger chicken performance competition level squeeze a few Ji ji Jian prize Lecture sauce glue pouring arrogant Jiao stir hinge correction foot dumplings handed twisted pair sedan than straw stage stem Jing jiu old Ju cited according to saw fear drama xiao xi jie jiejie tight Jin only Jin Jing Jue Jun Kai kai shell course Ken Kai Ku kaoku wide mine Kuang situation loss que feedback expanded from wax lailai to Lai LAN lazy abuse fishing la lelelei Lei Li lianlian Lian Liang Lian Liao Ling ridge collection Lou Lu Gu Lu Lun Lu on Luo luochao, luochuo, luocheng, luomao, luomomeng, maomma, maoma.com, and maoma.com mi Mian Myanmar temple Jin min Ming Zhe Mu na difficult to scratching the brain annoying yellow greasy twist stuffed birds bait tweezers nickel yellow Ning twist new pus thick Nong malaria noo goU puke Pan Pang guoai compensate spray Peng cheat floating frequency poor ping pu Qi abandon lead Qian pliers qian shangu's gun throws the wall and grabs the shovel bridge. Qiao qiaoqiao steals Qinqin's light hydrogen and invites Qing Qiong's poor community to drive the body and drive the right of the ship. hot tough recognize Rong velvet soft grui run sprinkling SA Gill game umbrella mourning Sao sweep sembit and kill screening Sun Shan Yi injury enjoy burning Shao Yan photo to deter set Shen shengsheng Shengshi Shi wet poetry corpse eclipse real knowledge driving trend Shi Shou Shu redemption belongs to SHU Shu Shuai Shuang who tax Shun said Shuo Si feeding loose changyi shaosu sued Su, although the Sui-Year-Old sun-damaged stalagmite, zomet, and taoban Tan Tang Tao Tang Teng tang tongtong head figure tu Tuan yi Tuo elliptical so bend Wan stubborn Wan wangwei violation Wei Wen Wei wu Xi Xia Xian xiang Xiao pin Xiao Zheng Xie zinc Xie Xing Yu rust embroidery XU Xu xuxuan Xuan Xun Zheng xun Yan Zheng Yang sample Yao Ye yi yi Yin Ying yi Yu you yu pre-Yu Yuan Yue Yun Yu disaster recovery save temporarily likes dirty chisel jujube stove responsibility selection ze thieves give Zha Rolling Brake fraud Zhai bonds felt throw rolling stack war Zhang account expansion Zhao Zhe zhe ge this zhen Zheng Zhi Zhong Zheng Qian Zhu Qian specialized bricks to earn Zhuang-like cone pendant with dirty Z resource stains trace the total longitudinal growth of the group drill caused by the clock so as only fierce quasi starting board in the residual chain leak';
}
Function ftpystr ()
{
Return 'pretty much lost in love with our senior vice versa. please refer to the following link for more information: our field Chief Executive has been driving a wide range of vehicles, including large numbers of vehicles, large numbers of vehicles, and small numbers of vehicles. when the website is being processed, there will be a number of large numbers of small numbers of numbers. there are just a few clicks on the power of the computer, just a few clicks on the power of the computer, just a few clicks on the power of the computer. I have been writing a huge number of questions about how to handle these problems. please refer to the following link for more information: in addition, Alibaba Cloud's legal regulations have been released, and the number of Chinese users in mainland China has been reduced. I also recommend that you have been using Alibaba Cloud products to improve the security of your website. please refer to our computing reports. Please refer to our reports when there are too many temporary problems during peak hours. Please refer to our reports. there are already many problems in the future. please refer to the following link for more information: please refer to the following link for more information: there are two types of operators that have been used to handle these problems. please refer to the following link for more information: there are two major reasons for this problem: please refer to the following documents for more information: Please refer to our website for more information. Please refer to our website for more information. there are already many other large numbers of small numbers of Chinese characters. there are still huge numbers of users who have been using this product, and they have been using this product to improve their scalability. please refer to our region's copyright authority for copyright verification. Please make sure that your website has been authorized to renew your website. please refer to the following link for more information: which of the following statements about dynamic route for analyticdb? users who say they have dynamic route for analyticdb? please refer to the following documents for more information: I have been reading this article, and I have been reading this article for some reasons. please try again later. Please try again later. there are two major problems in the field of artificial intelligence, artificial intelligence please refer to the following example: it is suggested that the primary there are two major problems in the future. There are two major reasons for this problem. this article introduces some technical guidelines, as well as some other technical guidelines. please refer to the following link for more information: alibaba Cloud has provided some technical support for its website. Alibaba Cloud has provided some technical support for its website administrators ';
}
Function traditionalized (CC ){
VaR STR = '', Ss = jtpystr (), TT = ftpystr ();
For (VAR I = 0; I <cc. length; I ++)
{
If (CC. charcodeat (I)> 10000 & SS. indexof (CC. charat (I ))! =-1) STR + = TT. charat (ss. indexof (CC. charat (I )));
Else STR + = cc. charat (I );
}
Return STR;
}
Function simplized (CC ){
VaR STR = '', Ss = jtpystr (), TT = ftpystr ();
For (VAR I = 0; I <cc. length; I ++)
{
If (CC. charcodeat (I)> 10000 & TT. indexof (CC. charat (I ))! =-1) STR + = ss. charat (TT. indexof (CC. charat (I )));
Else STR + = cc. charat (I );
}
Return STR;
}
Function setcookie (name, value) // set cookies
{
VaR argv = setcookie. arguments;
VaR argc = setcookie. Arguments. length;
VaR expires = (argc> 2 )? Argv [2]: NULL;
If (expires! = NULL)
{
VaR largeexpdate = new date ();
Largeexpdate. settime (largeexpdate. gettime () + (expires * 1000*3600*24 ));
}
Document. Cookie = Name + "=" + escape (value) + (expires = NULL )? "": ("; Expires =" + largeexpdate. togmtstring ()));
}
Function getcookie (name) // read cookies
{
VaR search = Name + "="
If (document. Cookie. length> 0)
{
Offset = Document. Cookie. indexof (Search)
If (offset! =-1)
{
Offset + = search. Length
End = Document. Cookie. indexof (";", offset)
If (END =-1) End = Document. Cookie. Length
Return Unescape (document. Cookie. substring (offset, end ))
}
Else return ""
}
}
VaR stranlink_obj = Document. getelementbyid ("stranlink ")
If (stranlink_obj)
{
VaR jf_cn = "ft" + self. Location. hostname. tostring (). Replace (/\./g ,"")
VaR bodyisft = getcookie (jf_cn)
If (bodyisft! = "1") bodyisft = default_isft
With (stranlink_obj)
{
If (typeof (document. All )! = "Object") // non-IE browser
{
Href = "stranbody ()"
}
Else
{
Href = "#";
Onclick = new function ("stranbody (); Return false ")
}
Title = strantext ("click to browse in Traditional Chinese)
Innerhtml = strantext (innerhtml, 1, 1)
}
If (bodyisft = "1") {setTimeout ("stranbody ()", stranit_delay )}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.