Added support for hyphenation including jquery dependency.
This commit is contained in:
parent
9abea054b7
commit
774f5989ec
10653
dist/iwmlib.3rdparty.js
vendored
10653
dist/iwmlib.3rdparty.js
vendored
File diff suppressed because one or more lines are too long
2
dist/iwmlib.3rdparty.min.js
vendored
2
dist/iwmlib.3rdparty.min.js
vendored
File diff suppressed because one or more lines are too long
@ -18,9 +18,13 @@ function vendors() {
|
|||||||
'./node_modules/pixi-projection/dist/pixi-projection.js',
|
'./node_modules/pixi-projection/dist/pixi-projection.js',
|
||||||
'./node_modules/gsap/src/uncompressed/TweenMax.js',
|
'./node_modules/gsap/src/uncompressed/TweenMax.js',
|
||||||
'./node_modules/gsap/src/uncompressed/TimelineMax.js',
|
'./node_modules/gsap/src/uncompressed/TimelineMax.js',
|
||||||
|
'./lib/3rdparty/jquery.js',
|
||||||
'./lib/3rdparty/pixi-ease.js',
|
'./lib/3rdparty/pixi-ease.js',
|
||||||
'./lib/3rdparty/pixi-viewport.js',
|
'./lib/3rdparty/pixi-viewport.js',
|
||||||
'./lib/3rdparty/convertPointFromPageToNode.js'
|
'./lib/3rdparty/convertPointFromPageToNode.js',
|
||||||
|
'./lib/3rdparty/hyphenation/de.js',
|
||||||
|
'./lib/3rdparty/hyphenation/en-gb.js',
|
||||||
|
'./lib/3rdparty/jquery.hypher.js'
|
||||||
],
|
],
|
||||||
{ sourcemaps: false }
|
{ sourcemaps: false }
|
||||||
)
|
)
|
||||||
|
37
lib/3rdparty/hyphenation/de.js
vendored
Normal file
37
lib/3rdparty/hyphenation/de.js
vendored
Normal file
File diff suppressed because one or more lines are too long
32
lib/3rdparty/hyphenation/en-gb.js
vendored
Normal file
32
lib/3rdparty/hyphenation/en-gb.js
vendored
Normal file
File diff suppressed because one or more lines are too long
35
lib/3rdparty/hyphenation/en-us.js
vendored
Normal file
35
lib/3rdparty/hyphenation/en-us.js
vendored
Normal file
File diff suppressed because one or more lines are too long
40
lib/3rdparty/hyphenation/fr.js
vendored
Normal file
40
lib/3rdparty/hyphenation/fr.js
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
(function () {
|
||||||
|
|
||||||
|
var module = {
|
||||||
|
exports: null
|
||||||
|
};
|
||||||
|
|
||||||
|
// The french hyphenation patterns are retrieved from
|
||||||
|
// http://tug_org/svn/texhyphen/trunk/collaboration/repository/hyphenator/
|
||||||
|
module.exports = {
|
||||||
|
'id': 'fr',
|
||||||
|
'leftmin': 2,
|
||||||
|
'rightmin': 3,
|
||||||
|
'patterns': {
|
||||||
|
2 : "1ç1j1q",
|
||||||
|
3 : "1gè’â41zu1zo1zi1zè1zé1ze1za’y4_y41wu1wo1wi1we1wa1vy1vû1vu1vô1vo1vî1vi1vê1vè1vé1ve1vâ1va’û4_û4’u4_u41ba1bâ1ty1be1bé1bè1bê1tû1tu1tô1bi1bî1to1tî1ti1tê1tè1té1te1tà1tâ1ta1bo1bô1sy1sû1su1sœ1bu1bû1by2’21ca1câ1sô1ce1cé1cè1cê1so1sî1si1sê1sè1sé1se1sâ1sa1ry1rû1ru1rô1ro1rî1ri1rê1rè1ré1re1râ1ra’a41py1pû1pu1pô1po1pî1pi1pê1pè1pé1pe1pâ1pa_ô41ci1cî’ô4’o4_o41nyn1x1nû1nu1nœ1nô1no1nî1ni1nê1nè1né1ne1nâ1co1cô1na1my1mû1mu1mœ1mô1mo1mî1mi1cœ1mê1mè1mé1me1mâ1ma1ly1lû1lu1lô1lo1lî1li1lê1lè1cu1cû1cy1lé1d’1da1dâ1le1là1de1dé1dè1dê1lâ1la1ky1kû1ku1kô1ko1kî1ki1kê1kè1ké1ke1kâ1ka2jk_a4’î4_î4’i4_i41hy1hû1hu1hô1ho1hî1hi1hê1hè1hé1he1hâ1ha1gy1gû1gu1gô1go1gî1gi1gê_â41gé1ge1gâ1ga1fy1di1dî1fû1fu1fô1fo’e41fî1fi1fê1fè1do1dô1fé1fe1fâ1fa’è41du1dû1dy_è4’é4_é4’ê4_ê4_e41zy",
|
||||||
|
4 : "1f2lab2h2ckg2ckp2cksd1s22ckb4ck_1c2k2chw4ze_4ne_2ckt1c2lad2hm1s22cht2chsch2r2chp4pe_1t2r1p2h_ph44ph_ph2l2phnph2r2phs1d2r2pht2chn4fe_2chm1p2l1p2r4me_1w2rch2l2chg1c2r2chb4ch_1f2r4le_4re_4de_f1s21k2r4we_1r2h_kh44kh_1k2h4ke_1c2h_ch44ge_4je_4se_1v2r_sh41s2h4ve_4sh_2shm2shr2shs4ce_il2l1b2r4be_1b2l4he_4te__th41t2h4th_g1s21g2r2thl1g2l2thm2thnth2r1g2n2ths2ckf",
|
||||||
|
5 : "2ck3h4rhe_4kes_4wes_4res_4cke_éd2hi4vre_4jes_4tre_4zes_4ges_4des_i1oxy4gle_d1d2h_cul44gne_4fre_o1d2l_sch44nes_4les_4gre_1s2ch_réu24sch_4the_1g2hy4gue_2schs4cle_1g2ho1g2hi1g2he4ses_4tes_1g2ha4ves_4she_4che_4cre_4ces_t1t2l4hes_l1s2t4bes_4ble__con4xil3lco1ap4que_vil3l4fle_co1arco1exco1enco1auco1axco1ef4pes_co1é2per3h4mes__pe4r4bre_4pre_4phe_1p2né4ple__dé2smil3llil3lhil3l4dre_cil3lgil3l4fes_",
|
||||||
|
6 : "’in1o2rcil4l4phre_4dres_l3lioni1algi2fent_émil4l4phle_rmil4l4ples_4phes_1p2neuextra14pres_y1asthpé2nul2xent__mé2sa2pent_y1algi4chre_1m2nès4bres_1p2tèr1p2tér4chle_’en1o24fles_oxy1a2avil4l_en1o24ques_uvil4lco1a2d4bles__in1a2’in1a21s2por_cons4_bi1u2’as2ta_in1e2’in1e2_in1é2’in1é21s2lov1s2lavco1acq2cent__as2ta_co1o24ches_hémi1é_in2er’in2er2s3homo1ioni_in1i2’in1i22went_4shes__ré1a2_ré1é2_ré1e2_ré2el_in1o2ucil4lco1accu2s3tr_ré2er_ré2èr4cles_2vent__ré1i22sent_2tent_2gent__ré1o24gues__re1s24sche_4thes_’en1a2e2s3ch4gres_1s2cop2lent__en1a22nent__in1u2’in1u24gnes_4cres_wa2g3n4fres_4tres_4gles_1octet_dé1o2_dé1io4thre__bi1au2jent__dé1a22zent_4vres_2dent_4ckes_4rhes__dy2s3sub1s22kent_2rent_2bent_3d2hal",
|
||||||
|
7 : "a2g3nos3d2houdé3rent__dé3s2t_dé3s2pé3dent_2r3heur2r3hydri1s2tat2frent_io1a2ctla2w3re’in2u3l_in2u3l2crent_’in2uit_in2uit1s2caph1s2clér_ré2ussi2s3ché_re2s3t_re2s3s4sches_é3cent__seu2le’in2ond_in2ond’in2i3t_in2i3t’in2i3q_ré2aux_in2i3q2shent__di1alduni1a2x’in2ept2flent__in2eptuni1o2v2brent_co2nurb2chent_2quent_1s2perm1s2phèr_ma2c3kuevil4l1s2phér1s2piel1s2tein1s2tigm4chles_1s2tock1s2tyle1p2sych_pro1é2_ma2r1x_stil3lpusil3libril3lcyril3l_pré1s2thril3l_mé3san_pré1u2_mé2s1i_pré1o2_pré1i2piril3lpupil3lâ2ment__pré1e2_pré1é2_pré2au_pré1a22prent_2vrent_supero2_di1e2npoly1u2è2ment_poly1s2poly1o2poly1i2poly1è2poly1é2poly1e2poly1a2supe4r1capil3l2plent_armil5lsemil4lmil4letvacil4l_di2s3h3ph2tis2dlent_a2s3tro4phres_l2ment_i1è2drei1arthr2drent_4phles_supers2ô2ment_extra2i2phent_su3r2ah_su2r3hextra2chypo1u21alcool_per1u2_per1o2_per1i2_per1é2hypo1s2_per1a2hypo1o2hypo1i2hypo1é2_pen2tahypo1e2hypo1a2y1s2tome2s3cophyperu2hype4r1hypers2hypero21m2némohyperi21m2nési4chres_a1è2drehyperé2hypere2hypera2’oua1ou_oua1ouo1s2tomo1s2timo1s2tato1s2tasomni1s2tung2s3_dé3s2c2blent__bio1a2télé1e2télé1i22clent_télé1s22guent_1é2nerg2grent_2trent__dé2s1œ2t3heuro1è2dre2gnent_2glent_4thres__bi1a2t1é2drie_bi1a2c_i2g3nin3s2at_’i2g3ni2ckent__i2g3né’ab3réa’i2g3né_ab3réa_per1e2",
|
||||||
|
8 : "_ma2l1ap_dy2s1u2_dy2s1o2_dy2s1i2n3s2ats__dy2s1a2distil3l1é2lectrinstil3l1s2trophe2n1i2vro2b3long1s2tomos_ae3s4ch’ae3s4ch_eu2r1a2ombud2s3’eu2r1a2_mono1s2_mono1u2o1s2téro_mono1o2eu1s2tato1s2tradfritil3la2l1algi_mono1i2_mono1é2_ovi1s2c’ovi1s2c_mono1e2_mono1a2co1assocpaléo1é2boutil3l1s2piros_ré2i3fi_pa2n1ischevil4l1s2patiaca3ou3t2_di1a2cé_para1s2_pa2r3héco1assur_su2b1é2tu2ment_su2ment__su2b1in_su2b3lupapil3lire3pent_’inte4r3_su2b1urab3sent__su2b1a2di2s3cophu2ment_fu2ment__intera2au2ment_as2ment_or2ment_’intera2_intere2pé1r2é2q_péri1os_péri1s2ja3cent__anti1a2_péri1u2’anti1a2er2ment__anti1e2ac3cent_ar2ment_to2ment_’intere2ré3gent_papil3leom2ment_’anti1e2photo1s2_anti1é2_interé2’anti1é2_anti1s2’anti1s23ph2talé’interé2ri2ment__interi2’interi2mi2ment_apo2s3tri2s3chio_pluri1ai2s3chia_intero2’intero2_inte4r3po1astre_interu2’interu2_inters2ai2ment_’inters2papil3la_tri1o2n_su2r1a2_pon2tet_pos2t3h_dés2a3mes3cent__pos2t3r_post1s2_tri1a2tta2ment__tri1a2nra2ment_is3cent__su2r1e2_tri1a2cfa2ment_da2ment__su3r2et_su2r1é2_mé2s1es_mé2g1oh_su2r1of_su2r1ox_re3s4ty_re3s4tu_ma2l1oc’a2g3nat_dé2s1é2_ma2l1entachy1a2_pud1d2ltchin3t2_re3s4trtran2s3p_bi2s1a2tran2s3hhémo1p2té3quent__a2g3nat_dé2s1i2télé1o2bo2g3nosiradio1a2télé1o2ppu2g3nacru3lent__sta2g3nre3lent__ré2a3le_di1a2mi",
|
||||||
|
9 : "_ré2a3lit_dé3s2o3lthermo1s2_dé3s2ist_dé3s2i3rmit3tent_éni3tent__do3lent__ré2a3lisopu3lent__pa3tent__re2s3cap_la3tent__co2o3lie_re2s3cou_re2s3cri_ma2g3num_re2s3pir_dé3s2i3dco2g3nititran2s1a2tran2s1o2_dé3s2exu_re3s4tab_re3s4tag_dé3s2ert_re3s4tat_re3s4tén_re3s4tér_re3s4tim_re3s4tip_re3s4toc_re3s4toptran2s1u2_no2n1obs_ma2l1a2v_ma2l1int_prou3d2hpro2s3tativa3lent__ta3lent__rétro1a2_pro1s2cé_ma2l1o2dcci3dent__pa3rent__su2r1int_su2r1inf_su2r1i2mtor3rent_cur3rent__mé2s1u2stri3dent__dé3s2orm_su3r2ell_ar3dent__su3r2eaupru3dent__pré2a3lacla2ment__su3r2a3t_pos2t1o2_pos2t1inqua2ment_ter3gent_ser3gent_rai3ment_abî2ment_éci2ment_’ar3gent__ar3gent_rin3gent_tan3gent_éli2ment_ani2ment_’apo2s3ta_apo2s3tavélo1s2kivol2t1amp_dé3s2orp_dé2s1u2n_péri2s3ssesqui1a2’ana3s4trfir2ment_écu2ment_ser3pent_pré3sent_’ar3pent__ar3pent_’in1s2tab_in1s2tab’in2o3cul_in2o3culplu2ment_bou2ment_’in2exora_in2exora_su2b3linbru2ment__su3b2é3r_milli1am’in2effab_in2effab’in2augur_di1a2cid_in2augur_pa2n1opt’in2a3nit_in2a3nit1informat_ana3s4trvanil3lis_di1a2tom_su3b2altvanil3linstéréo1s2_pa2n1a2fo1s2tratuépi2s3cop_ci2s1alp1s2tructu1é2lément1é2driquepapil3lomllu2ment_",
|
||||||
|
10 : "1s2tandardimmi3nent__émi3nent_imma3nent_réma3nent_épi3s4cope_in2i3miti’in2i3miti_res3sent_moye2n1â2gréti3cent__dé3s2a3crmon2t3réalinno3cent__mono1ï2dé_pa2n1a2méimpu3dent__pa2n1a2ra_amino1a2c’amino1a2c_pa2n1o2phinci3dent__ser3ment_appa3rent_déca3dent__dacryo1a2_dé3s2astr_re4s5trin_dé3s2é3gr_péri2s3ta_sar3ment__dé3s2oufr_re3s4tandchro2ment__com3ment__re2s3quil_re2s3pons_gem2ment__re2s3pect_re2s3ciso_dé3s2i3gn_dé3s2i3ligram2ment__dé3s2invo_re2s3cisitran3s2act’anti2enneindo3lent__sou3vent_indi3gent_dili3gent_flam2ment_impo3tent_inso3lent_esti2ment_’on3guent__on3guent_inti2ment__dé3s2o3défécu3lent_veni2ment_reli2ment_vidi2ment_chlo2r3é2tpu2g3nablechlo2r3a2cryth2ment_o2g3nomonicarê2ment__méta1s2ta_ma2l1aisé_macro1s2célo3quent_tran3s2ats_anti2enne",
|
||||||
|
11 : "_contre1s2cperti3nent_conti3nent__ma2l1a2dro_in2é3lucta_psycho1a2n_dé3s2o3pil’in2é3luctaperma3nent__in2é3narratesta3ment__su2b3liminrésur3gent_’in2é3narraimmis4cent__pro2g3nathchien3dent_sporu4lent_dissi3dent_corpu3lent_archi1é2pissubli2ment_indul3gent_confi3dent__syn2g3nathtrucu3lent_détri3ment_nutri3ment_succu3lent_turbu3lent__pa2r1a2che_pa2r1a2chèfichu3ment_entre3gent_conni3vent_mécon3tent_compé3tent__re4s5trict_dé3s2i3nen_re2s3plend1a2nesthésislalo2ment__dé3s2ensib_re4s5trein_phalan3s2tabsti3nent_",
|
||||||
|
12 : "polyva3lent_équiva4lent_monova3lent_amalga2ment_omnipo3tent__ma2l1a2dreséquipo3tent__dé3s2a3tellproémi3nent_contin3gent_munifi3cent__ma2g3nicideo1s2trictionsurémi3nent_préémi3nent__bai2se3main",
|
||||||
|
13 : "acquies4cent_intelli3gent_tempéra3ment_transpa3rent__ma2g3nificatantifer3ment_",
|
||||||
|
14 : "privatdo3cent_diaphrag2ment_privatdo3zent_ventripo3tent__contre3maître",
|
||||||
|
15 : "grandilo3quent_",
|
||||||
|
16 : "_chè2vre3feuille"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var h = new window['Hypher'](module.exports);
|
||||||
|
|
||||||
|
if (typeof module.exports.id === 'string') {
|
||||||
|
module.exports.id = [module.exports.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < module.exports.id.length; i += 1) {
|
||||||
|
window['Hypher']['languages'][module.exports.id[i]] = h;
|
||||||
|
}
|
||||||
|
}());
|
216
lib/3rdparty/jquery.hypher.js
vendored
Normal file
216
lib/3rdparty/jquery.hypher.js
vendored
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
(function () {
|
||||||
|
|
||||||
|
var module = {
|
||||||
|
exports: null
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @param {!{patterns: !Object, leftmin: !number, rightmin: !number}} language The language pattern file. Compatible with Hyphenator.js.
|
||||||
|
*/
|
||||||
|
function Hypher(language) {
|
||||||
|
var exceptions = [],
|
||||||
|
i = 0;
|
||||||
|
/**
|
||||||
|
* @type {!Hypher.TrieNode}
|
||||||
|
*/
|
||||||
|
this.trie = this.createTrie(language['patterns']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {!number}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
this.leftMin = language['leftmin'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {!number}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
this.rightMin = language['rightmin'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {!Object.<string, !Array.<string>>}
|
||||||
|
*/
|
||||||
|
this.exceptions = {};
|
||||||
|
|
||||||
|
if (language['exceptions']) {
|
||||||
|
exceptions = language['exceptions'].split(/,\s?/g);
|
||||||
|
|
||||||
|
for (; i < exceptions.length; i += 1) {
|
||||||
|
this.exceptions[exceptions[i].replace(/\u2027/g, '').toLowerCase()] = new RegExp('(' + exceptions[i].split('\u2027').join(')(') + ')', 'i');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{_points: !Array.<number>}}
|
||||||
|
*/
|
||||||
|
Hypher.TrieNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a trie from a language pattern.
|
||||||
|
* @private
|
||||||
|
* @param {!Object} patternObject An object with language patterns.
|
||||||
|
* @return {!Hypher.TrieNode} An object trie.
|
||||||
|
*/
|
||||||
|
Hypher.prototype.createTrie = function (patternObject) {
|
||||||
|
var size = 0,
|
||||||
|
i = 0,
|
||||||
|
c = 0,
|
||||||
|
p = 0,
|
||||||
|
chars = null,
|
||||||
|
points = null,
|
||||||
|
codePoint = null,
|
||||||
|
t = null,
|
||||||
|
tree = {
|
||||||
|
_points: []
|
||||||
|
},
|
||||||
|
patterns;
|
||||||
|
|
||||||
|
for (size in patternObject) {
|
||||||
|
if (patternObject.hasOwnProperty(size)) {
|
||||||
|
patterns = patternObject[size].match(new RegExp('.{1,' + (+size) + '}', 'g'));
|
||||||
|
|
||||||
|
for (i = 0; i < patterns.length; i += 1) {
|
||||||
|
chars = patterns[i].replace(/[0-9]/g, '').split('');
|
||||||
|
points = patterns[i].split(/\D/);
|
||||||
|
t = tree;
|
||||||
|
|
||||||
|
for (c = 0; c < chars.length; c += 1) {
|
||||||
|
codePoint = chars[c].charCodeAt(0);
|
||||||
|
|
||||||
|
if (!t[codePoint]) {
|
||||||
|
t[codePoint] = {};
|
||||||
|
}
|
||||||
|
t = t[codePoint];
|
||||||
|
}
|
||||||
|
|
||||||
|
t._points = [];
|
||||||
|
|
||||||
|
for (p = 0; p < points.length; p += 1) {
|
||||||
|
t._points[p] = points[p] || 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tree;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hyphenates a text.
|
||||||
|
*
|
||||||
|
* @param {!string} str The text to hyphenate.
|
||||||
|
* @return {!string} The same text with soft hyphens inserted in the right positions.
|
||||||
|
*/
|
||||||
|
Hypher.prototype.hyphenateText = function (str, minLength) {
|
||||||
|
minLength = minLength || 4;
|
||||||
|
|
||||||
|
// Regexp("\b", "g") splits on word boundaries,
|
||||||
|
// compound separators and ZWNJ so we don't need
|
||||||
|
// any special cases for those characters. Unfortunately
|
||||||
|
// it does not support unicode word boundaries, so
|
||||||
|
// we implement it manually.
|
||||||
|
var words = str.split(/([a-zA-Z0-9_\u0027\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g);
|
||||||
|
|
||||||
|
for (var i = 0; i < words.length; i += 1) {
|
||||||
|
if (words[i].indexOf('/') !== -1) {
|
||||||
|
// Don't insert a zero width space if the slash is at the beginning or end
|
||||||
|
// of the text, or right after or before a space.
|
||||||
|
if (i !== 0 && i !== words.length - 1 && !(/\s+\/|\/\s+/.test(words[i]))) {
|
||||||
|
words[i] += '\u200B';
|
||||||
|
}
|
||||||
|
} else if (words[i].length > minLength) {
|
||||||
|
words[i] = this.hyphenate(words[i]).join('\u00AD');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return words.join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hyphenates a word.
|
||||||
|
*
|
||||||
|
* @param {!string} word The word to hyphenate
|
||||||
|
* @return {!Array.<!string>} An array of word fragments indicating valid hyphenation points.
|
||||||
|
*/
|
||||||
|
Hypher.prototype.hyphenate = function (word) {
|
||||||
|
var characters,
|
||||||
|
characterPoints = [],
|
||||||
|
originalCharacters,
|
||||||
|
i,
|
||||||
|
j,
|
||||||
|
k,
|
||||||
|
node,
|
||||||
|
points = [],
|
||||||
|
wordLength,
|
||||||
|
lowerCaseWord = word.toLowerCase(),
|
||||||
|
nodePoints,
|
||||||
|
nodePointsLength,
|
||||||
|
m = Math.max,
|
||||||
|
trie = this.trie,
|
||||||
|
result = [''];
|
||||||
|
|
||||||
|
if (this.exceptions.hasOwnProperty(lowerCaseWord)) {
|
||||||
|
return word.match(this.exceptions[lowerCaseWord]).slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (word.indexOf('\u00AD') !== -1) {
|
||||||
|
return [word];
|
||||||
|
}
|
||||||
|
|
||||||
|
word = '_' + word + '_';
|
||||||
|
|
||||||
|
characters = word.toLowerCase().split('');
|
||||||
|
originalCharacters = word.split('');
|
||||||
|
wordLength = characters.length;
|
||||||
|
|
||||||
|
for (i = 0; i < wordLength; i += 1) {
|
||||||
|
points[i] = 0;
|
||||||
|
characterPoints[i] = characters[i].charCodeAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < wordLength; i += 1) {
|
||||||
|
node = trie;
|
||||||
|
for (j = i; j < wordLength; j += 1) {
|
||||||
|
node = node[characterPoints[j]];
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
nodePoints = node._points;
|
||||||
|
if (nodePoints) {
|
||||||
|
for (k = 0, nodePointsLength = nodePoints.length; k < nodePointsLength; k += 1) {
|
||||||
|
points[i + k] = m(points[i + k], nodePoints[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 1; i < wordLength - 1; i += 1) {
|
||||||
|
if (i > this.leftMin && i < (wordLength - this.rightMin) && points[i] % 2) {
|
||||||
|
result.push(originalCharacters[i]);
|
||||||
|
} else {
|
||||||
|
result[result.length - 1] += originalCharacters[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Hypher;
|
||||||
|
window['Hypher'] = module.exports;
|
||||||
|
|
||||||
|
window['Hypher']['languages'] = {};
|
||||||
|
}());(function ($) {
|
||||||
|
$.fn.hyphenate = function (language) {
|
||||||
|
if (window['Hypher']['languages'][language]) {
|
||||||
|
return this.each(function () {
|
||||||
|
var i = 0, len = this.childNodes.length;
|
||||||
|
for (; i < len; i += 1) {
|
||||||
|
if (this.childNodes[i].nodeType === 3) {
|
||||||
|
this.childNodes[i].nodeValue = window['Hypher']['languages'][language].hyphenateText(this.childNodes[i].nodeValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}(jQuery));
|
10364
lib/3rdparty/jquery.js
vendored
Normal file
10364
lib/3rdparty/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user