1!function(define, undefined) { 2 define(function() { 3 "use strict"; 4 var isArray, impl = { 5 mobileDetectRules: { 6 phones: { 7 iPhone: "\\biPhone\\b|\\biPod\\b", 8 BlackBerry: "BlackBerry|\\bBB10\\b|rim[0-9]+", 9 HTC: "HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\bEVO\\b|T-Mobile G1|Z520m|Android [0-9.]+; Pixel", 10 Nexus: "Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6", 11 Dell: "Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\\b001DL\\b|\\b101DL\\b|\\bGS01\\b", 12 Motorola: "Motorola|DROIDX|DROID BIONIC|\\bDroid\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b|XT1068|XT1092|XT1052", 13 Samsung:
vendor: 5,393 bytes, line 13
13"\\bSamsung\\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190
13|SM-J500FN|SM-G903F|SM-J330F", 14 LG: "\\bLG\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)", 15 Sony: "SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533", 16 Asus: "Asus.*Galaxy|PadFone.*Mobile", 17 NokiaLumia: "Lumia [0-9]{3,4}", 18 Micromax: "Micromax.*\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\b", 19 Palm: "PalmSource|Palm", 20 Vertu: "Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature", 21 Pantech: "PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790", 22 Fly: "IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250", 23 Wiko: "KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLI
23M|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM", 24 iMobile: "i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)", 25 SimValley: "\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\b", 26 Wolfgang: "AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q", 27 Alcatel: "Alcatel", 28 Nintendo: "Nintendo (3DS|Switch)", 29 Amoi: "Amoi", 30 INQ: "INQ", 31 GenericPhone: "Tapatalk|PDA;|SAGEM|\\bmmp\\b|pocket|\\bpsp\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\bwap\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser" 32 }, 33 tablets: { 34 iPad: "iPad|iPad.*Mobile", 35 NexusTablet: "Android.*Nexus[\\s]+(7|9|10)", 36 GoogleTablet: "Android.*Pixel C", 37 SamsungTablet: "SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708", 38 Kindle: "Kindle|Silk.*Accelerated|Android.*\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)", 39 SurfaceTablet: "Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)", 40 HPTablet: "HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10", 41 AsusTablet: "^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\bK00F\\b|\\bK00C\\b|\\bK00E\\b|\\bK00L\\b|TX201LA|ME176C|ME102A|\\bM80TA\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\\bME70C\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\\bP027\\b|\\bP024\\b|\\bP00C\\b", 42 BlackBerryTablet: "PlayBook|RIM Tablet", 43 HTCtablet: "HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410", 44 MotorolaTablet: "xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617", 45 NookTablet: "Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2", 46 AcerTablet: "Android.*; \\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\b|W3-810|\\bA3-A10\\b|\\bA3-A11\\b|\\bA3-A20\\b|\\bA3-A30", 47 ToshibaTablet: "Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO", 48 LGTablet: "\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V4
4800|LG-VK810\\b", 49 FujitsuTablet: "Android.*\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\b", 50 PrestigioTablet: "PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002", 51 LenovoTablet: "Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304F|TB-X304L|TB-8703F|Tab2A7-10F", 52 DellTablet: "Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7", 53 YarvikTablet: "Android.*\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\b", 54 MedionTablet: "Android.*\\bOYO\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB", 55 ArnovaTablet: "97G4|AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2", 56 IntensoTablet: "INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004", 57 IRUTablet: "M702pro", 58 MegafonTablet: "MegaFon V9|\\bZTE V9\\b|Android.*\\bMT7A\\b", 59 EbodaTablet: "E-Boda (Supreme|Impresspeed|Izzycomm|Essential)", 60 AllViewTablet: "Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)", 61 ArchosTablet: "\\b(101G9|80G9|A101IT)\\b|Qilive 97R|Archos5|\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|c|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\b", 62 AinolTablet: "NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark", 63 NokiaLumiaTablet: "Lumia 2520", 64 SonyTablet: "Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP612|SOT31", 65 PhilipsTablet: "\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\b", 66 CubeTablet: "Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT", 67 CobyTablet: "MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010", 68 MIDTablet: "M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10", 69 MSITablet: "MSI \\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\b", 70 SMiTTablet: "Android.*(\\bMID\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)", 71 RockChipTablet: "Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A", 72 FlyTablet: "IQ310|Fly Vision", 73 bqTablet: "Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))|Maxwell.*Lite|Maxwell.*Plus", 74 HuaweiTablet: "MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09", 75 NecTablet: "\\bN-06D|\\bN-08D", 76 PantechTablet: "Pantech.*P4100",
77 BronchoTablet: "Broncho.*(N701|N708|N802|a710)", 78 VersusTablet: "TOUCHPAD.*[78910]|\\bTOUCHTAB\\b", 79 ZyncTablet: "z1000|Z99 2G|z99|z930|z999|z990|z909|Z919|z900", 80 PositivoTablet: "TB07STA|TB10STA|TB07FTA|TB10FTA", 81 NabiTablet: "Android.*\\bNabi", 82 KoboTablet: "Kobo Touch|\\bK080\\b|\\bVox\\b Build|\\bArc\\b Build", 83 DanewTablet: "DSlide.*\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\b", 84 TexetTablet: "NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE", 85 PlaystationTablet: "Playstation.*(Portable|Vita)", 86 TrekstorTablet: "ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab", 87 PyleAudioTablet: "\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\b", 88 AdvanTablet: "Android.* \\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\b ", 89 DanyTechTablet: "Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1", 90 GalapadTablet: "Android.*\\bG1\\b", 91 MicromaxTablet: "Funbook|Micromax.*\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\b", 92 KarbonnTablet: "Android.*\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\b", 93 AllFineTablet: "Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide", 94 PROSCANTablet: "\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\b", 95 YONESTablet: "BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026", 96 ChangJiaTablet: "TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503", 97 GUTablet: "TX-A1301|TX-M9002|Q702|kf026", 98 PointOfViewTablet: "TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10", 99 OvermaxTablet: "OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)|Qualcore 1027", 100 HCLTablet: "HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync", 101 DPSTablet: "DPS Dream 9|DPS Dual 7", 102 VistureTablet: "V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10", 103 CrestaTablet: "CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989", 104 MediatekTablet: "\\bMT8125|MT8389|MT8135|MT8377\\b", 105 ConcordeTablet: "Concorde([ ]+)?Tab|ConCorde ReadMan", 106 GoCleverTablet: "GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042", 107 ModecomTablet: "FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003", 108 VoninoTablet: "\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\bQ8\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\b", 109 ECSTablet: "V07OT2|TM105A|S10OT1|TR10CS1", 110 StorexTablet: "eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab", 111 VodafoneTablet: "SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497", 112 EssentielBTablet: "Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2", 113 RossMoorTablet: "RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711",
114 iMobileTablet: "i-mobile i-note", 115 TolinoTablet: "tolino tab [0-9.]+|tolino shine", 116 AudioSonicTablet: "\\bC-22Q|T7-QC|T-17B|T-17P\\b", 117 AMPETablet: "Android.* A78 ", 118 SkkTablet: "Android.* (SKYPAD|PHOENIX|CYCLOPS)", 119 TecnoTablet: "TECNO P9|TECNO DP8D", 120 JXDTablet: "Android.* \\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\b", 121 iJoyTablet: "Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)", 122 FX2Tablet: "FX2 PAD7|FX2 PAD10", 123 XoroTablet: "KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151", 124 ViewsonicTablet: "ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a", 125 VerizonTablet: "QTAQZ3|QTAIR7|QTAQTZ3|QTASUN1|QTASUN2|QTAXIA1", 126 OdysTablet: "LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\bXELIO\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10", 127 CaptivaTablet: "CAPTIVA PAD", 128 IconbitTablet: "NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S", 129 TeclastTablet: "T98 4G|\\bP80\\b|\\bX90HD\\b|X98 Air|X98 Air 3G|\\bX89\\b|P80 3G|\\bX80h\\b|P98 Air|\\bX89HD\\b|P98 3G|\\bP90HD\\b|P89 3G|X98 3G|\\bP70h\\b|P79HD 3G|G18d 3G|\\bP79HD\\b|\\bP89s\\b|\\bA88\\b|\\bP10HD\\b|\\bP19HD\\b|G18 3G|\\bP78HD\\b|\\bA78\\b|\\bP75\\b|G17s 3G|G17h 3G|\\bP85t\\b|\\bP90\\b|\\bP11\\b|\\bP98t\\b|\\bP98HD\\b|\\bG18d\\b|\\bP85s\\b|\\bP11HD\\b|\\bP88s\\b|\\bA80HD\\b|\\bA80se\\b|\\bA10h\\b|\\bP89\\b|\\bP78s\\b|\\bG18\\b|\\bP85\\b|\\bA70h\\b|\\bA70\\b|\\bG17\\b|\\bP18\\b|\\bA80s\\b|\\bA11s\\b|\\bP88HD\\b|\\bA80h\\b|\\bP76s\\b|\\bP76h\\b|\\bP98\\b|\\bA10HD\\b|\\bP78\\b|\\bP88\\b|\\bA11\\b|\\bA10t\\b|\\bP76a\\b|\\bP76t\\b|\\bP76e\\b|\\bP85HD\\b|\\bP85a\\b|\\bP86\\b|\\bP75HD\\b|\\bP76v\\b|\\bA12\\b|\\bP75a\\b|\\bA15\\b|\\bP76Ti\\b|\\bP81HD\\b|\\bA10\\b|\\bT760VE\\b|\\bT720HD\\b|\\bP76\\b|\\bP73\\b|\\bP71\\b|\\bP72\\b|\\bT720SE\\b|\\bC520Ti\\b|\\bT760\\b|\\bT720VE\\b|T720-3GE|T720-WiFi", 130 OndaTablet: "\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\b[\\s]+", 131 JaytechTablet: "TPC-PA762", 132 BlaupunktTablet: "Endeavour 800NG|Endeavour 1010", 133 DigmaTablet: "\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\b", 134 EvolioTablet: "ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\bEvotab\\b|\\bNeura\\b", 135 LavaTablet: "QPAD E704|\\bIvoryS\\b|E-TAB IVORY|\\bE-TAB\\b", 136 AocTablet: "MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712", 137 MpmanTablet: "MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\bMPG7\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010",
138 CelkonTablet: "CT695|CT888|CT[\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\bCT-1\\b", 139 WolderTablet: "miTab \\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\b", 140 MediacomTablet: "M-MPI10C3G|M-SP10EG|M-SP10EGP|M-SP10HXAH|M-SP7HXAH|M-SP10HXBH|M-SP8HXAH|M-SP8MXA", 141 MiTablet: "\\bMI PAD\\b|\\bHM NOTE 1W\\b", 142 NibiruTablet: "Nibiru M1|Nibiru Jupiter One", 143 NexoTablet: "NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI", 144 LeaderTablet: "TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100", 145 UbislateTablet: "UbiSlate[\\s]?7C", 146 PocketBookTablet: "Pocketbook", 147 KocasoTablet: "\\b(TB-1207)\\b", 148 HisenseTablet: "\\b(F5281|E2371)\\b", 149 Hudl: "Hudl HT7S3|Hudl 2", 150 TelstraTablet: "T-Hub2", 151 GenericTablet: "Android.*\\b97D\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\bA7EB\\b|CatNova8|A1_07|CT704|CT1002|\\bM721\\b|rk30sdk|\\bEVOTAB\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\bM6pro\\b|CT1020W|arc 10HD|\\bTP750\\b|\\bQTAQZ3\\b|WVT101|TM1088|KT107" 152 }, 153 oss: { 154 AndroidOS: "Android", 155 BlackBerryOS: "blackberry|\\bBB10\\b|rim tablet os", 156 PalmOS: "PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino", 157 SymbianOS: "Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\bS60\\b", 158 WindowsMobileOS: "Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;", 159 WindowsPhoneOS: "Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;", 160 iOS: "\\biPhone.*Mobile|\\biPod|\\biPad|AppleCoreMedia", 161 MeeGoOS: "MeeGo", 162 MaemoOS: "Maemo", 163 JavaOS: "J2ME/|\\bMIDP\\b|\\bCLDC\\b", 164 webOS: "webOS|hpwOS", 165 badaOS: "\\bBada\\b", 166 BREWOS: "BREW" 167 }, 168 uas: { 169 Chrome: "\\bCrMo\\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?", 170 Dolfin: "\\bDolfin\\b", 171 Opera: "Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR/[0-9.]+|Coast/[0-9.]+", 172 Skyfire: "Skyfire", 173 Edge: "Mobile Safari/[.0-9]* Edge", 174 IE: "IEMobile|MSIEMobile", 175 Firefox: "fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS", 176 Bolt: "bolt", 177 TeaShark: "teashark", 178 Blazer: "Blazer", 179 Safari: "Version.*Mobile.*Safari|Safari.*Mobile|MobileSafari", 180 UCBrowser: "UC.*Browser|UCWEB", 181 baiduboxapp: "baiduboxapp", 182 baidubrowser: "baidubrowser", 183 DiigoBrowser: "DiigoBrowser", 184 Puffin: "Puffin", 185 Mercury: "\\bMercury\\b", 186 ObigoBrowser: "Obigo", 187 NetFront: "NF-Browser", 188 GenericBrowser: "NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger", 189 PaleMoon: "Android.*PaleMoon|Mobile.*PaleMoon" 190 }, 191 props: { 192 Mobile: "Mobile/[VER]", 193 Build: "Build/[VER]", 194 Version: "Version/[VER]", 195 VendorID: "VendorID/[VER]", 196 iPad: "iPad.*CPU[a-z ]+[VER]", 197 iPhone: "iPhone.*CPU[a-z ]+[VER]", 198 iPod: "iPod.*CPU[a-z ]+[VER]", 199 Kindle: "Kindle/[VER]", 200 Chrome: [ "Chrome/[VER]", "CriOS/[VER]", "CrMo/[VER]" ], 201 Coast: [ "Coast/[VER]" ], 202 Dolfin: "Dolfin/[VER]", 203 Firefox: [ "Firefox/[VER]", "FxiOS/[VER]" ], 204 Fennec: "Fennec/[VER]", 205 Edge: "Edge/[VER]", 206 IE: [ "IEMobile/[VER];", "IEMobile [VER]", "MSIE [VER];", "Trident/[0-9.]+;.*rv:[VER]" ], 207 NetFront: "NetFront/[VER]", 208 NokiaBrowser: "NokiaBrowser/[VER]", 209 Opera: [ " OPR/[VER]", "Opera Mini/[VER]", "Version/[VER]" ], 210 "Opera Mini": "Opera Mini/[VER]", 211 "Opera Mobi": "Version/[VER]", 212 UCBrowser: [ "UCWEB[VER]", "UC.*Browser/[VER]" ], 213 MQQBrowser: "MQQBrowser/[VER]",
214 MicroMessenger: "MicroMessenger/[VER]", 215 baiduboxapp: "baiduboxapp/[VER]", 216 baidubrowser: "baidubrowser/[VER]", 217 SamsungBrowser: "SamsungBrowser/[VER]", 218 Iron: "Iron/[VER]", 219 Safari: [ "Version/[VER]", "Safari/[VER]" ], 220 Skyfire: "Skyfire/[VER]", 221 Tizen: "Tizen/[VER]", 222 Webkit: "webkit[ /][VER]", 223 PaleMoon: "PaleMoon/[VER]", 224 Gecko: "Gecko/[VER]", 225 Trident: "Trident/[VER]", 226 Presto: "Presto/[VER]", 227 Goanna: "Goanna/[VER]", 228 iOS: " \\bi?OS\\b [VER][ ;]{1}", 229 Android: "Android [VER]", 230 BlackBerry: [ "BlackBerry[\\w]+/[VER]", "BlackBerry.*Version/[VER]", "Version/[VER]" ], 231 BREW: "BREW [VER]", 232 Java: "Java/[VER]", 233 "Windows Phone OS": [ "Windows Phone OS [VER]", "Windows Phone [VER]" ], 234 "Windows Phone": "Windows Phone [VER]", 235 "Windows CE": "Windows CE/[VER]", 236 "Windows NT": "Windows NT [VER]", 237 Symbian: [ "SymbianOS/[VER]", "Symbian/[VER]" ], 238 webOS: [ "webOS/[VER]", "hpwOS/[VER];" ] 239 }, 240 utils: { 241 Bot: "Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom", 242 MobileBot: "Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/M1A1-R2D2", 243 DesktopMode: "WPDesktop", 244 TV: "SonyDTV|HbbTV", 245 WebKit: "(webkit)[ /]([\\w.]+)", 246 Console: "\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|Nintendo Switch|PLAYSTATION|Xbox)\\b", 247 Watch: "SM-V700" 248 } 249 }, 250 detectMobileBrowsers: { 251 fullPattern: /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i, 252 shortPattern: /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i, 253 tabletPattern: /android|ipad|playbook|silk/i 254 } 255 }, hasOwnProp = Object.prototype.hasOwnProperty; 256 function equalIC(a, b) { 257 return null != a && null != b && a.toLowerCase() === b.toLowerCase(); 258 } 259 function containsIC(array, value) { 260 var valueLC, i, len = array.length; 261 if (!len || !value) return !1;
262 for (valueLC = value.toLowerCase(), i = 0; i < len; ++i) if (valueLC === array[i].toLowerCase()) return !0; 263 return !1; 264 } 265 function convertPropsToRegExp(object) { 266 for (var key in object) hasOwnProp.call(object, key) && (object[key] = new RegExp(object[key], "i")); 267 } 268 function MobileDetect(userAgent, maxPhoneWidth) { 269 this.ua = function(userAgent) { 270 return (userAgent || "").substr(0, 500); 271 }(userAgent), this._cache = {}, this.maxPhoneWidth = maxPhoneWidth || 600; 272 } 273 return impl.FALLBACK_PHONE = "UnknownPhone", impl.FALLBACK_TABLET = "UnknownTablet", 274 impl.FALLBACK_MOBILE = "UnknownMobile", isArray = "isArray" in Array ? Array.isArray : function(value) { 275 return "[object Array]" === Object.prototype.toString.call(value); 276 }, function() { 277 var key, values, value, i, len, verPos, mobileDetectRules = impl.mobileDetectRules; 278 for (key in mobileDetectRules.props) if (hasOwnProp.call(mobileDetectRules.props, key)) { 279 for (values = mobileDetectRules.props[key], isArray(values) || (values = [ values ]), 280 len = values.length, i = 0; i < len; ++i) 0 <= (verPos = (value = values[i]).indexOf("[VER]")) && (value = value.substring(0, verPos) + "([\\w._\\+]+)" + value.substring(verPos + 5)), 281 values[i] = new RegExp(value, "i"); 282 mobileDetectRules.props[key] = values; 283 } 284 convertPropsToRegExp(mobileDetectRules.oss), convertPropsToRegExp(mobileDetectRules.phones), 285 convertPropsToRegExp(mobileDetectRules.tablets), convertPropsToRegExp(mobileDetectRules.uas), 286 convertPropsToRegExp(mobileDetectRules.utils), mobileDetectRules.oss0 = { 287 WindowsPhoneOS: mobileDetectRules.oss.WindowsPhoneOS, 288 WindowsMobileOS: mobileDetectRules.oss.WindowsMobileOS 289 }; 290 }(), impl.findMatch = function(rules, userAgent) { 291 for (var key in rules) if (hasOwnProp.call(rules, key) && rules[key].test(userAgent)) return key; 292 return null; 293 }, impl.findMatches = function(rules, userAgent) { 294 var result = []; 295 for (var key in rules) hasOwnProp.call(rules, key) && rules[key].test(userAgent) && result.push(key); 296 return result; 297 }, impl.getVersionStr = function(propertyName, userAgent) { 298 var patterns, i, len, match, props = impl.mobileDetectRules.props; 299 if (hasOwnProp.call(props, propertyName)) for (len = (patterns = props[propertyName]).length, 300 i = 0; i < len; ++i) if (null !== (match = patterns[i].exec(userAgent))) return match[1]; 301 return null; 302 }, impl.getVersion = function(propertyName, userAgent) { 303 var version = impl.getVersionStr(propertyName, userAgent); 304 return version ? impl.prepareVersionNo(version) : NaN; 305 }, impl.prepareVersionNo = function(version) { 306 var numbers; 307 return 1 === (numbers = version.split(/[a-z._ \/\-]/i)).length && (version = numbers[0]), 308 1 < numbers.length && (version = numbers[0] + ".", numbers.shift(), version += numbers.join("")), 309 Number(version); 310 }, impl.isMobileFallback = function(userAgent) { 311 return impl.detectMobileBrowsers.fullPattern.test(userAgent) || impl.detectMobileBrowsers.shortPattern.test(userAgent.substr(0, 4)); 312 }, impl.isTabletFallback = function(userAgent) { 313 return impl.detectMobileBrowsers.tabletPattern.test(userAgent); 314 }, impl.prepareDetectionCache = function(cache, userAgent, maxPhoneWidth) { 315 if (void 0 === cache.mobile) { 316 var phone, tablet, phoneSized; 317 if (tablet = impl.findMatch(impl.mobileDetectRules.tablets, userAgent)) return cache.mobile = cache.tablet = tablet, 318 void (cache.phone = null); 319 if (phone = impl.findMatch(impl.mobileDetectRules.phones, userAgent)) return cache.mobile = cache.phone = phone, 320 void (cache.tablet = null); 321 impl.isMobileFallback(userAgent) ? void 0 === (phoneSized = MobileDetect.isPhoneSized(maxPhoneWidth)) ? (cache.mobile = impl.FALLBACK_MOBILE, 322 cache.tablet = cache.phone = null) : phoneSized ? (cache.mobile = cache.phone = impl.FALLBACK_PHONE, 323 cache.tablet = null) : (cache.mobile = cache.tablet = impl.FALLBACK_TABLET, cache.phone = null) : impl.isTabletFallback(userAgent) ? (cache.mobile = cache.tablet = impl.FALLBACK_TABLET, 324 cache.phone = null) : cache.mobile = cache.tablet = cache.phone = null; 325 } 326 }, impl.mobileGrade = function(t) { 327 var $isMobile = null !== t.mobile(); 328 return t.os("iOS") && 4.3 <= t.version("iPad") || t.os("iOS") && 3.1 <= t.version("iPhone") || t.os("iOS") && 3.1 <= t.version("iPod") || 2.1 < t.version("Android") && t.is("Webkit") || 7 <= t.version("Windows Phone OS") || t.is("BlackBerry") && 6 <= t.version("BlackBerry") || t.match("Playbook.*Tablet") || 1.4 <= t.version("webOS") && t.match("Palm|Pre|Pixi") || t.match("hp.*TouchPad") || t.is("Firefox") && 12 <= t.version("Firefox") || t.is("Chrome") && t.is("AndroidOS") && 4 <= t.version("Android") || t.is("Skyfire") && 4.1 <= t.version("Skyfire") && t.is("AndroidOS") && 2.3 <= t.version("Android") || t.is("Opera") && 11 < t.version("Opera Mobi") && t.is("AndroidOS") || t.is("MeeGoOS") || t.is("Tizen") || t.is("Dolfin") && 2 <= t.version("Bada") || (t.is("UC Browser") || t.is("Dolfin")) && 2.3 <= t.version("Android") || t.match("Kindle Fire") || t.is("Kindle") && 3 <= t.version("Kindle") || t.is("AndroidOS") && t.is("NookTablet") || 11 <= t.version("Chrome") && !$isMobile || 5 <= t.version("Safari") && !$isMobile || 4 <= t.version("Firefox") && !$isMobile || 7 <= t.version("MSIE") && !$isMobile || 10 <= t.version("Opera") && !$isMobile ? "A" : t.os("iOS") && t.version("iPad") < 4.3 || t.os("iOS") && t.version("iPhone") < 3.1 || t.os("iOS") && t.version("iPod") < 3.1 || t.is("Blackberry") && 5 <= t.version("BlackBerry") && t.version("BlackBerry") < 6 || 5 <= t.version("Opera Mini") && t.version("Opera Mini") <= 6.5 && (2.3 <= t.version("Android") || t.is("iOS")) || t.match("NokiaN8|NokiaC7|N97.*Series60|Symbian/3") || 11 <= t.version("Opera Mobi") && t.is("SymbianOS") ? "B" : (t.version("BlackBerry") < 5 || t.match("MSIEMobile|Windows CE.*Mobile") || t.version("Windows Mobile"), 329 "C"); 330 }, impl.detectOS = function(ua) { 331 return impl.findMatch(impl.mobileDetectRules.oss0, ua) || impl.findMatch(impl.mobileDetectRules.oss, ua); 332 }, impl.getDeviceSmallerSide = function() { 333 return window.screen.width < window.screen.height ? window.screen.width : window.screen.height; 334 }, MobileDetect.prototype = { 335 constructor: MobileDetect, 336 mobile: function() { 337 return impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth), this._cache.mobile; 338 }, 339 phone: function() { 340 return impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth), this._cache.phone; 341 }, 342 tablet: function() { 343 return impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth), this._cache.tablet;
344 }, 345 userAgent: function() { 346 return void 0 === this._cache.userAgent && (this._cache.userAgent = impl.findMatch(impl.mobileDetectRules.uas, this.ua)), 347 this._cache.userAgent; 348 }, 349 userAgents: function() { 350 return void 0 === this._cache.userAgents && (this._cache.userAgents = impl.findMatches(impl.mobileDetectRules.uas, this.ua)), 351 this._cache.userAgents; 352 }, 353 os: function() { 354 return void 0 === this._cache.os && (this._cache.os = impl.detectOS(this.ua)), this._cache.os; 355 }, 356 version: function(key) { 357 return impl.getVersion(key, this.ua); 358 }, 359 versionStr: function(key) { 360 return impl.getVersionStr(key, this.ua); 361 }, 362 is: function(key) { 363 return containsIC(this.userAgents(), key) || equalIC(key, this.os()) || equalIC(key, this.phone()) || equalIC(key, this.tablet()) || containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key); 364 }, 365 match: function(pattern) { 366 return pattern instanceof RegExp || (pattern = new RegExp(pattern, "i")), pattern.test(this.ua); 367 }, 368 isPhoneSized: function(maxPhoneWidth) { 369 return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth); 370 }, 371 mobileGrade: function() { 372 return void 0 === this._cache.grade && (this._cache.grade = impl.mobileGrade(this)), 373 this._cache.grade; 374 } 375 }, MobileDetect.isPhoneSized = "undefined" != typeof window && window.screen ? function(maxPhoneWidth) { 376 return maxPhoneWidth < 0 ? void 0 : impl.getDeviceSmallerSide() <= maxPhoneWidth; 377 } : function() {}, MobileDetect._impl = impl, MobileDetect.version = "1.4.2 2018-06-10", 378 MobileDetect; 379 }); 380}(function(undefined) { 381 if ("undefined" != typeof module && module.exports) return function(factory) { 382 module.exports = factory(); 383 }; 384 if ("function" == typeof define && define.amd) return define; 385 if ("undefined" != typeof window) return function(factory) { 386 window.MobileDetect = factory(); 387 }; 388 throw new Error("unknown environment"); 389}()), function(f) { 390 if ("object" == typeof exports && "undefined" != typeof module) module.exports = f(); else if ("function" == typeof define && define.amd) define([], f); else { 391 ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).DMVAST = f(); 392 } 393}(function() { 394 return function e(t, n, r) { 395 function s(o, u) { 396 if (!n[o]) { 397 if (!t[o]) { 398 var a = "function" == typeof require && require; 399 if (!u && a) return a(o, !0); 400 if (i) return i(o, !0); 401 var f = new Error("Cannot find module '" + o + "'"); 402 throw f.code = "MODULE_NOT_FOUND", f; 403 } 404 var l = n[o] = { 405 exports: {} 406 }; 407 t[o][0].call(l.exports, function(e) { 408 var n = t[o][1][e]; 409 return s(n || e); 410 }, l, l.exports, e, t, n, r); 411 } 412 return n[o].exports; 413 } 414 for (var i = "function" == typeof require && require, o = 0; o < r.length; o++) s(r[o]); 415 return s; 416 }({ 417 1: [ function(require, module, exports) { 418 function EventEmitter() { 419 this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0; 420 } 421 function isFunction(arg) { 422 return "function" == typeof arg; 423 } 424 function isObject(arg) { 425 return "object" == typeof arg && null !== arg; 426 } 427 function isUndefined(arg) { 428 return void 0 === arg; 429 } 430 ((module.exports = EventEmitter).EventEmitter = EventEmitter).prototype._events = void 0, 431 EventEmitter.prototype._maxListeners = void 0, EventEmitter.defaultMaxListeners = 10, 432 EventEmitter.prototype.setMaxListeners = function(n) { 433 if ("number" != typeof n || n < 0 || isNaN(n)) throw TypeError("n must be a positive number"); 434 return this._maxListeners = n, this; 435 }, EventEmitter.prototype.emit = function(type) { 436 var er, handler, len, args, i, listeners; 437 if (this._events || (this._events = {}), "error" === type && (!this._events.error || isObject(this._events.error) && !this._events.error.length)) { 438 if ((er = arguments[1]) instanceof Error) throw er; 439 var err = new Error('Uncaught, unspecified "error" event. (' + er + ")"); 440 throw err.context = er, err; 441 } 442 if (isUndefined(handler = this._events[type])) return !1; 443 if (isFunction(handler)) switch (arguments.length) { 444 case 1: 445 handler.call(this); 446 break; 447 448 case 2: 449 handler.call(this, arguments[1]); 450 break; 451 452 case 3: 453 handler.call(this, arguments[1], arguments[2]); 454 break; 455 456 default: 457 args = Array.prototype.slice.call(arguments, 1), handler.apply(this, args); 458 } else if (isObject(handler)) for (args = Array.prototype.slice.call(arguments, 1), 459 len = (listeners = handler.slice()).length, i = 0; i < len; i++) listeners[i].apply(this, args); 460 return !0; 461 }, EventEmitter.prototype.on = EventEmitter.prototype.addListener = function(type, listener) { 462 var m; 463 if (!isFunction(listener)) throw TypeError("listener must be a function"); 464 return this._events || (this._events = {}
464), this._events.newListener && this.emit("newListener", type, isFunction(listener.listener) ? listener.listener : listener), 465 this._events[type] ? isObject(this._events[type]) ? this._events[type].push(listener) : this._events[type] = [ this._events[type], listener ] : this._events[type] = listener, 466 isObject(this._events[type]) && !this._events[type].warned && (m = isUndefined(this._maxListeners) ? EventEmitter.defaultMaxListeners : this._maxListeners) && 0 < m && this._events[type].length > m && (this._events[type].warned = !0, 467 console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[type].length), 468 "function" == typeof console.trace && console.trace()), this; 469 }, EventEmitter.prototype.once = function(type, listener) { 470 if (!isFunction(listener)) throw TypeError("listener must be a function"); 471 var fired = !1; 472 function g() { 473 this.removeListener(type, g), fired || (fired = !0, listener.apply(this, arguments)); 474 } 475 return g.listener = listener, this.on(type, g), this; 476 }, EventEmitter.prototype.removeListener = function(type, listener) { 477 var list, position, length, i; 478 if (!isFunction(listener)) throw TypeError("listener must be a function"); 479 if (!this._events || !this._events[type]) return this; 480 if (length = (list = this._events[type]).length, position = -1, list === listener || isFunction(list.listener) && list.listener === listener) delete this._events[type], 481 this._events.removeListener && this.emit("removeListener", type, listener); else if (isObject(list)) { 482 for (i = length; 0 < i--; ) if (list[i] === listener || list[i].listener && list[i].listener === listener) { 483 position = i; 484 break; 485 } 486 if (position < 0) return this; 487 1 === list.length ? (list.length = 0, delete this._events[type]) : list.splice(position, 1), 488 this._events.removeListener && this.emit("removeListener", type, listener); 489 } 490 return this; 491 }, EventEmitter.prototype.removeAllListeners = function(type) { 492 var key, listeners; 493 if (!this._events) return this; 494 if (!this._events.removeListener) return 0 === arguments.length ? this._events = {} : this._events[type] && delete this._events[type], 495 this; 496 if (0 === arguments.length) { 497 for (key in this._events) "removeListener" !== key && this.removeAllListeners(key); 498 return this.removeAllListeners("removeListener"), this._events = {}, this; 499 } 500 if (isFunction(listeners = this._events[type])) this.removeListener(type, listeners); else if (listeners) for (;listeners.length; ) this.removeListener(type, listeners[listeners.length - 1]); 501 return delete this._events[type], this; 502 }, EventEmitter.prototype.listeners = function(type) { 503 return this._events && this._events[type] ? isFunction(this._events[type]) ? [ this._events[type] ] : this._events[type].slice() : []; 504 }, EventEmitter.prototype.listenerCount = function(type) { 505 if (this._events) { 506 var evlistener = this._events[type]; 507 if (isFunction(evlistener)) return 1; 508 if (evlistener) return evlistener.length; 509 } 510 return 0; 511 }, EventEmitter.listenerCount = function(emitter, type) { 512 return emitter.listenerCount(type); 513 }; 514 }, {} ], 515 2: [ function(require, module, exports) { 516 var VASTAd; 517 VASTAd = function() { 518 this.id = null, this.sequence = null, this.system = null, this.title = null, this.description = null, 519 this.advertiser = null, this.pricing = null, this.survey = null, this.errorURLTemplates = [], 520 this.impressionURLTemplates = [], this.creatives = [], this.extensions = []; 521 }, module.exports = VASTAd; 522 }, {} ],
523 3: [ function(require, module, exports) { 524 var VASTClient, VASTParser, VASTUtil; 525 VASTParser = require("./parser"), VASTUtil = require("./util"), VASTClient = function() { 526 function VASTClient() {} 527 var defineProperty, storage; 528 return VASTClient.cappingFreeLunch = 0, VASTClient.cappingMinimumTimeInterval = 0, 529 VASTClient.options = { 530 withCredentials: !1, 531 timeout: 0 532 }, VASTClient.get = function(url, opts, cb) { 533 var extend, now, options, timeSinceLastCall; 534 if (now = +new Date(), extend = exports.extend = function(object, properties) { 535 var key, val; 536 for (key in properties) val = properties[key], object[key] = val; 537 return object; 538 }, cb || ("function" == typeof opts && (cb = opts), options = {}), options = extend(this.options, opts), 539 this.totalCallsTimeout < now ? (this.totalCalls = 1, this.totalCallsTimeout = now + 36e5) : this.totalCalls++, 540 !(this.cappingFreeLunch >= this.totalCalls)) { 541 if ((timeSinceLastCall = now - this.lastSuccessfullAd) < 0) this.lastSuccessfullAd = 0; else if (timeSinceLastCall < this.cappingMinimumTimeInterval) return void cb(null, new Error("VAST call canceled â (" + this.cappingMinimumTimeInterval + ")ms minimum interval reached")); 542 return VASTParser.parse(url, options, function(response, err) { 543 return cb(response, err); 544 }); 545 } 546 cb(null, new Error("VAST call canceled â FreeLunch capping not reached yet " + this.totalCalls + "/" + this.cappingFreeLunch)); 547 }, storage = VASTUtil.storage, defineProperty = Object.defineProperty, [ "lastSuccessfullAd", "totalCalls", "totalCallsTimeout" ].forEach(function(property) { 548 defineProperty(VASTClient, property, { 549 get: function() { 550 return storage.getItem(property); 551 }, 552 set: function(value) { 553 return storage.setItem(property, value); 554 }, 555 configurable: !1, 556 enumerable: !0 557 }); 558 }), null == VASTClient.lastSuccessfullAd && (VASTClient.lastSuccessfullAd = 0), 559 null == VASTClient.totalCalls && (VASTClient.totalCalls = 0), null == VASTClient.totalCallsTimeout && (VASTClient.totalCallsTimeout = 0), 560 VASTClient; 561 }(), module.exports = VASTClient; 562 }, { 563 "./parser": 12, 564 "./util": 18 565 } ], 566 4: [ function(require, module, exports) { 567 var VASTCompanionAd; 568 VASTCompanionAd = function() { 569 this.id = null, this.width = 0, this.height = 0, this.type = null, this.staticResource = null, 570 this.htmlResource = null, this.iframeResource = null, this.altText = null, this.companionClickThroughURLTemplate = null, 571 this.companionClickTrackingURLTemplates = [], this.trackingEvents = {}; 572 }, module.exports = VASTCompanionAd; 573 }, {} ], 574 5: [ function(require, module, exports) { 575 var VASTCreative, VASTCreativeCompanion, VASTCreativeLinear, VASTCreativeNonLinear, extend = function(child, parent) { 576 for (var key in parent) hasProp.call(parent, key) && (child[key] = parent[key]); 577 function ctor() { 578 this.constructor = child; 579 } 580 return ctor.prototype = parent.prototype, child.prototype = new ctor(), child.__super__ = parent.prototype, 581 child; 582 }, hasProp = {}.hasOwnProperty; 583 VASTCreative = function(creativeAttributes) { 584 null == creativeAttributes && (creativeAttributes = {}), this.id = creativeAttributes.id || null, 585 this.adId = creativeAttributes.adId || null, this.sequence = creativeAttributes.sequence || null, 586 this.apiFramework = creativeAttributes.apiFramework || null, this.trackingEvents = {}; 587 }, VASTCreativeLinear = function(superClass) { 588 function VASTCreativeLinear() { 589 VASTCreativeLinear.__super__.constructor.apply(this, arguments), this.type = "linear", 590 this.duration = 0, this.skipDelay = null, this.mediaFiles = [], this.videoClickThroughURLTemplate = null, 591 this.videoClickTrackingURLTemplates = [], this.videoCustomClickURLTemplates = [], 592 this.adParameters = null, this.icons = []; 593 } 594 return extend(VASTCreativeLinear, VASTCreative), VASTCreativeLinear; 595 }(), VASTCreativeNonLinear = function(superClass) { 596 function VASTCreativeNonLinear() { 597 VASTCreativeNonLinear.__super__.constructor.apply(this, arguments), this.type = "nonlinear", 598 this.variations = []; 599 } 600 return extend(VASTCreativeNonLinear, VASTCreative), VASTCreativeNonLinear; 601 }(), VASTCreativeCompanion = function(superClass) { 602 function VASTCreativeCompanion() { 603 VASTCreativeCompanion.__super__.constructor.apply(this, arguments), this.type = "companion", 604 this.variations = []; 605 } 606 return extend(VASTCreativeCompanion, VASTCreative), VASTCreativeCompanion; 607 }(), module.exports = { 608 VASTCreativeLinear: VASTCreativeLinear, 609 VASTCreativeNonLinear: VASTCreativeNonLinear, 610 VASTCreativeCompanion: VASTCreativeCompanion 611 }; 612 }, {} ],
613 6: [ function(require, module, exports) { 614 var VASTAdExtension; 615 VASTAdExtension = function() { 616 this.attributes = {}, this.children = []; 617 }, module.exports = VASTAdExtension; 618 }, {} ], 619 7: [ function(require, module, exports) { 620 var VASTAdExtensionChild; 621 VASTAdExtensionChild = function() { 622 this.name = null, this.value = null, this.attributes = {}; 623 }, module.exports = VASTAdExtensionChild; 624 }, {} ], 625 8: [ function(require, module, exports) { 626 var VASTIcon; 627 VASTIcon = function() { 628 this.program = null, this.height = 0, this.width = 0, this.xPosition = 0, this.yPosition = 0, 629 this.apiFramework = null, this.offset = null, this.duration = 0, this.type = null, 630 this.staticResource = null, this.htmlResource = null, this.iframeResource = null, 631 this.iconClickThroughURLTemplate = null, this.iconClickTrackingURLTemplates = [], 632 this.iconViewTrackingURLTemplate = null; 633 }, module.exports = VASTIcon; 634 }, {} ], 635 9: [ function(require, module, exports) { 636 module.exports = { 637 client: require("./client"), 638 tracker: require("./tracker"), 639 parser: require("./parser"), 640 util: require("./util") 641 }; 642 }, { 643 "./client": 3, 644 "./parser": 12, 645 "./tracker": 14, 646 "./util": 18 647 } ], 648 10: [ function(require, module, exports) { 649 var VASTMediaFile; 650 VASTMediaFile = function() { 651 this.id = null, this.fileURL = null, this.deliveryType = "progressive", this.mimeType = null, 652 this.codec = null, this.bitrate = 0, this.minBitrate = 0, this.maxBitrate = 0, this.width = 0, 653 this.height = 0, this.apiFramework = null, this.scalable = null, this.maintainAspectRatio = null; 654 }, module.exports = VASTMediaFile; 655 }, {} ], 656 11: [ function(require, module, exports) { 657 var VASTNonLinear; 658 VASTNonLinear = function() { 659 this.id = null, this.width = 0, this.height = 0, this.expandedWidth = 0, this.expandedHeight = 0, 660 this.scalable = !0, this.maintainAspectRatio = !0, this.minSuggestedDuration = 0, 661 this.apiFramework = "static", this.type = null, this.staticResource = null, this.htmlResource = null, 662 this.iframeResource = null, this.nonlinearClickThroughURLTemplate = null, this.nonlinearClickTrackingURLTemplates = [], 663 this.adParameters = null; 664 }, module.exports = VASTNonLinear; 665 }, {} ], 666 12: [ function(require, module, exports) { 667 var EventEmitter, URLHandler, VASTAd, VASTAdExtension, VASTAdExtensionChild, VASTCompanionAd, VASTCreativeCompanion, VASTCreativeLinear, VASTCreativeNonLinear, VASTIcon, VASTMediaFile, VASTNonLinear, VASTParser, VASTResponse, VASTUtil, indexOf = [].indexOf || function(item) { 668 for (var i = 0, l = this.length; i < l; i++) if (i in this && this[i] === item) return i; 669 return -1; 670 }; 671 URLHandler = require("./urlhandler"), VASTResponse = require("./response"), VASTAd = require("./ad"), 672 VASTAdExtension = require("./extension"), VASTAdExtensionChild = require("./extensionchild"), 673 VASTUtil = require("./util"), VASTCreativeLinear = require("./creative").VASTCreativeLinear, 674 VASTCreativeCompanion = require("./creative").VASTCreativeCompanion, VASTCreativeNonLinear = require("./creative").VASTCreativeNonLinear, 675 VASTMediaFile = require("./mediafile"), VASTIcon = require("./icon"), VASTCompanionAd = require("./companionad"), 676 VASTNonLinear = require("./nonlinear"), EventEmitter = require("events").EventEmitter, 677 VASTParser = function() { 678 var URLTemplateFilters; 679 function VASTParser() {} 680 return URLTemplateFilters = [], VASTParser.addURLTemplateFilter = function(func) { 681 "function" == typeof func && URLTemplateFilters.push(func); 682 }, VASTParser.removeURLTemplateFilter = function() { 683 return URLTemplateFilters.pop(); 684 }, VASTParser.countURLTemplateFilters = function() { 685 return URLTemplateFilters.length; 686 }, VASTParser.clearUrlTemplateFilters = function() { 687 return URLTemplateFilters = []; 688 }, VASTParser.parse = function(url, options, cb) { 689 return cb || ("function" == typeof options && (cb = options), options = {}), this._parse(url, null, options, function(err, response) { 690 return cb(response, err); 691 }); 692 }, VASTParser.load = function(xml, options, cb) { 693 return cb || ("function" == typeof options && (cb = options), options = {}), this.parseXmlDocument(null, [], options, xml, cb); 694 }
694, VASTParser.vent = new EventEmitter(), VASTParser.track = function(templates, errorCode) { 695 return this.vent.emit("VAST-error", errorCode), VASTUtil.track(templates, errorCode); 696 }, VASTParser.on = function(eventName, cb) { 697 return this.vent.on(eventName, cb); 698 }, VASTParser.once = function(eventName, cb) { 699 return this.vent.once(eventName, cb); 700 }, VASTParser.off = function(eventName, cb) { 701 return this.vent.removeListener(eventName, cb); 702 }, VASTParser._parse = function(url, parentURLs, options, cb) { 703 var filter, i, len, _this; 704 for (cb || ("function" == typeof options && (cb = options), options = {}), i = 0, 705 len = URLTemplateFilters.length; i < len; i++) filter = URLTemplateFilters[i], url = filter(url); 706 return null == parentURLs && (parentURLs = []), parentURLs.push(url), URLHandler.get(url, options, (_this = this, 707 function(err, xml) { 708 return null != err ? cb(err) : _this.parseXmlDocument(url, parentURLs, options, xml, cb); 709 })); 710 }, VASTParser.parseXmlDocument = function(url, parentURLs, options, xml, cb) { 711 var ad, complete, i, j, len, len1, loopIndex, node, ref, ref1, response; 712 if (response = new VASTResponse(), null == (null != xml ? xml.documentElement : void 0) || "VAST" !== xml.documentElement.nodeName) return cb({ 713 error: 4, 714 error_code: "AD_NO", 715 msg: "Invalid VAST XMLDocument" 716 }); 717 for (i = 0, len = (ref = xml.documentElement.childNodes).length; i < len; i++) "Error" === (node = ref[i]).nodeName && response.errorURLTemplates.push(VASTParser.parseNodeText(node)); 718 for (j = 0, len1 = (ref1 = xml.documentElement.childNodes).length; j < len1; j++) "Ad" === (node = ref1[j]).nodeName && (null != (ad = VASTParser.parseAdElement(node)) ? response.ads.push(ad) : VASTParser.track(response.errorURLTemplates, { 719 ERRORCODE: 101 720 })); 721 for (complete = function(error, errorAlreadyRaised) { 722 var k, len2, noCreatives, ref2; 723 if (null == error && (error = null), null == errorAlreadyRaised && (errorAlreadyRaised = !1), 724 response) { 725 for (noCreatives = !0, k = 0, len2 = (ref2 = response.ads).length; k < len2; k++) { 726 if (null != (ad = ref2[k]).nextWrapperURL) return; 727 0 < ad.creatives.length && (noCreatives = !1); 728 } 729 return noCreatives && (errorAlreadyRaised || VASTParser.track(response.errorURLTemplates, { 730 ERRORCODE: 303 731 })), 0 === response.ads.length && (response = null, error = new Error("No ads: no valid <inline> has been found")), 732 cb(error, response); 733 } 734 }, loopIndex = response.ads.length; loopIndex--; ) null != (ad = response.ads[loopIndex]).nextWrapperURL && function(ad) { 735 var ref2; 736 parentURLs.length > (null !== options.wrapperLimit ? options.wrapperLimit : 9) || (ref2 = ad.nextWrapperURL, 737 0 <= indexOf.call(parentURLs, ref2)) ? (VASTParser.track(ad.errorURLTemplates, { 738 ERRORCODE: 302 739 }), response.ads.splice(response.ads.indexOf(ad), 1), complete(new Error("Wrapper limit reached, as defined by the video player"))) : (null != url && (ad.nextWrapperURL = VASTParser.resolveVastAdTagURI(ad.nextWrapperURL, url)), 740 VASTParser._parse(ad.nextWrapperURL, parentURLs, options, function(err, wrappedResponse) { 741 var errorAlreadyRaised, index, k, len2, ref3, wrappedAd; 742 if (errorAlreadyRaised = !1, null != err) VASTParser.track(ad.errorURLTemplates, { 743 ERRORCODE: 301 744 }), response.ads.splice(response.ads.indexOf(ad), 1), errorAlreadyRaised = !0;
744 else if (null == wrappedResponse) VASTParser.track(ad.errorURLTemplates, { 745 ERRORCODE: 303 746 }), response.ads.splice(response.ads.indexOf(ad), 1), errorAlreadyRaised = !0; else for (response.errorURLTemplates = response.errorURLTemplates.concat(wrappedResponse.errorURLTemplates), 747 index = response.ads.indexOf(ad), response.ads.splice(index, 1), k = 0, len2 = (ref3 = wrappedResponse.ads).length; k < len2; k++) wrappedAd = ref3[k], 748 VASTParser.mergeWrapperAdData(wrappedAd, ad), response.ads.splice(++index, 0, wrappedAd); 749 return delete ad.nextWrapperURL, complete(err, errorAlreadyRaised); 750 })); 751 }(ad); 752 return complete(); 753 }, VASTParser.resolveVastAdTagURI = function(vastAdTagUrl, originalUrl) { 754 return 0 === vastAdTagUrl.indexOf("//") ? "" + location.protocol + vastAdTagUrl : -1 === vastAdTagUrl.indexOf("://") ? originalUrl.slice(0, originalUrl.lastIndexOf("/")) + "/" + vastAdTagUrl : vastAdTagUrl; 755 }, VASTParser.mergeWrapperAdData = function(wrappedAd, ad) { 756 var base, creative, eventName, i, j, k, l, len, len1, len2, len3, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, results, urls; 757 for (wrappedAd.errorURLTemplates = ad.errorURLTemplates.concat(wrappedAd.errorURLTemplates), 758 wrappedAd.impressionURLTemplates = ad.impressionURLTemplates.concat(wrappedAd.impressionURLTemplates), 759 wrappedAd.extensions = ad.extensions.concat(wrappedAd.extensions), i = 0, len = (ref = wrappedAd.creatives).length; i < len; i++) if (creative = ref[i], 760 null != (null != (ref1 = ad.trackingEvents) ? ref1[creative.type] : void 0)) for (eventName in ref2 = ad.trackingEvents[creative.type]) urls = ref2[eventName], 761 (base = creative.trackingEvents)[eventName] || (base[eventName] = []), creative.trackingEvents[eventName] = creative.trackingEvents[eventName].concat(urls); 762 if (null != (ref3 = ad.videoClickTrackingURLTemplates) ? ref3.length : void 0) for (j = 0, 763 len1 = (ref4 = wrappedAd.creatives).length; j < len1; j++) "linear" === (creative = ref4[j]).type && (creative.videoClickTrackingURLTemplates = creative.videoClickTrackingURLTemplates.concat(ad.videoClickTrackingURLTemplates)); 764 if (null != (ref5 = ad.videoCustomClickURLTemplates) ? ref5.length : void 0) for (k = 0, 765 len2 = (ref6 = wrappedAd.creatives).length; k < len2; k++) "linear" === (creative = ref6[k]).type && (creative.videoCustomClickURLTemplates = creative.videoCustomClickURLTemplates.concat(ad.videoCustomClickURLTemplates)); 766 if (null != ad.videoClickThroughURLTemplate) { 767 for (results = [], l = 0, len3 = (ref7 = wrappedAd.creatives).length; l < len3; l++) "linear" === (creative = ref7[l]).type && null == creative.videoClickThroughURLTemplate ? results.push(creative.videoClickThroughURLTemplate = ad.videoClickThroughURLTemplate) : results.push(void 0); 768 return results; 769 } 770 }, VASTParser.childByName = function(node, name) { 771 var child, i, len, ref; 772 for (i = 0, len = (ref = node.childNodes).length; i < len; i++) if ((child = ref[i]).nodeName === name) return child; 773 }, VASTParser.childsByName = function(node, name) { 774 var child, childs, i, len, ref; 775 for (childs = [], i = 0, len = (ref = node.childNodes).length; i < len; i++) (child = ref[i]).nodeName === name && childs.push(child); 776 return childs; 777 }, VASTParser.parseAdElement = function(adElement) { 778 var adTypeElement, i, len, ref, ref1; 779 for (i = 0, len = (ref = adElement.childNodes).length; i < len; i++) if ("Wrapper" === (ref1 = (adTypeElement = ref[i]).nodeName) || "InLine" === ref1) { 780 if (this.copyNodeAttribute("id", adElement, adTypeElement), this.copyNodeAttribute("sequence", adElement, adTypeElement), 781 "Wrapper" === adTypeElement.nodeName) return this.parseWrapperElement(adTypeElement); 782 if ("InLine" === adTypeElement.nodeName) return this.parseInLineElement(adTypeElement); 783 } 784 }, VASTParser.parseWrapperElement = function(wrapperElement) { 785 var ad, base, base1, eventName, i, item, j, k, l, len, len1, len2, len3, name1, ref, ref1, ref2, ref3, ref4, url, urls, wrapperCreativeElement, wrapperURLElement; 786 for (ad = this.parseInLineElement(wrapperElement), null != (wrapperURLElement = this.childByName(wrapperElement, "VASTAdTagURI")) ? ad.nextWrapperURL = this.parseNodeText(wrapperURLElement) : null != (wrapperURLElement = this.childByName(wrapperElement, "VASTAdTagURL")) && (ad.nextWrapperURL = this.parseNodeText(this.childByName(wrapperURLElement, "URL"))), 787 i = 0, len = (ref = ad.creatives).length; i < len; i++) if ("linear" === (ref1 = (wrapperCreativeElement = ref[i]).type) || "nonlinear" === ref1) { 788 if (null != wrapperCreativeElement.trackingEvents) for (eventName in ad.trackingEvents || (ad.trackingEvents = {}), 789 (base = ad.trackingEvents)[name1 = wrapperCreativeElement.type] || (base[name1] = {}), 790 ref2 = wrapperCreativeElement.trackingEvents) for (urls = ref2[eventName], (base1 = ad.trackingEvents[wrapperCreativeElement.type])[eventName] || (base1[eventName] = []), 791 j = 0, len1 = urls.length; j < len1; j++) url = urls[j], ad.trackingEvents[wrapperCreativeElement.type][eventName].push(url); 792 if (null != wrapperCreativeElement.videoClickTrackingURLTemplates) for (ad.videoClickTrackingURLTemplates || (ad.videoClickTrackingURLTemplates = []), 793 k = 0, len2 = (ref3 = wrapperCreativeElement.videoClickTrackingURLTemplates).length; k < len2; k++) item = ref3[k], 794 ad.videoClickTrackingURLTemplates.push(item); 795 if (null != wrapperCreativeElement.videoClickThroughURLTemplate && (ad.videoClickThroughURLTemplate = wrapperCreativeElement.videoClickThroughURLTemplate), 796 null != wrapperCreativeElement.videoCustomClickURLTemplates) for (ad.videoCustomClickURLTemplates || (ad.videoCustomClickURLTemplates = []), 797 l = 0, len3 = (ref4 = wrapperCreativeElement.videoCustomClickURLTemplates).length; l < len3; l++) item = ref4[l], 798 ad.videoCustomClickURLTemplates.push(item); 799 } 800 if (null != ad.nextWrapperURL) return ad; 801 }, VASTParser.parseInLineElement = function(inLineElement) { 802 var ad, creative, creativeAttributes, creativeElement, creativeTypeElement, i, j, k, len, len1, len2, node, ref, ref1, ref2; 803 for ((ad = new VASTAd()).id = inLineElement.getAttribute("id") || null, ad.sequence = inLineElement.getAttribute("sequence") || null, 804 i = 0, len = (ref = inLineElement.childNodes).length; i < len; i++) switch ((node = ref[i]).nodeName) { 805 case "Error": 806 ad.errorURLTemplates.push(this.parseNodeText(node)); 807 break; 808 809 case "Impression": 810 ad.impressionURLTemplates.push(this.parseNodeText(node)); 811 break; 812 813 case "Creatives": 814 for (j = 0, len1 = (ref1 = this.childsByName(node, "Creative")).length; j < len1; j++) for (creativeAttributes = { 815 id: (creativeElement = ref1[j]).getAttribute("id") || null, 816 adId: this.parseCreativeAdIdAttribute(creativeElement), 817 sequence: creativeElement.getAttribute("sequence") || null, 818 apiFramework: creativeElement.getAttribute("apiFramework") || null 819 }, k = 0, len2 = (ref2 = creativeElement.childNodes).length; k < len2; k++) switch ((creativeTypeElement = ref2[k]).nodeName) { 820 case "Linear": 821 (creative = this.parseCreativeLinearElement(creativeTypeElement, creativeAttributes)) && ad.creatives.push(creative); 822 break; 823 824 case "NonLinearAds": 825 (creative = this.parseNonLinear(creativeTypeElement, creativeAttributes)) && ad.creatives.push(creative); 826 break; 827 828 case "CompanionAds": 829 (creative = this.parseCompanionAd(creativeTypeElement, creativeAttributes)) && ad.creatives.push(creative); 830 } 831 break; 832 833 case "Extensions": 834 this.parseExtension(ad.extensions, this.childsByName(node, "Extension")); 835 break; 836 837 case "AdSystem": 838 ad.system = { 839 value: this.parseNodeText(node), 840 version: node.getAttribute("version") || null 841 }; 842 break; 843 844 case "AdTitle": 845 ad.title = this.parseNodeText(node); 846 break; 847 848 case "Description": 849 ad.description = this.parseNodeText(node); 850 break; 851 852 case "Advertiser": 853 ad.advertiser = this.parseNodeText(node); 854 break; 855 856 case "Pricing": 857 ad.pricing = { 858 value: this.parseNodeText(node), 859 model: node.getAttribute("model") || null, 860 currency: node.getAttribute("currency") || null 861 }; 862 break; 863 864 case "Survey": 865 ad.survey = this.parseNodeText(node); 866 } 867 return ad; 868 }, VASTParser.parseExtension = function(collection, extensions) { 869 var childNode, ext, extChild, extChildNodeAttr, extNode, extNodeAttr, i, j, k, l, len, len1, len2, len3, ref, ref1, ref2, results, txt; 870 for (results = [], i = 0, len = extensions.length; i < len; i++) { 871 if (extNode = extensions[i], ext = new VASTAdExtension(), extNode.attributes) for (j = 0, 872 len1 = (ref = extNode.attributes).length; j < len1; j++) extNodeAttr = ref[j], ext.attributes[extNodeAttr.nodeName] = extNodeAttr.nodeValue; 873 for (k = 0, len2 = (ref1 = extNode.childNodes).length; k < len2; k++) if (childNode = ref1[k], 874 txt = this.parseNodeText(childNode), "#comment" !== childNode.nodeName && "" !== txt) { 875 if ((extChild = new VASTAdExtensionChild()).name = childNode.nodeName, extChild.value = txt, 876 childNode.attributes) for (l = 0, len3 = (ref2 = childNode.attributes).length; l < len3; l++) extChildNodeAttr = ref2[l], 877 extChild.attributes[extChildNodeAttr.nodeName] = extChildNodeAttr.nodeValue; 878 ext.children.push(extChild); 879 } 880 results.push(collection.push(ext)); 881 } 882 return results; 883 }, VASTParser.parseCreativeLinearElement = function(creativeElement, creativeAttributes) { 884 var adParamsElement, base, clickTrackingElement, creative, customClickElement, eventName, htmlElement, i, icon, iconCl
884ickTrackingElement, iconClicksElement, iconElement, iconsElement, iframeElement, j, k, l, len, len1, len10, len2, len3, len4, len5, len6, len7, len8, len9, m, maintainAspectRatio, mediaFile, mediaFileElement, mediaFilesElement, n, o, offset, p, percent, q, r, ref, ref1, ref10, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, s, scalable, skipOffset, staticElement, trackingElement, trackingEventsElement, trackingURLTemplate, videoClicksElement; 885 if ((creative = new VASTCreativeLinear(creativeAttributes)).duration = this.parseDuration(this.parseNodeText(this.childByName(creativeElement, "Duration"))), 886 -1 === creative.duration && "Wrapper" !== creativeElement.parentNode.parentNode.parentNode.nodeName) return null; 887 if (null == (skipOffset = creativeElement.getAttribute("skipoffset")) ? creative.skipDelay = null : "%" === skipOffset.charAt(skipOffset.length - 1) ? (percent = parseInt(skipOffset, 10), 888 creative.skipDelay = creative.duration * (percent / 100)) : creative.skipDelay = this.parseDuration(skipOffset), 889 null != (videoClicksElement = this.childByName(creativeElement, "VideoClicks"))) { 890 for (creative.videoClickThroughURLTemplate = this.parseNodeText(this.childByName(videoClicksElement, "ClickThrough")), 891 i = 0, len = (ref = this.childsByName(videoClicksElement, "ClickTracking")).length; i < len; i++) clickTrackingElement = ref[i], 892 creative.videoClickTrackingURLTemplates.push(this.parseNodeText(clickTrackingElement)); 893 for (j = 0, len1 = (ref1 = this.childsByName(videoClicksElement, "CustomClick")).length; j < len1; j++) customClickElement = ref1[j], 894 creative.videoCustomClickURLTemplates.push(this.parseNodeText(customClickElement)); 895 } 896 for (null != (adParamsElement = this.childByName(creativeElement, "AdParameters")) && (creative.adParameters = this.parseNodeText(adParamsElement)), 897 k = 0, len2 = (ref2 = this.childsByName(creativeElement, "TrackingEvents")).length; k < len2; k++) for (trackingEventsElement = ref2[k], 898 l = 0, len3 = (ref3 = this.childsByName(trackingEventsElement, "Tracking")).length; l < len3; l++) if (eventName = (trackingElement = ref3[l]).getAttribute("event"), 899 trackingURLTemplate = this.parseNodeText(trackingElement), null != eventName && null != trackingURLTemplate) { 900 if ("progress" === eventName) { 901 if (!(offset = trackingElement.getAttribute("offset"))) continue; 902 eventName = "%" === offset.charAt(offset.length - 1) ? "progress-" + offset : "progress-" + Math.round(this.parseDuration(offset)); 903 } 904 null == (base = creative.trackingEvents)[eventName] && (base[eventName] = []), creative.trackingEvents[eventName].push(trackingURLTemplate); 905 } 906 for (m = 0, len4 = (ref4 = this.childsByName(creativeElement, "MediaFiles")).length; m < len4; m++) for (mediaFilesElement = ref4[m], 907 n = 0, len5 = (ref5 = this.childsByName(mediaFilesElement, "MediaFile")).length; n < len5; n++) mediaFileElement = ref5[n], 908 (mediaFile = new VASTMediaFile()).id = mediaFileElement.getAttribute("id"), mediaFile.fileURL = this.parseNodeText(mediaFileElement), 909 mediaFile.deliveryType = mediaFileElement.getAttribute("delivery"), mediaFile.codec = mediaFileElement.getAttribute("codec"), 910 mediaFile.mimeType = mediaFileElement.getAttribute("type"), mediaFile.apiFramework = mediaFileElement.getAttribute("apiFramework"), 911 mediaFile.bitrate = parseInt(mediaFileElement.getAttribute("bitrate") || 0), mediaFile.minBitrate = parseInt(mediaFileElement.getAttribute("minBitrate") || 0), 912 mediaFile.maxBitrate = parseInt(mediaFileElement.getAttribute("maxBitrate") || 0), 913 mediaFile.width = parseInt(mediaFileElement.getAttribute("width") || 0), mediaFile.height = parseInt(mediaFileElement.getAttribute("height") || 0), 914 (scalable = mediaFileElement.getAttribute("scalable")) && "string" == typeof scalable && ("true" === (scalable = scalable.toLowerCase()) ? mediaFile.scalable = !0 : "false" === scalable && (mediaFile.scalable = !1)), 915 (maintainAspectRatio = mediaFileElement.getAttribute("maintainAspectRatio")) && "string" == typeof maintainAspectRatio && ("true" === (maintainAspectRatio = maintainAspectRatio.toLowerCase()) ? mediaFile.maintainAspectRatio = !0 : "false" === maintainAspectRatio && (mediaFile.maintainAspectRatio = !1)), 916 creative.mediaFiles.push(mediaFile); 917 if (null != (iconsElement = this.childByName(creativeElement, "Icons"))) for (o = 0, 918 len6 = (ref6 = this.childsByName(iconsElement, "Icon")).length; o < len6; o++) { 919 for (iconElement = ref6[o], (icon = new VASTIcon()).program = iconElement.getAttribute("program"), 920 icon.height = parseInt(iconElement.getAttribute("height") || 0), icon.width = parseInt(iconElement.getAttribute("width") || 0), 921 icon.xPosition = this.parseXPosition(iconElement.getAttribute("xPosition")), icon.yPosition = this.parseYPosition(iconElement.getAttribute("yPosition")), 922 icon.apiFramework = iconElement.getAttribute("apiFramework"), icon.offset = this.parseDuration(iconElement.getAttribute("offset")), 923 icon.duration = this.parseDuration(iconElement.getAttribute("duration")), p = 0, 924 len7 = (ref7 = this.childsByName(iconElement, "HTMLResource")).length; p < len7; p++) htmlElement = ref7[p], 925 icon.type = htmlElement.getAttribute("creativeType") || "text/html", icon.htmlResource = this.parseNodeText(htmlElement); 926 for (q = 0, len8 = (ref8 = this.childsByName(iconElement, "IFrameResource")).length; q < len8; q++) iframeElement = ref8[q], 927 icon.type = iframeElement.getAttribute("creativeType") || 0, icon.iframeResource = this.parseNodeText(iframeElement); 928 for (r = 0, len9 = (ref9 = this.childsByName(iconElement, "StaticResource")).length; r < len9; r++) staticElement = ref9[r], 929 icon.type = staticElement.getAttribute("creativeType") || 0, icon.staticResource = this.parseNodeText(staticElement); 930 if (null != (iconClicksElement = this.childByName(iconElement, "IconClicks"))) for (icon.iconClickThroughURLTemplate = this.parseNodeText(this.childByName(iconClicksElement, "IconClickThrough")), 931 s = 0, len10 = (ref10 = this.childsByName(iconClicksElement, "IconClickTracking")).length; s < len10; s++) iconClickTrackingElement = ref10[s], 932 icon.iconClickTrackingURLTemplates.push(this.parseNodeText(iconClickTrackingElement)); 933 icon.iconViewTrackingURLTemplate = this.parseNodeText(this.childByName(iconElement, "IconViewTracking")), 934 creative.icons.push(icon); 935 } 936 return creative; 937 }, VASTParser.parseNonLinear = function(creativeElement, creativeAttributes) { 938 var adParamsElement, base, clickTrackingElement, creative, eventName, htmlElement, i, iframeElement, j, k, l, len, len1, len2, len3, len4, len5, len6, m, n, nonlinearAd, nonlinearResource, o, ref, ref1, ref2, ref3, ref4, ref5, ref6, staticElement, trackingElement, trackingEventsElement, trackingURLTemplate; 939 for (creative = new VASTCreativeNonLinear(creativeAttributes), i = 0, len = (ref = this.childsByName(creativeElement, "TrackingEvents")).length; i < len; i++) for (trackingEventsElement = ref[i], 940 j = 0, len1 = (ref1 = this.childsByName(trackingEventsElement, "Tracking")).length; j < len1; j++) eventName = (trackingElement = ref1[j]).getAttribute("event"), 941 trackingURLTemplate = this.parseNodeText(trackingElement), null != eventName && null != trackingURLTemplate && (null == (base = creative.trackingEvents)[eventName] && (base[eventName] = []), 942 creative.trackingEvents[eventName].push(trackingURLTemplate)); 943 for (k = 0, len2 = (ref2 = this.childsByName(creativeElement, "NonLinear")).length; k < len2; k++) { 944 for (nonlinearResource = ref2[k], (nonlinearAd = new VASTNonLinear()).id = nonlinearResource.getAttribute("id") || null, 945 nonlinearAd.width = nonlinearResource.getAttribute("width"), nonlinearAd.height = nonlinearResource.getAttribute("height"), 946 nonlinearAd.expandedWidth = nonlinearResource.getAttribute("expandedWidth"), nonlinearAd.expandedHeight = nonlinearResource.getAttribute("expandedHeight"), 947 nonlinearAd.scalable = this.parseBoolean(nonlinearResource.getAttribute("scalable")), 948 nonlinearAd.maintainAspectRatio = this.parseBoolean(nonlinearResource.getAttribute("maintainAspectRatio")), 949 nonlinearAd.minSuggestedDuration = this.parseDuration(nonlinearResource.getAttribute("minSuggestedDuration")), 950 nonlinearAd.apiFramework = nonlinearResource.getAttribute("apiFramework"), l = 0, 951 len3 = (ref3 = this.childsByName(nonlinearResource, "HTMLResource")).length; l < len3; l++) htmlElement = ref3[l], 952 nonlinearAd.type = htmlElement.getAttribute("creativeType") || "text/html", nonlinearAd.htmlResource = this.parseNodeText(htmlElement); 953 for (m = 0, len4 = (ref4 = this.childsByName(nonlinearResource, "IFrameResource")).length; m < len4; m++) iframeElement = ref4[m], 954 nonlinearAd.type = iframeElement.getAttribute("creativeType") || 0, nonlinearAd.iframeResource = this.parseNodeText(iframeElement); 955 for (n = 0, len5 = (ref5 = this.childsByName(nonlinearResource, "StaticResource")).length; n < len5; n++) staticElement = ref5[n], 956 nonlinearAd.type = staticElement.getAttribute("creativeType") || 0, nonlinearAd.staticResource = this.parseNodeText(staticElement); 957 for (null != (adParamsElement = this.childByName(nonlinearResource, "AdParameters")) && (nonlinearAd.adParameters = this.parseNodeText(adParamsElement)), 958 nonlinearAd.nonlinearClickThroughURLTemplate = this.parseNodeText(this.childByName(nonlinearResource, "NonLinearClickThrough")), 959 o = 0, len6 = (ref6 = this.childsByName(nonlinearResource, "NonLinearClickTracking")).length; o < len6; o++) clickTrackingElement = ref6[o], 960 nonlinearAd.nonlinearClickTrackingURLTemplates.push(this.parseNodeText(clickTrackingElement)); 961 creative.variations.push(nonlinearAd); 962 } 963 return creative; 964 }, VASTParser.parseCompanionAd = function(creativeElement, creativeAttributes) { 965 var base, child, clickTrackingElement, companionAd, companionResource, creative, eventName, htmlElement, i, iframeElement, j, k, l, len, len1, len2, len3, len4, len5, len6, len7, m, n, o, p, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, staticElement, trackingElement, trackingEventsElement, trackingURLTemplate; 966 for (creative = new VASTCreativeCompanion(creativeAttributes), i = 0, len = (ref = this.childsByName(creativeElement, "Companion")).length; i < len; i++) { 967 for (companionResource = ref[i], (companionAd = new VASTCompanionAd()).id = companionResource.getAttribute("id") || null, 968 companionAd.width = companionResource.getAttribute("width"), companionAd.height = companionResource.getAttribute("height"),
969 companionAd.companionClickTrackingURLTemplates = [], j = 0, len1 = (ref1 = this.childsByName(companionResource, "HTMLResource")).length; j < len1; j++) htmlElement = ref1[j], 970 companionAd.type = htmlElement.getAttribute("creativeType") || "text/html", companionAd.htmlResource = this.parseNodeText(htmlElement); 971 for (k = 0, len2 = (ref2 = this.childsByName(companionResource, "IFrameResource")).length; k < len2; k++) iframeElement = ref2[k], 972 companionAd.type = iframeElement.getAttribute("creativeType") || 0, companionAd.iframeResource = this.parseNodeText(iframeElement); 973 for (l = 0, len3 = (ref3 = this.childsByName(companionResource, "StaticResource")).length; l < len3; l++) { 974 for (staticElement = ref3[l], companionAd.type = staticElement.getAttribute("creativeType") || 0, 975 m = 0, len4 = (ref4 = this.childsByName(companionResource, "AltText")).length; m < len4; m++) child = ref4[m], 976 companionAd.altText = this.parseNodeText(child); 977 companionAd.staticResource = this.parseNodeText(staticElement); 978 } 979 for (n = 0, len5 = (ref5 = this.childsByName(companionResource, "TrackingEvents")).length; n < len5; n++) for (trackingEventsElement = ref5[n], 980 o = 0, len6 = (ref6 = this.childsByName(trackingEventsElement, "Tracking")).length; o < len6; o++) eventName = (trackingElement = ref6[o]).getAttribute("event"), 981 trackingURLTemplate = this.parseNodeText(trackingElement), null != eventName && null != trackingURLTemplate && (null == (base = companionAd.trackingEvents)[eventName] && (base[eventName] = []), 982 companionAd.trackingEvents[eventName].push(trackingURLTemplate)); 983 for (p = 0, len7 = (ref7 = this.childsByName(companionResource, "CompanionClickTracking")).length; p < len7; p++) clickTrackingElement = ref7[p], 984 companionAd.companionClickTrackingURLTemplates.push(this.parseNodeText(clickTrackingElement)); 985 companionAd.companionClickThroughURLTemplate = this.parseNodeText(this.childByName(companionResource, "CompanionClickThrough")), 986 companionAd.companionClickTrackingURLTemplate = this.parseNodeText(this.childByName(companionResource, "CompanionClickTracking")), 987 creative.variations.push(companionAd); 988 } 989 return creative; 990 }, VASTParser.parseDuration = function(durationString) { 991 var durationComponents, hours, minutes, seconds, secondsAndMS; 992 return null == durationString ? -1 : VASTUtil.isNumeric(durationString) ? parseInt(durationString) : 3 !== (durationComponents = durationString.split(":")).length ? -1 : (secondsAndMS = durationComponents[2].split("."), 993 seconds = parseInt(secondsAndMS[0]), 2 === secondsAndMS.length && (seconds += parseFloat("0." + secondsAndMS[1])), 994 minutes = parseInt(60 * durationComponents[1]), hours = parseInt(60 * durationComponents[0] * 60), 995 isNaN(hours) || isNaN(minutes) || isNaN(seconds) || 3600 < minutes || 60 < seconds ? -1 : hours + minutes + seconds); 996 }, VASTParser.parseXPosition = function(xPosition) { 997 return "left" === xPosition || "right" === xPosition ? xPosition : parseInt(xPosition || 0); 998 }, VASTParser.parseYPosition = function(yPosition) { 999 return "top" === yPosition || "bottom" === yPosition ? yPosition : parseInt(yPosition || 0); 1000 }, VASTParser.parseBoolean = function(booleanString) { 1001 return "true" === booleanString || "TRUE" === booleanString || "1" === booleanString; 1002 }, VASTParser.parseNodeText = function(node) { 1003 return node && (node.textContent || node.text || "").trim(); 1004 }, VASTParser.copyNodeAttribute = function(attributeName, nodeSource, nodeDestination) { 1005 var attributeValue; 1006 if (attributeValue = nodeSource.getAttribute(attributeName)) return nodeDestination.setAttribute(attributeName, attributeValue); 1007 }, VASTParser.parseCreativeAdIdAttribute = function(creativeElement) { 1008 return creativeElement.getAttribute("AdID") || creativeElement.getAttribute("adID") || creativeElement.getAttribute("adId") || null; 1009 }, VASTParser; 1010 }(), module.exports = VASTParser; 1011 }, { 1012 "./ad": 2, 1013 "./companionad": 4, 1014 "./creative": 5, 1015 "./extension": 6, 1016 "./extensionchild": 7, 1017 "./icon": 8, 1018 "./mediafile": 10, 1019 "./nonlinear": 11, 1020 "./response": 13, 1021 "./urlhandler": 15, 1022 "./util": 18, 1023 events: 1 1024 } ],
1025 13: [ function(require, module, exports) { 1026 var VASTResponse; 1027 VASTResponse = function() { 1028 this.ads = [], this.errorURLTemplates = []; 1029 }, module.exports = VASTResponse; 1030 }, {} ], 1031 14: [ function(require, module, exports) { 1032 var EventEmitter, VASTClient, VASTCompanionAd, VASTCreativeLinear, VASTNonLinear, VASTTracker, VASTUtil, hasProp = {}.hasOwnProperty; 1033 VASTClient = require("./client"), VASTUtil = require("./util"), VASTCreativeLinear = require("./creative").VASTCreativeLinear, 1034 VASTNonLinear = require("./nonlinear"), VASTCompanionAd = require("./companionad"), 1035 EventEmitter = require("events").EventEmitter, VASTTracker = function(superClass) { 1036 function VASTTracker(ad, creative, variation) { 1037 var eventName, events, ref; 1038 for (eventName in this.ad = ad, this.creative = creative, this.variation = null != variation ? variation : null, 1039 this.muted = !1, this.impressed = !1, this.skipable = !1, this.skipDelayDefault = -1, 1040 this.trackingEvents = {}, this.emitAlwaysEvents = [ "creativeView", "start", "firstQuartile", "midpoint", "thirdQuartile", "complete", "resume", "pause", "rewind", "skip", "closeLinear", "close" ], 1041 ref = this.creative.trackingEvents) events = ref[eventName], this.trackingEvents[eventName] = events.slice(0); 1042 this.creative instanceof VASTCreativeLinear ? (this.setDuration(this.creative.duration), 1043 this.skipDelay = this.creative.skipDelay, this.linear = !0, this.clickThroughURLTemplate = this.creative.videoClickThroughURLTemplate, 1044 this.clickTrackingURLTemplates = this.creative.videoClickTrackingURLTemplates) : (this.skipDelay = -1, 1045 this.linear = !1, this.variation && (this.variation instanceof VASTNonLinear ? (this.clickThroughURLTemplate = this.variation.nonlinearClickThroughURLTemplate, 1046 this.clickTrackingURLTemplates = this.variation.nonlinearClickTrackingURLTemplates) : this.variation instanceof VASTCompanionAd && (this.clickThroughURLTemplate = this.variation.companionClickThroughURLTemplate, 1047 this.clickTrackingURLTemplates = this.variation.companionClickTrackingURLTemplates))), 1048 this.on("start", function() { 1049 VASTClient.lastSuccessfullAd = +new Date(); 1050 }); 1051 } 1052 return function(child, parent) { 1053 for (var key in parent) hasProp.call(parent, key) && (child[key] = parent[key]); 1054 function ctor() { 1055 this.constructor = child; 1056 } 1057 ctor.prototype = parent.prototype, child.prototype = new ctor(), child.__super__ = parent.prototype; 1058 }(VASTTracker, EventEmitter), VASTTracker.off = function(eventName, cb) { 1059 return this.removeListener(eventName, cb); 1060 }, VASTTracker.prototype.setDuration = function(duration) { 1061 return this.assetDuration = duration, this.quartiles = { 1062 firstQuartile: Math.round(25 * this.assetDuration) / 100, 1063 midpoint: Math.round(50 * this.assetDuration) / 100, 1064 thirdQuartile: Math.round(75 * this.assetDuration) / 100 1065 }; 1066 }, VASTTracker.prototype.setProgress = function(progress) { 1067 var eventName, events, i, len, percent, quartile, ref, skipDelay, time; 1068 if (-1 === (skipDelay = null === this.skipDelay ? this.skipDelayDefault : this.skipDelay) || this.skipable || (progress < skipDelay ? this.emit("skip-countdown", skipDelay - progress) : (this.skipable = !0, 1069 this.emit("skip-countdown", 0))), this.linear && 0 < this.assetDuration) { 1070 if (events = [], 0 < progress) for (quartile in events.push("start"), percent = Math.round(progress / this.assetDuration * 100), 1071 events.push("progress-" + percent + "%"), events.push("progress-" + Math.round(progress)), 1072 ref = this.quartiles) (time = ref[quartile]) <= progress && progress <= time + 1 && events.push(quartile); 1073 for (i = 0, len = events.length; i < len; i++) eventName = events[i], this.track(eventName, !0); 1074 progress < this.progress && this.track("rewind"); 1075 } 1076 return this.progress = progress; 1077 }, VASTTracker.prototype.setMuted = function(muted) { 1078 return this.muted !== muted && this.track(muted ? "mute" : "unmute"), this.muted = muted; 1079 }, VASTTracker.prototype.setPaused = function(paused) { 1080 return this.paused !== paused && this.track(paused ? "pause" : "resume"), this.paused = paused; 1081 }, VASTTracker.prototype.setFullscreen = function(fullscreen) { 1082 return this.fullscreen !== fullscreen && this.track(fullscreen ? "fullscreen" : "exitFullscreen"), 1083 this.fullscreen = fullscreen; 1084 }, VASTTracker.prototype.setExpand = function(expanded) { 1085 return this.expanded !== expanded && this.track(expanded ? "expand" : "collapse"), 1086 this.expanded = expanded; 1087 }, VASTTracker.prototype.setSkipDelay = function(duration) { 1088 if ("number" == typeof duration) return this.skipDelay = duration; 1089 }, VASTTracker.prototype.load = function() { 1090 if (!this.impressed) return this.impressed = !0, this.trackURLs(this.ad.impressionURLTemplates), 1091 this.track("creativeView"); 1092 }, VASTTracker.prototype.errorWithCode = function(errorCode) { 1093 return this.trackURLs(this.ad.errorURLTemplates, { 1094 ERRORCODE: errorCode 1095 }); 1096 }, VASTTracker.prototype.complete = function() { 1097 return this.track("complete"); 1098 }, VASTTracker.prototype.close = function() { 1099 return this.track(this.linear ? "closeLinear" : "close"); 1100 }, VASTTracker.prototype.stop = function() {}, VASTTracker.prototype.skip = function() { 1101 return this.track("skip"), this.trackingEvents = []; 1102 }, VASTTracker.prototype.click = function() { 1103 var clickThroughURL, ref, variables; 1104 if ((null != (ref = this.clickTrackingURLTemplates) ? ref.length : void 0) && this.trackURLs(this.clickTrackingURLTemplates), 1105 null != this.clickThroughURLTemplate) return this.linear && (variables = { 1106 CONTENTPLAYHEAD: this.progressFormated() 1107 }), clickThroughURL = VASTUtil.resolveURLTemplates([ this.clickThroughURLTemplate ], variables)[0],
1108 this.emit("clickthrough", clickThroughURL); 1109 }, VASTTracker.prototype.track = function(eventName, once) { 1110 var idx, trackingURLTemplates; 1111 null == once && (once = !1), "closeLinear" === eventName && null == this.trackingEvents[eventName] && null != this.trackingEvents.close && (eventName = "close"), 1112 trackingURLTemplates = this.trackingEvents[eventName], idx = this.emitAlwaysEvents.indexOf(eventName), 1113 null != trackingURLTemplates ? (this.emit(eventName, ""), this.trackURLs(trackingURLTemplates)) : -1 !== idx && this.emit(eventName, ""), 1114 !0 === once && (delete this.trackingEvents[eventName], -1 < idx && this.emitAlwaysEvents.splice(idx, 1)); 1115 }, VASTTracker.prototype.trackURLs = function(URLTemplates, variables) { 1116 var ref; 1117 return null == variables && (variables = {}), this.linear && (null != (null != (ref = this.creative.mediaFiles[0]) ? ref.fileURL : void 0) && (variables.ASSETURI = this.creative.mediaFiles[0].fileURL), 1118 variables.CONTENTPLAYHEAD = this.progressFormated()), VASTUtil.track(URLTemplates, variables); 1119 }, VASTTracker.prototype.progressFormated = function() { 1120 var h, m, s, seconds; 1121 return (h = (seconds = parseInt(this.progress)) / 3600).length < 2 && (h = "0" + h), 1122 (m = seconds / 60 % 60).length < 2 && (m = "0" + m), (s = seconds % 60).length < 2 && (s = "0" + m), 1123 h + ":" + m + ":" + s + "." + parseInt(100 * (this.progress - seconds)); 1124 }, VASTTracker; 1125 }(), module.exports = VASTTracker; 1126 }, { 1127 "./client": 3, 1128 "./companionad": 4, 1129 "./creative": 5, 1130 "./nonlinear": 11, 1131 "./util": 18, 1132 events: 1 1133 } ], 1134 15: [ function(require, module, exports) { 1135 var URLHandler, flash, xhr; 1136 xhr = require("./urlhandlers/xmlhttprequest"), flash = require("./urlhandlers/flash"), 1137 URLHandler = function() { 1138 function URLHandler() {} 1139 return URLHandler.get = function(url, options, cb) { 1140 var ref, response; 1141 return cb || ("function" == typeof options && (cb = options), options = {}), null != options.response ? (response = options.response, 1142 delete options.response, cb(null, response)) : (null != (ref = options.urlhandler) ? ref.supported() : void 0) ? options.urlhandler.get(url, options, cb) : "undefined" == typeof window || null === window ? require("./urlhandlers/node").get(url, options, cb) : xhr.supported() ? xhr.get(url, options, cb) : flash.supported() ? flash.get(url, options, cb) : cb(new Error("Current context is not supported by any of the default URLHandlers. Please provide a custom URLHandler")); 1143 }, URLHandler; 1144 }(), module.exports = URLHandler; 1145 }, { 1146 "./urlhandlers/flash": 16, 1147 "./urlhandlers/xmlhttprequest": 17 1148 } ], 1149 16: [ function(require, module, exports) { 1150 var FlashURLHandler; 1151 FlashURLHandler = function() { 1152 function FlashURLHandler() {} 1153 return FlashURLHandler.xdr = function() { 1154 var xdr; 1155 return window.XDomainRequest && (xdr = new XDomainRequest()), xdr; 1156 }, FlashURLHandler.supported = function() { 1157 return !!this.xdr(); 1158 }, FlashURLHandler.get = function(url, options, cb) { 1159 var xdr, xmlDocument; 1160 return (xmlDocument = "function" == typeof window.ActiveXObject ? new window.ActiveXObject("Microsoft.XMLDOM") : void 0) ? (xmlDocument.async = !1, 1161 (xdr = this.xdr()).open("GET", url), xdr.timeout = options.timeout || 0, xdr.withCredentials = options.withCredentials || !1, 1162 xdr.send(), xdr.onprogress = function() {}, xdr.onload = function() { 1163 return xmlDocument.loadXML(xdr.responseText), cb(null, xmlDocument); 1164 }
1164) : cb(new Error("FlashURLHandler: Microsoft.XMLDOM format not supported")); 1165 }, FlashURLHandler; 1166 }(), module.exports = FlashURLHandler; 1167 }, {} ], 1168 17: [ function(require, module, exports) { 1169 var XHRURLHandler; 1170 XHRURLHandler = function() { 1171 function XHRURLHandler() {} 1172 return XHRURLHandler.xhr = function() { 1173 var xhr; 1174 if ("withCredentials" in (xhr = new window.XMLHttpRequest())) return xhr; 1175 }, XHRURLHandler.supported = function() { 1176 return !!this.xhr(); 1177 }, XHRURLHandler.get = function(url, options, cb) { 1178 var xhr; 1179 if ("https:" === window.location.protocol && 0 === url.indexOf("http://")) return cb(new Error("XHRURLHandler: Cannot go from HTTPS to HTTP.")); 1180 try { 1181 return (xhr = this.xhr()).open("GET", url), xhr.timeout = options.timeout || 0, 1182 xhr.withCredentials = options.withCredentials || !1, xhr.overrideMimeType && xhr.overrideMimeType("text/xml"), 1183 xhr.onreadystatechange = function() { 1184 if (4 === xhr.readyState) return 200 === xhr.status ? cb(null, xhr.responseXML) : cb({ 1185 error: 3, 1186 error_code: "ERROR_URL", 1187 msg: "XHRURLHandler: " + xhr.statusText 1188 }); 1189 }, xhr.send(); 1190 } catch (error) { 1191 return cb({ 1192 error: 3, 1193 error_code: "ERROR_URL", 1194 msg: "XHRURLHandler: " + xhr.statusText 1195 }); 1196 } 1197 }, XHRURLHandler; 1198 }(), module.exports = XHRURLHandler; 1199 }, {} ], 1200 18: [ function(require, module, exports) { 1201 var VASTUtil; 1202 VASTUtil = function() { 1203 function VASTUtil() {} 1204 return VASTUtil.track = function(URLTemplates, variables) { 1205 var URL, URLs, i, j, len, results; 1206 for (results = [], j = 0, len = (URLs = this.resolveURLTemplates(URLTemplates, variables)).length; j < len; j++) URL = URLs[j], 1207 "undefined" != typeof window && null !== window && (i = new Image(), results.push(i.src = URL)); 1208 return results; 1209 }, VASTUtil.resolveURLTemplates = function(URLTemplates, variables) { 1210 var URLs, j, key, len, macro1, macro2, resolveURL, value; 1211 for (null == variables && (variables = {}), URLs = [], null != variables.ASSETURI && (variables.ASSETURI = this.encodeURIComponentRFC3986(variables.ASSETURI)), 1212 null != variables.CONTENTPLAYHEAD && (variables.CONTENTPLAYHEAD = this.encodeURIComponentRFC3986(variables.CONTENTPLAYHEAD)), 1213 null == variables.ERRORCODE || /^[0-9]{3}$/.test(variables.ERRORCODE) || (variables.ERRORCODE = 900), 1214 variables.CACHEBUSTING = this.leftpad(Math.round(1e8 * Math.random()).toString()), 1215 variables.TIMESTAMP = this.encodeURIComponentRFC3986(new Date().toISOString()), 1216 variables.RANDOM = variables.random = variables.CACHEBUSTING, j = 0, len = URLTemplates.length; j < len; j++) if (resolveURL = URLTemplates[j]) { 1217 for (key in variables) value = variables[key], macro1 = "[" + key + "]", macro2 = "%%" + key + "%%", 1218 resolveURL = (resolveURL = resolveURL.replace(macro1, value)).replace(macro2, value); 1219 URLs.push(resolveURL); 1220 } 1221 return URLs; 1222 }, VASTUtil.encodeURIComponentRFC3986 = function(str) { 1223 return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { 1224 return "%" + c.charCodeAt(0).toString(16); 1225 }); 1226 }, VASTUtil.leftpad = function(str) { 1227 return str.length < 8 ? function() { 1228 var j, ref, results; 1229 for (results = [], j = 0, ref = 8 - str.length; 0 <= ref ? j < ref : ref < j; 0 <= ref ? j++ : j--) results.push("0"); 1230 return results; 1231 }().join("") + str : str; 1232 }, VASTUtil.storage = function() { 1233 var data, storage; 1234 try { 1235 storage = "undefined" != typeof window && null !== window ? window.localStorage || window.sessionStorage : null; 1236 } catch (error) { 1237 error, storage = null; 1238 } 1239 return (null == storage || function(store) { 1240 try { 1241 if ("__VASTUtil__", store.setItem("__VASTUtil__", "__VASTUtil__"), "__VASTUtil__" !== store.getItem("__VASTUtil__")) return !0; 1242 } catch (error) { 1243 return error, !0; 1244 } 1245 return !1; 1246 }(storage)) && (data = {}, storage = { 1247 length: 0, 1248 getItem: function(key) { 1249 return data[key]; 1250 }, 1251 setItem: function(key, value) { 1252 data[key] = value, this.length = Object.keys(data).length; 1253 }, 1254 removeItem: function(key) { 1255 delete data[key], this.length = Object.keys(data).length; 1256 }, 1257 clear: function() { 1258 data = {}, this.length = 0; 1259 } 1260 }), storage; 1261 }(), VASTUtil.isNumeric = function(n) { 1262 return !isNaN(parseFloat(n)) && isFinite(n); 1263 }, VASTUtil; 1264 }(), module.exports = VASTUtil; 1265 }, {} ] 1266 }, {}, [ 9 ])(9); 1267}), function(global, factory) { 1268 "object" == typeof exports && "undefined" != typeof module ? module.exports = factory() : "function" == typeof define && define.amd ? define(factory) : global.videojs = factory(); 1269}(this, function() { 1270 var version = "6.7.3", commonjsGlobal = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; 1271 function createCommonjsModule(fn, module) { 1272 return fn(module = { 1273 exports: {} 1274 }, module.exports), module.exports; 1275 } 1276 var doccy, window_1 = "undefined" != typeof window ? window : void 0 !== commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : {}, empty = {}, empty$1 = (Object.freeze || Object)({ 1277 default: empty 1278 }), minDoc = empty$1 && empty || empty$1, topLevel = void 0 !== commonjsGlobal ? commonjsGlobal : "undefined" != typeof window ? window : {}; 1279 "undefined" != typeof document ? doccy = document : (doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"]) || (doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"] = minDoc); 1280 var match, document_1 = doccy, USER_AGENT = window_1.navigator && window_1.navigator.userAgent || "", webkitVersionMap = /AppleWeb
1280Kit\/([\d.]+)/i.exec(USER_AGENT), appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null, IS_IPAD = /iPad/i.test(USER_AGENT), IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD, IS_IPOD = /iPod/i.test(USER_AGENT), IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD, IOS_VERSION = (match = USER_AGENT.match(/OS (\d+)_/i)) && match[1] ? match[1] : null, IS_ANDROID = /Android/i.test(USER_AGENT), ANDROID_VERSION = function() { 1281 var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i); 1282 if (!match) return null; 1283 var major = match[1] && parseFloat(match[1]), minor = match[2] && parseFloat(match[2]); 1284 return major && minor ? parseFloat(match[1] + "." + match[2]) : major || null; 1285 }(), IS_OLD_ANDROID = IS_ANDROID && /webkit/i.test(USER_AGENT) && ANDROID_VERSION < 2.3, IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537, IS_FIREFOX = /Firefox/i.test(USER_AGENT), IS_EDGE = /Edge/i.test(USER_AGENT), IS_CHROME = !IS_EDGE && /Chrome/i.test(USER_AGENT), CHROME_VERSION = function() { 1286 var match = USER_AGENT.match(/Chrome\/(\d+)/); 1287 return match && match[1] ? parseFloat(match[1]) : null; 1288 }(), IS_IE8 = /MSIE\s8\.0/.test(USER_AGENT), IE_VERSION = function() { 1289 var result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT), version = result && parseFloat(result[1]); 1290 return !version && /Trident\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT) && (version = 11), 1291 version; 1292 }(), IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE, IS_ANY_SAFARI = IS_SAFARI || IS_IOS, TOUCH_ENABLED = isReal() && ("ontouchstart" in window_1 || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch), BACKGROUND_SIZE_SUPPORTED = isReal() && "backgroundSize" in window_1.document.createElement("video").style, browser = (Object.freeze || Object)({ 1293 IS_IPAD: IS_IPAD, 1294 IS_IPHONE: IS_IPHONE, 1295 IS_IPOD: IS_IPOD, 1296 IS_IOS: IS_IOS, 1297 IOS_VERSION: IOS_VERSION, 1298 IS_ANDROID: IS_ANDROID, 1299 ANDROID_VERSION: ANDROID_VERSION, 1300 IS_OLD_ANDROID: IS_OLD_ANDROID, 1301 IS_NATIVE_ANDROID: IS_NATIVE_ANDROID, 1302 IS_FIREFOX: IS_FIREFOX, 1303 IS_EDGE: IS_EDGE, 1304 IS_CHROME: IS_CHROME, 1305 CHROME_VERSION: CHROME_VERSION, 1306 IS_IE8: IS_IE8, 1307 IE_VERSION: IE_VERSION, 1308 IS_SAFARI: IS_SAFARI, 1309 IS_ANY_SAFARI: IS_ANY_SAFARI, 1310 TOUCH_ENABLED: TOUCH_ENABLED, 1311 BACKGROUND_SIZE_SUPPORTED: BACKGROUND_SIZE_SUPPORTED 1312 }), _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { 1313 return typeof obj; 1314 } : function(obj) { 1315 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 1316 }, classCallCheck = function(instance, Constructor) { 1317 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); 1318 }, inherits = function(subClass, superClass) { 1319 if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 1320 subClass.prototype = Object.create(superClass && superClass.prototype, { 1321 constructor: { 1322 value: subClass, 1323 enumerable: !1, 1324 writable: !0, 1325 configurable: !0 1326 } 1327 }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass); 1328 }, possibleConstructorReturn = function(self, call) { 1329 if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1330 return !call || "object" != typeof call && "function" != typeof call ? self : call; 1331 }, taggedTemplateLiteralLoose = function(strings, raw) { 1332 return strings.raw = raw, strings; 1333 }, toString = Object.prototype.toString, keys = function(object) { 1334 return isObject(object) ? Object.keys(object) : []; 1335 }; 1336 function each(object, fn) { 1337 keys(object).forEach(function(key) { 1338 return fn(object[key], key); 1339 }); 1340 } 1341 function assign(target) { 1342 for (var _len = arguments.length, sources = Array(1 < _len ? _len - 1 : 0), _key = 1; _key < _len; _key++) sources[_key - 1] = arguments[_key]; 1343 return Object.assign ? Object.assign.apply(Object, [ target ].concat(sources)) : (sources.forEac
1343h(function(source) { 1344 source && each(source, function(value, key) { 1345 target[key] = value; 1346 }); 1347 }), target); 1348 } 1349 function isObject(value) { 1350 return !!value && "object" === (void 0 === value ? "undefined" : _typeof(value)); 1351 } 1352 function isPlain(value) { 1353 return isObject(value) && "[object Object]" === toString.call(value) && value.constructor === Object; 1354 } 1355 var log = void 0, level = "info", history = [], logByType = function(type, args) { 1356 var stringify = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : !!IE_VERSION && IE_VERSION < 11, lvl = log.levels[level], lvlRegExp = new RegExp("^(" + lvl + ")$"); 1357 if ("log" !== type && args.unshift(type.toUpperCase() + ":"), history && history.push([].concat(args)), 1358 args.unshift("VIDEOJS:"), window_1.console) { 1359 var fn = window_1.console[type]; 1360 fn || "debug" !== type || (fn = window_1.console.info || window_1.console.log), 1361 fn && lvl && lvlRegExp.test(type) && (stringify && (args = args.map(function(a) { 1362 if (isObject(a) || Array.isArray(a)) try { 1363 return JSON.stringify(a); 1364 } catch (x) { 1365 return String(a); 1366 } 1367 return String(a); 1368 }).join(" ")), fn.apply ? fn[Array.isArray(args) ? "apply" : "call"](window_1.console, args) : fn(args)); 1369 } 1370 }; 1371 (log = function() { 1372 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; 1373 logByType("log", args); 1374 }).levels = { 1375 all: "debug|log|warn|error", 1376 off: "", 1377 debug: "debug|log|warn|error", 1378 info: "log|warn|error", 1379 warn: "warn|error", 1380 error: "error", 1381 DEFAULT: level 1382 }, log.level = function(lvl) { 1383 if ("string" == typeof lvl) { 1384 if (!log.levels.hasOwnProperty(lvl)) throw new Error('"' + lvl + '" in not a valid log level'); 1385 level = lvl; 1386 } 1387 return level; 1388 }, log.history = function() { 1389 return history ? [].concat(history) : []; 1390 }, log.history.clear = function() { 1391 history && (history.length = 0); 1392 }, log.history.disable = function() { 1393 null !== history && (history.length = 0, history = null); 1394 }, log.history.enable = function() { 1395 null === history && (history = []); 1396 }, log.error = function() { 1397 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2]; 1398 return logByType("error", args); 1399 }, log.warn = function() { 1400 for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) args[_key3] = arguments[_key3]; 1401 return logByType("warn", args); 1402 }, log.debug = function() { 1403 for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4]; 1404 return logByType("debug", args); 1405 }; 1406 var log$1 = log; 1407 function clean(s) { 1408 return s.replace(/\n\r?\s*/g, ""); 1409 } 1410 var tsml = function(sa) { 1411 for (var s = "", i = 0; i < arguments.length; i++) s += clean(sa[i]) + (arguments[i + 1] || ""); 1412 return s; 1413 }; 1414 function computedStyle(el, prop) { 1415 if (!el || !prop) return ""; 1416 if ("function" == typeof window_1.getComputedStyle) { 1417 var cs = window_1.getComputedStyle(el); 1418 return cs ? cs[prop] : ""; 1419 } 1420 return el.currentStyle[prop] || ""; 1421 } 1422 var _templateObject = taggedTemplateLiteralLoose([ "Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ", " to ", "." ], [ "Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ", " to ", "." ]); 1423 function isNonBlankString(str) { 1424 return "string" == typeof str && /\S/.test(str); 1425 } 1426 function throwIfWhitespace(str) { 1427 if (/\s/.test(str)) throw new Error("class has illegal whitespace characters"); 1428 } 1429 function isReal() { 1430 return document_1 === window_1.document && void 0 !== document_1.createElement; 1431 } 1432 function isEl(value) { 1433 return isObject(value) && 1 === value.nodeType; 1434 } 1435 function isInFrame() { 1436 try { 1437 return window_1.parent !== window_1.self; 1438 } catch (x) { 1439 return !0; 1440 } 1441 } 1442 function createQuerier(method) { 1443 return function(selector, context) { 1444 if (!isNonBlankString(selector)) return document_1[method](null); 1445 isNonBlankString(context) && (context = document_1.querySelector(context)); 1446 var ctx = isEl(context) ? context : document_1; 1447 return ctx[method] && ctx[method](selector); 1448 }; 1449 } 1450 function createEl() { 1451 var tagName = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "div", properties = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, attributes = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}, content = arguments[3], el = document_1.createElement(tagName);
1452 return Object.getOwnPropertyNames(properties).forEach(function(propName) { 1453 var val = properties[propName]; 1454 -1 !== propName.indexOf("aria-") || "role" === propName || "type" === propName ? (log$1.warn(tsml(_templateObject, propName, val)), 1455 el.setAttribute(propName, val)) : "textContent" === propName ? textContent(el, val) : el[propName] = val; 1456 }), Object.getOwnPropertyNames(attributes).forEach(function(attrName) { 1457 el.setAttribute(attrName, attributes[attrName]); 1458 }), content && appendContent(el, content), el; 1459 } 1460 function textContent(el, text) { 1461 return void 0 === el.textContent ? el.innerText = text : el.textContent = text, 1462 el; 1463 } 1464 function prependTo(child, parent) { 1465 parent.firstChild ? parent.insertBefore(child, parent.firstChild) : parent.appendChild(child); 1466 } 1467 function hasClass(element, classToCheck) { 1468 return throwIfWhitespace(classToCheck), element.classList ? element.classList.contains(classToCheck) : (className = classToCheck, 1469 new RegExp("(^|\\s)" + className + "($|\\s)")).test(element.className); 1470 var className; 1471 } 1472 function addClass(element, classToAdd) { 1473 return element.classList ? element.classList.add(classToAdd) : hasClass(element, classToAdd) || (element.className = (element.className + " " + classToAdd).trim()), 1474 element; 1475 } 1476 function removeClass(element, classToRemove) { 1477 return element.classList ? element.classList.remove(classToRemove) : (throwIfWhitespace(classToRemove), 1478 element.className = element.className.split(/\s+/).filter(function(c) { 1479 return c !== classToRemove; 1480 }).join(" ")), element; 1481 } 1482 function toggleClass(element, classToToggle, predicate) { 1483 var has = hasClass(element, classToToggle); 1484 if ("function" == typeof predicate && (predicate = predicate(element, classToToggle)), 1485 "boolean" != typeof predicate && (predicate = !has), predicate !== has) return predicate ? addClass(element, classToToggle) : removeClass(element, classToToggle), 1486 element; 1487 } 1488 function setAttributes(el, attributes) { 1489 Object.getOwnPropertyNames(attributes).forEach(function(attrName) { 1490 var attrValue = attributes[attrName]; 1491 null == attrValue || !1 === attrValue ? el.removeAttribute(attrName) : el.setAttribute(attrName, !0 === attrValue ? "" : attrValue); 1492 }); 1493 } 1494 function getAttributes(tag) { 1495 var obj = {}, knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,"; 1496 if (tag && tag.attributes && 0 < tag.attributes.length) for (var attrs = tag.attributes, i = attrs.length - 1; 0 <= i; i--) { 1497 var attrName = attrs[i].name, attrVal = attrs[i].value; 1498 "boolean" != typeof tag[attrName] && -1 === knownBooleans.indexOf("," + attrName + ",") || (attrVal = null !== attrVal), 1499 obj[attrName] = attrVal; 1500 } 1501 return obj; 1502 } 1503 function getAttribute(el, attribute) { 1504 return el.getAttribute(attribute); 1505 } 1506 function setAttribute(el, attribute, value) { 1507 el.setAttribute(attribute, value); 1508 } 1509 function removeAttribute(el, attribute) { 1510 el.removeAttribute(attribute); 1511 } 1512 function blockTextSelection() { 1513 document_1.body.focus(), document_1.onselectstart = function() { 1514 return !1; 1515 }; 1516 } 1517 function unblockTextSelection() { 1518 document_1.onselectstart = function() { 1519 return !0; 1520 }; 1521 } 1522 function getBoundingClientRect(el) { 1523 if (el && el.getBoundingClientRect && el.parentNode) { 1524 var rect = el.getBoundingClientRect(), result = {}; 1525 return [ "bottom", "height", "left", "right", "top", "width" ].forEach(function(k) { 1526 void 0 !== rect[k] && (result[k] = rect[k]); 1527 }), result.height || (result.height = parseFloat(computedStyle(el, "height"))), 1528 result.width || (result.width = parseFloat(computedStyle(el, "width"))), result; 1529 } 1530 } 1531 function findPosition(el) { 1532 var box = void 0; 1533 if (el.getBoundingClientRect && el.parentNode && (box = el.getBoundingClientRect()), 1534 !box) return { 1535 left: 0, 1536 top: 0 1537 }; 1538 var docEl = document_1.documentElement, body = document_1.body, clientLeft = docEl.clientLeft || body.clientLeft || 0, scrollLeft = window_1.pageXOffset || body.scrollLeft, left = box.left + scrollLeft - clientLeft, clientTop = docEl.clientTop || body.clientTop || 0, scrollTop = window_1.pageYOffset || body.scrollTop, top = box.top + scrollTop - clientTop; 1539 return { 1540 left: Math.round(left), 1541 top: Math.round(top) 1542 }; 1543 } 1544 function getPointerPosition(el, event) { 1545 var position = {}, box = findPosition(el), boxW = el.offsetWidth, boxH = el.offsetHeight, boxY = box.top, boxX = box.left, pageY = event.pageY, pageX = event.pageX; 1546 return event.changedTouches && (pageX = event.changedTouches[0].pageX, pageY = event.changedTouches[0].pageY), 1547 position.y = Math.max(0, Math.min(1, (boxY - pageY + boxH) / boxH)), position.x = Math.max(0, Math.min(1, (pageX - boxX) / boxW)), 1548 position; 1549 } 1550 function isTextNode(value) { 1551 return isObject(value) && 3 === value.nodeType; 1552 } 1553 function emptyEl(el) { 1554 for (;el.firstChild; ) el.removeChild(el.firstChild); 1555 return el; 1556 } 1557 function normalizeContent(content) { 1558 return "function" == typeof content && (content = content()), (Array.isArray(content) ? c
1558ontent : [ content ]).map(function(value) { 1559 return "function" == typeof value && (value = value()), isEl(value) || isTextNode(value) ? value : "string" == typeof value && /\S/.test(value) ? document_1.createTextNode(value) : void 0; 1560 }).filter(function(value) { 1561 return value; 1562 }); 1563 } 1564 function appendContent(el, content) { 1565 return normalizeContent(content).forEach(function(node) { 1566 return el.appendChild(node); 1567 }), el; 1568 } 1569 function insertContent(el, content) { 1570 return appendContent(emptyEl(el), content); 1571 } 1572 function isSingleLeftClick(event) { 1573 return void 0 === event.button && void 0 === event.buttons || (0 === event.button && void 0 === event.buttons || (9 === IE_VERSION || 0 === event.button && 1 === event.buttons)); 1574 } 1575 var $ = createQuerier("querySelector"), $$ = createQuerier("querySelectorAll"), Dom = (Object.freeze || Object)({ 1576 isReal: isReal, 1577 isEl: isEl, 1578 isInFrame: isInFrame, 1579 createEl: createEl, 1580 textContent: textContent, 1581 prependTo: prependTo, 1582 hasClass: hasClass, 1583 addClass: addClass, 1584 removeClass: removeClass, 1585 toggleClass: toggleClass, 1586 setAttributes: setAttributes, 1587 getAttributes: getAttributes, 1588 getAttribute: getAttribute, 1589 setAttribute: setAttribute, 1590 removeAttribute: removeAttribute, 1591 blockTextSelection: blockTextSelection, 1592 unblockTextSelection: unblockTextSelection, 1593 getBoundingClientRect: getBoundingClientRect, 1594 findPosition: findPosition, 1595 getPointerPosition: getPointerPosition, 1596 isTextNode: isTextNode, 1597 emptyEl: emptyEl, 1598 normalizeContent: normalizeContent, 1599 appendContent: appendContent, 1600 insertContent: insertContent, 1601 isSingleLeftClick: isSingleLeftClick, 1602 $: $, 1603 $$: $$ 1604 }), _guid = 1; 1605 function newGUID() { 1606 return _guid++; 1607 } 1608 var elData = {}, elIdAttr = "vdata" + new Date().getTime(); 1609 function getData(el) { 1610 var id = el[elIdAttr]; 1611 return id || (id = el[elIdAttr] = newGUID()), elData[id] || (elData[id] = {}), elData[id]; 1612 } 1613 function hasData(el) { 1614 var id = el[elIdAttr]; 1615 return !!id && !!Object.getOwnPropertyNames(elData[id]).length; 1616 } 1617 function removeData(el) { 1618 var id = el[elIdAttr]; 1619 if (id) { 1620 delete elData[id]; 1621 try { 1622 delete el[elIdAttr]; 1623 } catch (e) { 1624 el.removeAttribute ? el.removeAttribute(elIdAttr) : el[elIdAttr] = null; 1625 } 1626 } 1627 } 1628 function _cleanUpEvents(elem, type) { 1629 var data = getData(elem); 1630 0 === data.handlers[type].length && (delete data.handlers[type], elem.removeEventListener ? elem.removeEventListener(type, data.dispatcher, !1) : elem.detachEvent && elem.detachEvent("on" + type, data.dispatcher)), 1631 Object.getOwnPropertyNames(data.handlers).length <= 0 && (delete data.handlers, 1632 delete data.dispatcher, delete data.disabled), 0 === Object.getOwnPropertyNames(data).length && removeData(elem); 1633 } 1634 function _handleMultipleEvents(fn, elem, types, callback) { 1635 types.forEach(function(type) { 1636 fn(elem, type, callback); 1637 }); 1638 } 1639 function fixEvent(event) { 1640 function returnTrue() { 1641 return !0; 1642 } 1643 function returnFalse() { 1644 return !1; 1645 } 1646 if (!event || !event.isPropagationStopped) { 1647 var old = event || window_1.event; 1648 for (var key in event = {}, old) "layerX" !== key && "layerY" !== key && "keyLocation" !== key && "webkitMovementX" !== key && "webkitMovementY" !== key && ("returnValue" === key && old.preventDefault || (event[key] = old[key])); 1649 if (event.target || (event.target = event.srcElement || document_1), event.relatedTarget || (event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement), 1650 event.preventDefault = function() { 1651 old.preventDefault && old.preventDefault(), event.returnValue = !1, old.returnValue = !1, 1652 event.defaultPrevented = !0; 1653 }, event.defaultPrevented = !1, event.stopPropagation = function() { 1654 old.stopPropagation && old.stopPropagation(), event.cancelBubble = !0, old.cancelBubble = !0, 1655 event.isPropagationStopped = returnTrue; 1656 }, event.isPropagationStopped = returnFalse, event.stopImmediatePropagation = function() { 1657 old.stopImmediatePropagation && old.stopImmediatePropagation(), event.isImmediatePropagationStopped = returnTrue, 1658 event.stopPropagation(); 1659 }, event.isImmediatePropagationStopped = returnFalse, null !== event.clientX && void 0 !== event.clientX) { 1660 var doc = document_1.documentElement, body = document_1.body; 1661 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0), 1662 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); 1663 } 1664 event.which = event.charCode || event.keyCode, null !== event.button && void 0 !== event.button && (event.button = 1 & event.button ? 0 : 4 & event.button ? 1 : 2 & event.button ? 2 : 0); 1665 } 1666 return event; 1667 } 1668 var _supportsPassive = !1; 1669 !function() { 1670 try { 1671 var opts = Object.defineProperty({}, "passive", { 1672 get: function() { 1673 _supportsPassive = !0; 1674 } 1675 }); 1676 window_1.addEventListener("test", null, opts), window_1.removeEventListener("test", null, opts); 1677 } catch (e) {} 1678 }(); 1679 var passiveEvents = [ "touchstart", "touchmove" ]; 1680 function on(elem, type, fn) { 1681 if (Array.isArray(type)) return _handleMultipleEvents(on, elem, type, fn); 1682 var data = getData(elem); 1683 if (data.handlers || (data.handlers = {}), data.handlers[type] || (data.handlers[type] = []), 1684 fn.guid || (fn.guid = newGUID()), data.handlers[type].push(fn), data.dispatcher || (data.disabled = !1, 1685 data.dispatcher = function(event, hash) { 1686 if (!data.disabled) { 1687 event = fixEvent(event); 1688 var handlers = data.handlers[event.type]; 1689 if (handlers) for (var handlersCopy = handlers.slice(0), m = 0, n = handlersCopy.length; m < n && !event.isImmediatePropagationStopped(); m++) try { 1690 handlersCopy[m].call(elem, event, hash); 1691 } catch (e) { 1692 log$1.error(e); 1693 } 1694 } 1695 }), 1 === data.handlers[type].length) if (elem.addEventListener) { 1696 var options = !1; 1697 _supportsPassive && -1 < passiveEvents.indexOf(type) && (options = { 1698 passive: !0 1699 }), elem.addEventListener(type, data.dispatcher, options); 1700 } else elem.attachEvent && elem.attachEvent("on" + type, data.dispatcher); 1701 } 1702 function off(elem, type, fn) { 1703 if (hasData(elem)) { 1704 var data = getData(elem); 1705 if (data.handlers) { 1706 if (Array.isArray(type)) return _handleMultipleEvents(off, elem, type, fn); 1707 var removeType = function(el, t) { 1708 data.handlers[t] = [], _cleanUpEvents(el, t); 1709 }; 1710 if (void 0 !== type) { 1711 var handlers = data.handlers[type]; 1712 if (handlers) if (fn) { 1713 if (fn.guid) for (var n = 0; n < handlers.length; n++) handlers[n].guid === fn.guid && handlers.splice(n--, 1); 1714 _cleanUpEvents(elem, type); 1715 } else removeType(elem, type); 1716 } else for (var t in data.handlers) Object.prototype.hasOwnProperty.call(data.handlers || {}, t) && removeType(elem, t); 1717 } 1718 } 1719 } 1720 function trigger(elem, event, hash) { 1721 var elemData = hasData(elem) ? getData(elem) : {}, parent = elem.parentNode || elem.ownerDocument; 1722 if ("string" == typeof event && (event = { 1723 type: event, 1724 target: elem 1725 }), event = fixEvent(event), elemData.dispatcher && elemData.dispatcher.call(elem, event, hash), 1726 parent && !event.isPropagationStopped() && !0 === event.bubbles) trigger.call(null, parent, event, hash); else if (!parent && !event.defaultPrevented) { 1727 var targetData = getData(event.target); 1728 event.target[event.type] && (targetData.disabled = !0, "function" == typeof event.target[event.type] && event.target[event.type](), 1729 targetData.disabled = !1); 1730 } 1731 return !event.defaultPrevented; 1732 } 1733 function one(elem, type, fn) { 1734 if (Array.isArray(type)) return _handleMultipleEvents(one, elem, type, fn); 1735 var func = function func() { 1736 off(elem, type, func), fn.apply(this, arguments); 1737 }; 1738 func.guid = fn.guid = fn.guid || newGUID(), on(elem, type, func); 1739 } 1740 var Events = (Object.freeze || Object)({
1741 fixEvent: fixEvent, 1742 on: on, 1743 off: off, 1744 trigger: trigger, 1745 one: one 1746 }), _windowLoaded = !1, videojs$2 = void 0, autoSetup = function() { 1747 if (isReal()) { 1748 var vids = document_1.getElementsByTagName("video"), audios = document_1.getElementsByTagName("audio"), divs = document_1.getElementsByTagName("video-js"), mediaEls = []; 1749 if (vids && 0 < vids.length) for (var i = 0, e = vids.length; i < e; i++) mediaEls.push(vids[i]); 1750 if (audios && 0 < audios.length) for (var _i = 0, _e = audios.length; _i < _e; _i++) mediaEls.push(audios[_i]); 1751 if (divs && 0 < divs.length) for (var _i2 = 0, _e2 = divs.length; _i2 < _e2; _i2++) mediaEls.push(divs[_i2]); 1752 if (mediaEls && 0 < mediaEls.length) for (var _i3 = 0, _e3 = mediaEls.length; _i3 < _e3; _i3++) { 1753 var mediaEl = mediaEls[_i3]; 1754 if (!mediaEl || !mediaEl.getAttribute) { 1755 autoSetupTimeout(1); 1756 break; 1757 } 1758 void 0 === mediaEl.player && null !== mediaEl.getAttribute("data-setup") && videojs$2(mediaEl); 1759 } else _windowLoaded || autoSetupTimeout(1); 1760 } 1761 }; 1762 function autoSetupTimeout(wait, vjs) { 1763 vjs && (videojs$2 = vjs), window_1.setTimeout(autoSetup, wait); 1764 } 1765 isReal() && "complete" === document_1.readyState ? _windowLoaded = !0 : one(window_1, "load", function() { 1766 _windowLoaded = !0; 1767 }); 1768 var createStyleElement = function(className) { 1769 var style = document_1.createElement("style"); 1770 return style.className = className, style; 1771 }, setTextContent = function(el, content) { 1772 el.styleSheet ? el.styleSheet.cssText = content : el.textContent = content; 1773 }, bind = function(context, fn, uid) { 1774 fn.guid || (fn.guid = newGUID()); 1775 var bound = function() { 1776 return fn.apply(context, arguments); 1777 }; 1778 return bound.guid = uid ? uid + "_" + fn.guid : fn.guid, bound; 1779 }, throttle = function(fn, wait) { 1780 var last = Date.now(); 1781 return function() { 1782 var now = Date.now(); 1783 wait <= now - last && (fn.apply(void 0, arguments), last = now); 1784 }; 1785 }, debounce = function(func, wait, immediate) { 1786 var context = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : window_1, timeout = void 0; 1787 return function() { 1788 var self = this, args = arguments, _later = function() { 1789 _later = timeout = null, immediate || func.apply(self, args); 1790 }; 1791 !timeout && immediate && func.apply(self, args), context.clearTimeout(timeout), 1792 timeout = context.setTimeout(_later, wait); 1793 }; 1794 }, EventTarget = function() {}; 1795 EventTarget.prototype.allowedEvents_ = {}, EventTarget.prototype.addEventListener = EventTarget.prototype.on = function(type, fn) { 1796 var ael = this.addEventListener; 1797 this.addEventListener = function() {}, on(this, type, fn), this.addEventListener = ael; 1798 }, EventTarget.prototype.removeEventListener = EventTarget.prototype.off = function(type, fn) { 1799 off(this, type, fn); 1800 }, EventTarget.prototype.one = function(type, fn) { 1801 var ael = this.addEventListener; 1802 this.addEventListener = function() {}, one(this, type, fn), this.addEventListener = ael; 1803 }, EventTarget.prototype.dispatchEvent = EventTarget.prototype.trigger = function(event) { 1804 var type = event.type || event; 1805 "string" == typeof event && (event = { 1806 type: type 1807 }), event = fixEvent(event), this.allowedEvents_[type] && this["on" + type] && this["on" + type](event), 1808 trigger(this, event); 1809 }; 1810 var isEvented = function(object) { 1811 return object instanceof EventTarget || !!object.eventBusEl_ && [ "on", "one", "off", "trigger" ].every(function(k) { 1812 return "function" == typeof object[k]; 1813 }); 1814 }, isValidEventType = function(type) { 1815 return "string" == typeof type && /\S/.test(type) || Array.isArray(type) && !!type.length; 1816 }, validateTarget = function(target) { 1817 if (!target.nodeName && !isEvented(target)) throw new Error("Invalid target; must be a DOM node or evented object."); 1818 }, validateEventType = function(type) { 1819 if (!isValidEventType(type)) throw new Error("Invalid event type; must be a non-empty string or array."); 1820 }, validateListener = function(listener) { 1821 if ("function" != typeof listener) throw new Error("Invalid listener; must be a function."); 1822 }, normalizeListenArgs = function(self, args) { 1823 var isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_, target = void 0, type = void 0, listener = void 0; 1824 return isTargetingSelf ? (target = self.eventBusEl_, 3 <= args.length && args.shift(), 1825 type = args[0], listener = args[1]) : (target = args[0], type = args[1], listener = args[2]), 1826 validateTarget(target), validateEventType(type), validateListener(listener), { 1827 isTargetingSelf: isTargetingSelf, 1828 target: target, 1829 type: type, 1830 listener: listener = bind(self, listener) 1831 }; 1832 }, listen = function(target, method, type, listener) { 1833 validateTarget(target), target.nodeName ? Events[method](target, type, listener) : target[method](type, listener); 1834 }, EventedMixin = { 1835 on: function() { 1836 for (var _this = this, _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; 1837 var _normalizeListenArgs = normalizeListenArgs(this, args), isTargetingSelf = _normalizeListenArgs.isTargetingSelf, target = _normalizeListenArgs.target, type = _normalizeListenArgs.type, listener = _normalizeListenArgs.listener; 1838 if (listen(target, "on", type, listener), !isTargetingSelf) { 1839 var removeListenerOnDispose = function() { 1840 return _this.off(target, type, listener); 1841 }; 1842 removeListenerOnDispose.guid = listener.guid; 1843 var removeRemoverOnTargetDispose = function() { 1844 return _this.off("dispose", removeListenerOnDispose); 1845 }; 1846 removeRemoverOnTargetDispose.guid = listener.guid, listen(this, "on", "dis
1846pose", removeListenerOnDispose), 1847 listen(target, "on", "dispose", removeRemoverOnTargetDispose); 1848 } 1849 }, 1850 one: function() { 1851 for (var _this2 = this, _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2]; 1852 var _normalizeListenArgs2 = normalizeListenArgs(this, args), isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, target = _normalizeListenArgs2.target, type = _normalizeListenArgs2.type, listener = _normalizeListenArgs2.listener; 1853 if (isTargetingSelf) listen(target, "one", type, listener); else { 1854 var wrapper = function wrapper() { 1855 for (var _len3 = arguments.length, largs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) largs[_key3] = arguments[_key3]; 1856 _this2.off(target, type, wrapper), listener.apply(null, largs); 1857 }; 1858 wrapper.guid = listener.guid, listen(target, "one", type, wrapper); 1859 } 1860 }, 1861 off: function(targetOrType, typeOrListener, listener) { 1862 if (!targetOrType || isValidEventType(targetOrType)) off(this.eventBusEl_, targetOrType, typeOrListener); else { 1863 var target = targetOrType, type = typeOrListener; 1864 validateTarget(target), validateEventType(type), validateListener(listener), listener = bind(this, listener), 1865 this.off("dispose", listener), target.nodeName ? (off(target, type, listener), off(target, "dispose", listener)) : isEvented(target) && (target.off(type, listener), 1866 target.off("dispose", listener)); 1867 } 1868 }, 1869 trigger: function(event, hash) { 1870 return trigger(this.eventBusEl_, event, hash); 1871 } 1872 }; 1873 function evented(target) { 1874 var eventBusKey = (1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}).eventBusKey; 1875 if (eventBusKey) { 1876 if (!target[eventBusKey].nodeName) throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.'); 1877 target.eventBusEl_ = target[eventBusKey]; 1878 } else target.eventBusEl_ = createEl("span", { 1879 className: "vjs-event-bus" 1880 }); 1881 return assign(target, EventedMixin), target.on("dispose", function() { 1882 target.off(), window_1.setTimeout(function() { 1883 target.eventBusEl_ = null; 1884 }, 0); 1885 }), target; 1886 } 1887 var StatefulMixin = { 1888 state: {}, 1889 setState: function(stateUpdates) { 1890 var _this = this; 1891 "function" == typeof stateUpdates && (stateUpdates = stateUpdates()); 1892 var changes = void 0; 1893 return each(stateUpdates, function(value, key) { 1894 _this.state[key] !== value && ((changes = changes || {})[key] = { 1895 from: _this.state[key], 1896 to: value 1897 }), _this.state[key] = value; 1898 }), changes && isEvented(this) && this.trigger({ 1899 changes: changes, 1900 type: "statechanged" 1901 }), changes; 1902 } 1903 }; 1904 function stateful(target, defaultState) { 1905 return assign(target, StatefulMixin), target.state = assign({}, target.state, defaultState), 1906 "function" == typeof target.handleStateChanged && isEvented(target) && target.on("statechanged", target.handleStateChanged), 1907 target; 1908 } 1909 function toTitleCase(string) { 1910 return "string" != typeof string ? string : string.charAt(0).toUpperCase() + string.slice(1); 1911 } 1912 function mergeOptions() { 1913 for (var result = {}, _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) sources[_key] = arguments[_key]; 1914 return sources.forEach(function(source) { 1915 source && each(source, function(value, key) { 1916 isPlain(value) ? (isPlain(result[key]) || (result[key] = {}), result[key] = mergeOptions(result[key], value)) : result[key] = value; 1917 }); 1918 }), result; 1919 } 1920 var Component = function() { 1921 function Component(player, options, ready) { 1922 if (classCallCheck(this, Component), !player && this.play ? this.player_ = player = this : this.player_ = player, 1923 this.options_ = mergeOptions({}, this.options_), options = this.options_ = mergeOptions(this.options_, options), 1924 this.id_ = options.id || options.el && options.el.id, !this.id_) { 1925 var id = player && player.id && player.id() || "n
1925o_player"; 1926 this.id_ = id + "_component_" + newGUID(); 1927 } 1928 this.name_ = options.name || null, options.el ? this.el_ = options.el : !1 !== options.createEl && (this.el_ = this.createEl()), 1929 !1 !== options.evented && evented(this, { 1930 eventBusKey: this.el_ ? "el_" : null 1931 }), stateful(this, this.constructor.defaultState), this.children_ = [], this.childIndex_ = {}, 1932 !(this.childNameIndex_ = {}) !== options.initChildren && this.initChildren(), this.ready(ready), 1933 !1 !== options.reportTouchActivity && this.enableTouchActivity(); 1934 } 1935 return Component.prototype.dispose = function() { 1936 if (this.trigger({ 1937 type: "dispose", 1938 bubbles: !1 1939 }), this.children_) for (var i = this.children_.length - 1; 0 <= i; i--) this.children_[i].dispose && this.children_[i].dispose(); 1940 this.children_ = null, this.childIndex_ = null, this.childNameIndex_ = null, this.el_ && (this.el_.parentNode && this.el_.parentNode.removeChild(this.el_), 1941 removeData(this.el_), this.el_ = null), this.player_ = null; 1942 }, Component.prototype.player = function() { 1943 return this.player_; 1944 }, Component.prototype.options = function(obj) { 1945 return log$1.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"), 1946 obj && (this.options_ = mergeOptions(this.options_, obj)), this.options_; 1947 }, Component.prototype.el = function() { 1948 return this.el_; 1949 }, Component.prototype.createEl = function(tagName, properties, attributes) { 1950 return createEl(tagName, properties, attributes); 1951 }, Component.prototype.localize = function(string, tokens) { 1952 var defaultValue = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : string, code = this.player_.language && this.player_.language(), languages = this.player_.languages && this.player_.languages(), language = languages && languages[code], primaryCode = code && code.split("-")[0], primaryLang = languages && languages[primaryCode], localizedString = defaultValue; 1953 return language && language[string] ? localizedString = language[string] : primaryLang && primaryLang[string] && (localizedString = primaryLang[string]), 1954 tokens && (localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index) { 1955 var value = tokens[index - 1], ret = value; 1956 return void 0 === value && (ret = match), ret; 1957 })), localizedString; 1958 }, Component.prototype.contentEl = function() { 1959 return this.contentEl_ || this.el_; 1960 }, Component.prototype.id = function() { 1961 return this.id_; 1962 }, Component.prototype.name = function() { 1963 return this.name_; 1964 }, Component.prototype.children = function() { 1965 return this.children_; 1966 }, Component.prototype.getChildById = function(id) { 1967 return this.childIndex_[id]; 1968 }, Component.prototype.getChild = function(name) { 1969 if (name) return name = toTitleCase(name), this.childNameIndex_[name]; 1970 }, Component.prototype.addChild = function(child) { 1971 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, index = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : this.children_.length, component = void 0, componentName = void 0; 1972 if ("string" == typeof child) { 1973 componentName = toTitleCase(child); 1974 var componentClassName = options.componentClass || componentName; 1975 options.name = componentName; 1976 var ComponentClass = Component.getComponent(componentClassName); 1977 if (!ComponentClass) throw new Error("Component " + componentClassName + " does not exist"); 1978 if ("function" != typeof ComponentClass) return null; 1979 component = new ComponentClass(this.player_ || this, options); 1980 } else component = child; 1981 if (this.children_.splice(index, 0, component), "function" == typeof component.id && (this.childIndex_[component.id()] = component), 1982 (componentName = componentName || component.name && toTitleCase(component.name())) && (this.childNameIndex_[componentName] = component), 1983 "function" == typeof component.el && component.el()) {
vendor: 2,145 bytes, lines 1984-2018
1984 var refNode = this.contentEl().children[index] || null; 1985 this.contentEl().insertBefore(component.el(), refNode); 1986 } 1987 return component; 1988 }, Component.prototype.removeChild = function(component) { 1989 if ("string" == typeof component && (component = this.getChild(component)), component && this.children_) { 1990 for (var childFound = !1, i = this.children_.length - 1; 0 <= i; i--) if (this.children_[i] === component) { 1991 childFound = !0, this.children_.splice(i, 1); 1992 break; 1993 } 1994 if (childFound) { 1995 this.childIndex_[component.id()] = null, this.childNameIndex_[component.name()] = null; 1996 var compEl = component.el(); 1997 compEl && compEl.parentNode === this.contentEl() && this.contentEl().removeChild(component.el()); 1998 } 1999 } 2000 }, Component.prototype.initChildren = function() { 2001 var _this = this, children = this.options_.children; 2002 if (children) { 2003 var parentOptions = this.options_, workingChildren = void 0, Tech = Component.getComponent("Tech"); 2004 (workingChildren = Array.isArray(children) ? children : Object.keys(children)).concat(Object.keys(this.options_).filter(function(child) { 2005 return !workingChildren.some(function(wchild) { 2006 return "string" == typeof wchild ? child === wchild : child === wchild.name; 2007 }); 2008 })).map(function(child) { 2009 var name = void 0, opts = void 0; 2010 return "string" == typeof child ? opts = children[name = child] || _this.options_[name] || {} : (name = child.name, 2011 opts = child), { 2012 name: name, 2013 opts: opts 2014 }; 2015 }).filter(function(child) { 2016 var c = Component.getComponent(child.opts.componentClass || toTitleCase(child.name)); 2017 return c && !Tech.isTech(c); 2018 }
2018).forEach(function(child) { 2019 var name = child.name, opts = child.opts; 2020 if (void 0 !== parentOptions[name] && (opts = parentOptions[name]), !1 !== opts) { 2021 !0 === opts && (opts = {}), opts.playerOptions = _this.options_.playerOptions; 2022 var newChild = _this.addChild(name, opts); 2023 newChild && (_this[name] = newChild); 2024 } 2025 }); 2026 } 2027 }, Component.prototype.buildCSSClass = function() { 2028 return ""; 2029 }, Component.prototype.ready = function(fn) { 2030 var sync = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; 2031 if (fn) return this.isReady_ ? void (sync ? fn.call(this) : this.setTimeout(fn, 1)) : (this.readyQueue_ = this.readyQueue_ || [], 2032 void this.readyQueue_.push(fn)); 2033 }, Component.prototype.triggerReady = function() { 2034 this.isReady_ = !0, this.setTimeout(function() { 2035 var readyQueue = this.readyQueue_; 2036 this.readyQueue_ = [], readyQueue && 0 < readyQueue.length && readyQueue.forEach(function(fn) { 2037 fn.call(this); 2038 }, this), this.trigger("ready"); 2039 }, 1); 2040 }, Component.prototype.$ = function(selector, context) { 2041 return $(selector, context || this.contentEl()); 2042 }, Component.prototype.$$ = function(selector, context) { 2043 return $$(selector, context || this.contentEl()); 2044 }, Component.prototype.hasClass = function(classToCheck) { 2045 return hasClass(this.el_, classToCheck); 2046 }, Component.prototype.addClass = function(classToAdd) { 2047 addClass(this.el_, classToAdd); 2048 }, Component.prototype.removeClass = function(classToRemove) { 2049 removeClass(this.el_, classToRemove); 2050 }, Component.prototype.toggleClass = function(classToToggle, predicate) { 2051 toggleClass(this.el_, classToToggle, predicate); 2052 }, Component.prototype.show = function() { 2053 this.removeClass("vjs-hidden"); 2054 }, Component.prototype.hide = function() { 2055 this.addClass("vjs-hidden"); 2056 }, Component.prototype.lockShowing = function() { 2057 this.addClass("vjs-lock-showing"); 2058 }, Component.prototype.unlockShowing = function() { 2059 this.removeClass("vjs-lock-showing"); 2060 }, Component.prototype.getAttribute = function(attribute) { 2061 return getAttribute(this.el_, attribute); 2062 }, Component.prototype.setAttribute = function(attribute, value) { 2063 setAttribute(this.el_, attribute, value); 2064 }, Component.prototype.removeAttribute = function(attribute) { 2065 removeAttribute(this.el_, attribute); 2066 }, Component.prototype.width = function(num, skipListeners) { 2067 return this.dimension("width", num, skipListeners); 2068 }, Component.prototype.height = function(num, skipListeners) { 2069 return this.dimension("height", num, skipListeners); 2070 }, Component.prototype.dimensions = function(width, height) { 2071 this.width(width, !0), this.height(height); 2072 }, Component.prototype.dimension = function(widthOrHeight, num, skipListeners) { 2073 if (void 0 !== num) return null !== num && num == num || (num = 0), -1 !== ("" + num).indexOf("%") || -1 !== ("" + num).indexOf("px") ? this.el_.style[widthOrHeight] = num : this.el_.style[widthOrHeight] = "auto" === num ? "" : num + "px", 2074 void (skipListeners || this.trigger("componentresize")); 2075 if (!this.el_) return 0; 2076 var val = this.el_.style[widthOrHeight], pxIndex = val.indexOf("px"); 2077 return -1 !== pxIndex ? parseInt(val.slice(0, pxIndex), 10) : parseInt(this.el_["offset" + toTitleCase(widthOrHeight)], 10); 2078 }, Component.prototype.currentDimension = function(widthOrHeight) { 2079 var computedWidthOrHeight = 0; 2080 if ("width" !== widthOrHeight && "height" !== widthOrHeight) throw new Error("currentDimension only accepts width or height value"); 2081 if ("function" == typeof window_1.getComputedStyle) { 2082 var computedStyle = window_1.getComputedStyle(this.el_); 2083 computedWidthOrHeight = computedStyle.getPropertyValue(widthOrHeight) || computedStyle[widthOrHeight]; 2084 } 2085 if (0 === (computedWidthOrHeight = parseFloat(computedWidthOrHeight))) { 2086 var rule = "offset" + toTitleCase(widthOrHeight); 2087 computedWidthOrHeight = this.el_[rule]; 2088 } 2089 return computedWidthOrHeight; 2090 }, Component.prototype.currentDimensions = function() { 2091 return { 2092 width: this.currentDimension("width"), 2093 height: this.currentDimension("height") 2094 }; 2095 }, Component.prototype.currentWidth = function() { 2096 return this.currentDimension("width"); 2097 }, Component.prototype.currentHeight = function() { 2098 return this.currentDimension("height"); 2099 }
2099, Component.prototype.focus = function() { 2100 this.el_.focus(); 2101 }, Component.prototype.blur = function() { 2102 this.el_.blur(); 2103 }, Component.prototype.emitTapEvents = function() { 2104 var touchStart = 0, firstTouch = null, couldBeTap = void 0; 2105 this.on("touchstart", function(event) { 2106 1 === event.touches.length && (firstTouch = { 2107 pageX: event.touches[0].pageX, 2108 pageY: event.touches[0].pageY 2109 }, touchStart = new Date().getTime(), couldBeTap = !0); 2110 }), this.on("touchmove", function(event) { 2111 if (1 < event.touches.length) couldBeTap = !1; else if (firstTouch) { 2112 var xdiff = event.touches[0].pageX - firstTouch.pageX, ydiff = event.touches[0].pageY - firstTouch.pageY; 2113 10 < Math.sqrt(xdiff * xdiff + ydiff * ydiff) && (couldBeTap = !1); 2114 } 2115 }); 2116 var noTap = function() { 2117 couldBeTap = !1; 2118 }; 2119 this.on("touchleave", noTap), this.on("touchcancel", noTap), this.on("touchend", function(event) { 2120 !(firstTouch = null) === couldBeTap && (new Date().getTime() - touchStart < 200 && (event.preventDefault(), 2121 this.trigger("tap"))); 2122 }); 2123 }, Component.prototype.enableTouchActivity = function() { 2124 if (this.player() && this.player().reportUserActivity) { 2125 var report = bind(this.player(), this.player().reportUserActivity), touchHolding = void 0; 2126 this.on("touchstart", function() { 2127 report(), this.clearInterval(touchHolding), touchHolding = this.setInterval(report, 250); 2128 }); 2129 var touchEnd = function(event) { 2130 report(), this.clearInterval(touchHolding); 2131 }; 2132 this.on("touchmove", report), this.on("touchend", touchEnd), this.on("touchcancel", touchEnd); 2133 } 2134 }, Component.prototype.setTimeout = function(fn, timeout) { 2135 var _this2 = this; 2136 fn = bind(this, fn); 2137 var timeoutId = window_1.setTimeout(fn, timeout), disposeFn = function() { 2138 return _this2.clearTimeout(timeoutId); 2139 }; 2140 return disposeFn.guid = "vjs-timeout-" + timeoutId, this.on("dispose", disposeFn), 2141 timeoutId; 2142 }, Component.prototype.clearTimeout = function(timeoutId) { 2143 window_1.clearTimeout(timeoutId); 2144 var disposeFn = function() {}; 2145 return disposeFn.guid = "vjs-timeout-" + timeoutId, this.off("dispose", disposeFn), 2146 timeoutId; 2147 }, Component.prototype.setInterval = function(fn, interval) { 2148 var _this3 = this; 2149 fn = bind(this, fn); 2150 var intervalId = window_1.setInterval(fn, interval), disposeFn = function() { 2151 return _this3.clearInterval(intervalId); 2152 }; 2153 return disposeFn.guid = "vjs-interval-" + intervalId, this.on("dispose", disposeFn), 2154 intervalId; 2155 }, Component.prototype.clearInterval = function(intervalId) { 2156 window_1.clearInterval(intervalId); 2157 var disposeFn = function() {}; 2158 return disposeFn.guid = "vjs-interval-" + intervalId, this.off("dispose", disposeFn), 2159 intervalId; 2160 }, Component.prototype.requestAnimationFrame = function(fn) { 2161 var _this4 = this; 2162 if (this.supportsRaf_) { 2163 fn = bind(this, fn); 2164 var id = window_1.requestAnimationFrame(fn), disposeFn = function() { 2165 return _this4.cancelAnimationFrame(id); 2166 }; 2167 return disposeFn.guid = "vjs-raf-" + id, this.on("dispose", disposeFn), id; 2168 } 2169 return this.setTimeout(fn, 1e3 / 60); 2170 }, Component.prototype.cancelAnimationFrame = function(id) { 2171 if (this.supportsRaf_) { 2172 window_1.cancelAnimationFrame(id); 2173 var disposeFn = function() {};
2174 return disposeFn.guid = "vjs-raf-" + id, this.off("dispose", disposeFn), id; 2175 } 2176 return this.clearTimeout(id); 2177 }, Component.registerComponent = function(name, ComponentToRegister) { 2178 if ("string" != typeof name || !name) throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.'); 2179 var Tech = Component.getComponent("Tech"), isTech = Tech && Tech.isTech(ComponentToRegister), isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype); 2180 if (isTech || !isComp) { 2181 var reason = void 0; 2182 throw reason = isTech ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass", 2183 new Error('Illegal component, "' + name + '"; ' + reason + "."); 2184 } 2185 name = toTitleCase(name), Component.components_ || (Component.components_ = {}); 2186 var Player = Component.getComponent("Player"); 2187 if ("Player" === name && Player && Player.players) { 2188 var players = Player.players, playerNames = Object.keys(players); 2189 if (players && 0 < playerNames.length && playerNames.map(function(pname) { 2190 return players[pname]; 2191 }).every(Boolean)) throw new Error("Can not register Player component after player has been created."); 2192 } 2193 return Component.components_[name] = ComponentToRegister; 2194 }, Component.getComponent = function(name) { 2195 if (name) return name = toTitleCase(name), Component.components_ && Component.components_[name] ? Component.components_[name] : void 0; 2196 }, Component; 2197 }(); 2198 function getRange(fnName, valueIndex, ranges, rangeIndex) { 2199 return function(fnName, index, maxIndex) { 2200 if ("number" != typeof index || index < 0 || maxIndex < index) throw new Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index + ") is non-numeric or out of bounds (0-" + maxIndex + ")."); 2201 }(fnName, rangeIndex, ranges.length - 1), ranges[rangeIndex][valueIndex]; 2202 } 2203 function createTimeRangesObj(ranges) { 2204 return void 0 === ranges || 0 === ranges.length ? { 2205 length: 0, 2206 start: function() { 2207 throw new Error("This TimeRanges object is empty"); 2208 }, 2209 end: function() { 2210 throw new Error("This TimeRanges object is empty"); 2211 } 2212 } : { 2213 length: ranges.length, 2214 start: getRange.bind(null, "start", 0, ranges), 2215 end: getRange.bind(null, "end", 1, ranges) 2216 }; 2217 } 2218 function createTimeRanges(start, end) { 2219 return Array.isArray(start) ? createTimeRangesObj(start) : void 0 === start || void 0 === end ? createTimeRangesObj() : createTimeRangesObj([ [ start, end ] ]); 2220 } 2221 function bufferedPercent(buffered, duration) { 2222 var bufferedDuration = 0, start = void 0, end = void 0; 2223 if (!duration) return 0; 2224 buffered && buffered.length || (buffered = createTimeRanges(0, 0)); 2225 for (var i = 0; i < buffered.length; i++) start = buffered.start(i), duration < (end = buffered.end(i)) && (end = duration), 2226 bufferedDuration += end - start; 2227 return bufferedDuration / duration; 2228 } 2229 Component.prototype.supportsRaf_ = "function" == typeof window_1.requestAnimationFrame && "function" == typeof window_1.cancelAnimationFrame, 2230 Component.registerComponent("Component", Component); 2231 for (var FullscreenApi = {}, apiMap = [ [ "requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror" ], [ "webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror" ], [ "webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror" ], [ "mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror" ], [ "msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError" ] ], specApi = apiMap[0], browserApi = void 0, i = 0; i < apiMap.length; i++) if (apiMap[i][1] in document_1) { 2232 browserApi = apiMap[i]; 2233 break; 2234 } 2235 if (browserApi) for (var _i = 0; _i < browserApi.length; _i++) FullscreenApi[specApi[_i]] = browserApi[_i]; 2236 function MediaError(value) { 2237 if (value instanceof MediaError) return value; 2238 "number" == typeof value ? this.code = value : "string" == typeof value ? this.message = value : isObject(value) && ("number" == typeof value.code && (this.code = value.code), 2239 assign(this, value)), this.message || (this.message = MediaError.defaultMessages[this.code] || ""); 2240 } 2241 MediaError.prototype.code = 0, MediaError.prototype.message = "", MediaError.prototype.status = null, 2242 MediaError.errorTypes = [ "MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED" ], 2243 MediaError.defaultMessages = { 2244 1: "You aborted the media playback", 2245 2: "A network error caused the media download to fail part-way.", 2246 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.", 2247 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.", 2248 5: "The media is encrypted and we do not have the keys to decrypt it." 2249 }; 2250 for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) MediaError[MediaError.errorTypes[errNum]] = errNum, 2251 MediaError.prototype[MediaError.errorTypes[errNum]] = errNum; 2252 var tuple = function(obj, reviver) { 2253 var json, error = null; 2254 try { 2255 json = JSON.parse(obj, reviver); 2256 } catch (err) { 2257 error = err; 2258 } 2259 return [ error, json ]; 2260 }; 2261 function isPromise(value) { 2262 return null != value && "function" == typeof value.then; 2263 } 2264 function silencePromise(value) { 2265 isPromise(value) && value.then(null, function(e) {}); 2266 } 2267 var trackToJson_ = function(track) { 2268 return [ "kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src" ].reduce(function(acc, prop, i) { 2269 return track[prop] && (acc[prop] = track[prop]), acc; 2270 }, { 2271 cues: track.cues && Array.prototype.map.call(track.cues, function(cue) { 2272 return { 2273 startTime: cue.startTime, 2274 endTime: cue.endTime, 2275 text: cue.text, 2276 id: cue.id 2277 }; 2278 }) 2279 }); 2280 }, textTrackConverter_textTracksToJson = function(tech) { 2281 var trackEls = tech.$$("track"), trackObjs = Array.prototype.map.call(trackEls, function(t) { 2282 return t.track; 2283 }); 2284 return Array.prototype.map.call(trackEls, function(trackEl) { 2285 var json = trackToJson_(trackEl.track); 2286 return trackEl.src && (json.src = trackEl.src), json; 2287 }).concat(Array.prototype.filter.call(tech.textTracks(), function(track) { 2288 return -1 === trackObjs.indexOf(track); 2289 }).map(trackToJson_)); 2290 }, textTrackConverter_jsonToTextTracks = function(json, tech) { 2291 return json.forEach(function(track) { 2292 var addedTrack = tech.addRemoteTextTrack(track).track;
vendor: 4,449 bytes, lines 2293-2358
2293 !track.src && track.cues && track.cues.forEach(function(cue) { 2294 return addedTrack.addCue(cue); 2295 }); 2296 }), tech.textTracks(); 2297 }, MODAL_CLASS_NAME = "vjs-modal-dialog", ModalDialog = function(_Component) { 2298 function ModalDialog(player, options) { 2299 classCallCheck(this, ModalDialog); 2300 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 2301 return _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = !1, _this.closeable(!_this.options_.uncloseable), 2302 _this.content(_this.options_.content), _this.contentEl_ = createEl("div", { 2303 className: MODAL_CLASS_NAME + "-content" 2304 }, { 2305 role: "document" 2306 }), _this.descEl_ = createEl("p", { 2307 className: MODAL_CLASS_NAME + "-description vjs-control-text", 2308 id: _this.el().getAttribute("aria-describedby") 2309 }), textContent(_this.descEl_, _this.description()), _this.el_.appendChild(_this.descEl_), 2310 _this.el_.appendChild(_this.contentEl_), _this; 2311 } 2312 return inherits(ModalDialog, _Component), ModalDialog.prototype.createEl = function() { 2313 return _Component.prototype.createEl.call(this, "div", { 2314 className: this.buildCSSClass(), 2315 tabIndex: -1 2316 }, { 2317 "aria-describedby": this.id() + "_description", 2318 "aria-hidden": "true", 2319 "aria-label": this.label(), 2320 role: "dialog" 2321 }); 2322 }, ModalDialog.prototype.dispose = function() { 2323 this.contentEl_ = null, this.descEl_ = null, this.previouslyActiveEl_ = null, _Component.prototype.dispose.call(this); 2324 }, ModalDialog.prototype.buildCSSClass = function() { 2325 return MODAL_CLASS_NAME + " vjs-hidden " + _Component.prototype.buildCSSClass.call(this); 2326 }, ModalDialog.prototype.handleKeyPress = function(e) { 2327 27 === e.which && this.closeable() && this.close(); 2328 }, ModalDialog.prototype.label = function() { 2329 return this.localize(this.options_.label || "Modal Window"); 2330 }, ModalDialog.prototype.description = function() { 2331 var desc = this.options_.description || this.localize("This is a modal window."); 2332 return this.closeable() && (desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.")), 2333 desc; 2334 }, ModalDialog.prototype.open = function() { 2335 if (!this.opened_) { 2336 var player = this.player(); 2337 this.trigger("beforemodalopen"), this.opened_ = !0, (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) && this.fill(), 2338 this.wasPlaying_ = !player.paused(), this.options_.pauseOnOpen && this.wasPlaying_ && player.pause(), 2339 this.closeable() && this.on(this.el_.ownerDocument, "keydown", bind(this, this.handleKeyPress)), 2340 this.hadControls_ = player.controls(), player.controls(!1), this.show(), this.conditionalFocus_(), 2341 this.el().setAttribute("aria-hidden", "false"), this.trigger("modalopen"), this.hasBeenOpened_ = !0; 2342 } 2343 }, ModalDialog.prototype.opened = function(value) { 2344 return "boolean" == typeof value && this[value ? "open" : "close"](), this.opened_; 2345 }, ModalDialog.prototype.close = function() { 2346 if (this.opened_) { 2347 var player = this.player(); 2348 this.trigger("beforemodalclose"), this.opened_ = !1, this.wasPlaying_ && this.options_.pauseOnOpen && player.play(), 2349 this.closeable() && this.off(this.el_.ownerDocument, "keydown", bind(this, this.handleKeyPress)), 2350 this.hadControls_ && player.controls(!0), this.hide(), this.el().setAttribute("aria-hidden", "true"), 2351 this.trigger("modalclose"), this.conditionalBlur_(), this.options_.temporary && this.dispose(); 2352 } 2353 }, ModalDialog.prototype.closeable = function(value) { 2354 if ("boolean" == typeof value) { 2355 var closeable = this.closeable_ = !!value, close = this.getChild("closeButton"); 2356 if (closeable && !close) { 2357 var temp = this.contentEl_; 2358 this.contentEl_ = this.el_, close = this.addChild("closeButton", {
2359 controlText: "Close Modal Dialog" 2360 }), this.contentEl_ = temp, this.on(close, "close", this.close); 2361 } 2362 !closeable && close && (this.off(close, "close", this.close), this.removeChild(close), 2363 close.dispose()); 2364 } 2365 return this.closeable_; 2366 }, ModalDialog.prototype.fill = function() { 2367 this.fillWith(this.content()); 2368 }, ModalDialog.prototype.fillWith = function(content) { 2369 var contentEl = this.contentEl(), parentEl = contentEl.parentNode, nextSiblingEl = contentEl.nextSibling; 2370 this.trigger("beforemodalfill"), this.hasBeenFilled_ = !0, parentEl.removeChild(contentEl), 2371 this.empty(), insertContent(contentEl, content), this.trigger("modalfill"), nextSiblingEl ? parentEl.insertBefore(contentEl, nextSiblingEl) : parentEl.appendChild(contentEl); 2372 var closeButton = this.getChild("closeButton"); 2373 closeButton && parentEl.appendChild(closeButton.el_); 2374 }, ModalDialog.prototype.empty = function() { 2375 this.trigger("beforemodalempty"), emptyEl(this.contentEl()), this.trigger("modalempty"); 2376 }, ModalDialog.prototype.content = function(value) { 2377 return void 0 !== value && (this.content_ = value), this.content_; 2378 }, ModalDialog.prototype.conditionalFocus_ = function() { 2379 var activeEl = document_1.activeElement, playerEl = this.player_.el_; 2380 this.previouslyActiveEl_ = null, (playerEl.contains(activeEl) || playerEl === activeEl) && (this.previouslyActiveEl_ = activeEl, 2381 this.focus(), this.on(document_1, "keydown", this.handleKeyDown)); 2382 }, ModalDialog.prototype.conditionalBlur_ = function() { 2383 this.previouslyActiveEl_ && (this.previouslyActiveEl_.focus(), this.previouslyActiveEl_ = null), 2384 this.off(document_1, "keydown", this.handleKeyDown); 2385 }, ModalDialog.prototype.handleKeyDown = function(event) { 2386 if (9 === event.which) { 2387 for (var focusableEls = this.focusableEls_(), activeEl = this.el_.querySelector(":focus"), focusIndex = void 0, i = 0; i < focusableEls.length; i++) if (activeEl === focusableEls[i]) { 2388 focusIndex = i; 2389 break; 2390 } 2391 document_1.activeElement === this.el_ && (focusIndex = 0), event.shiftKey && 0 === focusIndex ? (focusableEls[focusableEls.length - 1].focus(), 2392 event.preventDefault()) : event.shiftKey || focusIndex !== focusableEls.length - 1 || (focusableEls[0].focus(), 2393 event.preventDefault()); 2394 } 2395 }, ModalDialog.prototype.focusableEls_ = function() { 2396 var allChildren = this.el_.querySelectorAll("*"); 2397 return Array.prototype.filter.call(allChildren, function(child) { 2398 return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute("href") || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute("disabled") || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute("tabindex") && -1 !== child.getAttribute("tabindex") || child.hasAttribute("contenteditable"); 2399 }); 2400 }, ModalDialog; 2401 }(Component); 2402 ModalDialog.prototype.options_ = { 2403 pauseOnOpen: !0, 2404 temporary: !0 2405 }, Component.registerComponent("ModalDialog", ModalDialog); 2406 var TrackList = function(_EventTarget) { 2407 function TrackList() { 2408 var tracks = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], list = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : null; 2409 classCallCheck(this, TrackList); 2410 var _this = possibleConstructorReturn(this, _EventTarget.call(this)); 2411 if (!list && (list = _this, IS_IE8)) for (var prop in list = document_1.createElement("custom"), 2412 TrackList.prototype) "constructor" !== prop && (list[prop] = TrackList.prototype[prop]); 2413 list.tracks_ = [], Object.defineProperty(list, "length", { 2414 get: function() { 2415 return this.tracks_.length; 2416 } 2417 }); 2418 for (var i = 0; i < tracks.length; i++) list.addTrack(tracks[i]); 2419 return possibleConstructorReturn(_this, list); 2420 } 2421 return inherits(TrackList, _EventTarget), TrackList.prototype.addTrack = function(track) { 2422 var index = this.tracks_.length; 2423 "" + index in this || Object.defineProperty(this, index, { 2424 get: function() { 2425 return this.tracks_[index]; 2426 } 2427 }), -1 === this.tracks_.indexOf(track) && (this.tracks_.push(track), this.trigger({ 2428 track: track, 2429 type: "addtrack" 2430 })); 2431 }, TrackList.prototype.removeTrack = function(rtrack) { 2432 for (var track = void 0, i = 0, l = this.length; i < l; i++) if (this[i] === rtrack) { 2433 (track = this[i]).off && track.off(), this.tracks_.splice(i, 1); 2434 break; 2435 } 2436 track && this.trigger({ 2437 track: track, 2438 type: "removetrack" 2439 }); 2440 }, TrackList.prototype.getTrackById = function(id) { 2441 for (var result = null, i = 0, l = this.length; i < l; i++) { 2442 var track = this[i]; 2443 if (track.id === id) { 2444 result = track; 2445 break; 2446 } 2447 } 2448 return result; 2449 }, TrackList; 2450 }(EventTarget); 2451 for (var event in TrackList.prototype.allowedEvents_ = { 2452 change: "change", 2453 addtrack: "addtrack", 2454 removetrack: "removetrack" 2455 }, TrackList.prototype.allowedEvents_) TrackList.prototype["on" + event] = null; 2456 var disableOthers = function(list, track) { 2457 for (var i = 0; i < list.length; i++) Object.keys(list[i]).length && track.id !== list[i].id && (list[i].enabled = !1); 2458 }, AudioTrackList = function(_TrackList) { 2459 function AudioTrackList() { 2460 var _this, tracks = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; 2461 classCallCheck(this, AudioTrackList); 2462 for (var list = void 0, i = tracks.length - 1; 0 <= i; i--) if (tracks[i].enabled) { 2463 disableOthers(tracks, tracks[i]); 2464 break; 2465 } 2466 if (IS_IE8) { 2467 for (var prop in list = document_1.createElement("custom"), TrackList.prototype) "constructor" !== prop && (list[prop] = TrackList.prototype[prop]); 2468 for (var _prop in AudioTrackList.prototype) "constructor" !== _prop && (list[_prop] = AudioTrackList.prototype[_prop]); 2469 } 2470 return (list = _this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list))).changing_ = !1, 2471 possibleConstructorReturn(_this, list); 2472 } 2473 return inherits(AudioTrackList, _TrackList), AudioTrackList.prototype.addTrack = function(track) { 2474 var _this2 = this; 2475 track.enabled && disableOthers(this, track), _TrackList.prototype.addTrack.call(this, track), 2476 track.addEventListener && track.addEventListener("enabledchange", function() { 2477 _this2.changing_ || (_this2.changing_ = !0, disableOthers(_this2, track), _this2.changing_ = !1, 2478 _this2.trigger("change")); 2479 }); 2480 }, AudioTrackList; 2481 }(TrackList), disableOthers$1 = function(list, track) { 2482 for (var i = 0; i < list.length; i++) Object.keys(list[i]).length && track.id !== list[i].id && (list[i].selected = !1); 2483 }, VideoTrackList = function(_TrackList) { 2484 function VideoTrackList() { 2485 var _this, tracks = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; 2486 classCallCheck(this, VideoTrackList); 2487 for (var list = void 0, i = tracks.length - 1; 0 <= i; i--) if (tracks[i].selected) { 2488 disableOthers$1(tracks, tracks[i]); 2489 break; 2490 } 2491 if (IS_IE8) { 2492 for (var prop in list = document_1.createElement("custom"), TrackList.prototype) "constructor" !== prop && (list[prop] = TrackList.prototype[prop]); 2493 for (var _prop in VideoTrackList.prototype) "constructor" !== _prop && (list[_prop] = VideoTrackList.prototype[_prop]); 2494 } 2495 return (list = _this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list))).changing_ = !1, 2496 Object.defineProperty(list, "selectedIndex", { 2497 get: function() { 2498 for (var _i = 0; _i < this.length; _i++) if (this[_i].selected) return _i; 2499 return -1; 2500 }, 2501 set: function() {} 2502 }), possibleConstructorReturn(_this, list); 2503 } 2504 return inherits(VideoTrackList, _TrackList), VideoTrackList.prototype.addTrack = function(track) { 2505 var _this2 = this; 2506 track.selected && disableOthers$1(this, track), _TrackList.prototype.addTrack.call(this, track), 2507 track.addEventListener && track.addEventListener("selectedchange", function() { 2508 _this2.changing_ || (_this2.changing_ = !0, disableOthers$1(_this2, track), _this2.changing_ = !1, 2509 _this2.trigger("change")); 2510 }); 2511 }, VideoTrackList; 2512 }(TrackList), TextTrackList = function(_TrackList) { 2513 function TextTrackList() { 2514 var _this, tracks = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; 2515 classCallCheck(this, TextTrackList); 2516 var list = void 0; 2517 if (IS_IE8) { 2518 for (var prop in list = document_1.createElement("custom"), TrackList.prototype) "constructor" !== prop && (list[prop] = TrackList.prototype[prop]); 2519 for (var _prop in TextTrackList.prototype) "constructor" !== _prop && (list[_prop] = TextTrackList.prototype[_prop]); 2520 } 2521 return _this = possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), 2522 possibleConstructorReturn(list = _this, list); 2523 } 2524 return inherits(TextTrackList, _TrackList), TextTrackList.prototype.addTrack = function(track) { 2525 _TrackList.prototype.addTrack.call(this, track), track.addEventListener("modechange", bind(this, function() { 2526 this.trigger("change"); 2527 })); 2528 -1 === [ "metadata", "chapters" ].indexOf(track.kind) && track.addEventListener("modechange", bind(this, function() { 2529 this.trigger("selectedlanguagechange"); 2530 })); 2531 }, TextTrackList; 2532 }(TrackList), HtmlTrackElementList = function() { 2533 function HtmlTrackElementList() { 2534 var trackElements = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; 2535 classCallCheck(this, HtmlTrackElementList); 2536 var list = this; 2537 if (IS_IE8) for (var prop in list = document_1.createElement("custom"), HtmlTrackElementList.prototype) "constructor" !== prop && (list[prop] = HtmlTrackElementList.prototype[prop]); 2538 list.trackElements_ = [], Object.defineProperty(list, "length", { 2539 get: function() { 2540 return this.trackElements_.length; 2541 } 2542 }); 2543 for (var i = 0, length = trackElements.length; i < length; i++) list.addTrackElement_(trackElements[i]); 2544 if (IS_IE8) return list; 2545 } 2546 return HtmlTrackElementList.prototype.addTrackElement_ = function(trackElement) { 2547 var index = this.trackElements_.length; 2548 "" + index in this || Object.defineProperty(this, index, { 2549 get: function() { 2550 return this.trackElements_[index]; 2551 } 2552 }), -1 === this.trackElements_.indexOf(trackElement) && this.trackElements_.pu
2552sh(trackElement); 2553 }, HtmlTrackElementList.prototype.getTrackElementByTrack_ = function(track) { 2554 for (var trackElement_ = void 0, i = 0, length = this.trackElements_.length; i < length; i++) if (track === this.trackElements_[i].track) { 2555 trackElement_ = this.trackElements_[i]; 2556 break; 2557 } 2558 return trackElement_; 2559 }, HtmlTrackElementList.prototype.removeTrackElement_ = function(trackElement) { 2560 for (var i = 0, length = this.trackElements_.length; i < length; i++) if (trackElement === this.trackElements_[i]) { 2561 this.trackElements_.splice(i, 1); 2562 break; 2563 } 2564 }, HtmlTrackElementList; 2565 }(), TextTrackCueList = function() { 2566 function TextTrackCueList(cues) { 2567 classCallCheck(this, TextTrackCueList); 2568 var list = this; 2569 if (IS_IE8) for (var prop in list = document_1.createElement("custom"), TextTrackCueList.prototype) "constructor" !== prop && (list[prop] = TextTrackCueList.prototype[prop]); 2570 if (TextTrackCueList.prototype.setCues_.call(list, cues), Object.defineProperty(list, "length", { 2571 get: function() { 2572 return this.length_; 2573 } 2574 }), IS_IE8) return list; 2575 } 2576 return TextTrackCueList.prototype.setCues_ = function(cues) { 2577 var oldLength = this.length || 0, i = 0, l = cues.length; 2578 this.cues_ = cues, this.length_ = cues.length; 2579 var defineProp = function(index) { 2580 "" + index in this || Object.defineProperty(this, "" + index, { 2581 get: function() { 2582 return this.cues_[index]; 2583 } 2584 }); 2585 }; 2586 if (oldLength < l) for (i = oldLength; i < l; i++) defineProp.call(this, i); 2587 }, TextTrackCueList.prototype.getCueById = function(id) { 2588 for (var result = null, i = 0, l = this.length; i < l; i++) { 2589 var cue = this[i]; 2590 if (cue.id === id) { 2591 result = cue; 2592 break; 2593 } 2594 } 2595 return result; 2596 }, TextTrackCueList; 2597 }(), VideoTrackKind = { 2598 alternative: "alternative", 2599 captions: "captions", 2600 main: "main", 2601 sign: "sign", 2602 subtitles: "subtitles", 2603 commentary: "commentary" 2604 }, AudioTrackKind = { 2605 alternative: "alternative", 2606 descriptions: "descriptions", 2607 main: "main", 2608 "main-desc": "main-desc", 2609 translation: "translation", 2610 commentary: "commentary" 2611 }, TextTrackKind = { 2612 subtitles: "subtitles", 2613 captions: "captions", 2614 descriptions: "descriptions", 2615 chapters: "chapters", 2616 metadata: "metadata" 2617 }, TextTrackMode = { 2618 disabled: "disabled", 2619 hidden: "hidden", 2620 showing: "showing" 2621 }, Track = function(_EventTarget) { 2622 function Track() { 2623 var options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 2624 classCallCheck(this, Track); 2625 var _this = possibleConstructorReturn(this, _EventTarget.call(this)), track = _this; 2626 if (IS_IE8) for (var prop in track = document_1.createElement("custom"), Track.prototype) "constructor" !== prop && (track[prop] = Track.prototype[prop]); 2627 var trackProps = { 2628 id: options.id || "vjs_track_" + newGUID(), 2629 kind: options.kind || "", 2630 label: options.label || "", 2631 language: options.language || "" 2632 }, _loop = function(key) { 2633 Object.defineProperty(track, key, { 2634 get: function() { 2635 return trackProps[key]; 2636 }, 2637 set: function() {} 2638 }); 2639 }; 2640 for (var key in trackProps) _loop(key); 2641 return possibleConstructorReturn(_this, track); 2642 } 2643 return inherits(Track, _EventTarget), Track; 2644 }(EventTarget), parseUrl = function(url) { 2645 var props = [ "protocol", "hostname", "port", "pathname", "search", "hash", "host" ], a = document_1.createElement("a"); 2646 a.href = url; 2647 var addToBody = "" === a.host && "file:" !== a.protocol, div = void 0; 2648 addToBody && ((div = document_1.createElement("div")).innerHTML = '<a href="' + url + '"></a>', 2649 a = div.firstChild, div.setAttribute("style", "display:none; position:absolute;"), 2650 document_1.body.appendChild(div)); 2651 for (var details = {}, i = 0; i < props.length; i++) details[props[i]] = a[props[i]]; 2652 return "http:" === details.protocol && (details.host = details.host.replace(/:80$/, "")), 2653 "https:" === details.protocol && (details.host = details.host.replace(/:443$/, "")), 2654 details.protocol || (details.protocol = window_1.location.protocol), addToBody && document_1.body.removeChild(div), 2655 details; 2656 }, getFileExtension = function(path) { 2657 if ("string" == typeof path) { 2658 var pathParts = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(path); 2659 if (pathParts) return pathParts.pop().toLowerCase(); 2660 } 2661 return ""; 2662 }, isCrossOrigin = function(url) { 2663 var winLoc = window_1.location, urlInfo = parseUrl(url); 2664 return (":" === urlInfo.protocol ? winLoc.protocol : urlInfo.protocol) + urlInfo.host !== winLoc.protocol + winLoc.host; 2665 }, Url = (Object.freeze || Object)({ 2666 parseUrl: parseUrl, 2667 getAbsoluteURL: function(url) { 2668 if (!url.match(/^https?:\/\//)) { 2669 var div = document_1.createElement("div"); 2670 div.innerHTML = '<a href="' + url + '">x</a>', url = div.firstChild.href; 2671 } 2672 return url; 2673 }, 2674 getFileExtension: getFileExtension, 2675 isCrossOrigin: isCrossOrigin 2676 }), isFunction_1 = function(fn) { 2677 var string = toString$1.call(fn); 2678 return "[object Function]" === string || "function" == typeof fn && "[object RegExp]" !== string || "undefined" != typeof window && (fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt); 2679 }, toString$1 = Object.prototype.toString;
2680 var trim_1 = createCommonjsModule(function(module, exports) { 2681 (exports = module.exports = function(str) { 2682 return str.replace(/^\s*|\s*$/g, ""); 2683 }).left = function(str) { 2684 return str.replace(/^\s*/, ""); 2685 }, exports.right = function(str) { 2686 return str.replace(/\s*$/, ""); 2687 }; 2688 }), forEach_1 = function(list, iterator, context) { 2689 if (!isFunction_1(iterator)) throw new TypeError("iterator must be a function"); 2690 arguments.length < 3 && (context = this); 2691 "[object Array]" === toString$2.call(list) ? function(array, iterator, context) { 2692 for (var i = 0, len = array.length; i < len; i++) hasOwnProperty.call(array, i) && iterator.call(context, array[i], i, array); 2693 }(list, iterator, context) : "string" == typeof list ? function(string, iterator, context) { 2694 for (var i = 0, len = string.length; i < len; i++) iterator.call(context, string.charAt(i), i, string); 2695 }(list, iterator, context) : function(object, iterator, context) { 2696 for (var k in object) hasOwnProperty.call(object, k) && iterator.call(context, object[k], k, object); 2697 }(list, iterator, context); 2698 }, toString$2 = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty; 2699 var parseHeaders = function(headers) { 2700 if (!headers) return {}; 2701 var result = {}; 2702 return forEach_1(trim_1(headers).split("\n"), function(row) { 2703 var arg, index = row.indexOf(":"), key = trim_1(row.slice(0, index)).toLowerCase(), value = trim_1(row.slice(index + 1)); 2704 void 0 === result[key] ? result[key] = value : (arg = result[key], "[object Array]" === Object.prototype.toString.call(arg) ? result[key].push(value) : result[key] = [ result[key], value ]); 2705 }), result; 2706 }, immutable = function() { 2707 for (var target = {}, i = 0; i < arguments.length; i++) { 2708 var source = arguments[i]; 2709 for (var key in source) hasOwnProperty$1.call(source, key) && (target[key] = source[key]); 2710 } 2711 return target; 2712 }, hasOwnProperty$1 = Object.prototype.hasOwnProperty; 2713 var xhr = createXHR; 2714 function initParams(uri, options, callback) { 2715 var params = uri; 2716 return isFunction_1(options) ? (callback = options, "string" == typeof uri && (params = { 2717 uri: uri 2718 })) : params = immutable(options, { 2719 uri: uri 2720 }), params.callback = callback, params; 2721 } 2722 function createXHR(uri, options, callback) { 2723 return _createXHR(options = initParams(uri, options, callback)); 2724 } 2725 function _createXHR(options) { 2726 if (void 0 === options.callback) throw new Error("callback argument missing"); 2727 var called = !1, callback = function(err, response, body) { 2728 called || (called = !0, options.callback(err, response, body)); 2729 }; 2730 function errorFunc(evt) { 2731 return clearTimeout(timeoutTimer), evt instanceof Error || (evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"))), 2732 evt.statusCode = 0, callback(evt, failureResponse); 2733 } 2734 function loadFunc() { 2735 if (!aborted) { 2736 var status; 2737 clearTimeout(timeoutTimer), status = options.useXDR && void 0 === xhr.status ? 200 : 1223 === xhr.status ? 204 : xhr.status; 2738 var response = failureResponse, err = null; 2739 return 0 !== status ? (response = { 2740 body: function() { 2741 var body = void 0; 2742 if (body = xhr.response ? xhr.response : xhr.responseText || function(xhr) { 2743 if ("document" === xhr.responseType) return xhr.responseXML; 2744 var firefoxBugTakenEffect = xhr.responseXML && "parsererror" === xhr.responseXML.documentElement.nodeName; 2745 return "" !== xhr.responseType || firefoxBugTakenEffect ? null : xhr.responseXML; 2746 }(xhr), isJson) try { 2747 body = JSON.parse(body); 2748 } catch (e) {} 2749 return body; 2750 }(), 2751 statusCode: status, 2752 method: method, 2753 headers: {},
2754 url: uri, 2755 rawRequest: xhr 2756 }, xhr.getAllResponseHeaders && (response.headers = parseHeaders(xhr.getAllResponseHeaders()))) : err = new Error("Internal XMLHttpRequest Error"), 2757 callback(err, response, response.body); 2758 } 2759 } 2760 var key, aborted, xhr = options.xhr || null; 2761 xhr || (xhr = options.cors || options.useXDR ? new createXHR.XDomainRequest() : new createXHR.XMLHttpRequest()); 2762 var timeoutTimer, uri = xhr.url = options.uri || options.url, method = xhr.method = options.method || "GET", body = options.body || options.data, headers = xhr.headers = options.headers || {}, sync = !!options.sync, isJson = !1, failureResponse = { 2763 body: void 0, 2764 headers: {}, 2765 statusCode: 0, 2766 method: method, 2767 url: uri, 2768 rawRequest: xhr 2769 }; 2770 if ("json" in options && !1 !== options.json && (isJson = !0, headers.accept || headers.Accept || (headers.Accept = "application/json"), 2771 "GET" !== method && "HEAD" !== method && (headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json"), 2772 body = JSON.stringify(!0 === options.json ? body : options.json))), xhr.onreadystatechange = function() { 2773 4 === xhr.readyState && setTimeout(loadFunc, 0); 2774 }, xhr.onload = loadFunc, xhr.onerror = errorFunc, xhr.onprogress = function() {}, 2775 xhr.onabort = function() { 2776 aborted = !0; 2777 }, xhr.ontimeout = errorFunc, xhr.open(method, uri, !sync, options.username, options.password), 2778 sync || (xhr.withCredentials = !!options.withCredentials), !sync && 0 < options.timeout && (timeoutTimer = setTimeout(function() { 2779 if (!aborted) { 2780 aborted = !0, xhr.abort("timeout"); 2781 var e = new Error("XMLHttpRequest timeout"); 2782 e.code = "ETIMEDOUT", errorFunc(e); 2783 } 2784 }, options.timeout)), xhr.setRequestHeader) for (key in headers) headers.hasOwnProperty(key) && xhr.setRequestHeader(key, headers[key]); else if (options.headers && !function(obj) { 2785 for (var i in obj) if (obj.hasOwnProperty(i)) return !1; 2786 return !0; 2787 }(options.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); 2788 return "responseType" in options && (xhr.responseType = options.responseType), "beforeSend" in options && "function" == typeof options.beforeSend && options.beforeSend(xhr), 2789 xhr.send(body || null), xhr; 2790 } 2791 createXHR.XMLHttpRequest = window_1.XMLHttpRequest || function() {}, createXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window_1.XDomainRequest, 2792 function(array, iterator) { 2793 for (var i = 0; i < array.length; i++) iterator(array[i]); 2794 }([ "get", "put", "post", "patch", "head", "delete" ], function(method) { 2795 createXHR["delete" === method ? "del" : method] = function(uri, options, callback) { 2796 return (options = initParams(uri, options, callback)).method = method.toUpperCase(), 2797 _createXHR(options); 2798 }; 2799 }); 2800 var parseCues = function(srcContent, track) { 2801 var parser = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder()), errors = []; 2802 parser.oncue = function(cue) { 2803 track.addCue(cue); 2804 }, parser.onparsingerror = function(error) { 2805 errors.push(error); 2806 }, parser.onflush = function() { 2807 track.trigger({ 2808 type: "loadeddata", 2809 target: track 2810 }); 2811 }, parser.parse(srcContent), 0 < errors.length && (window_1.console && window_1.console.groupCollapsed && window_1.console.groupCollapsed("Text Track parsing errors for " + track.src), 2812 errors.forEach(function(error) { 2813 return log$1.error(error); 2814 }), window_1.console && window_1.console.groupEnd && window_1.console.groupEnd()), 2815 parser.flush(); 2816 }, loadTrack = function(src, track) { 2817 var opts = { 2818 uri: src 2819 }, crossOrigin = isCrossOrigin(src); 2820 crossOrigin && (opts.cors = crossOrigin), xhr(opts, bind(this, function(err, response, responseBody) { 2821 if (err) return log$1.error(err, response); 2822 if (track.loaded_ = !0, "function" != typeof window_1.WebVTT) { 2823 if (track.tech_) { 2824 var loadHandler = function() { 2825 return parseCues(responseBody, track); 2826 }; 2827 track.tech_.on("vttjsloaded", loadHandler), track.tech_.on("vttjserror", function() { 2828 log$1.error("vttjs failed to load, stopping trying to process " + track.src), track.tech_.off("vttjsloaded", loadHandler); 2829 }); 2830 } 2831 } else parseCues(responseBody, track); 2832 })); 2833 }, TextTrack = function(_Track) { 2834 function TextTrack() { 2835 var _this, options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 2836 if (classCallCheck(this, TextTrack), !options.tech) throw new Error("A tech w
2836as not provided."); 2837 var settings = mergeOptions(options, { 2838 kind: TextTrackKind[options.kind] || "subtitles", 2839 language: options.language || options.srclang || "" 2840 }), mode = TextTrackMode[settings.mode] || "disabled", default_ = settings.default; 2841 "metadata" !== settings.kind && "chapters" !== settings.kind || (mode = "hidden"); 2842 var tt = _this = possibleConstructorReturn(this, _Track.call(this, settings)); 2843 if (tt.tech_ = settings.tech, IS_IE8) for (var prop in TextTrack.prototype) "constructor" !== prop && (tt[prop] = TextTrack.prototype[prop]); 2844 tt.cues_ = [], tt.activeCues_ = []; 2845 var cues = new TextTrackCueList(tt.cues_), activeCues = new TextTrackCueList(tt.activeCues_), changed = !1, timeupdateHandler = bind(tt, function() { 2846 this.activeCues, changed && (this.trigger("cuechange"), changed = !1); 2847 }); 2848 return "disabled" !== mode && tt.tech_.ready(function() { 2849 tt.tech_.on("timeupdate", timeupdateHandler); 2850 }, !0), Object.defineProperty(tt, "default", { 2851 get: function() { 2852 return default_; 2853 }, 2854 set: function() {} 2855 }), Object.defineProperty(tt, "mode", { 2856 get: function() { 2857 return mode; 2858 }, 2859 set: function(newMode) { 2860 var _this2 = this; 2861 TextTrackMode[newMode] && ("showing" === (mode = newMode) && this.tech_.ready(function() { 2862 _this2.tech_.on("timeupdate", timeupdateHandler); 2863 }, !0), this.trigger("modechange")); 2864 } 2865 }), Object.defineProperty(tt, "cues", { 2866 get: function() { 2867 return this.loaded_ ? cues : null; 2868 }, 2869 set: function() {} 2870 }), Object.defineProperty(tt, "activeCues", { 2871 get: function() { 2872 if (!this.loaded_) return null; 2873 if (0 === this.cues.length) return activeCues; 2874 for (var ct = this.tech_.currentTime(), active = [], i = 0, l = this.cues.length; i < l; i++) { 2875 var cue = this.cues[i]; 2876 cue.startTime <= ct && cue.endTime >= ct ? active.push(cue) : cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + .5 >= ct && active.push(cue); 2877 } 2878 if (changed = !1, active.length !== this.activeCues_.length) changed = !0; else for (var _i = 0; _i < active.length; _i++) -1 === this.activeCues_.indexOf(active[_i]) && (changed = !0); 2879 return this.activeCues_ = active, activeCues.setCues_(this.activeCues_), activeCues; 2880 }, 2881 set: function() {} 2882 }), settings.src ? (tt.src = settings.src, loadTrack(settings.src, tt)) : tt.loaded_ = !0, 2883 possibleConstructorReturn(_this, tt); 2884 } 2885 return inherits(TextTrack, _Track), TextTrack.prototype.addCue = function(originalCue) { 2886 var cue = originalCue; 2887 if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) { 2888 for (var prop in cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text), 2889 originalCue) prop in cue || (cue[prop] = originalCue[prop]); 2890 cue.id = originalCue.id, cue.originalCue_ = originalCue; 2891 } 2892 for (var tracks = this.tech_.textTracks(), i = 0; i < tracks.length; i++) tracks[i] !== this && tracks[i].removeCue(cue); 2893 this.cues_.push(cue), this.cues.setCues_(this.cues_); 2894 }, TextTrack.prototype.removeCue = function(_removeCue) { 2895 for (var i = this.cues_.length; i--; ) { 2896 var cue = this.cues_[i]; 2897 if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) { 2898 this.cues_.splice(i, 1), this.cues.setCues_(this.cues_); 2899 break; 2900 } 2901 } 2902 }, TextTrack; 2903 }(Track); 2904 TextTrack.prototype.allowedEvents_ = { 2905 cuechange: "cuechange" 2906 }; 2907 var AudioTrack = function(_Track) { 2908 function AudioTrack() { 2909 var _this, options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 2910 classCallCheck(this, AudioTrack); 2911 var settings = mergeOptions(options, { 2912 kind: AudioTrackKind[options.kind] || "" 2913 }), track = _this = possibleConstructorReturn(this, _Track.call(this, settings)), enabled = !1; 2914 if (IS_IE8) for (var prop in AudioTrack.prototype) "constructor" !== prop && (track[prop] = AudioTrack.prototype[prop]); 2915 return Object.defineProperty(track, "enabled", { 2916 get: function() { 2917 return enabled; 2918 }, 2919 set: function(newEnabled) { 2920 "boolean" == typeof newEnabled && newEnabled !== enabled && (enabled = newEnabled, 2921 this.trigger("enabledchange")); 2922 } 2923 }), settings.enabled && (track.enabled = settings.enabled), track.loaded_ = !0, 2924 possibleConstructorReturn(_this, track); 2925 } 2926 return inherits(AudioTrack, _Track), AudioTrack; 2927 }(Track), VideoTrack = function(_Track) { 2928 function VideoTrack() { 2929 var _this, options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 2930 classCallCheck(this, VideoTrack); 2931 var settings = mergeOptions(options, { 2932 kind: VideoTrackKind[options.kind] || "" 2933 }), track = _this = possibleConstructorReturn(this, _Track.call(this, settings)), selected = !1; 2934 if (IS_IE8) for (var prop in VideoTrack.prototype) "constructor" !== prop && (track[prop] = VideoTrack.prototype[prop]); 2935 return Object.defineProperty(track, "selected", { 2936 get: function() { 2937 return selected; 2938 }, 2939 set: function(newSelected) { 2940 "boolean" == typeof newSelected && newSelected !== selected && (selected = newSelected, 2941 this.trigger("selectedchange")); 2942 } 2943 }), settings.selected && (track.selected = settings.selected), possibleConstructorReturn(_this, track); 2944 } 2945 return inherits(VideoTrack, _Track), VideoTrack; 2946 }(Track), NONE = 0, LOADED = 2, HTMLTrackElement = function(_EventTarget) { 2947 function HTMLTrackElement() { 2948 var options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 2949 classCallCheck(this, HTMLTrackElement); 2950 var _this = possibleConstructorReturn(this, _EventTarget.call(this)), readyState = void 0, trackElement = _this; 2951 if (IS_IE8) for (var prop in trackElement = document_1.createElement("custom"), 2952 HTMLTrackElement.prototype) "constructor" !== prop && (trackElement[prop] = HTMLTrackElement.prototype[prop]); 2953 var track = new TextTrack(options); 2954 return trackElement.kind = track.kind, trackElement.src = track.src, trackElement.srclang = track.language, 2955 trackElement.label = track.label, trackElement.default = track.default, Object.defineProperty(trackElement, "readyState", { 2956 get: function() { 2957 return readyState; 2958 } 2959 }), Object.defineProperty(trackElement, "track", { 2960 get: function() { 2961 return track; 2962 } 2963 }), readyState = NONE, track.addEventListener("loadeddata", function() { 2964 readyState = LOADED, trackElement.trigger({ 2965 type: "load", 2966 target: trackElement 2967 }); 2968 }), IS_IE8 ? possibleConstructorReturn(_this, trackElement) : _this; 2969 } 2970 return inherits(HTMLTrackElement, _EventTarget), HTMLTrackElement; 2971 }(EventTarget); 2972 HTMLTrackElement.prototype.allowedEvents_ = { 2973 load: "load" 2974 }, HTMLTrackElement.NONE = NONE, HTMLTrackElement.LOADING = 1, HTMLTrackElement.LOADED = LOADED, 2975 HTMLTrackElement.ERROR = 3; 2976 var NORMAL = { 2977 audio: { 2978 ListClass: AudioTrackList, 2979 TrackClass: AudioTrack, 2980 capitalName: "Audio" 2981 }, 2982 video: { 2983 ListClass: VideoTrackList, 2984 TrackClass: VideoTrack, 2985 capitalName: "Video" 2986 }, 2987 text: { 2988 ListClass: TextTrackList, 2989 TrackClass: TextTrack, 2990 capitalName: "Text" 2991 } 2992 };
vendor: 4,827 bytes, lines 2993-3091
2993 Object.keys(NORMAL).forEach(function(type) { 2994 NORMAL[type].getterName = type + "Tracks", NORMAL[type].privateName = type + "Tracks_"; 2995 }); 2996 var REMOTE = { 2997 remoteText: { 2998 ListClass: TextTrackList, 2999 TrackClass: TextTrack, 3000 capitalName: "RemoteText", 3001 getterName: "remoteTextTracks", 3002 privateName: "remoteTextTracks_" 3003 }, 3004 remoteTextEl: { 3005 ListClass: HtmlTrackElementList, 3006 TrackClass: HTMLTrackElement, 3007 capitalName: "RemoteTextTrackEls", 3008 getterName: "remoteTextTrackEls", 3009 privateName: "remoteTextTrackEls_" 3010 } 3011 }, ALL = mergeOptions(NORMAL, REMOTE); 3012 REMOTE.names = Object.keys(REMOTE), NORMAL.names = Object.keys(NORMAL), ALL.names = [].concat(REMOTE.names).concat(NORMAL.names); 3013 var _objCreate = Object.create || function() { 3014 function F() {} 3015 return function(o) { 3016 if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter."); 3017 return F.prototype = o, new F(); 3018 }; 3019 }(); 3020 function ParsingError(errorData, message) { 3021 this.name = "ParsingError", this.code = errorData.code, this.message = message || errorData.message; 3022 } 3023 function parseTimeStamp(input) { 3024 function computeSeconds(h, m, s, f) { 3025 return 3600 * (0 | h) + 60 * (0 | m) + (0 | s) + (0 | f) / 1e3; 3026 } 3027 var m = input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); 3028 return m ? m[3] ? computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]) : 59 < m[1] ? computeSeconds(m[1], m[2], 0, m[4]) : computeSeconds(0, m[1], m[2], m[4]) : null; 3029 } 3030 function Settings() { 3031 this.values = _objCreate(null); 3032 } 3033 function parseOptions(input, callback, keyValueDelim, groupDelim) { 3034 var groups = groupDelim ? input.split(groupDelim) : [ input ]; 3035 for (var i in groups) if ("string" == typeof groups[i]) { 3036 var kv = groups[i].split(keyValueDelim); 3037 if (2 === kv.length) callback(kv[0], kv[1]); 3038 } 3039 } 3040 function parseCue(input, cue, regionList) { 3041 var oInput = input; 3042 function consumeTimeStamp() { 3043 var ts = parseTimeStamp(input); 3044 if (null === ts) throw new ParsingError(ParsingError.Errors.BadTimeStamp, "Malformed timestamp: " + oInput); 3045 return input = input.replace(/^[^\sa-zA-Z-]+/, ""), ts; 3046 } 3047 function skipWhitespace() { 3048 input = input.replace(/^\s+/, ""); 3049 } 3050 if (skipWhitespace(), cue.startTime = consumeTimeStamp(), skipWhitespace(), "--\x3e" !== input.substr(0, 3)) throw new ParsingError(ParsingError.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '--\x3e'): " + oInput); 3051 input = input.substr(3), skipWhitespace(), cue.endTime = consumeTimeStamp(), skipWhitespace(), 3052 function(input, cue) { 3053 var settings = new Settings(); 3054 parseOptions(input, function(k, v) { 3055 switch (k) { 3056 case "region": 3057 for (var i = regionList.length - 1; 0 <= i; i--) if (regionList[i].id === v) { 3058 settings.set(k, regionList[i].region); 3059 break; 3060 } 3061 break; 3062 3063 case "vertical": 3064 settings.alt(k, v, [ "rl", "lr" ]); 3065 break; 3066 3067 case "line": 3068 var vals = v.split(","), vals0 = vals[0]; 3069 settings.integer(k, vals0), settings.percent(k, vals0) && settings.set("snapToLines", !1), 3070 settings.alt(k, vals0, [ "auto" ]), 2 === vals.length && settings.alt("lineAlign", vals[1], [ "start", "middle", "end" ]); 3071 break; 3072 3073 case "position": 3074 vals = v.split(","), settings.percent(k, vals[0]), 2 === vals.length && settings.alt("positionAlign", vals[1], [ "start", "middle", "end" ]); 3075 break; 3076 3077 case "size": 3078 settings.percent(k, v); 3079 break; 3080 3081 case "align": 3082 settings.alt(k, v, [ "start", "middle", "end", "left", "right" ]); 3083 } 3084 }, /:/, /\s/), cue.region = settings.get("region", null), cue.vertical = settings.get("vertical", ""), 3085 cue.line = settings.get("line", "auto"), cue.lineAlign = settings.get("lineAlign", "start"), 3086 cue.snapToLines = settings.get("snapToLines", !0), cue.size = settings.get("size", 100), 3087 cue.align = settings.get("align", "middle"), cue.position = settings.get("position", { 3088 start: 0, 3089 left: 0, 3090 middle: 50, 3091 end: 100,
3092 right: 100 3093 }, cue.align), cue.positionAlign = settings.get("positionAlign", { 3094 start: "start", 3095 left: "start", 3096 middle: "middle", 3097 end: "end", 3098 right: "end" 3099 }, cue.align); 3100 }(input, cue); 3101 } 3102 ((ParsingError.prototype = _objCreate(Error.prototype)).constructor = ParsingError).Errors = { 3103 BadSignature: { 3104 code: 0, 3105 message: "Malformed WebVTT signature." 3106 }, 3107 BadTimeStamp: { 3108 code: 1, 3109 message: "Malformed time stamp." 3110 } 3111 }, Settings.prototype = { 3112 set: function(k, v) { 3113 this.get(k) || "" === v || (this.values[k] = v); 3114 }, 3115 get: function(k, dflt, defaultKey) { 3116 return defaultKey ? this.has(k) ? this.values[k] : dflt[defaultKey] : this.has(k) ? this.values[k] : dflt; 3117 }, 3118 has: function(k) { 3119 return k in this.values; 3120 }, 3121 alt: function(k, v, a) { 3122 for (var n = 0; n < a.length; ++n) if (v === a[n]) { 3123 this.set(k, v); 3124 break; 3125 } 3126 }, 3127 integer: function(k, v) { 3128 /^-?\d+$/.test(v) && this.set(k, parseInt(v, 10)); 3129 }, 3130 percent: function(k, v) { 3131 return !!(v.match(/^([\d]{1,3})(\.[\d]*)?%$/) && 0 <= (v = parseFloat(v)) && v <= 100) && (this.set(k, v), 3132 !0); 3133 } 3134 }; 3135 var ESCAPE = { 3136 "&": "&", 3137 "<": "<", 3138 ">": ">", 3139 "‎": "â", 3140 "‏": "â", 3141 " ": "Â " 3142 }, TAG_NAME = { 3143 c: "span", 3144 i: "i", 3145 b: "b", 3146 u: "u", 3147 ruby: "ruby", 3148 rt: "rt", 3149 v: "span", 3150 lang: "span" 3151 }, TAG_ANNOTATION = { 3152 v: "title", 3153 lang: "lang" 3154 }, NEEDS_PARENT = { 3155 rt: "ruby" 3156 }; 3157 function parseContent(window, input) { 3158 function nextToken() { 3159 if (!input) return null; 3160 var result, m = input.match(/^([^<]*)(<[^>]+>?)?/); 3161 return result = m[1] ? m[1] : m[2], input = input.substr(result.length), result; 3162 } 3163 function unescape1(e) { 3164 return ESCAPE[e]; 3165 } 3166 function unescape(s) { 3167 for (;m = s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/); ) s = s.replace(m[0], unescape1); 3168 return s; 3169 } 3170 function shouldAdd(current, element) { 3171 return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current.localName; 3172 } 3173 function createElement(type, annotation) { 3174 var tagName = TAG_NAME[type]; 3175 if (!tagName) return null; 3176 var element = window.document.createElement(tagName); 3177 element.localName = tagName; 3178 var name = TAG_ANNOTATION[type]; 3179 return name && annotation && (element[name] = annotation.trim()), element; 3180 } 3181 for (var t, rootDiv = window.document.createElement("div"), current = rootDiv, tagStack = []; null !== (t = nextToken()); ) if ("<" !== t[0]) current.appendChild(window.document.createTextNode(unescape(t))); else { 3182 if ("/" === t[1]) { 3183 tagStack.length && tagStack[tagStack.length - 1] === t.substr(2).replace(">", "") && (tagStack.pop(), 3184 current = current.parentNode); 3185 continue; 3186 } 3187 var node, ts = parseTimeStamp(t.substr(1, t.length - 2)); 3188 if (ts) { 3189 node = window.document.createProcessingInstruction("timestamp", ts), current.appendChild(node); 3190 continue; 3191 } 3192 var m = t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); 3193 if (!m) continue; 3194 if (!(node = createElement(m[1], m[3]))) continue; 3195 if (!shouldAdd(current, node)) continue; 3196 m[2] && (node.className = m[2].substr(1).replace(".", " ")), tagStack.push(m[1]), 3197 current.appendChild(node), current = node; 3198 } 3199 return rootDiv; 3200 } 3201 var strongRTLRanges = [ [ 1470, 1470 ], [ 1472, 1472 ], [ 1475, 1475 ], [ 1478, 1478 ], [ 1488, 1514 ], [ 1520, 1524 ], [ 1544, 1544 ], [ 1547, 1547 ], [ 1549, 1549 ], [ 1563, 1563 ], [ 1566, 1610 ], [ 1645, 1647 ], [ 1649, 1749 ], [ 1765, 1766 ], [ 1774, 1775 ], [ 1786, 1805 ], [ 1807, 1808 ], [ 1810, 1839 ], [ 1869, 1957 ], [ 1969, 1969 ], [ 1984, 2026 ], [ 2036, 2037 ], [ 2042, 2042 ], [ 2048, 2069 ], [ 2074, 2074 ], [ 2084, 2084 ], [ 2088, 2088 ], [ 2096, 2110 ], [ 2112, 2136 ], [ 2142, 2142 ], [ 2208, 2208 ], [ 2210, 2220 ], [ 8207, 8207 ], [ 64285, 64285 ], [ 64287, 64296 ], [ 64298, 64310 ], [ 64312, 64316 ], [ 64318, 64318 ], [ 64320, 64321 ], [ 64323, 64324 ], [ 64326, 64449 ], [ 64467, 64829 ], [ 64848, 64911 ], [ 64914, 64967 ], [ 65008, 65020 ], [ 65136, 65140 ], [ 65142, 65276 ], [ 67584, 67589 ], [ 67592, 67592 ], [ 67594, 67637 ], [ 67639, 67640 ], [ 67644, 67644 ], [ 67647, 67669 ], [ 67671, 67679 ], [ 67840, 67867 ], [ 67872, 67897 ], [ 67903, 67903 ], [ 67968, 68023 ], [ 68030, 68031 ], [ 68096, 68096 ], [ 68112, 68115 ], [ 68117, 68119 ], [ 68121, 68147 ], [ 68160, 68167 ], [ 68176, 68184 ], [ 68192, 68223 ], [ 68352, 68405 ], [ 68416, 68437 ], [ 68440, 68466 ], [ 68472, 68479 ], [ 68608, 68680 ], [ 126464, 126467 ], [ 126469, 126495 ], [ 126497, 126498 ], [ 126500, 126500 ], [ 126503, 126503 ], [ 126505, 126514 ], [ 126516, 126519 ], [ 126521, 126521 ], [ 126523, 126523 ], [ 126530, 126530 ], [ 126535, 126535 ], [ 126537, 126537 ], [ 126539, 126539 ], [ 126541, 126543 ], [ 126545, 126546 ], [ 126548, 126548 ], [ 126551, 126551 ], [ 126553, 126553 ], [ 126555, 126555 ], [ 126557, 126557 ], [ 126559, 126559 ], [ 126561, 126562 ], [ 126564, 126564 ], [ 126567, 126570 ], [ 126572, 126578 ], [ 126580, 126583 ], [ 126585, 126588 ], [ 126590, 126590 ], [ 126592, 126601 ], [ 126603, 126619 ], [ 126625, 126627 ], [ 126629, 126633 ], [ 126635, 126651 ], [ 1114109, 1114109 ] ]; 3202 function isStrongRTLChar(charCode) { 3203 for (var i = 0; i < strongRTLRanges.length; i++) { 3204 var currentRange = strongRTLRanges[i]; 3205 if (charCode >
vendor: 15,766 bytes, lines 3205-3513
3205= currentRange[0] && charCode <= currentRange[1]) return !0; 3206 } 3207 return !1; 3208 } 3209 function StyleBox() {} 3210 function CueStyleBox(window, cue, styleOptions) { 3211 var isIE8 = /MSIE\s8\.0/.test(navigator.userAgent), color = "rgba(255, 255, 255, 1)", backgroundColor = "rgba(0, 0, 0, 0.8)"; 3212 isIE8 && (color = "rgb(255, 255, 255)", backgroundColor = "rgb(0, 0, 0)"), StyleBox.call(this), 3213 this.cue = cue, this.cueDiv = parseContent(window, cue.text); 3214 var styles = { 3215 color: color, 3216 backgroundColor: backgroundColor, 3217 position: "relative", 3218 left: 0, 3219 right: 0, 3220 top: 0, 3221 bottom: 0, 3222 display: "inline" 3223 }; 3224 isIE8 || (styles.writingMode = "" === cue.vertical ? "horizontal-tb" : "lr" === cue.vertical ? "vertical-lr" : "vertical-rl", 3225 styles.unicodeBidi = "plaintext"), this.applyStyles(styles, this.cueDiv), this.div = window.document.createElement("div"), 3226 styles = { 3227 textAlign: "middle" === cue.align ? "center" : cue.align, 3228 font: styleOptions.font, 3229 whiteSpace: "pre-line", 3230 position: "absolute" 3231 }, isIE8 || (styles.direction = function(cueDiv) { 3232 var nodeStack = [], text = ""; 3233 if (!cueDiv || !cueDiv.childNodes) return "ltr"; 3234 function pushNodes(nodeStack, node) { 3235 for (var i = node.childNodes.length - 1; 0 <= i; i--) nodeStack.push(node.childNodes[i]); 3236 } 3237 function nextTextNode(nodeStack) { 3238 if (!nodeStack || !nodeStack.length) return null; 3239 var node = nodeStack.pop(), text = node.textContent || node.innerText; 3240 if (text) { 3241 var m = text.match(/^.*(\n|\r)/); 3242 return m ? m[nodeStack.length = 0] : text; 3243 } 3244 return "ruby" === node.tagName ? nextTextNode(nodeStack) : node.childNodes ? (pushNodes(nodeStack, node), 3245 nextTextNode(nodeStack)) : void 0; 3246 } 3247 for (pushNodes(nodeStack, cueDiv); text = nextTextNode(nodeStack); ) for (var i = 0; i < text.length; i++) if (isStrongRTLChar(text.charCodeAt(i))) return "rtl"; 3248 return "ltr"; 3249 }(this.cueDiv), styles.writingMode = "" === cue.vertical ? "horizontal-tb" : "lr" === cue.vertical ? "vertical-lr" : "vertical-rl".stylesunicodeBidi = "plaintext"), 3250 this.applyStyles(styles), this.div.appendChild(this.cueDiv); 3251 var textPos = 0; 3252 switch (cue.positionAlign) { 3253 case "start": 3254 textPos = cue.position; 3255 break; 3256 3257 case "middle": 3258 textPos = cue.position - cue.size / 2; 3259 break; 3260 3261 case "end": 3262 textPos = cue.position - cue.size; 3263 } 3264 "" === cue.vertical ? this.applyStyles({ 3265 left: this.formatStyle(textPos, "%"), 3266 width: this.formatStyle(cue.size, "%") 3267 }) : this.applyStyles({ 3268 top: this.formatStyle(textPos, "%"), 3269 height: this.formatStyle(cue.size, "%") 3270 }), this.move = function(box) { 3271 this.applyStyles({ 3272 top: this.formatStyle(box.top, "px"), 3273 bottom: this.formatStyle(box.bottom, "px"), 3274 left: this.formatStyle(box.left, "px"), 3275 right: this.formatStyle(box.right, "px"), 3276 height: this.formatStyle(box.height, "px"), 3277 width: this.formatStyle(box.width, "px") 3278 }); 3279 }; 3280 } 3281 function BoxPosition(obj) { 3282 var lh, height, width, top, isIE8 = /MSIE\s8\.0/.test(navigator.userAgent); 3283 if (obj.div) { 3284 height = obj.div.offsetHeight, width = obj.div.offsetWidth, top = obj.div.offsetTop; 3285 var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects(); 3286 obj = obj.div.getBoundingClientRect(), lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0; 3287 } 3288 this.left = obj.left, this.right = obj.right, this.top = obj.top || top, this.height = obj.height || height, 3289 this.bottom = obj.bottom || top + (obj.height || height), this.width = obj.width || width, 3290 this.lineHeight = void 0 !== lh ? lh : obj.lineHeight, isIE8 && !this.lineHeight && (this.lineHeight = 13); 3291 } 3292 function moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) { 3293 var boxPosition = new BoxPosition(styleBox), cue = styleBox.cue, linePos = function(cue) { 3294 if ("number" == typeof cue.line && (cue.snapToLines || 0 <= cue.line && cue.line <= 100)) return cue.line; 3295 if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) return -1; 3296 for (var track = cue.track, trackList = track.textTrackList, count = 0, i = 0; i < trackList.length && trackList[i] !== track; i++) "showing" === trackList[i].mode && count++; 3297 return -1 * ++count; 3298 }(cue), axis = []; 3299 if (cue.snapToLines) { 3300 var size; 3301 switch (cue.vertical) { 3302 case "": 3303 axis = [ "+y", "-y" ], size = "height"; 3304 break; 3305 3306 case "rl": 3307 axis = [ "+x", "-x" ], size = "width"; 3308 break; 3309 3310 case "lr": 3311 axis = [ "-x", "+x" ], size = "width"; 3312 } 3313 var step = boxPosition.lineHeight, position = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis[0]; 3314 Math.abs(position) > maxPosition && (position = position < 0 ? -1 : 1, position *= Math.ceil(maxPosition / step) * step), 3315 linePos < 0 && (position += "" === cue.vertical ? containerBox.height : containerBox.width, 3316 axis = axis.reverse()), boxPosition.move(initialAxis, position); 3317 } else { 3318 var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100; 3319 switch (cue.lineAlign) { 3320 case "middle": 3321 linePos -= calculatedPercentage / 2; 3322 break; 3323 3324 case "end": 3325 linePos -= calculatedPercentage; 3326 } 3327 switch (cue.vertical) { 3328 case "": 3329 styleBox.applyStyles({ 3330 top: styleBox.formatStyle(linePos, "%") 3331 }); 3332 break; 3333 3334 case "rl": 3335 styleBox.applyStyles({ 3336 left: styleBox.formatStyle(linePos, "%") 3337 }); 3338 break; 3339 3340 case "lr": 3341 styleBox.applyStyles({ 3342 right: styleBox.formatStyle(linePos, "%") 3343 }); 3344 } 3345 axis = [ "+y", "-x", "+x", "-y" ], boxPosition = new BoxPosition(styleBox); 3346 } 3347 var bestPosition = function(b, axis) { 3348 for (var bestPosition, specifiedPosition = new BoxPosition(b), percentage = 1, i = 0; i < axis.length; i++) { 3349 for (;b.overlapsOppositeAxis(containerBox, axis[i]) || b.within(containerBox) && b.overlapsAny(boxPositions); ) b.move(axis[i]); 3350 if (b.within(containerBox)) return b; 3351 var p = b.intersectPercentage(containerBox); 3352 p < percentage && (bestPosition = new BoxPosition(b), percentage = p), b = new BoxPosition(specifiedPosition); 3353 } 3354 return bestPosition || specifiedPosition; 3355 }(boxPosition, axis); 3356 styleBox.move(bestPosition.toCSSCompatValues(containerBox)); 3357 } 3358 function WebVTT$1() {} 3359 StyleBox.prototype.applyStyles = function(styles, div) { 3360 for (var prop in div = div || this.div, styles) styles.hasOwnProperty(prop) && (div.style[prop] = styles[prop]); 3361 }, StyleBox.prototype.formatStyle = function(val, unit) { 3362 return 0 === val ? 0 : val + unit; 3363 }, (CueStyleBox.prototype = _objCreate(StyleBox.prototype)).constructor = CueStyleBox, 3364 BoxPosition.prototype.move = function(axis, toMove) { 3365 switch (toMove = void 0 !== toMove ? toMove : this.lineHeight, axis) { 3366 case "+x": 3367 this.left += toMove, this.right += toMove; 3368 break; 3369 3370 case "-x": 3371 this.left -= toMove, this.right -= toMove; 3372 break; 3373 3374 case "+y": 3375 this.top += toMove, this.bottom += toMove; 3376 break; 3377 3378 case "-y": 3379 this.top -= toMove, this.bottom -= toMove; 3380 } 3381 }, BoxPosition.prototype.overlaps = function(b2) { 3382 return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top; 3383 }, BoxPosition.prototype.overlapsAny = function(boxes) { 3384 for (var i = 0; i < boxes.length; i++) if (this.overlaps(boxes[i])) return !0; 3385 return !1; 3386 }, BoxPosition.prototype.within = function(container) { 3387 return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right; 3388 }, BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) { 3389 switch (axis) { 3390 case "+x": 3391 return this.left < container.left; 3392 3393 case "-x": 3394 return this.right > container.right; 3395 3396 case "+y": 3397 return this.top < container.top; 3398 3399 case "-y": 3400 return this.bottom > container.bottom; 3401 } 3402 }, BoxPosition.prototype.intersectPercentage = function(b2) { 3403 return Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)) * Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)) / (this.height * this.width); 3404 }, BoxPosition.prototype.toCSSCompatValues = function(reference) { 3405 return { 3406 top: this.top - reference.top, 3407 bottom: reference.bottom - this.bottom, 3408 left: this.left - reference.left, 3409 right: reference.right - this.right, 3410 height: this.height, 3411 width: this.width 3412 }; 3413 }, BoxPosition.getSimpleBoxPosition = function(obj) { 3414 var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0, width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0, top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0; 3415 return { 3416 left: (obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj).left, 3417 right: obj.right, 3418 top: obj.top || top, 3419 height: obj.height || height, 3420 bottom: obj.bottom || top + (obj.height || height), 3421 width: obj.width || width 3422 }; 3423 }, WebVTT$1.StringDecoder = function() { 3424 return { 3425 decode: function(data) { 3426 if (!data) return ""; 3427 if ("string" != typeof data) throw new Error("Error - expected string data."); 3428 return decodeURIComponent(encodeURIComponent(data)); 3429 } 3430 }; 3431 }, WebVTT$1.convertCueToDOMTree = function(window, cuetext) { 3432 return window && cuetext ? parseContent(window, cuetext) : null; 3433 }; 3434 WebVTT$1.processCues = function(window, cues, overlay) { 3435 if (!window || !cues || !overlay) return null; 3436 for (;overlay.firstChild; ) overlay.removeChild(overlay.firstChild); 3437 var paddedOverlay = window.document.createElement("div"); 3438 if (paddedOverlay.style.position = "absolute", paddedOverlay.style.left = "0", paddedOverlay.style.right = "0", 3439 paddedOverlay.style.top = "0", paddedOverlay.style.bottom = "0", paddedOverlay.style.margin = "1.5%", 3440 overlay.appendChild(paddedOverlay), function(cues) { 3441 for (var i = 0; i < cues.length; i++) if (cues[i].hasBeenReset || !cues[i].displayState) return !0; 3442 return !1; 3443 }(cues)) { 3444 var boxPositions = [], containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay), styleOptions = { 3445 font: Math.round(.05 * containerBox.height * 100) / 100 + "px sans-serif" 3446 }; 3447 !function() { 3448 for (var styleBox, cue, i = 0; i < cues.length; i++) cue = cues[i], styleBox = new CueStyleBox(window, cue, styleOptions), 3449 paddedOverlay.appendChild(styleBox.div), moveBoxToLinePosition(0, styleBox, containerBox, boxPositions), 3450 cue.displayState = styleBox.div, boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox)); 3451 }(); 3452 } else for (var i = 0; i < cues.length; i++) paddedOverlay.appendChild(cues[i].displayState); 3453 }, (WebVTT$1.Parser = function(window, vttjs, decoder) { 3454 decoder || (decoder = vttjs, vttjs = {}), vttjs || (vttjs = {}), this.window = window, 3455 this.vttjs = vttjs, this.state = "INITIAL", this.buffer = "", this.decoder = decoder || new TextDecoder("utf8"), 3456 this.regionList = []; 3457 }).prototype = { 3458 reportOrThrowError: function(e) { 3459 if (!(e instanceof ParsingError)) throw e; 3460 this.onparsingerror && this.onparsingerror(e); 3461 }, 3462 parse: function(data) { 3463 var self = this; 3464 function collectNextLine() { 3465 for (var buffer = self.buffer, pos = 0; pos < buffer.length && "\r" !== buffer[pos] && "\n" !== buffer[pos]; ) ++pos; 3466 var line = buffer.substr(0, pos); 3467 return "\r" === buffer[pos] && ++pos, "\n" === buffer[pos] && ++pos, self.buffer = buffer.substr(pos), 3468 line; 3469 } 3470 function parseHeader(input) { 3471 input.match(/X-TIMESTAMP-MAP/) ? parseOptions(input, function(k, v) { 3472 switch (k) { 3473 case "X-TIMESTAMP-MAP": 3474 input = v, settings = new Settings(), parseOptions(input, function(k, v) { 3475 switch (k) { 3476 case "MPEGT": 3477 settings.integer(k + "S", v); 3478 break; 3479 3480 case "LOCA": 3481 settings.set(k + "L", parseTimeStamp(v)); 3482 } 3483 }, /[^\d]:/, /,/), self.ontimestampmap && self.ontimestampmap({ 3484 MPEGTS: settings.get("MPEGTS"), 3485 LOCAL: settings.get("LOCAL") 3486 }); 3487 } 3488 var input, settings; 3489 }, /=/) : parseOptions(input, function(k, v) { 3490 switch (k) { 3491 case "Region": 3492 !function(input) { 3493 var settings = new Settings(); 3494 if (parseOptions(input, function(k, v) { 3495 switch (k) { 3496 case "id": 3497 settings.set(k, v); 3498 break; 3499 3500 case "width": 3501 settings.percent(k, v); 3502 break; 3503 3504 case "lines": 3505 settings.integer(k, v); 3506 break; 3507 3508 case "regionanchor": 3509 case "viewportanchor": 3510 var xy = v.split(","); 3511 if (2 !== xy.length) break; 3512 var anchor = new Settings(); 3513 if (anchor.percent("x", xy[0]), anchor.percent("y", xy[1]), !anchor.has("x") || !anchor.has("y")) break;
3514 settings.set(k + "X", anchor.get("x")), settings.set(k + "Y", anchor.get("y")); 3515 break; 3516 3517 case "scroll": 3518 settings.alt(k, v, [ "up" ]); 3519 } 3520 }, /=/, /\s/), settings.has("id")) { 3521 var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)(); 3522 region.width = settings.get("width", 100), region.lines = settings.get("lines", 3), 3523 region.regionAnchorX = settings.get("regionanchorX", 0), region.regionAnchorY = settings.get("regionanchorY", 100), 3524 region.viewportAnchorX = settings.get("viewportanchorX", 0), region.viewportAnchorY = settings.get("viewportanchorY", 100), 3525 region.scroll = settings.get("scroll", ""), self.onregion && self.onregion(region), 3526 self.regionList.push({ 3527 id: settings.get("id"), 3528 region: region 3529 }); 3530 } 3531 }(v); 3532 } 3533 }, /:/); 3534 } 3535 data && (self.buffer += self.decoder.decode(data, { 3536 stream: !0 3537 })); 3538 try { 3539 var line; 3540 if ("INITIAL" === self.state) { 3541 if (!/\r\n|\n/.test(self.buffer)) return this; 3542 var m = (line = collectNextLine()).match(/^WEBVTT([ \t].*)?$/); 3543 if (!m || !m[0]) throw new ParsingError(ParsingError.Errors.BadSignature); 3544 self.state = "HEADER"; 3545 } 3546 for (var alreadyCollectedLine = !1; self.buffer; ) { 3547 if (!/\r\n|\n/.test(self.buffer)) return this; 3548 switch (alreadyCollectedLine ? alreadyCollectedLine = !1 : line = collectNextLine(), 3549 self.state) { 3550 case "HEADER": 3551 /:/.test(line) ? parseHeader(line) : line || (self.state = "ID"); 3552 continue; 3553 3554 case "NOTE": 3555 line || (self.state = "ID"); 3556 continue; 3557 3558 case "ID": 3559 if (/^NOTE($|[ \t])/.test(line)) { 3560 self.state = "NOTE"; 3561 break; 3562 } 3563 if (!line) continue; 3564 if (self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, ""), self.state = "CUE", 3565 -1 === line.indexOf("--\x3e")) { 3566 self.cue.id = line; 3567 continue; 3568 } 3569 3570 case "CUE": 3571 try { 3572 parseCue(line, self.cue, self.regionList); 3573 } catch (e) { 3574 self.reportOrThrowError(e), self.cue = null, self.state = "BADCUE"; 3575 continue; 3576 } 3577 self.state = "CUETEXT"; 3578 continue; 3579 3580 case "CUETEXT": 3581 var hasSubstring = -1 !== line.indexOf("--\x3e"); 3582 if (!line || hasSubstring && (alreadyCollectedLine = !0)) { 3583 self.oncue && self.oncue(self.cue), self.cue = null, self.state = "ID"; 3584 continue; 3585 } 3586 self.cue.text && (self.cue.text += "\n"), self.cue.text += line; 3587 continue; 3588 3589 case "BADCUE": 3590 line || (self.state = "ID"); 3591 continue; 3592 } 3593 } 3594 } catch (e) { 3595 self.reportOrThrowError(e), "CUETEXT" === self.state && self.cue && self.oncue && self.oncue(self.cue), 3596 self.cue = null, self.state = "INITIAL" === self.state ? "BADWEBVTT" : "BADCUE"; 3597 } 3598 return this; 3599 }, 3600 flush: function() { 3601 var self = this; 3602 try { 3603 if (self.buffer += self.decoder.decode(), (self.cue || "HEADER" === self.state) && (self.buffer += "\n\n", 3604 self.parse()), "INITIAL" === self.state) throw new ParsingError(ParsingError.Errors.BadSignature); 3605 } catch (e) { 3606 self.reportOrThrowError(e); 3607 } 3608 return self.onflush && self.onflush(), this; 3609 } 3610 }; 3611 var vtt$1 = WebVTT$1, autoKeyword = "auto", directionSetting = { 3612 "": !0, 3613 lr: !0, 3614 rl: !0 3615 }, alignSetting = { 3616 start: !0, 3617 middle: !0, 3618 end: !0, 3619 left: !0, 3620 right: !0 3621 };
3622 function findAlignSetting(value) { 3623 return "string" == typeof value && (!!alignSetting[value.toLowerCase()] && value.toLowerCase()); 3624 } 3625 function extend$1(obj) { 3626 for (var i = 1; i < arguments.length; i++) { 3627 var cobj = arguments[i]; 3628 for (var p in cobj) obj[p] = cobj[p]; 3629 } 3630 return obj; 3631 } 3632 function VTTCue(startTime, endTime, text) { 3633 var cue = this, isIE8 = /MSIE\s8\.0/.test(navigator.userAgent), baseObj = {}; 3634 isIE8 ? cue = document.createElement("custom") : baseObj.enumerable = !0, cue.hasBeenReset = !1; 3635 var _id = "", _pauseOnExit = !1, _startTime = startTime, _endTime = endTime, _text = text, _region = null, _vertical = "", _snapToLines = !0, _line = "auto", _lineAlign = "start", _position = 50, _positionAlign = "middle", _size = 50, _align = "middle"; 3636 if (Object.defineProperty(cue, "id", extend$1({}, baseObj, { 3637 get: function() { 3638 return _id; 3639 }, 3640 set: function(value) { 3641 _id = "" + value; 3642 } 3643 })), Object.defineProperty(cue, "pauseOnExit", extend$1({}, baseObj, { 3644 get: function() { 3645 return _pauseOnExit; 3646 }, 3647 set: function(value) { 3648 _pauseOnExit = !!value; 3649 } 3650 })), Object.defineProperty(cue, "startTime", extend$1({}, baseObj, { 3651 get: function() { 3652 return _startTime; 3653 }, 3654 set: function(value) { 3655 if ("number" != typeof value) throw new TypeError("Start time must be set to a number."); 3656 _startTime = value, this.hasBeenReset = !0; 3657 } 3658 })), Object.defineProperty(cue, "endTime", extend$1({}, baseObj, { 3659 get: function() { 3660 return _endTime; 3661 }, 3662 set: function(value) { 3663 if ("number" != typeof value) throw new TypeError("End time must be set to a number."); 3664 _endTime = value, this.hasBeenReset = !0; 3665 } 3666 })), Object.defineProperty(cue, "text", extend$1({}, baseObj, { 3667 get: function() { 3668 return _text; 3669 }, 3670 set: function(value) { 3671 _text = "" + value, this.hasBeenReset = !0; 3672 } 3673 })), Object.defineProperty(cue, "region", extend$1({}, baseObj, { 3674 get: function() { 3675 return _region; 3676 }, 3677 set: function(value) { 3678 _region = value, this.hasBeenReset = !0; 3679 } 3680 })), Object.defineProperty(cue, "vertical", extend$1({}, baseObj, { 3681 get: function() { 3682 return _vertical; 3683 }, 3684 set: function(value) { 3685 var setting = function(value) { 3686 return "string" == typeof value && !!directionSetting[value.toLowerCase()] && value.toLowerCase(); 3687 }(value); 3688 if (!1 === setting) throw new SyntaxError("An invalid or illegal string was specified."); 3689 _vertical = setting, this.hasBeenReset = !0; 3690 } 3691 })), Object.defineProperty(cue, "snapToLines", extend$1({}, baseObj, { 3692 get: function() { 3693 return _snapToLines; 3694 }, 3695 set: function(value) { 3696 _snapToLines = !!value, this.hasBeenReset = !0; 3697 } 3698 })), Object.defineProperty(cue, "line", extend$1({}, baseObj, { 3699 get: function() { 3700 return _line; 3701 }, 3702 set: function(value) { 3703 if ("number" != typeof value && value !== autoKeyword) throw new SyntaxError("An invalid number or illegal string was specified."); 3704 _line = value, this.hasBeenReset = !0; 3705 } 3706 })), Object.defineProperty(cue, "lineAlign", extend$1({}, baseObj, { 3707 get: function() { 3708 return _lineAlign; 3709 }, 3710 set: function(value) { 3711 var setting = findAlignSetting(value); 3712 if (!setting) throw new SyntaxError("An invalid or illegal string was specified."); 3713 _lineAlign = setting, this.hasBeenReset = !0; 3714 } 3715 })), Object.defineProperty(cue, "position", extend$1({}, baseObj, { 3716 get: function() { 3717 return _position; 3718 }, 3719 set: function(value) { 3720 if (value < 0 || 100 < value) throw new Error("Position must be between 0 and 100."); 3721 _position = value, this.hasBeenReset = !0; 3722 } 3723 })), Object.defineProperty(cue, "positionAlign", extend$1({}, baseObj, { 3724 get: function() { 3725 return _positionAlign; 3726 }, 3727 set: function(value) {
3728 var setting = findAlignSetting(value); 3729 if (!setting) throw new SyntaxError("An invalid or illegal string was specified."); 3730 _positionAlign = setting, this.hasBeenReset = !0; 3731 } 3732 })), Object.defineProperty(cue, "size", extend$1({}, baseObj, { 3733 get: function() { 3734 return _size; 3735 }, 3736 set: function(value) { 3737 if (value < 0 || 100 < value) throw new Error("Size must be between 0 and 100."); 3738 _size = value, this.hasBeenReset = !0; 3739 } 3740 })), Object.defineProperty(cue, "align", extend$1({}, baseObj, { 3741 get: function() { 3742 return _align; 3743 }, 3744 set: function(value) { 3745 var setting = findAlignSetting(value); 3746 if (!setting) throw new SyntaxError("An invalid or illegal string was specified."); 3747 _align = setting, this.hasBeenReset = !0; 3748 } 3749 })), cue.displayState = void 0, isIE8) return cue; 3750 } 3751 VTTCue.prototype.getCueAsHTML = function() { 3752 return WebVTT.convertCueToDOMTree(window, this.text); 3753 }; 3754 var vttcue = VTTCue, scrollSetting = { 3755 "": !0, 3756 up: !0 3757 }; 3758 function isValidPercentValue(value) { 3759 return "number" == typeof value && 0 <= value && value <= 100; 3760 } 3761 var vttregion = function() { 3762 var _width = 100, _lines = 3, _regionAnchorX = 0, _regionAnchorY = 100, _viewportAnchorX = 0, _viewportAnchorY = 100, _scroll = ""; 3763 Object.defineProperties(this, { 3764 width: { 3765 enumerable: !0, 3766 get: function() { 3767 return _width; 3768 }, 3769 set: function(value) { 3770 if (!isValidPercentValue(value)) throw new Error("Width must be between 0 and 100."); 3771 _width = value; 3772 } 3773 }, 3774 lines: { 3775 enumerable: !0, 3776 get: function() { 3777 return _lines; 3778 }, 3779 set: function(value) { 3780 if ("number" != typeof value) throw new TypeError("Lines must be set to a number."); 3781 _lines = value; 3782 } 3783 }, 3784 regionAnchorY: { 3785 enumerable: !0, 3786 get: function() { 3787 return _regionAnchorY; 3788 }, 3789 set: function(value) { 3790 if (!isValidPercentValue(value)) throw new Error("RegionAnchorX must be between 0 and 100."); 3791 _regionAnchorY = value; 3792 } 3793 }, 3794 regionAnchorX: { 3795 enumerable: !0, 3796 get: function() { 3797 return _regionAnchorX; 3798 }, 3799 set: function(value) { 3800 if (!isValidPercentValue(value)) throw new Error("RegionAnchorY must be between 0 and 100."); 3801 _regionAnchorX = value; 3802 } 3803 }, 3804 viewportAnchorY: { 3805 enumerable: !0, 3806 get: function() { 3807 return _viewportAnchorY; 3808 }, 3809 set: function(value) { 3810 if (!isValidPercentValue(value)) throw new Error("ViewportAnchorY must be between 0 and 100."); 3811 _viewportAnchorY = value; 3812 } 3813 }, 3814 viewportAnchorX: { 3815 enumerable: !0, 3816 get: function() { 3817 return _viewportAnchorX; 3818 }, 3819 set: function(value) { 3820 if (!isValidPercentValue(value)) throw new Error("ViewportAnchorX must be between 0 and 100."); 3821 _viewportAnchorX = value; 3822 } 3823 }, 3824 scroll: { 3825 enumerable: !0, 3826 get: function() { 3827 return _scroll; 3828 }, 3829 set: function(value) { 3830 var setting = function(value) { 3831 return "string" == typeof value && !!scrollSetting[value.toLowerCase()] && value.toLowerCase(); 3832 }(value); 3833 if (!1 === setting) throw new SyntaxError("An invalid or illegal string was specified."); 3834 _scroll = setting; 3835 } 3836 } 3837 }); 3838 }, browserIndex = createCommonjsModule(function(module) { 3839 var vttjs = module.exports = { 3840 WebVTT: vtt$1, 3841 VTTCue: vttcue, 3842 VTTRegion: vttregion 3843 }; 3844 window_1.vttjs = vttjs, window_1.WebVTT = vttjs.WebVTT; 3845 var cueShim = vttjs.VTTCue, regionShim = vttjs.VTTRegion, nativeVTTCue = window_1.VTTCue, nativeVTTRegion = window_1.VTTRegion; 3846 vttjs.shim = function() { 3847 window_1.VTTCue = cueShim, window_1.VTTRegion = regionShim; 3848 }, vttjs.restore = function() { 3849 window_1.VTTCue = nativeVTTCue, window_1.VTTRegion = nativeVTTRegion; 3850 }, window_1.VTTCue || vttjs.shim(); 3851 }); 3852 var Tech = function(_Component) { 3853 function Tech() { 3854 var options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, ready = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : function() {}; 3855 classCallCheck(this, Tech), options.reportTouchActivity = !1; 3856 var _this = possibleConstructorReturn(this, _Component.call(this, null, options, ready)); 3857 return _this.hasStarted_ = !1, _this.on("playing", function() { 3858 this.hasStarted_ = !0; 3859 }), _this.on("loadstart", function() { 3860 this.hasStarted_ = !1; 3861 }
3861), ALL.names.forEach(function(name) { 3862 var props = ALL[name]; 3863 options && options[props.getterName] && (_this[props.privateName] = options[props.getterName]); 3864 }), _this.featuresProgressEvents || _this.manualProgressOn(), _this.featuresTimeupdateEvents || _this.manualTimeUpdatesOn(), 3865 [ "Text", "Audio", "Video" ].forEach(function(track) { 3866 !1 === options["native" + track + "Tracks"] && (_this["featuresNative" + track + "Tracks"] = !1); 3867 }), !1 === options.nativeCaptions || !1 === options.nativeTextTracks ? _this.featuresNativeTextTracks = !1 : !0 !== options.nativeCaptions && !0 !== options.nativeTextTracks || (_this.featuresNativeTextTracks = !0), 3868 _this.featuresNativeTextTracks || _this.emulateTextTracks(), _this.autoRemoteTextTracks_ = new ALL.text.ListClass(), 3869 _this.initTrackListeners(), options.nativeControlsForTouch || _this.emitTapEvents(), 3870 _this.constructor && (_this.name_ = _this.constructor.name || "Unknown Tech"), _this; 3871 } 3872 return inherits(Tech, _Component), Tech.prototype.manualProgressOn = function() { 3873 this.on("durationchange", this.onDurationChange), this.manualProgress = !0, this.one("ready", this.trackProgress); 3874 }, Tech.prototype.manualProgressOff = function() { 3875 this.manualProgress = !1, this.stopTrackingProgress(), this.off("durationchange", this.onDurationChange); 3876 }, Tech.prototype.trackProgress = function(event) { 3877 this.stopTrackingProgress(), this.progressInterval = this.setInterval(bind(this, function() { 3878 var numBufferedPercent = this.bufferedPercent(); 3879 this.bufferedPercent_ !== numBufferedPercent && this.trigger("progress"), 1 === (this.bufferedPercent_ = numBufferedPercent) && this.stopTrackingProgress(); 3880 }), 500); 3881 }, Tech.prototype.onDurationChange = function(event) { 3882 this.duration_ = this.duration(); 3883 }, Tech.prototype.buffered = function() { 3884 return createTimeRanges(0, 0); 3885 }, Tech.prototype.bufferedPercent = function() { 3886 return bufferedPercent(this.buffered(), this.duration_); 3887 }, Tech.prototype.stopTrackingProgress = function() { 3888 this.clearInterval(this.progressInterval); 3889 }, Tech.prototype.manualTimeUpdatesOn = function() { 3890 this.manualTimeUpdates = !0, this.on("play", this.trackCurrentTime), this.on("pause", this.stopTrackingCurrentTime); 3891 }, Tech.prototype.manualTimeUpdatesOff = function() { 3892 this.manualTimeUpdates = !1, this.stopTrackingCurrentTime(), this.off("play", this.trackCurrentTime), 3893 this.off("pause", this.stopTrackingCurrentTime); 3894 }, Tech.prototype.trackCurrentTime = function() { 3895 this.currentTimeInterval && this.stopTrackingCurrentTime(), this.currentTimeInterval = this.setInterval(function() { 3896 this.trigger({ 3897 type: "timeupdate", 3898 target: this, 3899 manuallyTriggered: !0 3900 }); 3901 }, 250); 3902 }, Tech.prototype.stopTrackingCurrentTime = function() { 3903 this.clearInterval(this.currentTimeInterval), this.trigger({ 3904 type: "timeupdate", 3905 target: this, 3906 manuallyTriggered: !0 3907 }); 3908 }, Tech.prototype.dispose = function() { 3909 this.clearTracks(NORMAL.names), this.manualProgress && this.manualProgressOff(), 3910 this.manualTimeUpdates && this.manualTimeUpdatesOff(), _Component.prototype.dispose.call(this); 3911 }, Tech.prototype.clearTracks = function(types) { 3912 var _this2 = this; 3913 (types = [].concat(types)).forEach(function(type) { 3914 for (var list = _this2[type + "Tracks"]() || [], i = list.length; i--; ) { 3915 var track = list[i]; 3916 "text" === type && _this2.removeRemoteTextTrack(track), list.removeTrack(track); 3917 } 3918 }); 3919 }, Tech.prototype.cleanupAutoTextTracks = function() { 3920 for (var list = this.autoRemoteTextTracks_ || [], i = list.length; i--; ) { 3921 var track = list[i]; 3922 this.removeRemoteTextTrack(track); 3923 } 3924 }, Tech.prototype.reset = function() {}, Tech.prototype.error = function(err) { 3925 return void 0 !== err && (this.error_ = new MediaError(err), this.trigger("error")), 3926 this.error_; 3927 }, Tech.prototype.played = function() { 3928 return this.hasStarted_ ? createTimeRanges(0, 0) : createTimeRanges(); 3929 }, Tech.prototype.setCurrentTime = function() { 3930 this.manualTimeUpdates && this.trigger({ 3931 type: "timeupdate", 3932 target: this, 3933 manuallyTriggered: !0 3934 }); 3935 }, Tech.prototype.initTrackListeners = function() { 3936 var _this3 = this;
3937 NORMAL.names.forEach(function(name) { 3938 var props = NORMAL[name], trackListChanges = function() { 3939 _this3.trigger(name + "trackchange"); 3940 }, tracks = _this3[props.getterName](); 3941 tracks.addEventListener("removetrack", trackListChanges), tracks.addEventListener("addtrack", trackListChanges), 3942 _this3.on("dispose", function() { 3943 tracks.removeEventListener("removetrack", trackListChanges), tracks.removeEventListener("addtrack", trackListChanges); 3944 }); 3945 }); 3946 }, Tech.prototype.addWebVttScript_ = function() { 3947 var _this4 = this; 3948 if (!window_1.WebVTT) if (document_1.body.contains(this.el())) { 3949 if (!this.options_["vtt.js"] && isPlain(browserIndex) && 0 < Object.keys(browserIndex).length) return void this.trigger("vttjsloaded"); 3950 var script = document_1.createElement("script"); 3951 script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js", 3952 script.onload = function() { 3953 _this4.trigger("vttjsloaded"); 3954 }, script.onerror = function() { 3955 _this4.trigger("vttjserror"); 3956 }, this.on("dispose", function() { 3957 script.onload = null, script.onerror = null; 3958 }), window_1.WebVTT = !0, this.el().parentNode.appendChild(script); 3959 } else this.ready(this.addWebVttScript_); 3960 }, Tech.prototype.emulateTextTracks = function() { 3961 var _this5 = this, tracks = this.textTracks(), remoteTracks = this.remoteTextTracks(), handleAddTrack = function(e) { 3962 return tracks.addTrack(e.track); 3963 }, handleRemoveTrack = function(e) { 3964 return tracks.removeTrack(e.track); 3965 }; 3966 remoteTracks.on("addtrack", handleAddTrack), remoteTracks.on("removetrack", handleRemoveTrack), 3967 this.addWebVttScript_(); 3968 var updateDisplay = function() { 3969 return _this5.trigger("texttrackchange"); 3970 }, textTracksChanges = function() { 3971 updateDisplay(); 3972 for (var i = 0; i < tracks.length; i++) { 3973 var track = tracks[i]; 3974 track.removeEventListener("cuechange", updateDisplay), "showing" === track.mode && track.addEventListener("cuechange", updateDisplay); 3975 } 3976 }; 3977 textTracksChanges(), tracks.addEventListener("change", textTracksChanges), tracks.addEventListener("addtrack", textTracksChanges), 3978 tracks.addEventListener("removetrack", textTracksChanges), this.on("dispose", function() { 3979 remoteTracks.off("addtrack", handleAddTrack), remoteTracks.off("removetrack", handleRemoveTrack), 3980 tracks.removeEventListener("change", textTracksChanges), tracks.removeEventListener("addtrack", textTracksChanges), 3981 tracks.removeEventListener("removetrack", textTracksChanges); 3982 for (var i = 0; i < tracks.length; i++) { 3983 tracks[i].removeEventListener("cuechange", updateDisplay); 3984 } 3985 }); 3986 }, Tech.prototype.addTextTrack = function(kind, label, language) { 3987 if (!kind) throw new Error("TextTrack kind is required but was not provided"); 3988 return function(self, kind, label, language) { 3989 var options = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : {}, tracks = self.textTracks(); 3990 options.kind = kind, label && (options.label = label), language && (options.language = language), 3991 options.tech = self; 3992 var track = new ALL.text.TrackClass(options); 3993 return tracks.addTrack(track), track; 3994 }(this, kind, label, language); 3995 }, Tech.prototype.createRemoteTextTrack = function(options) { 3996 var track = mergeOptions(options, { 3997 tech: this 3998 }); 3999 return new REMOTE.remoteTextEl.TrackClass(track); 4000 }, Tech.prototype.addRemoteTextTrack = function() { 4001 var _this6 = this, options = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, manualCleanup = arguments[1], htmlTrackElement = this.createRemoteTextTrack(options); 4002 return !0 !== manualCleanup && !1 !== manualCleanup && (log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'), 4003 manualCleanup = !0), this.remoteTextTrackEls().addTrackElement_(htmlTrackElement), 4004 this.remoteTextTracks().addTrack(htmlTrackElement.track), !0 !== manualCleanup && this.ready(function() { 4005 return _this6.autoRemoteTextTracks_.addTrack(htmlTrackElement.track); 4006 }), htmlTrackElement; 4007 }, Tech.prototype.removeRemoteTextTrack = function(track) { 4008 var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track); 4009 this.remoteTextTrackEls().removeTrackElement_(trackElement), this.remoteTextTracks().removeTrack(track), 4010 this.autoRemoteTextTracks_.removeTrack(track); 4011 }, Tech.prototype.getVideoPlaybackQuality = function() { 4012 return {}; 4013 }, Tech.prototype.setPoster = function() {}, Tech.prototype.playsinline = function() {}, 4014 Tech.prototype.setPlaysinline = function() {}, Tech.prototype.canPlayType = function() { 4015 return ""; 4016 }, Tech.canPlayType = function() { 4017 return ""; 4018 }, Tech.canPlaySource = function(srcObj, options) { 4019 return Tech.canPlayType(srcObj.type); 4020 }, Tech.isTech = function(component) { 4021 return component.prototype instanceof Tech || component instanceof Tech || component === Tech; 4022 }, Tech.registerTech = function(name, tech) {
4023 if (Tech.techs_ || (Tech.techs_ = {}), !Tech.isTech(tech)) throw new Error("Tech " + name + " must be a Tech"); 4024 if (!Tech.canPlayType) throw new Error("Techs must have a static canPlayType method on them"); 4025 if (!Tech.canPlaySource) throw new Error("Techs must have a static canPlaySource method on them"); 4026 return name = toTitleCase(name), Tech.techs_[name] = tech, "Tech" !== name && Tech.defaultTechOrder_.push(name), 4027 tech; 4028 }, Tech.getTech = function(name) { 4029 if (name) return name = toTitleCase(name), Tech.techs_ && Tech.techs_[name] ? Tech.techs_[name] : window_1 && window_1.videojs && window_1.videojs[name] ? (log$1.warn("The " + name + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"), 4030 window_1.videojs[name]) : void 0; 4031 }, Tech; 4032 }(Component); 4033 ALL.names.forEach(function(name) { 4034 var props = ALL[name]; 4035 Tech.prototype[props.getterName] = function() { 4036 return this[props.privateName] = this[props.privateName] || new props.ListClass(), 4037 this[props.privateName]; 4038 }; 4039 }), Tech.prototype.featuresVolumeControl = !0, Tech.prototype.featuresFullscreenResize = !1, 4040 Tech.prototype.featuresPlaybackRate = !1, Tech.prototype.featuresProgressEvents = !1, 4041 Tech.prototype.featuresTimeupdateEvents = !1, Tech.prototype.featuresNativeTextTracks = !1, 4042 Tech.withSourceHandlers = function(_Tech) { 4043 _Tech.registerSourceHandler = function(handler, index) { 4044 var handlers = _Tech.sourceHandlers; 4045 handlers || (handlers = _Tech.sourceHandlers = []), void 0 === index && (index = handlers.length), 4046 handlers.splice(index, 0, handler); 4047 }, _Tech.canPlayType = function(type) { 4048 for (var handlers = _Tech.sourceHandlers || [], can = void 0, i = 0; i < handlers.length; i++) if (can = handlers[i].canPlayType(type)) return can; 4049 return ""; 4050 }, _Tech.selectSourceHandler = function(source, options) { 4051 for (var handlers = _Tech.sourceHandlers || [], i = 0; i < handlers.length; i++) if (handlers[i].canHandleSource(source, options)) return handlers[i]; 4052 return null; 4053 }, _Tech.canPlaySource = function(srcObj, options) { 4054 var sh = _Tech.selectSourceHandler(srcObj, options); 4055 return sh ? sh.canHandleSource(srcObj, options) : ""; 4056 }; 4057 [ "seekable", "duration" ].forEach(function(fnName) { 4058 var originalFn = this[fnName]; 4059 "function" == typeof originalFn && (this[fnName] = function() { 4060 return this.sourceHandler_ && this.sourceHandler_[fnName] ? this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments) : originalFn.apply(this, arguments); 4061 }); 4062 }, _Tech.prototype), _Tech.prototype.setSource = function(source) { 4063 var sh = _Tech.selectSourceHandler(source, this.options_); 4064 sh || (_Tech.nativeSourceHandler ? sh = _Tech.nativeSourceHandler : log$1.error("No source hander found for the current source.")), 4065 this.disposeSourceHandler(), this.off("dispose", this.disposeSourceHandler), sh !== _Tech.nativeSourceHandler && (this.currentSource_ = source), 4066 this.sourceHandler_ = sh.handleSource(source, this, this.options_), this.on("dispose", this.disposeSourceHandler); 4067 }, _Tech.prototype.disposeSourceHandler = function() { 4068 this.currentSource_ && (this.clearTracks([ "audio", "video" ]), this.currentSource_ = null), 4069 this.cleanupAutoTextTracks(), this.sourceHandler_ && (this.sourceHandler_.dispose && this.sourceHandler_.dispose(), 4070 this.sourceHandler_ = null); 4071 }; 4072 }, Component.registerComponent("Tech", Tech), Tech.registerTech("Tech", Tech), Tech.defaultTechOrder_ = []; 4073 var middlewares = {}, middlewareInstances = {}, TERMINATOR = {}; 4074 function setSource(player, src, next) { 4075 player.setTimeout(function() { 4076 return function setSourceHelper() { 4077 var src = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 4078 var middleware = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; 4079 var next = arguments[2]; 4080 var player = arguments[3]; 4081 var acc = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : []; 4082 var lastRun = 5 < arguments.length && void 0 !== arguments[5] && arguments[5]; 4083 var mwFactory = middleware[0], mwrest = middleware.slice(1); 4084 if ("string" == typeof mwFactory) setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun); else if (mwFactory) { 4085 var mw = function(player, mwFactory) { 4086 var mws = middlewareInstances[player.id()], mw = null; 4087 if (null == mws) return mw = mwFactory(player), middlewareInstances[player.id()] = [ [ mwFactory, mw ] ], 4088 mw; 4089 for (var i = 0; i < mws.length; i++) { 4090 var _mws$i = mws[i], mwf = _mws$i[0], mwi = _mws$i[1]; 4091 mwf === mwFactory && (mw = mwi); 4092 } 4093 null === mw && (mw = mwFactory(player), mws.push([ mwFactory, mw ])); 4094 return mw; 4095 }(player, mwFactory); 4096 mw.setSource(assign({}, src), function(err, _src) { 4097 if (err) return setSourceHelper(src, mwrest, next, player, acc, lastRun); 4098 acc.push(mw), setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun); 4099 }); 4100 } else mwrest.length ? setSourceHelper(src, mwrest, next, player, acc, lastRun) : lastRun ? next(src, acc) : setSourceHelper(src, middlewares["*"], next, player, acc, !0); 4101 }(src, middlewares[src.type], next, player); 4102 }, 1); 4103 } 4104 function mediate(middleware, tech, method) { 4105 var arg = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null, callMethod = "call" + toTitleCase(method), middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg), terminated = middlewareValue === TERMINATOR, returnValue = terminated ? null : tech[method](middlewareValue); 4106 return function(mws, method, value, terminated) { 4107 for (var i = mws.length - 1; 0 <= i; i--) { 4108 var mw = mws[i]; 4109 mw[method] && mw[method](terminated, value); 4110 } 4111 }(middleware, method, returnValue, terminated), returnValue; 4112 } 4113 var allowedGetters = { 4114 buffered: 1, 4115 currentTime: 1, 4116 duration: 1, 4117 seekable: 1, 4118 played: 1, 4119 paused: 1 4120 }, allowedSetters = { 4121 setCurrentTime: 1 4122 }, allowedMediators = { 4123 play: 1, 4124 pause: 1 4125 }; 4126 function middlewareIterator(method) { 4127 return function(value, mw) { 4128 return value === TERMINATOR ? TERMINATOR : mw[method] ? mw[method](value) : value; 4129 }; 4130 } 4131 var MediaLoader = function(_Component) { 4132 function MediaLoader(player, options, ready) { 4133 classCallCheck(this, MediaLoader); 4134 var options_ = mergeOptions({ 4135 createEl: !1 4136 }, options), _this = possibleConstructorReturn(this, _Component.call(this, player, options_, ready)); 4137 if (options.playerOptions.sources && 0 !== options.playerOptions.sources.length) player.src(options.playerOptions.sources); else for (var i = 0, j = options.playerOptions.techOrder; i < j.length; i++) { 4138 var techName = toTitleCase(j[i]), tech = Tech.getTech(techName); 4139 if (techName || (tech = Component.getComponent(techName)), tech && tech.isSupported()) { 4140 player.loadTech_(techName); 4141 break; 4142 } 4143 } 4144 return _this; 4145 } 4146 return inherits(MediaLoader, _Component), MediaLoader; 4147 }(Component); 4148 Component.registerComponent("MediaLoader", MediaLoader); 4149 var ClickableComponent = function(_Component) { 4150 function ClickableComponent(player, options) { 4151 classCallCheck(this, ClickableComponent); 4152 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4153 return _this.emitTapEvents(), _this.enable(), _this; 4154 }
4155 return inherits(ClickableComponent, _Component), ClickableComponent.prototype.createEl = function() { 4156 var tag = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "div", props = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, attributes = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; 4157 props = assign({ 4158 innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>', 4159 className: this.buildCSSClass(), 4160 tabIndex: 0 4161 }, props), "button" === tag && log$1.error("Creating a ClickableComponent with an HTML element of " + tag + " is not supported; use a Button instead."), 4162 attributes = assign({ 4163 role: "button", 4164 "aria-live": "polite" 4165 }, attributes), this.tabIndex_ = props.tabIndex; 4166 var el = _Component.prototype.createEl.call(this, tag, props, attributes); 4167 return this.createControlTextEl(el), el; 4168 }, ClickableComponent.prototype.dispose = function() { 4169 this.controlTextEl_ = null, _Component.prototype.dispose.call(this); 4170 }, ClickableComponent.prototype.createControlTextEl = function(el) { 4171 return this.controlTextEl_ = createEl("span", { 4172 className: "vjs-control-text" 4173 }), el && el.appendChild(this.controlTextEl_), this.controlText(this.controlText_, el), 4174 this.controlTextEl_; 4175 }, ClickableComponent.prototype.controlText = function(text) { 4176 var el = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.el(); 4177 if (void 0 === text) return this.controlText_ || "Need Text"; 4178 var localizedText = this.localize(text); 4179 this.controlText_ = text, textContent(this.controlTextEl_, localizedText), this.nonIconControl || el.setAttribute("title", localizedText); 4180 }, ClickableComponent.prototype.buildCSSClass = function() { 4181 return "vjs-control vjs-button " + _Component.prototype.buildCSSClass.call(this); 4182 }, ClickableComponent.prototype.enable = function() { 4183 this.enabled_ || (this.enabled_ = !0, this.removeClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "false"), 4184 void 0 !== this.tabIndex_ && this.el_.setAttribute("tabIndex", this.tabIndex_), 4185 this.on([ "tap", "click" ], this.handleClick), this.on("focus", this.handleFocus), 4186 this.on("blur", this.handleBlur)); 4187 }, ClickableComponent.prototype.disable = function() { 4188 this.enabled_ = !1, this.addClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "true"), 4189 void 0 !== this.tabIndex_ && this.el_.removeAttribute("tabIndex"), this.off([ "tap", "click" ], this.handleClick), 4190 this.off("focus", this.handleFocus), this.off("blur", this.handleBlur); 4191 }, ClickableComponent.prototype.handleClick = function(event) {}, ClickableComponent.prototype.handleFocus = function(event) { 4192 on(document_1, "keydown", bind(this, this.handleKeyPress)); 4193 }, ClickableComponent.prototype.handleKeyPress = function(event) { 4194 32 === event.which || 13 === event.which ? (event.preventDefault(), this.trigger("click")) : _Component.prototype.handleKeyPress && _Component.prototype.handleKeyPress.call(this, event); 4195 }, ClickableComponent.prototype.handleBlur = function(event) { 4196 off(document_1, "keydown", bind(this, this.handleKeyPress)); 4197 }, ClickableComponent; 4198 }(Component); 4199 Component.registerComponent("ClickableComponent", ClickableComponent); 4200 var PosterImage = function(_ClickableComponent) { 4201 function PosterImage(player, options) { 4202 classCallCheck(this, PosterImage); 4203 var _this = possibleConstructorReturn(this, _ClickableComponent.call(this, player, options)); 4204 return _this.update(), player.on("posterchange", bind(_this, _this.update)), _this; 4205 } 4206 return inherits(PosterImage, _ClickableComponent), PosterImage.prototype.dispose = function() { 4207 this.player().off("posterchange", this.update), _ClickableComponent.prototype.dispose.call(this); 4208 }, PosterImage.prototype.createEl = function() { 4209 var el = createEl("div", { 4210 className: "vjs-poster", 4211 tabIndex: -1 4212 }); 4213 return BACKGROUND_SIZE_SUPPORTED || (this.fallbackImg_ = createEl("img"), el.appendChild(this.fallbackImg_)), 4214 el; 4215 }, PosterImage.prototype.update = function(event) { 4216 var url = this.player().poster(); 4217 this.setSrc(url), url ? this.show() : this.hide(); 4218 }, PosterImage.prototype.setSrc = function(url) { 4219 if (this.fallbackImg_) this.fallbackImg_.src = url; else { 4220 var backgroundImage = ""; 4221 url && (backgroundImage = 'url("' + url + '")'), this.el_.style.backgroundImage = backgroundImage; 4222 } 4223 }, PosterImage.prototype.handleClick = function(event) { 4224 this.player_.controls() && (this.player_.paused() ? this.player_.play() : this.player_.pause()); 4225 }, PosterImage; 4226 }(ClickableComponent); 4227 Component.registerComponent("PosterImage", PosterImage); 4228 var fontMap = { 4229 monospace: "monospace", 4230 sansSerif: "sans-serif", 4231 serif: "serif", 4232 monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace', 4233 monospaceSerif: '"Courier New", monospace', 4234 proportionalSansSerif: "sans-serif", 4235 proportionalSerif: "serif",
4236 casual: '"Comic Sans MS", Impact, fantasy', 4237 script: '"Monotype Corsiva", cursive', 4238 smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif' 4239 }; 4240 function constructColor(color, opacity) { 4241 return "rgba(" + parseInt(color[1] + color[1], 16) + "," + parseInt(color[2] + color[2], 16) + "," + parseInt(color[3] + color[3], 16) + "," + opacity + ")"; 4242 } 4243 function tryUpdateStyle(el, style, rule) { 4244 try { 4245 el.style[style] = rule; 4246 } catch (e) { 4247 return; 4248 } 4249 } 4250 var TextTrackDisplay = function(_Component) { 4251 function TextTrackDisplay(player, options, ready) { 4252 classCallCheck(this, TextTrackDisplay); 4253 var _this = possibleConstructorReturn(this, _Component.call(this, player, options, ready)); 4254 return player.on("loadstart", bind(_this, _this.toggleDisplay)), player.on("texttrackchange", bind(_this, _this.updateDisplay)), 4255 player.on("loadstart", bind(_this, _this.preselectTrack)), player.ready(bind(_this, function() { 4256 if (player.tech_ && player.tech_.featuresNativeTextTracks) this.hide(); else { 4257 player.on("fullscreenchange", bind(this, this.updateDisplay)); 4258 for (var tracks = this.options_.playerOptions.tracks || [], i = 0; i < tracks.length; i++) this.player_.addRemoteTextTrack(tracks[i], !0); 4259 this.preselectTrack(); 4260 } 4261 })), _this; 4262 } 4263 return inherits(TextTrackDisplay, _Component), TextTrackDisplay.prototype.preselectTrack = function() { 4264 for (var modes = { 4265 captions: 1, 4266 subtitles: 1 4267 }, trackList = this.player_.textTracks(), userPref = this.player_.cache_.selectedLanguage, firstDesc = void 0, firstCaptions = void 0, preferredTrack = void 0, i = 0; i < trackList.length; i++) { 4268 var track = trackList[i]; 4269 userPref && userPref.enabled && userPref.language === track.language ? track.kind === userPref.kind ? preferredTrack = track : preferredTrack || (preferredTrack = track) : userPref && !userPref.enabled ? firstCaptions = firstDesc = preferredTrack = null : track.default && ("descriptions" !== track.kind || firstDesc ? track.kind in modes && !firstCaptions && (firstCaptions = track) : firstDesc = track); 4270 } 4271 preferredTrack ? preferredTrack.mode = "showing" : firstCaptions ? firstCaptions.mode = "showing" : firstDesc && (firstDesc.mode = "showing"); 4272 }, TextTrackDisplay.prototype.toggleDisplay = function() { 4273 this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show(); 4274 }, TextTrackDisplay.prototype.createEl = function() { 4275 return _Component.prototype.createEl.call(this, "div", { 4276 className: "vjs-text-track-display" 4277 }, { 4278 "aria-live": "off", 4279 "aria-atomic": "true" 4280 }); 4281 }, TextTrackDisplay.prototype.clearDisplay = function() { 4282 "function" == typeof window_1.WebVTT && window_1.WebVTT.processCues(window_1, [], this.el_); 4283 }, TextTrackDisplay.prototype.updateDisplay = function() { 4284 var tracks = this.player_.textTracks(); 4285 this.clearDisplay(); 4286 for (var descriptionsTrack = null, captionsSubtitlesTrack = null, i = tracks.length; i--; ) { 4287 var track = tracks[i]; 4288 "showing" === track.mode && ("descriptions" === track.kind ? descriptionsTrack = track : captionsSubtitlesTrack = track); 4289 } 4290 captionsSubtitlesTrack ? ("off" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "off"), 4291 this.updateForTrack(captionsSubtitlesTrack)) : descriptionsTrack && ("assertive" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "assertive"), 4292 this.updateForTrack(descriptionsTrack)); 4293 }, TextTrackDisplay.prototype.updateForTrack = function(track) { 4294 if ("function" == typeof window_1.WebVTT && track.activeCues) { 4295 for (var overrides = this.player_.textTrackSettings.getValues(), cues = [], _i = 0; _i < track.activeCues.length; _i++) cues.push(track.activeCues[_i]); 4296 window_1.WebVTT.processCues(window_1, cues, this.el_); 4297 for (var i = cues.length; i--; ) { 4298 var cue = cues[i]; 4299 if (cue) { 4300 var cueDiv = cue.displayState; 4301 if (overrides.color && (cueDiv.firstChild.style.color = overrides.color), overrides.textOpacity && tryUpdateStyle(cueDiv.firstChild, "color", constructColor(overrides.color || "#fff", overrides.textOpacity)), 4302 overrides.backgroundColor && (cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor), 4303 overrides.backgroundOpacity && tryUpdateStyle(cueDiv.firstChild, "backgroundColor", constructColor(overrides.backgroundColor || "#000", overrides.backgroundOpacity)), 4304 overrides.windowColor && (overrides.windowOpacity ? tryUpdateStyle(cueDiv, "backgroundColor", constructColor(overrides.windowColor, overrides.windowOpacity)) : cueDiv.style.backgroundColor = overrides.windowColor), 4305 overrides.edgeStyle && ("dropshadow" === overrides.edgeStyle ? cueDiv.firstChild.style.textShadow = "2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222" : "raised" === overrides.edgeStyle ? cueDiv.firstChild.style.textShadow = "1p
4305x 1px #222, 2px 2px #222, 3px 3px #222" : "depressed" === overrides.edgeStyle ? cueDiv.firstChild.style.textShadow = "1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222" : "uniform" === overrides.edgeStyle && (cueDiv.firstChild.style.textShadow = "0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")), 4306 overrides.fontPercent && 1 !== overrides.fontPercent) { 4307 var fontSize = window_1.parseFloat(cueDiv.style.fontSize); 4308 cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px", cueDiv.style.height = "auto", 4309 cueDiv.style.top = "auto", cueDiv.style.bottom = "2px"; 4310 } 4311 overrides.fontFamily && "default" !== overrides.fontFamily && ("small-caps" === overrides.fontFamily ? cueDiv.firstChild.style.fontVariant = "small-caps" : cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily]); 4312 } 4313 } 4314 } 4315 }, TextTrackDisplay; 4316 }(Component); 4317 Component.registerComponent("TextTrackDisplay", TextTrackDisplay); 4318 var LoadingSpinner = function(_Component) { 4319 function LoadingSpinner() { 4320 return classCallCheck(this, LoadingSpinner), possibleConstructorReturn(this, _Component.apply(this, arguments)); 4321 } 4322 return inherits(LoadingSpinner, _Component), LoadingSpinner.prototype.createEl = function() { 4323 var isAudio = this.player_.isAudio(), playerType = this.localize(isAudio ? "Audio Player" : "Video Player"), controlText = createEl("span", { 4324 className: "vjs-control-text", 4325 innerHTML: this.localize("{1} is loading.", [ playerType ]) 4326 }), el = _Component.prototype.createEl.call(this, "div", { 4327 className: "vjs-loading-spinner", 4328 dir: "ltr" 4329 }); 4330 return el.appendChild(controlText), el; 4331 }, LoadingSpinner; 4332 }(Component); 4333 Component.registerComponent("LoadingSpinner", LoadingSpinner); 4334 var Button = function(_ClickableComponent) { 4335 function Button() { 4336 return classCallCheck(this, Button), possibleConstructorReturn(this, _ClickableComponent.apply(this, arguments)); 4337 } 4338 return inherits(Button, _ClickableComponent), Button.prototype.createEl = function(tag) { 4339 var props = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, attributes = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; 4340 props = assign({ 4341 innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>', 4342 className: this.buildCSSClass() 4343 }, props), attributes = assign({ 4344 type: "button", 4345 "aria-live": "polite" 4346 }, attributes); 4347 var el = Component.prototype.createEl.call(this, "button", props, attributes); 4348 return this.createControlTextEl(el), el; 4349 }, Button.prototype.addChild = function(child) { 4350 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, className = this.constructor.name; 4351 return log$1.warn("Adding an actionable (user controllable) child to a Button (" + className + ") is not supported; use a ClickableComponent instead."), 4352 Component.prototype.addChild.call(this, child, options); 4353 }, Button.prototype.enable = function() { 4354 _ClickableComponent.prototype.enable.call(this), this.el_.removeAttribute("disabled"); 4355 }, Button.prototype.disable = function() { 4356 _ClickableComponent.prototype.disable.call(this), this.el_.setAttribute("disabled", "disabled"); 4357 }, Button.prototype.handleKeyPress = function(event) { 4358 32 !== event.which && 13 !== event.which && _ClickableComponent.prototype.handleKeyPress.call(this, event); 4359 }, Button; 4360 }(ClickableComponent); 4361 Component.registerComponent("Button", Button); 4362 var BigPlayButton = function(_Button) { 4363 function BigPlayButton(player, options) { 4364 classCallCheck(this, BigPlayButton); 4365 var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); 4366 return _this.mouseused_ = !1, _this.on("mousedown", _this.handleMouseDown), _this; 4367 } 4368 return inherits(BigPlayButton, _Button), BigPlayButton.prototype.buildCSSClass = function() { 4369 return "vjs-big-play-button"; 4370 }, BigPlayButton.prototype.handleClick = function(event) {
4371 var playPromise = this.player_.play(); 4372 if (!(this.mouseused_ && event.clientX && event.clientY)) { 4373 var cb = this.player_.getChild("controlBar"), playToggle = cb && cb.getChild("playToggle"); 4374 if (playToggle) { 4375 var playFocus = function() { 4376 return playToggle.focus(); 4377 }; 4378 isPromise(playPromise) ? playPromise.then(playFocus, function() {}) : this.setTimeout(playFocus, 1); 4379 } else this.player_.focus(); 4380 } 4381 }, BigPlayButton.prototype.handleKeyPress = function(event) { 4382 this.mouseused_ = !1, _Button.prototype.handleKeyPress.call(this, event); 4383 }, BigPlayButton.prototype.handleMouseDown = function(event) { 4384 this.mouseused_ = !0; 4385 }, BigPlayButton; 4386 }(Button); 4387 BigPlayButton.prototype.controlText_ = "Play Video", Component.registerComponent("BigPlayButton", BigPlayButton); 4388 var CloseButton = function(_Button) { 4389 function CloseButton(player, options) { 4390 classCallCheck(this, CloseButton); 4391 var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); 4392 return _this.controlText(options && options.controlText || _this.localize("Close")), 4393 _this; 4394 } 4395 return inherits(CloseButton, _Button), CloseButton.prototype.buildCSSClass = function() { 4396 return "vjs-close-button " + _Button.prototype.buildCSSClass.call(this); 4397 }, CloseButton.prototype.handleClick = function(event) { 4398 this.trigger({ 4399 type: "close", 4400 bubbles: !1 4401 }); 4402 }, CloseButton; 4403 }(Button); 4404 Component.registerComponent("CloseButton", CloseButton); 4405 var PlayToggle = function(_Button) { 4406 function PlayToggle(player, options) { 4407 classCallCheck(this, PlayToggle); 4408 var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); 4409 return _this.on(player, "play", _this.handlePlay), _this.on(player, "pause", _this.handlePause), 4410 _this.on(player, "ended", _this.handleEnded), _this; 4411 } 4412 return inherits(PlayToggle, _Button), PlayToggle.prototype.buildCSSClass = function() { 4413 return "vjs-play-control " + _Button.prototype.buildCSSClass.call(this); 4414 }, PlayToggle.prototype.handleClick = function(event) { 4415 this.player_.paused() ? this.player_.play() : this.player_.pause(); 4416 }, PlayToggle.prototype.handleSeeked = function(event) { 4417 this.removeClass("vjs-ended"), this.player_.paused() ? this.handlePause(event) : this.handlePlay(event); 4418 }, PlayToggle.prototype.handlePlay = function(event) { 4419 this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), 4420 this.controlText("Pause"); 4421 }, PlayToggle.prototype.handlePause = function(event) { 4422 this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.controlText("Play"); 4423 }, PlayToggle.prototype.handleEnded = function(event) { 4424 this.removeClass("vjs-playing"), this.addClass("vjs-ended"), this.controlText("Replay"), 4425 this.one(this.player_, "seeked", this.handleSeeked); 4426 }, PlayToggle; 4427 }(Button); 4428 function formatTime(seconds) { 4429 var guide = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : seconds; 4430 seconds = seconds < 0 ? 0 : seconds; 4431 var s = Math.floor(seconds % 60), m = Math.floor(seconds / 60 % 60), h = Math.floor(seconds / 3600), gm = Math.floor(guide / 60 % 60), gh = Math.floor(guide / 3600); 4432 return (isNaN(seconds) || seconds === 1 / 0) && (h = m = s = "-"), (h = 0 < h || 0 < gh ? h + ":" : "") + (m = ((h || 10 <= gm) && m < 10 ? "0" + m : m) + ":") + (s = s < 10 ? "0" + s : s); 4433 } 4434 PlayToggle.prototype.controlText_ = "Play", Component.registerComponent("PlayToggle", PlayToggle); 4435 var TimeDisplay = function(_Component) { 4436 function TimeDisplay(player, options) { 4437 classCallCheck(this, TimeDisplay); 4438 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4439 return _this.throttledUpdateContent = throttle(bind(_this, _this.updateContent), 25), 4440 _this.on(player, "timeupdate", _this.throttledUpdateContent), _this; 4441 } 4442 return inherits(TimeDisplay, _Component), TimeDisplay.prototype.createEl = function(plainName) { 4443 var className = this.buildCSSClass(), el = _Component.prototype.createEl.call(this, "div", { 4444 className: className + " vjs-time-control vjs-control" 4445 }); 4446 return this.contentEl_ = createEl("div", { 4447 className: className + "-display" 4448 }, { 4449 "aria-live": "off" 4450 }, createEl("span", { 4451 className: "vjs-control-text", 4452 textContent: this.localize(this.controlText_) 4453 })), this.updateTextNode_(), el.appendChild(this.contentEl_), el; 4454 }, TimeDisplay.prototype.dispose = function() { 4455 this.contentEl_ = null, this.textNode_ = null, _Component.prototype.dispose.call(this); 4456 }, TimeDisplay.prototype.updateTextNode_ = function() { 4457 if (this.contentEl_) { 4458 for (;this.contentEl_.firstChild; ) this.contentEl_.removeChild(this.contentEl_.firstChild); 4459 this.textNode_ = document_1.createTextNode(this.formattedTime_ || "0:00"), this.contentEl_.appendChild(this.textNode_); 4460 } 4461 }, TimeDisplay.prototype.formatTime_ = function(time) { 4462 return formatTime(time); 4463 }, TimeDisplay.prototype.updateFormattedTime_ = function(time) { 4464 var formattedTime = this.formatTime_(time); 4465 formattedTime !== this.formattedTime_ && (this.formattedTime_ = formattedTime, this.requestAnimationFrame(this.updateTextNode_)); 4466 }, TimeDisplay.prototype.updateContent = function(event) {}, TimeDisplay; 4467 }(Component); 4468 TimeDisplay.prototype.controlText_ = "Time", Component.registerComponent("TimeDisplay", TimeDisplay); 4469 var CurrentTimeDisplay = function(_TimeDisplay) { 4470 function CurrentTimeDisplay(player, options) { 4471 classCallCheck(this, CurrentTimeDisplay); 4472 var _this = possibleConstructorReturn(this, _TimeDisplay.call(this, player, options)); 4473 return _this.on(player, "ended", _this.handleEnded), _this; 4474 } 4475 return inherits(CurrentTimeDisplay, _TimeDisplay), CurrentTimeDisplay.prototype.buildCSSClass = function() { 4476 return "vjs-current-time"; 4477 }, CurrentTimeDisplay.prototype.updateContent = function(event) { 4478 var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); 4479 this.updateFormattedTime_(time); 4480 }, CurrentTimeDisplay.prototype.handleEnded = function(event) { 4481 this.player_.duration() && this.updateFormattedTime_(this.player_.duration()); 4482 }, CurrentTimeDisplay; 4483 }(TimeDisplay); 4484 CurrentTimeDisplay.prototype.controlText_ = "Current Time", Component.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay); 4485 var DurationDisplay = function(_TimeDisplay) { 4486 function DurationDisplay(player, options) { 4487 classCallCheck(this, DurationDisplay); 4488 var _this = possibleConstructorReturn(this, _TimeDisplay.call(this, player, options)); 4489 return _this.on(player, "durationchange", _this.updateContent), _this.on(player, "loadedmetadata", _this.throttledUpdateContent), 4490 _this; 4491 } 4492 return inherits(DurationDisplay, _TimeDisplay), DurationDisplay.prototype.buildCSSClass = function() { 4493 return "vjs-duration"; 4494 }, DurationDisplay.prototype.updateContent = function(event) { 4495 var duration = this.player_.duration(); 4496 duration && this.duration_ !== duration && (this.duration_ = duration, this.updateFormattedTime_(duration)); 4497 }, DurationDisplay; 4498 }(TimeDisplay); 4499 DurationDisplay.prototype.controlText_ = "Duration Time", Component.registerComponent("DurationDisplay", DurationDisplay); 4500 var TimeDivider = function(_Component) { 4501 function TimeDivider() { 4502 return classCallCheck(this, TimeDivider), possibleConstructorReturn(this, _Component.apply(this, arguments)); 4503 } 4504 return inherits(TimeDivider, _Component), TimeDivider.prototype.createEl = function() { 4505 return _Component.prototype.createEl.call(this, "div", { 4506 className: "vjs-time-control vjs-time-divider", 4507 innerHTML: "<div><span>/</span></div>" 4508 }); 4509 }, TimeDivider; 4510 }(Component); 4511 Component.registerComponent("TimeDivider", TimeDivider); 4512 var RemainingTimeDisplay = function(_TimeDisplay) { 4513 function RemainingTimeDisplay(player, options) { 4514 classCallCheck(this, RemainingTimeDisplay); 4515 var _this = possibleConstructorReturn(this, _TimeDisplay.call(this, player, options)); 4516 return _this.on(player, "durationchange", _this.throttledUpdateContent), _this.on(player, "ended", _this.handleEnded), 4517 _this; 4518 } 4519 return inherits(RemainingTimeDisplay, _TimeDisplay), RemainingTimeDisplay.prototype.buildCSSClass = function() { 4520 return "vjs-remaining-time"; 4521 }, RemainingTimeDisplay.prototype.formatTime_ = function(time) { 4522 return "-" + _TimeDisplay.prototype.formatTime_.call(this, time); 4523 }, RemainingTimeDisplay.prototype.updateContent = function(event) { 4524 this.player_.duration() && (this.player_.remainingTimeDisplay ? this.updateFormattedTime_(this.player_.remainingTimeDisplay()) : this.updateFormattedTime_(this.player_.remainingTime())); 4525 }, RemainingTimeDisplay.prototype.handleEnded = function(event) { 4526 this.player_.duration() && this.updateFormattedTime_(0); 4527 }, RemainingTimeDisplay; 4528 }(TimeDisplay); 4529 RemainingTimeDisplay.prototype.controlText_ = "Remaining Time", Component.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay); 4530 var LiveDisplay = function(_Component) { 4531 function LiveDisplay(player, options) { 4532 classCallCheck(this, LiveDisplay); 4533 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4534 return _this.updateShowing(), _this.on(_this.player(), "durationchange", _this.updateShowing), 4535 _this; 4536 } 4537 return inherits(LiveDisplay, _Component), LiveDisplay.prototype.createEl = function() { 4538 var el = _Component.prototype.createEl.call(this, "div", { 4539 className: "vjs-live-control vjs-control" 4540 }); 4541 return this.contentEl_ = createEl("div", { 4542 className: "vjs-live-display", 4543 innerHTML: '<span class="vjs-control-text">' + this.localize("Stream Type") + "</span>" + this.localize("LIVE") 4544 }, { 4545 "aria-live": "off" 4546 }), el.appendChild(this.contentEl_), el; 4547 }, LiveDisplay.prototype.dispose = function() { 4548 this.contentEl_ = null, _Component.prototype.dispose.call(this); 4549 }, LiveDisplay.prototype.updateShowing = function(event) { 4550 this.player().duration() === 1 / 0 ? this.show() : this.hide(); 4551 }, LiveDisplay; 4552 }(Component); 4553 Component.registerComponent("LiveDisplay", LiveDisplay); 4554 var Slider = function(_Component) { 4555 function Slider(player, options) { 4556 classCallCheck(this, Slider); 4557 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4558 return _this.bar = _this.getChild(_this.options_.barName), _this.vertical(!!_this.options_.vertical), 4559 _this.enable(), _this; 4560 } 4561 return inherits(Slider, _Component), Slider.prototype.enabled = function() { 4562 return this.enabled_; 4563 }, Slider.prototype.enable = function() { 4564 this.enabled() || (this.on("mousedown", this.handleMouseDown), this.on("touchstart", this.handleMouseDown), 4565 this.on("focus", this.handleFocus), this.on("blur", this.handleBlur), this.on("click", this.handleClick), 4566 this.on(this.player_, "controlsvisible", this.update), this.playerEvent && this.on(this.player_, this.playerEvent, this.update), 4567 this.removeClass("disabled"), this.setAttribute("tabindex", 0), this.enabled_ = !0); 4568 }, Slider.prototype.disable = function() { 4569 if (this.enabled()) { 4570 var doc = this.bar.el_.ownerDocument; 4571 this.off("mousedown", this.handleMouseDown), this.off("touchstart", this.handleMouseDown), 4572 this.off("focus", this.handleFocus), this.off("blur", this.handleBlur), this.off("click", this.handleClick), 4573 this.off(this.player_, "controlsvisible", this.update), this.off(doc, "mousemove", this.handleMouseMove), 4574 this.off(doc, "mouseup", this.handleMouseUp), this.off(doc, "touchmove", this.handleMouseMove), 4575 this.off(doc, "touchend", this.handleMouseUp), this.removeAttribute("tabindex"), 4576 this.addClass("disabled"), this.playerEvent && this.off(this.player_, this.playerEvent, this.update), 4577 this.enabled_ = !1; 4578 } 4579 }, Slider.prototype.createEl = function(type) { 4580 var props = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, attributes = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; 4581 return props.className = props.className + " vjs-slider", props = assign({ 4582 tabIndex: 0 4583 }, props), attributes = assign({ 4584 role: "slider", 4585 "aria-valuenow": 0, 4586 "aria-valuemin": 0, 4587 "aria-valuemax": 100, 4588 tabIndex: 0 4589 }, attributes), _Component.prototype.createEl.call(this, type, props, attributes); 4590 }, Slider.prototype.handleMouseDown = function(event) { 4591 var doc = this.bar.el_.ownerDocument; 4592 event.preventDefault(), blockTextSelection(), this.addClass("vjs-sliding"), this.trigger("slideractive"), 4593 this.on(doc, "mousemove", this.handleMouseMove), this.on(doc, "mouseup", this.handleMouseUp), 4594 this.on(doc, "touchmove", this.handleMouseMove), this.on(doc, "touchend", this.handleMouseUp), 4595 this.handleMouseMove(event); 4596 }, Slider.prototype.handleMouseMove = function(event) {}, Slider.prototype.handleMouseUp = function() { 4597 var doc = this.bar.el_.ownerDocument; 4598 unblockTextSelection(), this.removeClass("vjs-sliding"), this.trigger("sliderinactive"), 4599 this.off(doc, "mousemove", this.handleMouseMove), this.off(doc, "mouseup", this.handleMouseUp), 4600 this.off(doc, "touchmove", this.handleMouseMove), this.off(doc, "touchend", this.handleMouseUp), 4601 this.update(); 4602 }, Slider.prototype.update = function() { 4603 if (this.el_) { 4604 var progress = this.getPercent(), bar = this.bar; 4605 if (bar) { 4606 ("number" != typeof progress || progress != progress || progress < 0 || progress === 1 / 0) && (progress = 0); 4607 var percentage = (100 * progress).toFixed(2) + "%", style = bar.el().style; 4608 return this.vertical() ? style.height = percentage : style.width = percentage, progress; 4609 } 4610 } 4611 }, Slider.prototype.calculateDistance = function(event) { 4612 var position = getPointerPosition(this.el_, event); 4613 return this.vertical() ? position.y : position.x; 4614 }, Slider.prototype.handleFocus = function() { 4615 this.on(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress); 4616 }, Slider.prototype.handleKeyPress = function(event) { 4617 37 === event.which || 40 === event.which ? (event.preventDefault(), this.stepBack()) : 38 !== event.which && 39 !== event.which || (event.preventDefault(), 4618 this.stepForward()); 4619 }, Slider.prototype.handleBlur = function() { 4620 this.off(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress); 4621
4621 }, Slider.prototype.handleClick = function(event) { 4622 event.stopImmediatePropagation(), event.preventDefault(); 4623 }, Slider.prototype.vertical = function(bool) { 4624 if (void 0 === bool) return this.vertical_ || !1; 4625 this.vertical_ = !!bool, this.vertical_ ? this.addClass("vjs-slider-vertical") : this.addClass("vjs-slider-horizontal"); 4626 }, Slider; 4627 }(Component); 4628 Component.registerComponent("Slider", Slider); 4629 var LoadProgressBar = function(_Component) { 4630 function LoadProgressBar(player, options) { 4631 classCallCheck(this, LoadProgressBar); 4632 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4633 return _this.partEls_ = [], _this.on(player, "progress", _this.update), _this; 4634 } 4635 return inherits(LoadProgressBar, _Component), LoadProgressBar.prototype.createEl = function() { 4636 return _Component.prototype.createEl.call(this, "div", { 4637 className: "vjs-load-progress", 4638 innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Loaded") + "</span>: 0%</span>" 4639 }); 4640 }, LoadProgressBar.prototype.dispose = function() { 4641 this.partEls_ = null, _Component.prototype.dispose.call(this); 4642 }, LoadProgressBar.prototype.update = function(event) { 4643 var buffered = this.player_.buffered(), duration = this.player_.duration(), bufferedEnd = this.player_.bufferedEnd(), children = this.partEls_, percentify = function(time, end) { 4644 var percent = time / end || 0; 4645 return 100 * (1 <= percent ? 1 : percent) + "%"; 4646 }; 4647 this.el_.style.width = percentify(bufferedEnd, duration); 4648 for (var i = 0; i < buffered.length; i++) { 4649 var start = buffered.start(i), end = buffered.end(i), part = children[i]; 4650 part || (part = this.el_.appendChild(createEl()), children[i] = part), part.style.left = percentify(start, bufferedEnd), 4651 part.style.width = percentify(end - start, bufferedEnd); 4652 } 4653 for (var _i = children.length; _i > buffered.length; _i--) this.el_.removeChild(children[_i - 1]); 4654 children.length = buffered.length; 4655 }, LoadProgressBar; 4656 }(Component); 4657 Component.registerComponent("LoadProgressBar", LoadProgressBar); 4658 var TimeTooltip = function(_Component) { 4659 function TimeTooltip() { 4660 return classCallCheck(this, TimeTooltip), possibleConstructorReturn(this, _Component.apply(this, arguments)); 4661 } 4662 return inherits(TimeTooltip, _Component), TimeTooltip.prototype.createEl = function() { 4663 return _Component.prototype.createEl.call(this, "div", { 4664 className: "vjs-time-tooltip" 4665 }); 4666 }, TimeTooltip.prototype.update = function(seekBarRect, seekBarPoint, content) { 4667 var tooltipRect = getBoundingClientRect(this.el_), playerRect = getBoundingClientRect(this.player_.el()), seekBarPointPx = seekBarRect.width * seekBarPoint; 4668 if (playerRect && tooltipRect) { 4669 var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx, spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right), pullTooltipBy = tooltipRect.width / 2; 4670 spaceLeftOfPoint < pullTooltipBy ? pullTooltipBy += pullTooltipBy - spaceLeftOfPoint : spaceRightOfPoint < pullTooltipBy && (pullTooltipBy = spaceRightOfPoint), 4671 pullTooltipBy < 0 ? pullTooltipBy = 0 : pullTooltipBy > tooltipRect.width && (pullTooltipBy = tooltipRect.width), 4672 this.el_.style.right = "-" + pullTooltipBy + "px", textContent(this.el_, content); 4673 } 4674 }, TimeTooltip; 4675 }(Component); 4676 Component.registerComponent("TimeTooltip", TimeTooltip); 4677 var PlayProgressBar = function(_Component) { 4678 function PlayProgressBar() { 4679 return classCallCheck(this, PlayProgressBar), possibleConstructorReturn(this, _Component.apply(this, arguments)); 4680 } 4681 return inherits(PlayProgressBar, _Component), PlayProgressBar.prototype.createEl = function() { 4682 return _Component.prototype.createEl.call(this, "div", { 4683 className: "vjs-play-progress vjs-slider-bar", 4684 innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Progress") + "</span>: 0%</span>" 4685 }); 4686 }, PlayProgressBar.prototype.update = function(seekBarRect, seekBarPoint) { 4687 var _this2 = this; 4688 this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() { 4689 var content = formatTime(_this2.player_.scrubbing() ? _this2.player_.getCache().currentTime : _this2.player_.currentTime(), _this2.player_.duration()), timeTooltip = _this2.getChild("timeTooltip"); 4690 timeTooltip && timeTooltip.update(seekBarRect, seekBarPoint, content); 4691 }); 4692 }, PlayProgressBar; 4693 }(Component); 4694 PlayProgressBar.prototype.options_ = { 4695 children: [] 4696 }, IE_VERSION && !(8 < IE_VERSION) || IS_IOS || IS_ANDROID || PlayProgressBar.prototype.options_.children.push("timeTooltip"), 4697 Component.registerComponent("PlayProgressBar", PlayProgressBar); 4698 var MouseTimeDisplay = function(_Component) { 4699 function MouseTimeDisplay(player, options) { 4700 classCallCheck(this, MouseTimeDisplay); 4701 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4702 return _this.update = throttle(bind(_this, _this.update), 25), _this; 4703 } 4704 return inherits(MouseTimeDisplay, _Component), MouseTimeDisplay.prototype.createEl = function() { 4705 return _Component.prototype.createEl.call(this, "div", { 4706 className: "vjs-mouse-display" 4707 }); 4708 }, MouseTimeDisplay.prototype.update = function(seekBarRect, seekBarPoint) { 4709 var _this2 = this; 4710 this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() { 4711 var duration = _this2.player_.duration(), content = formatTime(seekBarPoint * duration, duration); 4712 _this2.el_.style.left = seekBarRect.width * seekBarPoint + "px", _this2.getChild("timeTooltip").update(seekBarRect, seekBarPoint, content); 4713 }); 4714 }, MouseTimeDisplay; 4715 }(Component); 4716 MouseTimeDisplay.prototype.options_ = { 4717 children: [ "timeTooltip" ] 4718 }, Component.registerComponent("MouseTimeDisplay", MouseTimeDisplay); 4719 var UPDATE_REFRESH_INTERVAL = 30, SeekBar = function(_Slider) { 4720 function SeekBar(player, options) { 4721 classCallCheck(this, SeekBar); 4722 var _this = possibleConstructorReturn(this, _Slider.call(this, player, options)); 4723 return _this.update = throttle(bind(_this, _this.update), UPDATE_REFRESH_INTERVAL), 4724 _this.on(player, "timeupdate", _this.update), _this.on(player, "ended", _this.handleEnded), 4725 _this.updateInterval = null, _this.on(player, [ "playing" ], function() { 4726 _this.clearInterval(_this.updateInterval), _this.updateInterval = _this.setInterval(function() { 4727 _this.requestAnimationFrame(function() { 4728 _this.update(); 4729 }); 4730 }, UPDATE_REFRESH_INTERVAL); 4731 }), _this.on(player, [ "ended", "pause", "waiting" ], function() { 4732 _this.clearInterval(_this.updateInterval); 4733 }), _this.on(player, [ "timeupdate", "ended" ], _this.update), _this; 4734 } 4735 return inherits(SeekBar, _Slider), SeekBar.prototype.createEl = function() { 4736 return _Slider.prototype.createEl.call(this, "div", { 4737 className: "vjs-progress-holder" 4738 }, { 4739 "aria-label": this.localize("Progress Bar") 4740 }); 4741 }, SeekBar.prototype.update_ = function(currentTime, percent) { 4742 var duration = this.player_.duration(); 4743 this.el_.setAttribute("aria-valuenow", (100 * percent).toFixed(2)), this.el_.setAttribute("aria-valuetext", this.localize("progress bar timing: currentTime={1} duration={2}
4743", [ formatTime(currentTime, duration), formatTime(duration, duration) ], "{1} of {2}")), 4744 this.bar.update(getBoundingClientRect(this.el_), percent); 4745 }, SeekBar.prototype.update = function(event) { 4746 var percent = _Slider.prototype.update.call(this); 4747 return this.update_(this.getCurrentTime_(), percent), percent; 4748 }, SeekBar.prototype.getCurrentTime_ = function() { 4749 return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); 4750 }, SeekBar.prototype.handleEnded = function(event) { 4751 this.update_(this.player_.duration(), 1); 4752 }, SeekBar.prototype.getPercent = function() { 4753 var percent = this.getCurrentTime_() / this.player_.duration(); 4754 return 1 <= percent ? 1 : percent; 4755 }, SeekBar.prototype.handleMouseDown = function(event) { 4756 isSingleLeftClick(event) && (event.stopPropagation(), this.player_.scrubbing(!0), 4757 this.videoWasPlaying = !this.player_.paused(), this.player_.pause(), _Slider.prototype.handleMouseDown.call(this, event)); 4758 }, SeekBar.prototype.handleMouseMove = function(event) { 4759 if (isSingleLeftClick(event)) { 4760 var newTime = this.calculateDistance(event) * this.player_.duration(); 4761 newTime === this.player_.duration() && (newTime -= .1), this.player_.currentTime(newTime); 4762 } 4763 }, SeekBar.prototype.enable = function() { 4764 _Slider.prototype.enable.call(this); 4765 var mouseTimeDisplay = this.getChild("mouseTimeDisplay"); 4766 mouseTimeDisplay && mouseTimeDisplay.show(); 4767 }, SeekBar.prototype.disable = function() { 4768 _Slider.prototype.disable.call(this); 4769 var mouseTimeDisplay = this.getChild("mouseTimeDisplay"); 4770 mouseTimeDisplay && mouseTimeDisplay.hide(); 4771 }, SeekBar.prototype.handleMouseUp = function(event) { 4772 _Slider.prototype.handleMouseUp.call(this, event), event && event.stopPropagation(), 4773 this.player_.scrubbing(!1), this.player_.trigger({ 4774 type: "timeupdate", 4775 target: this, 4776 manuallyTriggered: !0 4777 }), this.videoWasPlaying && silencePromise(this.player_.play()); 4778 }, SeekBar.prototype.stepForward = function() { 4779 this.player_.currentTime(this.player_.currentTime() + 5); 4780 }, SeekBar.prototype.stepBack = function() { 4781 this.player_.currentTime(this.player_.currentTime() - 5); 4782 }, SeekBar.prototype.handleAction = function(event) { 4783 this.player_.paused() ? this.player_.play() : this.player_.pause(); 4784 }, SeekBar.prototype.handleKeyPress = function(event) { 4785 32 === event.which || 13 === event.which ? (event.preventDefault(), this.handleAction(event)) : _Slider.prototype.handleKeyPress && _Slider.prototype.handleKeyPress.call(this, event); 4786 }, SeekBar; 4787 }(Slider); 4788 SeekBar.prototype.options_ = { 4789 children: [ "loadProgressBar", "playProgressBar" ], 4790 barName: "playProgressBar" 4791 }, IE_VERSION && !(8 < IE_VERSION) || IS_IOS || IS_ANDROID || SeekBar.prototype.options_.children.splice(1, 0, "mouseTimeDisplay"), 4792 SeekBar.prototype.playerEvent = "timeupdate", Component.registerComponent("SeekBar", SeekBar); 4793 var ProgressControl = function(_Component) { 4794 function ProgressControl(player, options) { 4795 classCallCheck(this, ProgressControl); 4796 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4797 return _this.handleMouseMove = throttle(bind(_this, _this.handleMouseMove), 25), 4798 _this.throttledHandleMouseSeek = throttle(bind(_this, _this.handleMouseSeek), 25), 4799 _this.enable(), _this; 4800 } 4801 return inherits(ProgressControl, _Component), ProgressControl.prototype.createEl = function() { 4802 return _Component.prototype.createEl.call(this, "div", { 4803 className: "vjs-progress-control vjs-control" 4804 }); 4805 }, ProgressControl.prototype.handleMouseMove = function(event) { 4806 var seekBar = this.getChild("seekBar"); 4807 if (seekBar) { 4808 var mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay"), seekBarEl = seekBar.el(), seekBarRect = getBoundingClientRect(seekBarEl), seekBarPoint = getPointerPosition(seekBarEl, event).x; 4809 1 < seekBarPoint ? seekBarPoint = 1 : seekBarPoint < 0 && (seekBarPoint = 0), mouseTimeDisplay && mouseTimeDisplay.update(seekBarRect, seekBarPoint); 4810 } 4811 }, ProgressControl.prototype.handleMouseSeek = function(event) { 4812 var seekBar = this.getChild("seekBar"); 4813 seekBar && seekBar.handleMouseMove(event); 4814 }, ProgressControl.prototype.enabled = function() { 4815 return this.enabled_; 4816 }, ProgressControl.prototype.disable = function() {
4817 this.children().forEach(function(child) { 4818 return child.disable && child.disable(); 4819 }), this.enabled() && (this.off([ "mousedown", "touchstart" ], this.handleMouseDown), 4820 this.off(this.el_, "mousemove", this.handleMouseMove), this.handleMouseUp(), this.addClass("disabled"), 4821 this.enabled_ = !1); 4822 }, ProgressControl.prototype.enable = function() { 4823 this.children().forEach(function(child) { 4824 return child.enable && child.enable(); 4825 }), this.enabled() || (this.on([ "mousedown", "touchstart" ], this.handleMouseDown), 4826 this.on(this.el_, "mousemove", this.handleMouseMove), this.removeClass("disabled"), 4827 this.enabled_ = !0); 4828 }, ProgressControl.prototype.handleMouseDown = function(event) { 4829 var doc = this.el_.ownerDocument, seekBar = this.getChild("seekBar"); 4830 seekBar && seekBar.handleMouseDown(event), this.on(doc, "mousemove", this.throttledHandleMouseSeek), 4831 this.on(doc, "touchmove", this.throttledHandleMouseSeek), this.on(doc, "mouseup", this.handleMouseUp), 4832 this.on(doc, "touchend", this.handleMouseUp); 4833 }, ProgressControl.prototype.handleMouseUp = function(event) { 4834 var doc = this.el_.ownerDocument, seekBar = this.getChild("seekBar"); 4835 seekBar && seekBar.handleMouseUp(event), this.off(doc, "mousemove", this.throttledHandleMouseSeek), 4836 this.off(doc, "touchmove", this.throttledHandleMouseSeek), this.off(doc, "mouseup", this.handleMouseUp), 4837 this.off(doc, "touchend", this.handleMouseUp); 4838 }, ProgressControl; 4839 }(Component); 4840 ProgressControl.prototype.options_ = { 4841 children: [ "seekBar" ] 4842 }, Component.registerComponent("ProgressControl", ProgressControl); 4843 var FullscreenToggle = function(_Button) { 4844 function FullscreenToggle(player, options) { 4845 classCallCheck(this, FullscreenToggle); 4846 var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); 4847 return _this.on(player, "fullscreenchange", _this.handleFullscreenChange), _this; 4848 } 4849 return inherits(FullscreenToggle, _Button), FullscreenToggle.prototype.buildCSSClass = function() { 4850 return "vjs-fullscreen-control " + _Button.prototype.buildCSSClass.call(this); 4851 }, FullscreenToggle.prototype.handleFullscreenChange = function(event) { 4852 this.player_.isFullscreen() ? this.controlText("Non-Fullscreen") : this.controlText("Fullscreen"); 4853 }, FullscreenToggle.prototype.handleClick = function(event) { 4854 this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen(); 4855 }, FullscreenToggle; 4856 }(Button); 4857 FullscreenToggle.prototype.controlText_ = "Fullscreen", Component.registerComponent("FullscreenToggle", FullscreenToggle); 4858 var checkVolumeSupport = function(self, player) { 4859 player.tech_ && !player.tech_.featuresVolumeControl && self.addClass("vjs-hidden"), 4860 self.on(player, "loadstart", function() { 4861 player.tech_.featuresVolumeControl ? self.removeClass("vjs-hidden") : self.addClass("vjs-hidden"); 4862 }); 4863 }, VolumeLevel = function(_Component) { 4864 function VolumeLevel() { 4865 return classCallCheck(this, VolumeLevel), possibleConstructorReturn(this, _Component.apply(this, arguments)); 4866 } 4867 return inherits(VolumeLevel, _Component), VolumeLevel.prototype.createEl = function() { 4868 return _Component.prototype.createEl.call(this, "div", { 4869 className: "vjs-volume-level", 4870 innerHTML: '<span class="vjs-control-text"></span>' 4871 }); 4872 }, VolumeLevel; 4873 }(Component); 4874 Component.registerComponent("VolumeLevel", VolumeLevel); 4875 var VolumeBar = function(_Slider) { 4876 function VolumeBar(player, options) { 4877 classCallCheck(this, VolumeBar); 4878 var _this = possibleConstructorReturn(this, _Slider.call(this, player, options)); 4879 return _this.on("slideractive", _this.updateLastVolume_), _this.on(player, "volumechange", _this.updateARIAAttributes), 4880 player.ready(function() { 4881 return _this.updateARIAAttributes(); 4882 }), _this; 4883 } 4884 return inherits(VolumeBar, _Slider), VolumeBar.prototype.createEl = function() { 4885 return _Slider.prototype.createEl.call(this, "div", { 4886 className: "vjs-volume-bar vjs-slider-bar" 4887 }, { 4888 "aria-label": this.localize("Volume Level"), 4889 "aria-live": "polite" 4890 }); 4891 }, VolumeBar.prototype.handleMouseDown = function(event) { 4892 isSingleLeftClick(event) && _Slider.prototype.handleMouseDown.call(this, event); 4893 }, VolumeBar.prototype.handleMouseMove = function(event) { 4894 isSingleLeftClick(event) && (this.checkMuted(), this.player_.volume(this.calculateDistance(event))); 4895 }, VolumeBar.prototype.checkMuted = function() { 4896 this.player_.muted() && this.player_.muted(!1); 4897 }, VolumeBar.prototype.getPercent = function() { 4898 return this.player_.muted() ? 0 : this.player_.volume(); 4899 }, VolumeBar.prototype.stepForward = function() { 4900 this.checkMuted(), this.player_.volume(this.player_.volume() + .1); 4901 }, VolumeBar.prototype.stepBack = function() { 4902 this.checkMuted(), this.player_.volume(this.player_.volume() - .1); 4903 }, VolumeBar.prototype.updateARIAAttributes = function(event) { 4904 var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_(); 4905 this.el_.setAttribute("aria-valuenow", ariaValue), this.el_.setAttribute("aria-valuetext", ariaValue + "%"); 4906 }, VolumeBar.prototype.volumeAsPercentage_ = function() { 4907 return Math.round(100 * this.player_.volume()); 4908 }, VolumeBar.prototype.updateLastVolume_ = function() { 4909 var _this2 = this, volumeBeforeDrag = this.player_.volume(); 4910 this.one("sliderinactive", function() { 4911 0 === _this2.player_.volume() && _this2.player_.lastVolume_(volumeBeforeDrag); 4912 }); 4913 }, VolumeBar; 4914 }(Slider); 4915 VolumeBar.prototype.options_ = { 4916 children: [ "volumeLevel" ], 4917 barName: "volumeLevel" 4918 }, VolumeBar.prototype.playerEvent = "volumechange", Component.registerComponent("
4918VolumeBar", VolumeBar); 4919 var VolumeControl = function(_Component) { 4920 function VolumeControl(player) { 4921 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 4922 classCallCheck(this, VolumeControl), options.vertical = options.vertical || !1, 4923 (void 0 === options.volumeBar || isPlain(options.volumeBar)) && (options.volumeBar = options.volumeBar || {}, 4924 options.volumeBar.vertical = options.vertical); 4925 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4926 return checkVolumeSupport(_this, player), _this.throttledHandleMouseMove = throttle(bind(_this, _this.handleMouseMove), 25), 4927 _this.on("mousedown", _this.handleMouseDown), _this.on("touchstart", _this.handleMouseDown), 4928 _this.on(_this.volumeBar, [ "focus", "slideractive" ], function() { 4929 _this.volumeBar.addClass("vjs-slider-active"), _this.addClass("vjs-slider-active"), 4930 _this.trigger("slideractive"); 4931 }), _this.on(_this.volumeBar, [ "blur", "sliderinactive" ], function() { 4932 _this.volumeBar.removeClass("vjs-slider-active"), _this.removeClass("vjs-slider-active"), 4933 _this.trigger("sliderinactive"); 4934 }), _this; 4935 } 4936 return inherits(VolumeControl, _Component), VolumeControl.prototype.createEl = function() { 4937 var orientationClass = "vjs-volume-horizontal"; 4938 return this.options_.vertical && (orientationClass = "vjs-volume-vertical"), _Component.prototype.createEl.call(this, "div", { 4939 className: "vjs-volume-control vjs-control " + orientationClass 4940 }); 4941 }, VolumeControl.prototype.handleMouseDown = function(event) { 4942 var doc = this.el_.ownerDocument; 4943 this.on(doc, "mousemove", this.throttledHandleMouseMove), this.on(doc, "touchmove", this.throttledHandleMouseMove), 4944 this.on(doc, "mouseup", this.handleMouseUp), this.on(doc, "touchend", this.handleMouseUp); 4945 }, VolumeControl.prototype.handleMouseUp = function(event) { 4946 var doc = this.el_.ownerDocument; 4947 this.off(doc, "mousemove", this.throttledHandleMouseMove), this.off(doc, "touchmove", this.throttledHandleMouseMove), 4948 this.off(doc, "mouseup", this.handleMouseUp), this.off(doc, "touchend", this.handleMouseUp); 4949 }, VolumeControl.prototype.handleMouseMove = function(event) { 4950 this.volumeBar.handleMouseMove(event); 4951 }, VolumeControl; 4952 }(Component); 4953 VolumeControl.prototype.options_ = { 4954 children: [ "volumeBar" ] 4955 }, Component.registerComponent("VolumeControl", VolumeControl); 4956 var MuteToggle = function(_Button) { 4957 function MuteToggle(player, options) { 4958 classCallCheck(this, MuteToggle); 4959 var _this = possibleConstructorReturn(this, _Button.call(this, player, options)); 4960 return checkVolumeSupport(_this, player), _this.on(player, [ "loadstart", "volumechange" ], _this.update), 4961 _this; 4962 } 4963 return inherits(MuteToggle, _Button), MuteToggle.prototype.buildCSSClass = function() { 4964 return "vjs-mute-control " + _Button.prototype.buildCSSClass.call(this); 4965 }, MuteToggle.prototype.handleClick = function(event) { 4966 var vol = this.player_.volume(), lastVolume = this.player_.lastVolume_(); 4967 if (0 === vol) { 4968 var volumeToSet = lastVolume < .1 ? .1 : lastVolume; 4969 this.player_.volume(volumeToSet), this.player_.muted(!1); 4970 } else this.player_.muted(!this.player_.muted()); 4971 }, MuteToggle.prototype.update = function(event) { 4972 this.updateIcon_(), this.updateControlText_(); 4973 }, MuteToggle.prototype.updateIcon_ = function() { 4974 var vol = this.player_.volume(), level = 3; 4975 0 === vol || this.player_.muted() ? level = 0 : vol < .33 ? level = 1 : vol < .67 && (level = 2); 4976 for (var i = 0; i < 4; i++) removeClass(this.el_, "vjs-vol-" + i); 4977 addClass(this.el_, "vjs-vol-" + level); 4978 }, MuteToggle.prototype.updateControlText_ = function() { 4979 var text = this.player_.muted() || 0 === this.player_.volume() ? "Unmute" : "Mute"; 4980 this.controlText() !== text && this.controlText(text); 4981 }, MuteToggle; 4982 }(Button); 4983 MuteToggle.prototype.controlText_ = "Mute", Component.registerComponent("MuteToggle", MuteToggle); 4984 var VolumePanel = function(_Component) { 4985 function VolumePanel(player) { 4986 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 4987 classCallCheck(this, VolumePanel), void 0 !== options.inline ? options.inline = options.inline : options.inline = !0, 4988 (void 0 === options.volumeControl || isPlain(options.volumeControl)) && (options.volumeControl = options.volumeControl || {}, 4989 options.volumeControl.vertical = !options.inline); 4990 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 4991 return checkVolumeSupport(_this, player), _this.on(_this.volumeControl, [ "slideractive" ], _this.sliderActive_), 4992 _this.on(_this.volumeControl, [ "sliderinactive" ], _this.sliderInactive_), _this; 4993 } 4994 return inherits(VolumePanel, _Component), VolumePanel.prototype.sliderActive_ = function() { 4995 this.addClass("vjs-slider-active"); 4996 }, VolumePanel.prototype.sliderInactive_ = function() { 4997 this.removeClass("vjs-slider-active"); 4998 }, VolumePanel.prototype.createEl = function() { 4999 var orientationClass = "vjs-volume-panel-horizontal"; 5000 return this.options_.inline || (orientationClass = "vjs-volume-panel-vertical"), 5001 _Component.prototype.createEl.call(this, "div", { 5002 className: "vjs-volume-panel vjs-control " + orientationClass 5003 }); 5004 }, VolumePanel; 5005 }(Component); 5006 VolumePanel.prototype.options_ = { 5007 children: [ "muteToggle", "volumeControl" ] 5008 }
5008, Component.registerComponent("VolumePanel", VolumePanel); 5009 var Menu = function(_Component) { 5010 function Menu(player, options) { 5011 classCallCheck(this, Menu); 5012 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 5013 return options && (_this.menuButton_ = options.menuButton), _this.focusedChild_ = -1, 5014 _this.on("keydown", _this.handleKeyPress), _this; 5015 } 5016 return inherits(Menu, _Component), Menu.prototype.addItem = function(component) { 5017 this.addChild(component), component.on("click", bind(this, function(event) { 5018 this.menuButton_ && (this.menuButton_.unpressButton(), "CaptionSettingsMenuItem" !== component.name() && this.menuButton_.focus()); 5019 })); 5020 }, Menu.prototype.createEl = function() { 5021 var contentElType = this.options_.contentElType || "ul"; 5022 this.contentEl_ = createEl(contentElType, { 5023 className: "vjs-menu-content" 5024 }), this.contentEl_.setAttribute("role", "menu"); 5025 var el = _Component.prototype.createEl.call(this, "div", { 5026 append: this.contentEl_, 5027 className: "vjs-menu" 5028 }); 5029 return el.appendChild(this.contentEl_), on(el, "click", function(event) { 5030 event.preventDefault(), event.stopImmediatePropagation(); 5031 }), el; 5032 }, Menu.prototype.dispose = function() { 5033 this.contentEl_ = null, _Component.prototype.dispose.call(this); 5034 }, Menu.prototype.handleKeyPress = function(event) { 5035 37 === event.which || 40 === event.which ? (event.preventDefault(), this.stepForward()) : 38 !== event.which && 39 !== event.which || (event.preventDefault(), 5036 this.stepBack()); 5037 }, Menu.prototype.stepForward = function() { 5038 var stepChild = 0; 5039 void 0 !== this.focusedChild_ && (stepChild = this.focusedChild_ + 1), this.focus(stepChild); 5040 }, Menu.prototype.stepBack = function() { 5041 var stepChild = 0; 5042 void 0 !== this.focusedChild_ && (stepChild = this.focusedChild_ - 1), this.focus(stepChild); 5043 }, Menu.prototype.focus = function() { 5044 var item = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, children = this.children().slice(); 5045 children.length && children[0].className && /vjs-menu-title/.test(children[0].className) && children.shift(), 5046 0 < children.length && (item < 0 ? item = 0 : item >= children.length && (item = children.length - 1), 5047 children[this.focusedChild_ = item].el_.focus()); 5048 }, Menu; 5049 }(Component); 5050 Component.registerComponent("Menu", Menu); 5051 var MenuButton = function(_Component) { 5052 function MenuButton(player) { 5053 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 5054 classCallCheck(this, MenuButton); 5055 var _this = possibleConstructorReturn(this, _Component.call(this, player, options)); 5056 _this.menuButton_ = new Button(player, options), _this.menuButton_.controlText(_this.controlText_), 5057 _this.menuButton_.el_.setAttribute("aria-haspopup", "true"); 5058 var buttonClass = Button.prototype.buildCSSClass(); 5059 return _this.menuButton_.el_.className = _this.buildCSSClass() + " " + buttonClass, 5060 _this.menuButton_.removeClass("vjs-control"), _this.addChild(_this.menuButton_), 5061 _this.update(), _this.enabled_ = !0, _this.on(_this.menuButton_, "tap", _this.handleClick), 5062 _this.on(_this.menuButton_, "click", _this.handleClick), _this.on(_this.menuButton_, "focu
vendor: 11,410 bytes, lines 5062-5232
5062s", _this.handleFocus), 5063 _this.on(_this.menuButton_, "blur", _this.handleBlur), _this.on("keydown", _this.handleSubmenuKeyPress), 5064 _this; 5065 } 5066 return inherits(MenuButton, _Component), MenuButton.prototype.update = function() { 5067 var menu = this.createMenu(); 5068 this.menu && (this.menu.dispose(), this.removeChild(this.menu)), this.menu = menu, 5069 this.addChild(menu), this.buttonPressed_ = !1, this.menuButton_.el_.setAttribute("aria-expanded", "false"), 5070 this.items && this.items.length <= this.hideThreshold_ ? this.hide() : this.show(); 5071 }, MenuButton.prototype.createMenu = function() { 5072 var menu = new Menu(this.player_, { 5073 menuButton: this 5074 }); 5075 if (this.hideThreshold_ = 0, this.options_.title) { 5076 var title = createEl("li", { 5077 className: "vjs-menu-title", 5078 innerHTML: toTitleCase(this.options_.title), 5079 tabIndex: -1 5080 }); 5081 this.hideThreshold_ += 1, menu.children_.unshift(title), prependTo(title, menu.contentEl()); 5082 } 5083 if (this.items = this.createItems(), this.items) for (var i = 0; i < this.items.length; i++) menu.addItem(this.items[i]); 5084 return menu; 5085 }, MenuButton.prototype.createItems = function() {}, MenuButton.prototype.createEl = function() { 5086 return _Component.prototype.createEl.call(this, "div", { 5087 className: this.buildWrapperCSSClass() 5088 }, {}); 5089 }, MenuButton.prototype.buildWrapperCSSClass = function() { 5090 var menuButtonClass = "vjs-menu-button"; 5091 return !0 === this.options_.inline ? menuButtonClass += "-inline" : menuButtonClass += "-popup", 5092 "vjs-menu-button " + menuButtonClass + " " + Button.prototype.buildCSSClass() + " " + _Component.prototype.buildCSSClass.call(this); 5093 }, MenuButton.prototype.buildCSSClass = function() { 5094 var menuButtonClass = "vjs-menu-button"; 5095 return !0 === this.options_.inline ? menuButtonClass += "-inline" : menuButtonClass += "-popup", 5096 "vjs-menu-button " + menuButtonClass + " " + _Component.prototype.buildCSSClass.call(this); 5097 }, MenuButton.prototype.controlText = function(text) { 5098 var el = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : this.menuButton_.el(); 5099 return this.menuButton_.controlText(text, el); 5100 }, MenuButton.prototype.handleClick = function(event) { 5101 this.one(this.menu.contentEl(), "mouseleave", bind(this, function(e) { 5102 this.unpressButton(), this.el_.blur(); 5103 })), this.buttonPressed_ ? this.unpressButton() : this.pressButton(); 5104 }, MenuButton.prototype.focus = function() { 5105 this.menuButton_.focus(); 5106 }, MenuButton.prototype.blur = function() { 5107 this.menuButton_.blur(); 5108 }, MenuButton.prototype.handleFocus = function() { 5109 on(document_1, "keydown", bind(this, this.handleKeyPress)); 5110 }, MenuButton.prototype.handleBlur = function() { 5111 off(document_1, "keydown", bind(this, this.handleKeyPress)); 5112 }, MenuButton.prototype.handleKeyPress = function(event) { 5113 27 === event.which || 9 === event.which ? (this.buttonPressed_ && this.unpressButton(), 5114 9 !== event.which && (event.preventDefault(), this.menuButton_.el_.focus())) : 38 !== event.which && 40 !== event.which || this.buttonPressed_ || (this.pressButton(), 5115 event.preventDefault()); 5116 }, MenuButton.prototype.handleSubmenuKeyPress = function(event) { 5117 27 !== event.which && 9 !== event.which || (this.buttonPressed_ && this.unpressButton(), 5118 9 !== event.which && (event.preventDefault(), this.menuButton_.el_.focus())); 5119 }, MenuButton.prototype.pressButton = function() { 5120 if (this.enabled_) { 5121 if (this.buttonPressed_ = !0, this.menu.lockShowing(), this.menuButton_.el_.setAttribute("aria-expanded", "true"), 5122 IS_IOS && isInFrame()) return; 5123 this.menu.focus(); 5124 } 5125 }, MenuButton.prototype.unpressButton = function() { 5126 this.enabled_ && (this.buttonPressed_ = !1, this.menu.unlockShowing(), this.menuButton_.el_.setAttribute("aria-expanded", "false")); 5127 }, MenuButton.prototype.disable = function() { 5128 this.unpressButton(), this.enabled_ = !1, this.addClass("vjs-disabled"), this.menuButton_.disable(); 5129 }, MenuButton.prototype.enable = function() { 5130 this.enabled_ = !0, this.removeClass("vjs-disabled"), this.menuButton_.enable(); 5131 }, MenuButton; 5132 }(Component); 5133 Component.registerComponent("MenuButton", MenuButton); 5134 var TrackButton = function(_MenuButton) { 5135 function TrackButton(player, options) { 5136 classCallCheck(this, TrackButton); 5137 var tracks = options.tracks, _this = possibleConstructorReturn(this, _MenuButton.call(this, player, options)); 5138 if (_this.items.length <= 1 && _this.hide(), !tracks) return possibleConstructorReturn(_this); 5139 var updateHandler = bind(_this, _this.update); 5140 return tracks.addEventListener("removetrack", updateHandler), tracks.addEventListener("addtrack", updateHandler), 5141 _this.player_.on("ready", updateHandler), _this.player_.on("dispose", function() { 5142 tracks.removeEventListener("removetrack", updateHandler), tracks.removeEventListener("addtrack", updateHandler); 5143 }), _this; 5144 } 5145 return inherits(TrackButton, _MenuButton), TrackButton; 5146 }(MenuButton); 5147 Component.registerComponent("TrackButton", TrackButton); 5148 var MenuItem = function(_ClickableComponent) { 5149 function MenuItem(player, options) { 5150 classCallCheck(this, MenuItem); 5151 var _this = possibleConstructorReturn(this, _ClickableComponent.call(this, player, options)); 5152 return _this.selectable = options.selectable, _this.isSelected_ = options.selected || !1, 5153 _this.selected(_this.isSelected_), _this.selectable ? _this.el_.setAttribute("role", "menuitemcheckbox") : _this.el_.setAttribute("role", "menuitem"), 5154 _this; 5155 } 5156 return inherits(MenuItem, _ClickableComponent), MenuItem.prototype.createEl = function(type, props, attrs) { 5157 return this.nonIconControl = !0, _ClickableComponent.prototype.createEl.call(this, "li", assign({ 5158 className: "vjs-menu-item", 5159 innerHTML: '<span class="vjs-menu-item-text">' + this.localize(this.options_.label) + "</span>", 5160 tabIndex: -1 5161 }, props), attrs); 5162 }, MenuItem.prototype.handleClick = function(event) { 5163 this.selected(!0); 5164 }, MenuItem.prototype.selected = function(_selected) { 5165 this.selectable && (_selected ? (this.addClass("vjs-selected"), this.el_.setAttribute("aria-checked", "true"), 5166 this.controlText(", selected"), this.isSelected_ = !0) : (this.removeClass("vjs-selected"), 5167 this.el_.setAttribute("aria-checked", "false"), this.controlText(""), this.isSelected_ = !1)); 5168 }, MenuItem; 5169 }(ClickableComponent); 5170 Component.registerComponent("MenuItem", MenuItem); 5171 var TextTrackMenuItem = function(_MenuItem) { 5172 function TextTrackMenuItem(player, options) { 5173 classCallCheck(this, TextTrackMenuItem); 5174 var track = options.track, tracks = player.textTracks(); 5175 options.label = track.label || track.language || "Unknown", options.selected = "showing" === track.mode; 5176 var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); 5177 _this.track = track; 5178 var changeHandler = function() { 5179 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; 5180 _this.handleTracksChange.apply(_this, args); 5181 }, selectedLanguageChangeHandler = function() { 5182 for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2]; 5183 _this.handleSelectedLanguageChange.apply(_this, args); 5184 }; 5185 if (player.on([ "loadstart", "texttrackchange" ], changeHandler), tracks.addEventListener("change", changeHandler), 5186 tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler), 5187 _this.on("dispose", function() { 5188 player.off([ "loadstart", "texttrackchange" ], changeHandler), tracks.removeEventListener("change", changeHandler), 5189 tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler); 5190 }), void 0 === tracks.onchange) { 5191 var event = void 0; 5192 _this.on([ "tap", "click" ], function() { 5193 if ("object" !== _typeof(window_1.Event)) try { 5194 event = new window_1.Event("change"); 5195 } catch (err) {} 5196 event || (event = document_1.createEvent("Event")).initEvent("change", !0, !0), 5197 tracks.dispatchEvent(event); 5198 }); 5199 } 5200 return _this.handleTracksChange(), _this; 5201 } 5202 return inherits(TextTrackMenuItem, _MenuItem), TextTrackMenuItem.prototype.handleClick = function(event) { 5203 var kind = this.track.kind, kinds = this.track.kinds, tracks = this.player_.textTracks(); 5204 if (kinds || (kinds = [ kind ]), _MenuItem.prototype.handleClick.call(this, event), 5205 tracks) for (var i = 0; i < tracks.length; i++) { 5206 var track = tracks[i]; 5207 track === this.track && -1 < kinds.indexOf(track.kind) ? "showing" !== track.mode && (track.mode = "showing") : "disabled" !== track.mode && (track.mode = "disabled"); 5208 } 5209 }, TextTrackMenuItem.prototype.handleTracksChange = function(event) { 5210 var shouldBeSelected = "showing" === this.track.mode; 5211 shouldBeSelected !== this.isSelected_ && this.selected(shouldBeSelected); 5212 }, TextTrackMenuItem.prototype.handleSelectedLanguageChange = function(event) { 5213 if ("showing" === this.track.mode) { 5214 var selectedLanguage = this.player_.cache_.selectedLanguage; 5215 if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) return; 5216 this.player_.cache_.selectedLanguage = { 5217 enabled: !0, 5218 language: this.track.language, 5219 kind: this.track.kind 5220 }; 5221 } 5222 }, TextTrackMenuItem.prototype.dispose = function() { 5223 this.track = null, _MenuItem.prototype.dispose.call(this); 5224 }, TextTrackMenuItem; 5225 }(MenuItem); 5226 Component.registerComponent("TextTrackMenuItem", TextTrackMenuItem); 5227 var OffTextTrackMenuItem = function(_TextTrackMenuItem) { 5228 function OffTextTrackMenuItem(player, options) { 5229 return classCallCheck(this, OffTextTrackMenuItem), options.track = { 5230 player: player, 5231 kind: options.kind, 5232 kinds: options.kinds,
5233 default: !1, 5234 mode: "disabled" 5235 }, options.kinds || (options.kinds = [ options.kind ]), options.label ? options.track.label = options.label : options.track.label = options.kinds.join(" and ") + " off", 5236 options.selectable = !0, possibleConstructorReturn(this, _TextTrackMenuItem.call(this, player, options)); 5237 } 5238 return inherits(OffTextTrackMenuItem, _TextTrackMenuItem), OffTextTrackMenuItem.prototype.handleTracksChange = function(event) { 5239 for (var tracks = this.player().textTracks(), shouldBeSelected = !0, i = 0, l = tracks.length; i < l; i++) { 5240 var track = tracks[i]; 5241 if (-1 < this.options_.kinds.indexOf(track.kind) && "showing" === track.mode) { 5242 shouldBeSelected = !1; 5243 break; 5244 } 5245 } 5246 shouldBeSelected !== this.isSelected_ && this.selected(shouldBeSelected); 5247 }, OffTextTrackMenuItem.prototype.handleSelectedLanguageChange = function(event) { 5248 for (var tracks = this.player().textTracks(), allHidden = !0, i = 0, l = tracks.length; i < l; i++) { 5249 var track = tracks[i]; 5250 if (-1 < [ "captions", "descriptions", "subtitles" ].indexOf(track.kind) && "showing" === track.mode) { 5251 allHidden = !1; 5252 break; 5253 } 5254 } 5255 allHidden && (this.player_.cache_.selectedLanguage = { 5256 enabled: !1 5257 }); 5258 }, OffTextTrackMenuItem; 5259 }(TextTrackMenuItem); 5260 Component.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem); 5261 var TextTrackButton = function(_TrackButton) { 5262 function TextTrackButton(player) { 5263 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 5264 return classCallCheck(this, TextTrackButton), options.tracks = player.textTracks(), 5265 possibleConstructorReturn(this, _TrackButton.call(this, player, options)); 5266 } 5267 return inherits(TextTrackButton, _TrackButton), TextTrackButton.prototype.createItems = function() { 5268 var items = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], TrackMenuItem = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : TextTrackMenuItem, label = void 0; 5269 this.label_ && (label = this.label_ + " off"), items.push(new OffTextTrackMenuItem(this.player_, { 5270 kinds: this.kinds_, 5271 kind: this.kind_, 5272 label: label 5273 })), this.hideThreshold_ += 1; 5274 var tracks = this.player_.textTracks(); 5275 Array.isArray(this.kinds_) || (this.kinds_ = [ this.kind_ ]); 5276 for (var i = 0; i < tracks.length; i++) { 5277 var track = tracks[i]; 5278 if (-1 < this.kinds_.indexOf(track.kind)) { 5279 var item = new TrackMenuItem(this.player_, { 5280 track: track, 5281 selectable: !0 5282 }); 5283 item.addClass("vjs-" + track.kind + "-menu-item"), items.push(item); 5284 } 5285 } 5286 return items; 5287 }, TextTrackButton; 5288 }(TrackButton); 5289 Component.registerComponent("TextTrackButton", TextTrackButton); 5290 var ChaptersTrackMenuItem = function(_MenuItem) { 5291 function ChaptersTrackMenuItem(player, options) { 5292 classCallCheck(this, ChaptersTrackMenuItem); 5293 var track = options.track, cue = options.cue, currentTime = player.currentTime(); 5294 options.selectable = !0, options.label = cue.text, options.selected = cue.startTime <= currentTime && currentTime < cue.endTime; 5295 var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); 5296 return _this.track = track, _this.cue = cue, track.addEventListener("cuechange", bind(_this, _this.update)), 5297 _this; 5298 } 5299 return inherits(ChaptersTrackMenuItem, _MenuItem), ChaptersTrackMenuItem.prototype.handleClick = function(event) { 5300 _MenuItem.prototype.handleClick.call(this), this.player_.currentTime(this.cue.startTime), 5301 this.update(this.cue.startTime); 5302 }, ChaptersTrackMenuItem.prototype.update = function(event) { 5303 var cue = this.cue, currentTime = this.player_.currentTime(); 5304 this.selected(cue.startTime <= currentTime && currentTime < cue.endTime); 5305 }, ChaptersTrackMenuItem; 5306 }(MenuItem); 5307 Component.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem); 5308 var ChaptersButton = function(_TextTrackButton) { 5309 function ChaptersButton(player, options, ready) { 5310 return classCallCheck(this, ChaptersButton), possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); 5311 } 5312 return inherits(ChaptersButton, _TextTrackButton), ChaptersButton.prototype.buildCSSClass = function() { 5313 return "vjs-chapters-button " + _TextTrackButton.prototype.buildCSSClass.call(this); 5314 }, ChaptersButton.prototype.buildWrapperCSSClass = function() { 5315 return "vjs-chapters-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); 5316 }, ChaptersButton.prototype.update = function(event) { 5317 this.track_ && (!event || "addtrack" !== event.type && "removetrack" !== event.type) || this.setTrack(this.findChapter
5317sTrack()), 5318 _TextTrackButton.prototype.update.call(this); 5319 }, ChaptersButton.prototype.setTrack = function(track) { 5320 if (this.track_ !== track) { 5321 if (this.updateHandler_ || (this.updateHandler_ = this.update.bind(this)), this.track_) { 5322 var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); 5323 remoteTextTrackEl && remoteTextTrackEl.removeEventListener("load", this.updateHandler_), 5324 this.track_ = null; 5325 } 5326 if (this.track_ = track, this.track_) { 5327 this.track_.mode = "hidden"; 5328 var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); 5329 _remoteTextTrackEl && _remoteTextTrackEl.addEventListener("load", this.updateHandler_); 5330 } 5331 } 5332 }, ChaptersButton.prototype.findChaptersTrack = function() { 5333 for (var tracks = this.player_.textTracks() || [], i = tracks.length - 1; 0 <= i; i--) { 5334 var track = tracks[i]; 5335 if (track.kind === this.kind_) return track; 5336 } 5337 }, ChaptersButton.prototype.getMenuCaption = function() { 5338 return this.track_ && this.track_.label ? this.track_.label : this.localize(toTitleCase(this.kind_)); 5339 }, ChaptersButton.prototype.createMenu = function() { 5340 return this.options_.title = this.getMenuCaption(), _TextTrackButton.prototype.createMenu.call(this); 5341 }, ChaptersButton.prototype.createItems = function() { 5342 var items = []; 5343 if (!this.track_) return items; 5344 var cues = this.track_.cues; 5345 if (!cues) return items; 5346 for (var i = 0, l = cues.length; i < l; i++) { 5347 var cue = cues[i], mi = new ChaptersTrackMenuItem(this.player_, { 5348 track: this.track_, 5349 cue: cue 5350 }); 5351 items.push(mi); 5352 } 5353 return items; 5354 }, ChaptersButton; 5355 }(TextTrackButton); 5356 ChaptersButton.prototype.kind_ = "chapters", ChaptersButton.prototype.controlText_ = "Chapters", 5357 Component.registerComponent("ChaptersButton", ChaptersButton); 5358 var DescriptionsButton = function(_TextTrackButton) { 5359 function DescriptionsButton(player, options, ready) { 5360 classCallCheck(this, DescriptionsButton); 5361 var _this = possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)), tracks = player.textTracks(), changeHandler = bind(_this, _this.handleTracksChange); 5362 return tracks.addEventListener("change", changeHandler), _this.on("dispose", function() { 5363 tracks.removeEventListener("change", changeHandler); 5364 }), _this; 5365 } 5366 return inherits(DescriptionsButton, _TextTrackButton), DescriptionsButton.prototype.handleTracksChange = function(event) { 5367 for (var tracks = this.player().textTracks(), disabled = !1, i = 0, l = tracks.length; i < l; i++) { 5368 var track = tracks[i]; 5369 if (track.kind !== this.kind_ && "showing" === track.mode) { 5370 disabled = !0; 5371 break; 5372 } 5373 } 5374 disabled ? this.disable() : this.enable(); 5375 }, DescriptionsButton.prototype.buildCSSClass = function() { 5376 return "vjs-descriptions-button " + _TextTrackButton.prototype.buildCSSClass.call(this); 5377 }, DescriptionsButton.prototype.buildWrapperCSSClass = function() { 5378 return "vjs-descriptions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); 5379 }, DescriptionsButton; 5380 }(TextTrackButton); 5381 DescriptionsButton.prototype.kind_ = "descriptions", DescriptionsButton.prototype.controlText_ = "Descriptions", 5382 Component.registerComponent("DescriptionsButton", DescriptionsButton); 5383 var SubtitlesButton = function(_TextTrackButton) { 5384 function SubtitlesButton(player, options, ready) { 5385 return classCallCheck(this, SubtitlesButton), possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); 5386 } 5387 return inherits(SubtitlesButton, _TextTrackButton), SubtitlesButton.prototype.buildCSSClass = function() { 5388 return "vjs-subtitles-button " + _TextTrackButton.prototype.buildCSSClass.call(this); 5389 }, SubtitlesButton.prototype.buildWrapperCSSClass = function() { 5390 return "vjs-subtitles-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); 5391 }, SubtitlesButton; 5392 }(TextTrackButton); 5393 SubtitlesButton.prototype.kind_ = "subtitles", SubtitlesButton.prototype.controlText_ = "Subtitles", 5394 Component.registerComponent("SubtitlesButton", SubtitlesButton); 5395 var CaptionSettingsMenuItem = function(_TextTrackMenuItem) { 5396 function CaptionSettingsMenuItem(player, options) { 5397 classCallCheck(this, CaptionSettingsMenuItem), options.track = { 5398 player: player, 5399 kind: options.kind, 5400 label: options.kind + " settings", 5401 selectable: !1, 5402 default: !1, 5403 mode: "disabled" 5404 }, options.selectable = !1, options.name = "CaptionSettingsMenuItem"; 5405 var _this = possibleConstructorReturn(this, _TextTrackMenuItem.call(this, player, options)); 5406 return _this.addClass("vjs-texttrack-settings"), _this.controlText(", opens " + options.kind + " settings dialog"), 5407 _this; 5408 } 5409 return inherits(CaptionSettingsMenuItem, _TextTrackMenuItem), CaptionSettingsMenuItem.prototype.handleClick = function(event) { 5410 this.player().getChild("textTrackSettings").open(); 5411 }, CaptionSettingsMenuItem; 5412 }(TextTrackMenuItem); 5413 Component.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem); 5414 var CaptionsButton = function(_TextTrackButton) { 5415 function CaptionsButton(player, options, ready) { 5416 return classCallCheck(this, CaptionsButton), possibleConstructorReturn(this, _TextTrackButton.call(this, player, options, ready)); 5417 } 5418 return inherits(CaptionsButton, _TextTrackButton), CaptionsButton.prototype.buildCSSClass = function() { 5419 return "vjs-captions-button " + _TextTrackButton.prototype.buildCSSClass.call(this); 5420 }, CaptionsButton.prototype.buildWrapperCSSClass = function() { 5421 return "vjs-captions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); 5422 }, CaptionsButton.prototype.createItems = function() { 5423 var items = []; 5424 return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || (items.push(new CaptionSettingsMenuItem(this.player_, { 5425 kind: this.kind_ 5426 })), this.hideThreshold_ += 1), _TextTrackButton.prototype.createItems.call(this, items); 5427 }, CaptionsButton; 5428 }(TextTrackButton); 5429 CaptionsButton.prototype.kind_ = "captions", CaptionsButton.prototype.controlText_ = "Captions", 5430 Component.registerComponent("CaptionsButton", CaptionsButton); 5431 var SubsCapsMenuItem = function(_TextTrackMenuItem) { 5432 function SubsCapsMenuItem() { 5433 return classCallCheck(this, SubsCapsMenuItem), possibleConstructorReturn(this, _TextTrackMenuItem.apply(this, arguments)); 5434 } 5435 return inherits(SubsCapsMenuItem, _TextTrackMenuItem), SubsCapsMenuItem.prototype.createEl = function(type, props, attrs) { 5436 var innerHTML = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label); 5437 return "captions" === this.options_.track.kind && (innerHTML += '\n <sp
5437an aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' + this.localize("Captions") + "</span>\n "), 5438 innerHTML += "</span>", _TextTrackMenuItem.prototype.createEl.call(this, type, assign({ 5439 innerHTML: innerHTML 5440 }, props), attrs); 5441 }, SubsCapsMenuItem; 5442 }(TextTrackMenuItem); 5443 Component.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem); 5444 var SubsCapsButton = function(_TextTrackButton) { 5445 function SubsCapsButton(player) { 5446 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 5447 classCallCheck(this, SubsCapsButton); 5448 var _this = possibleConstructorReturn(this, _TextTrackButton.call(this, player, options)); 5449 return _this.label_ = "subtitles", -1 < [ "en", "en-us", "en-ca", "fr-ca" ].indexOf(_this.player_.language_) && (_this.label_ = "captions"), 5450 _this.menuButton_.controlText(toTitleCase(_this.label_)), _this; 5451 } 5452 return inherits(SubsCapsButton, _TextTrackButton), SubsCapsButton.prototype.buildCSSClass = function() { 5453 return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildCSSClass.call(this); 5454 }, SubsCapsButton.prototype.buildWrapperCSSClass = function() { 5455 return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this); 5456 }, SubsCapsButton.prototype.createItems = function() { 5457 var items = []; 5458 return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || (items.push(new CaptionSettingsMenuItem(this.player_, { 5459 kind: this.label_ 5460 })), this.hideThreshold_ += 1), items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem); 5461 }, SubsCapsButton; 5462 }(TextTrackButton); 5463 SubsCapsButton.prototype.kinds_ = [ "captions", "subtitles" ], SubsCapsButton.prototype.controlText_ = "Subtitles", 5464 Component.registerComponent("SubsCapsButton", SubsCapsButton); 5465 var AudioTrackMenuItem = function(_MenuItem) { 5466 function AudioTrackMenuItem(player, options) { 5467 classCallCheck(this, AudioTrackMenuItem); 5468 var track = options.track, tracks = player.audioTracks(); 5469 options.label = track.label || track.language || "Unknown", options.selected = track.enabled; 5470 var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); 5471 _this.track = track; 5472 var changeHandler = function() { 5473 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; 5474 _this.handleTracksChange.apply(_this, args); 5475 }; 5476 return tracks.addEventListener("change", changeHandler), _this.on("dispose", function() { 5477 tracks.removeEventListener("change", changeHandler); 5478 }), _this; 5479 } 5480 return inherits(AudioTrackMenuItem, _MenuItem), AudioTrackMenuItem.prototype.handleClick = function(event) { 5481 var tracks = this.player_.audioTracks(); 5482 _MenuItem.prototype.handleClick.call(this, event); 5483 for (var i = 0; i < tracks.length; i++) { 5484 var track = tracks[i]; 5485 track.enabled = track === this.track; 5486 } 5487 }, AudioTrackMenuItem.prototype.handleTracksChange = function(event) { 5488 this.selected(this.track.enabled); 5489 }, AudioTrackMenuItem; 5490 }(MenuItem); 5491 Component.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem); 5492 var AudioTrackButton = function(_TrackButton) { 5493 function AudioTrackButton(player) { 5494 var options = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 5495 return classCallCheck(this, AudioTrackButton), options.tracks = player.audioTracks(), 5496 possibleConstructorReturn(this, _TrackButton.call(this, player, options)); 5497 } 5498 return inherits(AudioTrackButton, _TrackButton), AudioTrackButton.prototype.buildCSSClass = function() { 5499 return "vjs-audio-button " + _TrackButton.prototype.buildCSSClass.call(this); 5500 }, AudioTrackButton.prototype.buildWrapperCSSClass = function() { 5501 return "vjs-audio-button " + _TrackButton.prototype.buildWrapperCSSClass.call(this); 5502 }, AudioTrackButton.prototype.createItems = function() { 5503 var items = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; 5504 this.hideThreshold_ = 1; 5505 for (var tracks = this.player_.audioTracks(), i = 0; i < tracks.length; i++) { 5506 var track = tracks[i]; 5507 items.push(new AudioTrackMenuItem(this.player_, { 5508 track: track, 5509 selectable: !0 5510 })); 5511 } 5512 return items; 5513 }, AudioTrackButton; 5514 }(TrackButton); 5515 AudioTrackButton.prototype.controlText_ = "Audio Track", Component.registerComponent("AudioTrackButton", AudioTrackButton); 5516 var PlaybackRateMenuItem = function(_MenuItem) { 5517 function PlaybackRateMenuItem(player, options) { 5518 classCallCheck(this, PlaybackRateMenuItem); 5519 var label = options.rate, rate = parseFloat(label, 10); 5520 options.label = label, options.selected = 1 === rate, options.selectable = !0; 5521 var _this = possibleConstructorReturn(this, _MenuItem.call(this, player, options)); 5522 return _this.label = label, _this.rate = rate, _this.on(player, "ratechange", _this.update), 5523 _this; 5524 } 5525 return inherits(PlaybackRateMenuItem, _MenuItem), PlaybackRateMenuItem.prototype.handleClick = function(event) { 5526 _MenuItem.prototype.handleClick.call(this), this.player().playbackRate(this.rate); 5527 }, PlaybackRateMenuItem.prototype.update = function(event) { 5528 this.selected(this.player().playbackRate() === this.rate); 5529 }, PlaybackRateMenuItem; 5530 }(MenuItem); 5531 PlaybackRateMenuItem.prototype.contentElType = "button", Component.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem); 5532 var PlaybackRateMenuButton = function(_MenuButton) { 5533 function PlaybackRateMenuButton(player, options) { 5534 classCallCheck(this, PlaybackRateMenuButton); 5535 var _this = possibleConstructorReturn(this, _MenuButton.call(this, player, options)); 5536 return _this.updateVisibility(), _this.updateLabel(), _this.on(player, "loadstart", _this.updateVisibility), 5537 _this.on(player, "ratechange", _this.updateLabel), _this; 5538 } 5539 return inherits(PlaybackRateMenuButton, _MenuButton), PlaybackRateMenuButton.prototype.createEl = function() { 5540 var el = _MenuButton.prototype.createEl.call(this); 5541 return this.labelEl_ = createEl("div", { 5542 className: "vjs-playback-rate-value", 5543 innerHTML: "1x" 5544 }), el.appendChild(this.labelEl_), el; 5545 }, PlaybackRateMenuButton.prototype.dispose = function() { 5546 this.labelEl_ = null, _MenuButton.prototype.dispose.call(this); 5547 }, PlaybackRateMenuButton.prototype.buildCSSClass = function() { 5548 return "vjs-playback-rate " + _MenuButton.prototype.buildCSSClass.call(this); 5549 }, PlaybackRateMenuButton.prototype.buildWrapperCSSClass = function() { 5550 return "vjs-playback-rate " + _MenuButton.prototype.buildWrapperCSSClass.call(this); 5551 }, PlaybackRateMenuButton.prototype.createMenu = function() { 5552 var menu = new Menu(this.player()), rates = this.playbackRates(); 5553 if (rates) for (var i = rates.length - 1; 0 <= i; i--) menu.addChild(new PlaybackRateMenuItem(this.player(), { 5554 rate: rates[i] + "x" 5555 })); 5556 return menu; 5557 }, PlaybackRateMenuButton.prototype.updateARIAAttributes = function() { 5558 this.el().setAttribute("aria-valuenow", this.player().playbackRate()); 5559 }, PlaybackRateMenuButton.prototype.handleClick = function(event) { 5560 for (var currentRate = this.player().playbackRate(), rates = this.playbackRates(), newRate = rates[0], i = 0; i < rates.length; i++) if (rates[i] > currentRate) { 5561 newRate = rates[i]; 5562 break; 5563 } 5564 this.player().playbackRate(newRate); 5565 }, PlaybackRateMenuButton.prototype.playbackRates = function() { 5566 return this.options_.playbackRates || this.options_.playerOptions && this.options_.playerOptions.playbackRates; 5567 }, PlaybackRateMenuButton.prototype.playbackRateSupported = function() { 5568 return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && 0 < this.playbackRates().length; 5569 }, PlaybackRateMenuButton.prototype.updateVisibility = function(event) { 5570 this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden"); 5571 }, PlaybackRateMenuButton.prototype.updateLabel = function(event) { 5572 this.playbackRateSupported() && (this.labelEl_.innerHTML = this.player().playbackRate() + "x"); 5573 }, PlaybackRateMenuButton; 5574 }(MenuButton); 5575 PlaybackRateMenuButton.prototype.controlText_ = "Playback Rate", Component.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton); 5576 var Spacer = function(_Component) { 5577 function Spacer() { 5578 return classCallCheck(this, Spacer), possibleConstructorReturn(this, _Component.apply(this, arguments)); 5579 } 5580 return inherits(Spacer, _Component), Spacer.prototype.buildCSSClass = function() { 5581 return "vjs-spacer " + _Component.prototype.buildCSSClass.call(this); 5582 }, Spacer.prototype.createEl = function() { 5583 return _Component.prototype.createEl.call(this, "div", { 5584 className: this.buildCSSClass() 5585 }); 5586 }, Spacer; 5587 }(Component); 5588 Component.registerComponent("Spacer", Spacer); 5589 var CustomControlSpacer = function(_Spacer) { 5590 function CustomControlSpacer() { 5591 return classCallCheck(this, CustomControlSpacer), possibleConstructorReturn(this, _Spacer.apply(this, arguments)); 5592 } 5593 return inherits(CustomControlSpacer, _Spacer), CustomControlSpacer.prototype.buildCSSClass = function() { 5594 return "vjs-custom-control-spacer " + _Spacer.prototype.buildCSSClass.call(this); 5595 }, CustomControlSpacer.prototype.createEl = function() { 5596 var el = _Spacer.prototype.createEl.call(this, { 5597 className: this.buildCSSClass() 5598 }); 5599 return el.innerHTML = "Â ", el; 5600 }, CustomControlSpacer; 5601 }(Spacer); 5602 Component.registerComponent("CustomControlSpacer", CustomControlSpacer); 5603 var ControlBar = function(_Component) { 5604 function ControlBar() { 5605 return classCallCheck(this, ControlBar), possibleConstructorReturn(this, _Component.apply(this, arguments)); 5606 }
5607 return inherits(ControlBar, _Component), ControlBar.prototype.createEl = function() { 5608 return _Component.prototype.createEl.call(this, "div", { 5609 className: "vjs-control-bar", 5610 dir: "ltr" 5611 }, { 5612 role: "group" 5613 }); 5614 }, ControlBar; 5615 }(Component); 5616 ControlBar.prototype.options_ = { 5617 children: [ "playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle" ] 5618 }, Component.registerComponent("ControlBar", ControlBar); 5619 var ErrorDisplay = function(_ModalDialog) { 5620 function ErrorDisplay(player, options) { 5621 classCallCheck(this, ErrorDisplay); 5622 var _this = possibleConstructorReturn(this, _ModalDialog.call(this, player, options)); 5623 return _this.on(player, "error", _this.open), _this; 5624 } 5625 return inherits(ErrorDisplay, _ModalDialog), ErrorDisplay.prototype.buildCSSClass = function() { 5626 return "vjs-error-display " + _ModalDialog.prototype.buildCSSClass.call(this); 5627 }, ErrorDisplay.prototype.content = function() { 5628 var error = this.player().error(); 5629 return error ? this.localize(error.message) : ""; 5630 }, ErrorDisplay; 5631 }(ModalDialog); 5632 ErrorDisplay.prototype.options_ = mergeOptions(ModalDialog.prototype.options_, { 5633 pauseOnOpen: !1, 5634 fillAlways: !0, 5635 temporary: !1, 5636 uncloseable: !0 5637 }), Component.registerComponent("ErrorDisplay", ErrorDisplay); 5638 var COLOR_BLACK = [ "#000", "Black" ], COLOR_BLUE = [ "#00F", "Blue" ], COLOR_CYAN = [ "#0FF", "Cyan" ], COLOR_GREEN = [ "#0F0", "Green" ], COLOR_MAGENTA = [ "#F0F", "Magenta" ], COLOR_RED = [ "#F00", "Red" ], COLOR_WHITE = [ "#FFF", "White" ], COLOR_YELLOW = [ "#FF0", "Yellow" ], OPACITY_OPAQUE = [ "1", "Opaque" ], OPACITY_SEMI = [ "0.5", "Semi-Transparent" ], OPACITY_TRANS = [ "0", "Transparent" ], selectConfigs = { 5639 backgroundColor: { 5640 selector: ".vjs-bg-color > select", 5641 id: "captions-background-color-%s", 5642 label: "Color", 5643 options: [ COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN ] 5644 }, 5645 backgroundOpacity: { 5646 selector: ".vjs-bg-opacity > select", 5647 id: "captions-background-opacity-%s", 5648 label: "Transparency", 5649 options: [ OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS ] 5650 }, 5651 color: { 5652 selector: ".vjs-fg-color > select", 5653 id: "captions-foreground-color-%s", 5654 label: "Color", 5655 options: [ COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN ] 5656 }, 5657 edgeStyle: { 5658 selector: ".vjs-edge-style > select", 5659 id: "%s", 5660 label: "Text Edge Style", 5661 options: [ [ "none", "None" ], [ "raised", "Raised" ], [ "depressed", "Depressed" ], [ "uniform", "Uniform" ], [ "dropshadow", "Dropshadow" ] ] 5662 }, 5663 fontFamily: { 5664 selector: ".vjs-font-family > select", 5665 id: "captions-font-family-%s", 5666 label: "Font Family", 5667 options: [ [ "proportionalSansSerif", "Proportional Sans-Serif" ], [ "monospaceSansSerif", "Monospace Sans-Serif" ], [ "proportionalSerif", "Proportional Serif" ], [ "monospaceSerif", "Monospace Serif" ], [ "casual", "Casual" ], [ "script", "Script" ], [ "small-caps", "Small Caps" ] ] 5668 }, 5669 fontPercent: { 5670 selector: ".vjs-font-percent > select", 5671 id: "captions-font-size-%s", 5672 label: "Font Size", 5673 options: [ [ "0.50", "50%" ], [ "0.75", "75%" ], [ "1.00", "100%" ], [ "1.25", "125%" ], [ "1.50", "150%" ], [ "1.75", "175%" ], [ "2.00", "200%" ], [ "3.00", "300%" ], [ "4.00", "400%" ] ], 5674 default: 2, 5675 parser: function(v) { 5676 return "1.00" === v ? null : Number(v); 5677 } 5678 }, 5679 textOpacity: { 5680 selector: ".vjs-text-opacity > select", 5681 id: "captions-foreground-opacity-%s", 5682 label: "Transparency", 5683 options: [ OPACITY_OPAQUE, OPACITY_SEMI ] 5684 }, 5685 windowColor: { 5686 selector: ".vjs-window-color > select", 5687 id: "captions-window-color-%s", 5688 label: "Color" 5689 }, 5690 windowOpacity: { 5691 selector: ".vjs-window-opacity > select", 5692 id: "captions-window-opacity-%s", 5693 label: "Transparency", 5694 options: [ OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE ] 5695 } 5696 }; 5697 function parseOptionValue(value, parser) { 5698 if (parser && (value = parser(value)), value && "none" !== value) return value; 5699 } 5700 selectConfigs.windowColor.options = selectConfigs.backgroundColor.options; 5701 var TextTrackSettings = function(_ModalDialog) { 5702 function TextTrackSettings(player, options) { 5703 classCallCheck(this, TextTrackSettings), options.temporary = !1; 5704 var _this = possibleConstructorReturn(this, _ModalDialog.call(this, player, options)); 5705 return _this.updateDisplay = bind(_this, _this.updateDisplay), _this.fill(), _this.hasBeenOpened_ = _this.hasBeenFilled_ = !0, 5706 _this.endDialog = createEl("p", { 5707 className: "vjs-control-text", 5708 textContent: _this.localize("End of dialog window.") 5709 }), _this.el().appendChild(_this.endDialog), _this.setDefaults(), void 0 === options.persistTextTrackSettings && (_this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings), 5710 _this.on(_this.$(".vjs-done-button"), "click", function() { 5711 _this.saveSettings(), _this.close(); 5712 }), _this.on(_this.$(".vjs-default-button"), "click", function() { 5713 _this.setDefaults(), _this.updateDisplay(); 5714 }), each(selectConfigs, function(config) { 5715 _this.on(_this.$(config.selector), "change", _this.updateDisplay); 5716 }), _this.options_.persistTextTrackSettings && _this.restoreSettings(), _this; 5717 } 5718 return inherits(TextTrackSettings, _ModalDialog), TextTrackSettings.prototype.dispose = function() { 5719 this.endDialog = null, _ModalDialog.prototype.dispose.call(this); 5720 }, TextTrackSettings.prototype.createElSelect_ = function(key) { 5721 var _this2 = this, legendId = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "", type = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : "label", config = selectConfigs[key], id = config.id.replace("%s", this.id_); 5722 return [ "<" + type + ' id="' + id + '" class="' + ("label" === type ? "vjs-label" : "") + '">', this.localize(config.label), "</" + type + ">", '<select aria-labelledby="' + ("" !== legendId ? legendId + " " : "") + id + '">' ].concat(config.options.map(function(o) { 5723 var optionId = id + "-" + o[1]; 5724 return [ '<option id="' + optionId + '" value="' + o[0] + '" ', 'aria-labelledby="' + ("" !== legendId ? legendId + " " : "") + id + " " + optionId + '">', _this2.localize(o[1]), "</option>" ].join(""); 5725 })).concat("</select>").join(""); 5726 }, TextTrackSettings.prototype.createElFgColor_ = function() { 5727 var legendId = "captions-text-legend-" + this.id_; 5728 return [ '<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Text"), "</legend>", this.createElSelect_("color", legendId), '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", legendId), "</span>", "</fieldset>" ].join(""); 5729 }, TextTrackSettings.prototype.createElBgColor_ = function() { 5730 var legendId = "captions-background-" + this.id_; 5731 return [ '<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + legendId + '">
5731', this.localize("Background"), "</legend>", this.createElSelect_("backgroundColor", legendId), '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", legendId), "</span>", "</fieldset>" ].join(""); 5732 }, TextTrackSettings.prototype.createElWinColor_ = function() { 5733 var legendId = "captions-window-" + this.id_; 5734 return [ '<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Window"), "</legend>", this.createElSelect_("windowColor", legendId), '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", legendId), "</span>", "</fieldset>" ].join(""); 5735 }, TextTrackSettings.prototype.createElColors_ = function() { 5736 return createEl("div", { 5737 className: "vjs-track-settings-colors", 5738 innerHTML: [ this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_() ].join("") 5739 }); 5740 }, TextTrackSettings.prototype.createElFont_ = function() { 5741 return createEl("div", { 5742 className: "vjs-track-settings-font", 5743 innerHTML: [ '<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>" ].join("") 5744 }); 5745 }, TextTrackSettings.prototype.createElControls_ = function() { 5746 var defaultsDescription = this.localize("restore all settings to the default values"); 5747 return createEl("div", { 5748 className: "vjs-track-settings-controls", 5749 innerHTML: [ '<button class="vjs-default-button" title="' + defaultsDescription + '">', this.localize("Reset"), '<span class="vjs-control-text"> ' + defaultsDescription + "</span>", "</button>", '<button class="vjs-done-button">' + this.localize("Done") + "</button>" ].join("") 5750 }); 5751 }, TextTrackSettings.prototype.content = function() { 5752 return [ this.createElColors_(), this.createElFont_(), this.createElControls_() ]; 5753 }, TextTrackSettings.prototype.label = function() { 5754 return this.localize("Caption Settings Dialog"); 5755 }, TextTrackSettings.prototype.description = function() { 5756 return this.localize("Beginning of dialog window. Escape will cancel and close the window."); 5757 }, TextTrackSettings.prototype.buildCSSClass = function() { 5758 return _ModalDialog.prototype.buildCSSClass.call(this) + " vjs-text-track-settings"; 5759 }, TextTrackSettings.prototype.getValues = function() { 5760 var _this3 = this; 5761 return function(object, fn) { 5762 var initial = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; 5763 return keys(object).reduce(function(accum, key) { 5764 return fn(accum, object[key], key); 5765 }, initial); 5766 }(selectConfigs, function(accum, config, key) { 5767 var el, parser, value = (el = _this3.$(config.selector), parser = config.parser, 5768 parseOptionValue(el.options[el.options.selectedIndex].value, parser)); 5769 return void 0 !== value && (accum[key] = value), accum; 5770 }, {}); 5771 }, TextTrackSettings.prototype.setValues = function(values) { 5772 var _this4 = this; 5773 each(selectConfigs, function(config, key) { 5774 !function(el, value, parser) { 5775 if (value) for (var i = 0; i < el.options.length; i++) if (parseOptionValue(el.options[i].value, parser) === value) { 5776 el.selectedIndex = i; 5777 break; 5778 } 5779 }(_this4.$(config.selector), values[key], config.parser); 5780 }); 5781 }, TextTrackSettings.prototype.setDefaults = function() { 5782 var _this5 = this; 5783 each(selectConfigs, function(config) { 5784 var index = config.hasOwnProperty("default") ? config.default : 0; 5785 _this5.$(config.selector).selectedIndex = index; 5786 }); 5787 }, TextTrackSettings.prototype.restoreSettings = function() { 5788 var values = void 0; 5789 try { 5790 values = JSON.parse(window_1.localStorage.getItem("vjs-text-track-settings")); 5791 } catch (err) { 5792 log$1.warn(err); 5793 } 5794 values && this.setValues(values); 5795 }, TextTrackSettings.prototype.saveSettings = function() { 5796 if (this.options_.persistTextTrackSettings) { 5797 var values = this.getValues(); 5798 try { 5799 Object.keys(values).length ? window_1.localStorage.setItem("vjs-text-track-settings", JSON.stringify(values)) : window_1.localStorage.removeItem("vjs-text-track-settings"); 5800 } catch (err) { 5801 log$1.warn(err); 5802 } 5803 } 5804 }, TextTrackSettings.prototype.updateDisplay = function() { 5805 var ttDisplay = this.player_.getChild("textTrackDisplay"); 5806 ttDisplay && ttDisplay.updateDisplay(); 5807 }, TextTrackSettings.prototype.conditionalBlur_ = function() { 5808 this.previouslyActiveEl_ = null, this.off(document_1, "keydown", this.handleKeyDown); 5809 var cb = this.player_.controlBar, subsCapsBtn = cb && cb.
5809subsCapsButton, ccBtn = cb && cb.captionsButton; 5810 subsCapsBtn ? subsCapsBtn.focus() : ccBtn && ccBtn.focus(); 5811 }, TextTrackSettings; 5812 }(ModalDialog); 5813 Component.registerComponent("TextTrackSettings", TextTrackSettings); 5814 var ResizeManager = function(_Component) { 5815 function ResizeManager(player, options) { 5816 classCallCheck(this, ResizeManager); 5817 var RESIZE_OBSERVER_AVAILABLE = options.ResizeObserver || window_1.ResizeObserver; 5818 null === options.ResizeObserver && (RESIZE_OBSERVER_AVAILABLE = !1); 5819 var options_ = mergeOptions({ 5820 createEl: !RESIZE_OBSERVER_AVAILABLE 5821 }, options), _this = possibleConstructorReturn(this, _Component.call(this, player, options_)); 5822 return _this.ResizeObserver = options.ResizeObserver || window_1.ResizeObserver, 5823 _this.loadListener_ = null, _this.resizeObserver_ = null, _this.debouncedHandler_ = debounce(function() { 5824 _this.resizeHandler(); 5825 }, 100, !1, player), RESIZE_OBSERVER_AVAILABLE ? (_this.resizeObserver_ = new _this.ResizeObserver(_this.debouncedHandler_), 5826 _this.resizeObserver_.observe(player.el())) : (_this.loadListener_ = function() { 5827 _this.el_.contentWindow && on(_this.el_.contentWindow, "resize", _this.debouncedHandler_), 5828 _this.off("load", _this.loadListener_); 5829 }, _this.on("load", _this.loadListener_)), _this; 5830 } 5831 return inherits(ResizeManager, _Component), ResizeManager.prototype.createEl = function() { 5832 return _Component.prototype.createEl.call(this, "iframe", { 5833 className: "vjs-resize-manager" 5834 }); 5835 }, ResizeManager.prototype.resizeHandler = function() { 5836 this.player_.trigger("playerresize"); 5837 }, ResizeManager.prototype.dispose = function() { 5838 this.resizeObserver_ && (this.resizeObserver_.unobserve(this.player_.el()), this.resizeObserver_.disconnect()), 5839 this.el_ && this.el_.contentWindow && off(this.el_.contentWindow, "resize", this.debouncedHandler_), 5840 this.loadListener_ && this.off("load", this.loadListener_), this.ResizeObserver = null, 5841 this.resizeObserver = null, this.debouncedHandler_ = null, this.loadListener_ = null; 5842 }, ResizeManager; 5843 }(Component); 5844 Component.registerComponent("ResizeManager", ResizeManager); 5845 var _templateObject$2 = taggedTemplateLiteralLoose([ "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading." ], [ "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading." ]), Html5 = function(_Tech) { 5846 function Html5(options, ready) { 5847 classCallCheck(this, Html5); 5848 var _this = possibleConstructorReturn(this, _Tech.call(this, options, ready)), source = options.source, crossoriginTracks = !1; 5849 if (source && (_this.el_.currentSrc !== source.src || options.tag && 3 === options.tag.
5849initNetworkState_) ? _this.setSource(source) : _this.handleLateInit_(_this.el_), 5850 _this.el_.hasChildNodes()) { 5851 for (var nodes = _this.el_.childNodes, nodesLength = nodes.length, removeNodes = []; nodesLength--; ) { 5852 var node = nodes[nodesLength]; 5853 "track" === node.nodeName.toLowerCase() && (_this.featuresNativeTextTracks ? (_this.remoteTextTrackEls().addTrackElement_(node), 5854 _this.remoteTextTracks().addTrack(node.track), _this.textTracks().addTrack(node.track), 5855 crossoriginTracks || _this.el_.hasAttribute("crossorigin") || !isCrossOrigin(node.src) || (crossoriginTracks = !0)) : removeNodes.push(node)); 5856 } 5857 for (var i = 0; i < removeNodes.length; i++) _this.el_.removeChild(removeNodes[i]); 5858 } 5859 return _this.proxyNativeTracks_(), _this.featuresNativeTextTracks && crossoriginTracks && log$1.warn(tsml(_templateObject$2)), 5860 _this.restoreMetadataTracksInIOSNativePlayer_(), (TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && !0 === options.nativeControlsForTouch && _this.setControls(!0), 5861 _this.proxyWebkitFullscreen_(), _this.triggerReady(), _this; 5862 } 5863 return inherits(Html5, _Tech), Html5.prototype.dispose = function() { 5864 Html5.disposeMediaElement(this.el_), this.options_ = null, _Tech.prototype.dispose.call(this); 5865 }, Html5.prototype.restoreMetadataTracksInIOSNativePlayer_ = function() { 5866 var textTracks = this.textTracks(), metadataTracksPreFullscreenState = void 0, takeMetadataTrackSnapshot = function() { 5867 metadataTracksPreFullscreenState = []; 5868 for (var i = 0; i < textTracks.length; i++) { 5869 var track = textTracks[i]; 5870 "metadata" === track.kind && metadataTracksPreFullscreenState.push({ 5871 track: track, 5872 storedMode: track.mode 5873 }); 5874 } 5875 }; 5876 takeMetadataTrackSnapshot(), textTracks.addEventListener("change", takeMetadataTrackSnapshot), 5877 this.on("dispose", function() { 5878 return textTracks.removeEventListener("change", takeMetadataTrackSnapshot); 5879 }); 5880 var restoreTrackMode = function restoreTrackMode() { 5881 for (var i = 0; i < metadataTracksPreFullscreenState.length; i++) { 5882 var storedTrack = metadataTracksPreFullscreenState[i]; 5883 "disabled" === storedTrack.track.mode && storedTrack.track.mode !== storedTrack.storedMode && (storedTrack.track.mode = storedTrack.storedMode); 5884 } 5885 textTracks.removeEventListener("change", restoreTrackMode); 5886 }; 5887 this.on("webkitbeginfullscreen", function() { 5888 textTracks.removeEventListener("change", takeMetadataTrackSnapshot), textTracks.removeEventListener("change", restoreTrackMode), 5889 textTracks.addEventListener("change", restoreTrackMode); 5890 }), this.on("webkitendfullscreen", function() { 5891 textTracks.removeEventListener("change", takeMetadataTrackSnapshot), textTracks.addEventListener("change", takeMetadataTrackSnapshot), 5892 textTracks.removeEventListener("change", restoreTrackMode); 5893 }); 5894 }, Html5.prototype.proxyNativeTracks_ = function() { 5895 var _this2 = this; 5896 NORMAL.names.forEach(function(name) { 5897 var props = NORMAL[name], elTracks = _this2.el()[props.getterName], techTracks = _this2[props.getterName](); 5898 if (_this2["featuresNative" + props.capitalName + "Tracks"] && elTracks && elTracks.addEventListener) { 5899 var listeners = { 5900 change: function(e) { 5901 techTracks.trigger({ 5902 type: "change", 5903 target: techTracks, 5904 currentTarget: techTracks, 5905 srcElement: techTracks 5906 }); 5907 }, 5908 addtrack: function(e) { 5909 techTracks.addTrack(e.track); 5910 }, 5911 removetrack: function(e) { 5912 techTracks.removeTrack(e.track); 5913 } 5914 }, removeOldTracks = function() { 5915 for (var removeTracks = [], i = 0; i < techTracks.length; i++) { 5916 for (var found = !1, j = 0; j < elTracks.length; j++) if (elTracks[j] === techTracks[i]) { 5917 found = !0; 5918 break; 5919 } 5920 found || removeTracks.push(techTracks[i]); 5921 } 5922 for (;removeTracks.length; ) techTracks.removeTrack(removeTracks.shift()); 5923 };
5924 Object.keys(listeners).forEach(function(eventName) { 5925 var listener = listeners[eventName]; 5926 elTracks.addEventListener(eventName, listener), _this2.on("dispose", function(e) { 5927 return elTracks.removeEventListener(eventName, listener); 5928 }); 5929 }), _this2.on("loadstart", removeOldTracks), _this2.on("dispose", function(e) { 5930 return _this2.off("loadstart", removeOldTracks); 5931 }); 5932 } 5933 }); 5934 }, Html5.prototype.createEl = function() { 5935 var el = this.options_.tag; 5936 if (!el || !this.options_.playerElIngest && !this.movingMediaElementInDOM) { 5937 if (el) { 5938 var clone = el.cloneNode(!0); 5939 el.parentNode && el.parentNode.insertBefore(clone, el), Html5.disposeMediaElement(el), 5940 el = clone; 5941 } else { 5942 el = document_1.createElement("video"); 5943 var attributes = mergeOptions({}, this.options_.tag && getAttributes(this.options_.tag)); 5944 TOUCH_ENABLED && !0 === this.options_.nativeControlsForTouch || delete attributes.controls, 5945 setAttributes(el, assign(attributes, { 5946 id: this.options_.techId, 5947 class: "vjs-tech" 5948 })); 5949 } 5950 el.playerId = this.options_.playerId; 5951 } 5952 void 0 !== this.options_.preload && setAttribute(el, "preload", this.options_.preload); 5953 for (var settingsAttrs = [ "loop", "muted", "playsinline", "autoplay" ], i = 0; i < settingsAttrs.length; i++) { 5954 var attr = settingsAttrs[i], value = this.options_[attr]; 5955 void 0 !== value && (value ? setAttribute(el, attr, attr) : removeAttribute(el, attr), 5956 el[attr] = value); 5957 } 5958 return el; 5959 }, Html5.prototype.handleLateInit_ = function(el) { 5960 if (0 !== el.networkState && 3 !== el.networkState) { 5961 if (0 === el.readyState) { 5962 var loadstartFired = !1, setLoadstartFired = function() { 5963 loadstartFired = !0; 5964 }; 5965 this.on("loadstart", setLoadstartFired); 5966 var triggerLoadstart = function() { 5967 loadstartFired || this.trigger("loadstart"); 5968 }; 5969 return this.on("loadedmetadata", triggerLoadstart), void this.ready(function() { 5970 this.off("loadstart", setLoadstartFired), this.off("loadedmetadata", triggerLoadstart), 5971 loadstartFired || this.trigger("loadstart"); 5972 }); 5973 } 5974 var eventsToTrigger = [ "loadstart" ]; 5975 eventsToTrigger.push("loadedmetadata"), 2 <= el.readyState && eventsToTrigger.push("loadeddata"), 5976 3 <= el.readyState && eventsToTrigger.push("canplay"), 4 <= el.readyState && eventsToTrigger.push("canplaythrough"), 5977 this.ready(function() { 5978 eventsToTrigger.forEach(function(type) { 5979 this.trigger(type); 5980 }, this); 5981 }); 5982 } 5983 }, Html5.prototype.setCurrentTime = function(seconds) { 5984 try { 5985 this.el_.currentTime = seconds; 5986 } catch (e) { 5987 log$1(e, "Video is not ready. (Video.js)"); 5988 } 5989 }, Html5.prototype.duration = function() { 5990 var _this3 = this; 5991 if (this.el_.duration === 1 / 0 && IS_ANDROID && IS_CHROME && 0 === this.el_.currentTime) { 5992 return this.on("timeupdate", function checkProgress() { 5993 0 < _this3.el_.currentTime && (_this3.el_.duration === 1 / 0 && _this3.trigger("durationchange"), 5994 _this3.off("timeupdate", checkProgress)); 5995 }), NaN; 5996 } 5997 return this.el_.duration || NaN; 5998 }, Html5.prototype.width = function() { 5999 return this.el_.offsetWidth; 6000 }, Html5.prototype.height = function() { 6001 return this.el_.offsetHeight; 6002 }, Html5.prototype.proxyWebkitFullscreen_ = function() { 6003 var _this4 = this; 6004 if ("webkitDisplayingFullscreen" in this.el_) { 6005 var endFn = function() { 6006 this.trigger("fullscreenchange", { 6007 isFullscreen: !1 6008 }); 6009 }, beginFn = function() { 6010 "webkitPresentationMode" in this.el_ && "picture-in-picture" !== this.el_.webkitPresentationMode && (this.one("webkitendfullscreen", endFn), 6011 this.trigger("fullscreenchange", { 6012 isFullscreen: !0 6013 })); 6014 }; 6015 this.on("webkitbeginfullscreen", beginFn), this.on("dispose", function() { 6016 _this4.off("webkitbeginfullscreen", beginFn), _this4.off("webkitendfullscreen", endFn); 6017 }); 6018 } 6019 }, Html5.prototype.supportsFullScreen = function() { 6020 if ("function" == typeof this.el_.webkitEnterFullScreen) { 6021 var userAgent = window_1.navigator && window_1.navigator.userAgent || ""; 6022 if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) return !0; 6023 } 6024 return !1; 6025 }, Html5.prototype.enterFullScreen = function() { 6026 var video = this.el_; 6027 video.paused && video.networkState <= video.HAVE_METADATA ? (this.el_.play(), this.setTimeout(function() { 6028 video.pause(), video.webkitEnterFullScreen(); 6029 }, 0)) : video.webkitEnterFullScreen(); 6030 }, Html5.prototype.exitFullScreen = function() { 6031 this.el_.webkitExitFullScreen(); 6032 }, Html5.prototype.src = function(_src) { 6033 if (void 0 === _src) return this.el_.src; 6034 this.setSrc(_src); 6035 }, Html5.prototype.reset = function() { 6036 Html5.resetMediaElement(this.el_); 6037 }, Html5.prototype.currentSrc = function() { 6038 return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc; 6039 }, Html5.prototype.setControls = function(val) { 6040 this.el_.controls = !!val; 6041 }, Html5.prototype.addTextTrack = function(kind, label, language) { 6042 return this.featuresNativeTextTracks ? this.el_.addTextTrack(kind, label, language) : _Tech.prototype.addTextTrack.call(this, kind, label, language); 6043 }, Html5.prototype.createRemoteTextTrack = function(options) { 6044 if (!this.featuresNativeTextTracks) return _Tech.prototype.createRemoteTextTrack.call(this, options); 6045 var htmlTrackElement = document_1.createElement("track"); 6046 return options.kind && (htmlTrackElement.kind = options.kind), options.label && (htmlTrackElement.label = options.label), 6047 (options.language || options.srclang) && (htmlTrackElement.srclang = options.language || options.srclang), 6048 options.default && (htmlTrackElement.default = options.default), options.id && (htmlTrackElement.id = options.id), 6049 options.src && (htmlTrackElement.src = options.src), htmlTrackElement; 6050 }, Html5.prototype.addRemoteTextTrack = function(options, manualCleanup) { 6051 var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options, manualCleanup); 6052 return this.featuresNativeTextTracks && this.el().appendChild(htmlTrackElement), 6053 htmlTrackElement; 6054 }, Html5.prototype.removeRemoteTextTrack = function(track) { 6055 if (_Tech.prototype.removeRemoteTextTrack.call(this, track), this.featuresNativeTextTracks) for (var tracks = this.$$("track"), i = tracks.length; i--; ) track !== tracks[i] && track !== tracks[i].track || this.el().removeChild(tracks[i]); 6056 }, Html5.prototype.getVideoPlaybackQuality = function() { 6057 if ("function" == typeof this.el().getVideoPlaybackQuality) return this.el().getVideoPlaybackQuality(); 6058 var videoPlaybackQuality = {}; 6059 return void 0 !== this.el().webkitDroppedFrameCount && void 0 !== this.el().webkitDecodedFrameCount && (videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount, 6060 videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount), window_1.performance && "function" == typeof window_1.performance.now ? videoPlaybackQuality.creationTime = window_1.performance.now() : window_1.performance && window_1.performance.timing && "number" == typeof window_1.performance.timing.navigationStart && (videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart), 6061 videoPlaybackQuality; 6062 }, Html5; 6063 }(Tech); 6064 if (isReal()) {
6065 Html5.TEST_VID = document_1.createElement("video"); 6066 var track = document_1.createElement("track"); 6067 track.kind = "captions", track.srclang = "en", track.label = "English", Html5.TEST_VID.appendChild(track); 6068 } 6069 Html5.isSupported = function() { 6070 try { 6071 Html5.TEST_VID.volume = .5; 6072 } catch (e) { 6073 return !1; 6074 } 6075 return !(!Html5.TEST_VID || !Html5.TEST_VID.canPlayType); 6076 }, Html5.canPlayType = function(type) { 6077 return Html5.TEST_VID.canPlayType(type); 6078 }, Html5.canPlaySource = function(srcObj, options) { 6079 return Html5.canPlayType(srcObj.type); 6080 }, Html5.canControlVolume = function() { 6081 try { 6082 var volume = Html5.TEST_VID.volume; 6083 return Html5.TEST_VID.volume = volume / 2 + .1, volume !== Html5.TEST_VID.volume; 6084 } catch (e) { 6085 return !1; 6086 } 6087 }, Html5.canControlPlaybackRate = function() { 6088 if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) return !1; 6089 try { 6090 var playbackRate = Html5.TEST_VID.playbackRate; 6091 return Html5.TEST_VID.playbackRate = playbackRate / 2 + .1, playbackRate !== Html5.TEST_VID.playbackRate; 6092 } catch (e) { 6093 return !1; 6094 } 6095 }, Html5.supportsNativeTextTracks = function() { 6096 return IS_ANY_SAFARI; 6097 }, Html5.supportsNativeVideoTracks = function() { 6098 return !(!Html5.TEST_VID || !Html5.TEST_VID.videoTracks); 6099 }, Html5.supportsNativeAudioTracks = function() { 6100 return !(!Html5.TEST_VID || !Html5.TEST_VID.audioTracks); 6101 }, Html5.Events = [ "loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange" ], 6102 Html5.prototype.featuresVolumeControl = Html5.canControlVolume(), Html5.prototype.featuresPlaybackRate = Html5.canControlPlaybackRate(), 6103 Html5.prototype.movingMediaElementInDOM = !IS_IOS, Html5.prototype.featuresFullscreenResize = !0, 6104 Html5.prototype.featuresProgressEvents = !0, Html5.prototype.featuresTimeupdateEvents = !0, 6105 Html5.prototype.featuresNativeTextTracks = Html5.supportsNativeTextTracks(), Html5.prototype.featuresNativeVideoTracks = Html5.supportsNativeVideoTracks(), 6106 Html5.prototype.featuresNativeAudioTracks = Html5.supportsNativeAudioTracks(); 6107 var canPlayType = Html5.TEST_VID && Html5.TEST_VID.constructor.prototype.canPlayType, mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i, mp4RE = /^video\/mp4/i; 6108 Html5.patchCanPlayType = function() { 6109 4 <= ANDROID_VERSION && !IS_FIREFOX && !IS_CHROME ? Html5.TEST_VID.constructor.prototype.canPlayType = function(type) { 6110 return type && mpegurlRE.test(type) ? "maybe" : canPlayType.call(this, type); 6111 } : IS_OLD_ANDROID && (Html5.TEST_VID.constructor.prototype.canPlayType = function(type) { 6112 return type && mp4RE.test(type) ? "maybe" : canPlayType.call(this, type); 6113 }); 6114 }, Html5.unpatchCanPlayType = function() { 6115 var r = Html5.TEST_VID.constructor.prototype.canPlayType; 6116 return Html5.TEST_VID.constructor.prototype.canPlayType = canPlayType, r; 6117 }, Html5.patchCanPlayType(), Html5.disposeMediaElement = function(el) { 6118 if (el) { 6119 for (el.parentNode && el.parentNode.removeChild(el); el.hasChildNodes(); ) el.removeChild(el.firstChild); 6120 el.removeAttribute("src"), "function" == typeof el.load && function() { 6121 try { 6122 el.load(); 6123 } catch (e) {} 6124 }(); 6125 } 6126 }, Html5.resetMediaElement = function(el) { 6127 if (el) { 6128 for (var sources = el.querySelectorAll("source"), i = sources.length; i--; ) el.removeChild(sources[i]); 6129 el.removeAttribute("src"), "function" == typeof el.load && function() { 6130 try { 6131 el.load(); 6132 } catch (e) {} 6133 }(); 6134 } 6135 }, [ "muted", "defaultMuted", "autoplay", "controls", "loop", "playsinline" ].forEach(function(prop) { 6136 Html5.prototype[prop] = function() { 6137 return this.el_[prop] || this.el_.hasAttribute(prop); 6138 }; 6139 }), [ "muted", "defaultMuted", "autoplay", "loop", "playsinline" ].forEach(function(prop) { 6140 Html5.prototype["set" + toTitleCase(prop)] = function(v) { 6141 (this.el_[prop] = v) ? this.el_.setAttribute(prop, prop) : this.el_.removeAttribute(prop); 6142 }; 6143 }), [ "paused", "currentTime", "buffered", "volume", "poster", "preload", "error", "seeking", "seekable", "ended", "playbackRate", "defaultPlaybackRate", "played", "networkState", "readyState", "videoWidth", "videoHeight" ].forEach(function(prop) { 6144 Html5.prototype[prop] = function() { 6145 return this.el_[prop]; 6146 }; 6147 }), [ "volume", "src", "poster", "preload", "playbackRate", "defaultPlaybackRate" ].forEach(function(prop) { 6148 Html5.prototype["set" + toTitleCase(prop)] = function(v) { 6149 this.el_[prop] = v; 6150 }; 6151 }), [ "pause", "load", "play" ].forEach(function(prop) { 6152 Html5.prototype[prop] = function() { 6153 return this.el_[prop](); 6154 }; 6155 }), Tech.withSourceHandlers(Html5), Html5.nativeSourceHandler = {}, Html5.nativeSourceHandler.canPlayType = function(type) { 6156 try {
vendor: 5,422 bytes, lines 6157-6220
6157 return Html5.TEST_VID.canPlayType(type); 6158 } catch (e) { 6159 return ""; 6160 } 6161 }, Html5.nativeSourceHandler.canHandleSource = function(source, options) { 6162 if (source.type) return Html5.nativeSourceHandler.canPlayType(source.type); 6163 if (source.src) { 6164 var ext = getFileExtension(source.src); 6165 return Html5.nativeSourceHandler.canPlayType("video/" + ext); 6166 } 6167 return ""; 6168 }, Html5.nativeSourceHandler.handleSource = function(source, tech, options) { 6169 tech.setSrc(source.src); 6170 }, Html5.nativeSourceHandler.dispose = function() {}, Html5.registerSourceHandler(Html5.nativeSourceHandler), 6171 Tech.registerTech("Html5", Html5); 6172 var _templateObject$1 = taggedTemplateLiteralLoose([ "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n " ], [ "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n " ]), TECH_EVENTS_RETRIGGER = [ "progress", "abort", "suspend", "emptied", "stalled", "loadedmetadata", "loadeddata", "timeupdate", "ratechange", "resize", "volumechange", "texttrackchange" ], Player = function(_Component) { 6173 function Player(tag, options, ready) { 6174 if (classCallCheck(this, Player), tag.id = tag.id || "vjs_video_" + newGUID(), (options = assign(Player.getTagSettings(tag), options)).initChildren = !1, 6175 options.createEl = !1, options.evented = !1, options.reportTouchActivity = !1, !options.language) if ("function" == typeof tag.closest) { 6176 var closest = tag.closest("[lang]"); 6177 closest && closest.getAttribute && (options.language = closest.getAttribute("lang")); 6178 } else for (var element = tag; element && 1 === element.nodeType; ) { 6179 if (getAttributes(element).hasOwnProperty("lang")) { 6180 options.language = element.getAttribute("lang"); 6181 break; 6182 } 6183 element = element.parentNode; 6184 } 6185 var _this = possibleConstructorReturn(this, _Component.call(this, null, options, ready)); 6186 if (_this.isReady_ = !1, _this.hasStarted_ = !1, _this.userActive_ = !1, !_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?"); 6187 if (_this.tag = tag, _this.tagAttributes = tag && getAttributes(tag), _this.language(_this.options_.language), 6188 options.languages) { 6189 var languagesToLower = {}; 6190 Object.getOwnPropertyNames(options.languages).forEach(function(name$$1) { 6191 languagesToLower[name$$1.toLowerCase()] = options.languages[name$$1]; 6192 }), _this.languages_ = languagesToLower; 6193 } else _this.languages_ = Player.prototype.options_.languages; 6194 _this.cache_ = {}, _this.poster_ = options.poster || "", _this.controls_ = !!options.controls, 6195 _this.cache_.lastVolume = 1, tag.controls = !1, tag.removeAttribute("controls"), 6196 _this.scrubbing_ = !1, _this.el_ = _this.createEl(), evented(_this, { 6197 eventBusKey: "el_" 6198 }); 6199 var playerOptionsCopy = mergeOptions(_this.options_); 6200 if (options.plugins) { 6201 var plugins = options.plugins; 6202 Object.keys(plugins).forEach(function(name$$1) { 6203 if ("function" != typeof this[name$$1]) throw new Error('plugin "' + name$$1 + '" does not exist'); 6204 this[name$$1](plugins[name$$1]); 6205 }, _this); 6206 } 6207 _this.options_.playerOptions = playerOptionsCopy, _this.middleware_ = [], _this.initChildren(), 6208 _this.isAudio("audio" === tag.nodeName.toLowerCase()), _this.controls() ? _this.addClass("vjs-controls-enabled") : _this.addClass("vjs-controls-disabled"), 6209 _this.el_.setAttribute("role", "region"), _this.isAudio() ? _this.el_.setAttribute("aria-label", _this.localize("Audio Player")) : _this.el_.setAttribute("aria-label", _this.localize("Video Player")), 6210 _this.isAudio() && _this.addClass("vjs-audio"), _this.flexNotSupported_() && _this.addClass("vjs-no-flex"), 6211 IS_IOS || _this.addClass("vjs-workinghover"), Player.players[_this.id_] = _this; 6212 var majorVersion = version.split(".")[0]; 6213 return _this.addClass("vjs-v" + majorVersion), _this.userActive(!0), _this.reportUserActivity(), 6214 _this.listenForUserActivity_(), _this.on("fullscreenchange", _this.handleFullscreenChange_), 6215 _this.on("stageclick", _this.handleStageClick_), _this.changingSrc_ = !1, _this.playWaitingForReady_ = !1, 6216 _this.playOnLoadstart_ = null, _this.forceAutoplayInChrome_(), _this; 6217 } 6218 return inherits(Player, _Component), Player.prototype.dispose = function() { 6219 this.trigger("dispose"), this.off("dispose"), this.styleEl_ && this.styleEl_.parentNode && (this.styleEl_.parentNode.removeChild(this.styleEl_), 6220 this.styleEl_ = null), Player.players[this.id_] = null, this.tag && this.tag.player && (this.tag.player = null),
vendor: 9,704 bytes, lines 6221-6332
6221 this.el_ && this.el_.player && (this.el_.player = null), this.tech_ && this.tech_.dispose(), 6222 this.playerElIngest_ && (this.playerElIngest_ = null), this.tag && (this.tag = null), 6223 middlewareInstances[this.id()] = null, _Component.prototype.dispose.call(this); 6224 }, Player.prototype.createEl = function() { 6225 var tag = this.tag, el = void 0, playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player"), divEmbed = "video-js" === this.tag.tagName.toLowerCase(); 6226 playerElIngest ? el = this.el_ = tag.parentNode : divEmbed || (el = this.el_ = _Component.prototype.createEl.call(this, "div")); 6227 var attrs = getAttributes(tag); 6228 if (divEmbed) { 6229 for (el = this.el_ = tag, tag = this.tag = document_1.createElement("video"); el.children.length; ) tag.appendChild(el.firstChild); 6230 hasClass(el, "video-js") || addClass(el, "video-js"), el.appendChild(tag), playerElIngest = this.playerElIngest_ = el; 6231 } 6232 if (tag.setAttribute("tabindex", "-1"), tag.removeAttribute("width"), tag.removeAttribute("height"), 6233 Object.getOwnPropertyNames(attrs).forEach(function(attr) { 6234 "class" === attr ? (el.className += " " + attrs[attr], divEmbed && (tag.className += " " + attrs[attr])) : (el.setAttribute(attr, attrs[attr]), 6235 divEmbed && tag.setAttribute(attr, attrs[attr])); 6236 }), tag.playerId = tag.id, tag.id += "_html5_api", tag.className = "vjs-tech", tag.player = el.player = this, 6237 this.addClass("vjs-paused"), !0 !== window_1.VIDEOJS_NO_DYNAMIC_STYLE) { 6238 this.styleEl_ = createStyleElement("vjs-styles-dimensions"); 6239 var defaultsStyleEl = $(".vjs-styles-defaults"), head = $("head"); 6240 head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild); 6241 } 6242 this.width(this.options_.width), this.height(this.options_.height), this.fluid(this.options_.fluid), 6243 this.aspectRatio(this.options_.aspectRatio); 6244 for (var links = tag.getElementsByTagName("a"), i = 0; i < links.length; i++) { 6245 var linkEl = links.item(i); 6246 addClass(linkEl, "vjs-hidden"), linkEl.setAttribute("hidden", "hidden"); 6247 } 6248 return tag.initNetworkState_ = tag.networkState, tag.parentNode && !playerElIngest && tag.parentNode.insertBefore(el, tag), 6249 prependTo(tag, el), this.children_.unshift(tag), this.el_.setAttribute("lang", this.language_), 6250 this.el_ = el; 6251 }, Player.prototype.width = function(value) { 6252 return this.dimension("width", value); 6253 }, Player.prototype.height = function(value) { 6254 return this.dimension("height", value); 6255 }, Player.prototype.dimension = function(_dimension, value) { 6256 var privDimension = _dimension + "_"; 6257 if (void 0 === value) return this[privDimension] || 0; 6258 if ("" === value) return this[privDimension] = void 0, void this.updateStyleEl_(); 6259 var parsedVal = parseFloat(value); 6260 isNaN(parsedVal) ? log$1.error('Improper value "' + value + '" supplied for for ' + _dimension) : (this[privDimension] = parsedVal, 6261 this.updateStyleEl_()); 6262 }, Player.prototype.fluid = function(bool) { 6263 if (void 0 === bool) return !!this.fluid_; 6264 this.fluid_ = !!bool, bool ? this.addClass("vjs-fluid") : this.removeClass("vjs-fluid"), 6265 this.updateStyleEl_(); 6266 }, Player.prototype.aspectRatio = function(ratio) { 6267 if (void 0 === ratio) return this.aspectRatio_; 6268 if (!/^\d+\:\d+$/.test(ratio)) throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9."); 6269 this.aspectRatio_ = ratio, this.fluid(!0), this.updateStyleEl_(); 6270 }, Player.prototype.updateStyleEl_ = function() { 6271 if (!0 !== window_1.VIDEOJS_NO_DYNAMIC_STYLE) { 6272 var width = void 0, height = void 0, idClass = void 0, ratioParts = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : 0 < this.videoWidth() ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"), ratioMultiplier = ratioParts[1] / ratioParts[0]; 6273 width = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / ratioMultiplier : this.videoWidth() || 300, 6274 height = void 0 !== this.height_ ? this.height_ : width * ratioMultiplier, idClass = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", 6275 this.addClass(idClass), setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width + "px;\n height: " + height + "px;\n }\n\n ." + idClass + ".vjs-fluid {\n padding-top: " + 100 * ratioMultiplier + "%;\n }\n "); 6276 } else { 6277 var _width = "number" == typeof this.width_ ? this.width_ : this.options_.width, _height = "number" == typeof this.height_ ? this.height_ : this.options_.height, techEl = this.tech_ && this.tech_.el(); 6278 techEl && (0 <= _width && (techEl.width = _width), 0 <= _height && (techEl.height = _height)); 6279 } 6280 }, Player.prototype.loadTech_ = function(techName, source) { 6281 var _this2 = this; 6282 this.tech_ && this.unloadTech_(); 6283 var titleTechName = toTitleCase(techName), camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1); 6284 "Html5" !== titleTechName && this.tag && (Tech.getTech("Html5").disposeMediaElement(this.tag), 6285 this.tag.player = null, this.tag = null), this.techName_ = titleTechName, this.isReady_ = !1; 6286 var techOptions = { 6287 source: source, 6288 nativeControlsForTouch: this.options_.nativeControlsForTouch, 6289 playerId: this.id(), 6290 techId: this.id() + "_" + titleTechName + "_api", 6291 autoplay: this.options_.autoplay, 6292 playsinline: this.options_.playsinline, 6293 preload: this.options_.preload, 6294 loop: this.options_.loop, 6295 muted: this.options_.muted, 6296 poster: this.poster(), 6297 language: this.language(), 6298 playerElIngest: this.playerElIngest_ || !1, 6299 "vtt.js": this.options_["vtt.js"] 6300 }; 6301 ALL.names.forEach(function(name$$1) { 6302 var props = ALL[name$$1]; 6303 techOptions[props.getterName] = _this2[props.privateName]; 6304 }), assign(techOptions, this.options_[titleTechName]), assign(techOptions, this.options_[camelTechName]), 6305 assign(techOptions, this.options_[techName.toLowerCase()]), this.tag && (techOptions.tag = this.tag), 6306 source && source.src === this.cache_.src && 0 < this.cache_.currentTime && (techOptions.startTime = this.cache_.currentTime); 6307 var TechClass = Tech.getTech(techName); 6308 if (!TechClass) throw new Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'"); 6309 this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), 6310 textTrackConverter_jsonToTextTracks(this.textTracksJson_ || [], this.tech_), TECH_EVENTS_RETRIGGER.forEach(function(event) { 6311 _this2.on(_this2.tech_, event, _this2["handleTech" + toTitleCase(event) + "_"]); 6312 }), this.on(this.tech_, "loadstart", this.handleTechLoadStart_), this.on(this.tech_, "waiting", this.handleTechWaiting_), 6313 this.on(this.tech_, "canplay", this.handleTechCanPlay_), this.on(this.tech_, "canplaythrough", this.handleTechCanPlayThrough_), 6314 this.on(this.tech_, "playing", this.handleTechPlaying_), this.on(this.tech_, "ended", this.handleTechEnded_), 6315 this.on(this.tech_, "seeking", this.handleTechSeeking_), this.on(this.tech_, "seeked", this.handleTechSeeked_), 6316 this.on(this.tech_, "play", this.handleTechPlay_), this.on(this.tech_, "firstplay", this.handleTechFirstPlay_), 6317 this.on(this.tech_, "pause", this.handleTechPause_), this.on(this.tech_, "durationchange", this.handleTechDurationChange_), 6318 this.on(this.tech_, "fullscreenchange", this.handleTechFullscreenChange_), this.on(this.tech_, "error", this.handleTechError_), 6319 this.on(this.tech_, "loadedmetadata", this.updateStyleEl_), this.on(this.tech_, "posterchange", this.handleTechPosterChange_), 6320 this.on(this.tech_, "textdata", this.handleTechTextData_), this.usingNativeControls(this.techGet_("controls")), 6321 this.controls() && !this.usingNativeControls() && this.addTechControlsListeners_(), 6322 this.tech_.el().parentNode === this.el() || "Html5" === titleTechName && this.tag || prependTo(this.tech_.el(), this.el()), 6323 this.tag && (this.tag.player = null, this.tag = null); 6324 }, Player.prototype.unloadTech_ = function() { 6325 var _this3 = this; 6326 ALL.names.forEach(function(name$$1) { 6327 var props = ALL[name$$1]; 6328 _this3[props.privateName] = _this3[props.getterName](); 6329 }), this.textTracksJson_ = textTrackConverter_textTracksToJson(this.tech_), this.isReady_ = !1, 6330 this.tech_.dispose(), this.tech_ = !1; 6331 }, Player.prototype.tech = function(safety) { 6332 return void 0 === safety && log$1.warn(tsml(_templateOb
6332ject$1)), this.tech_; 6333 }, Player.prototype.addTechControlsListeners_ = function() { 6334 this.removeTechControlsListeners_(), this.on(this.tech_, "mousedown", this.handleTechClick_), 6335 this.on(this.tech_, "touchstart", this.handleTechTouchStart_), this.on(this.tech_, "touchmove", this.handleTechTouchMove_), 6336 this.on(this.tech_, "touchend", this.handleTechTouchEnd_), this.on(this.tech_, "tap", this.handleTechTap_); 6337 }, Player.prototype.removeTechControlsListeners_ = function() { 6338 this.off(this.tech_, "tap", this.handleTechTap_), this.off(this.tech_, "touchstart", this.handleTechTouchStart_), 6339 this.off(this.tech_, "touchmove", this.handleTechTouchMove_), this.off(this.tech_, "touchend", this.handleTechTouchEnd_), 6340 this.off(this.tech_, "mousedown", this.handleTechClick_); 6341 }, Player.prototype.handleTechReady_ = function() { 6342 if (this.triggerReady(), this.cache_.volume && this.techCall_("setVolume", this.cache_.volume), 6343 this.handleTechPosterChange_(), this.handleTechDurationChange_(), (this.src() || this.currentSrc()) && this.tag && this.options_.autoplay && this.paused()) try { 6344 delete this.tag.poster; 6345 } catch (e) { 6346 log$1("deleting tag.poster throws in some browsers", e); 6347 } 6348 }, Player.prototype.handleTechLoadStart_ = function() { 6349 this.removeClass("vjs-ended"), this.removeClass("vjs-seeking"), this.error(null), 6350 this.paused() ? (this.hasStarted(!1), this.trigger("loadstart")) : (this.trigger("loadstart"), 6351 this.trigger("firstplay")); 6352 }, Player.prototype.hasStarted = function(request) { 6353 if (void 0 === request) return this.hasStarted_; 6354 request !== this.hasStarted_ && (this.hasStarted_ = request, this.hasStarted_ ? (this.addClass("vjs-has-started"), 6355 this.trigger("firstplay")) : this.removeClass("vjs-has-started")); 6356 }, Player.prototype.handleTechPlay_ = function() { 6357 this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), 6358 this.hasStarted(!0), this.trigger("play"); 6359 }, Player.prototype.handleTechWaiting_ = function() { 6360 var _this4 = this; 6361 this.addClass("vjs-waiting"), this.trigger("waiting"), this.one("timeupdate", function() { 6362 return _this4.removeClass("vjs-waiting"); 6363 }); 6364 }, Player.prototype.handleTechCanPlay_ = function() { 6365 this.removeClass("vjs-waiting"), this.trigger("canplay"); 6366 }, Player.prototype.handleTechCanPlayThrough_ = function() { 6367 this.removeClass("vjs-waiting"), this.trigger("canplaythrough"); 6368 }, Player.prototype.handleTechPlaying_ = function() { 6369 this.removeClass("vjs-waiting"), this.trigger("playing"); 6370 }, Player.prototype.handleTechSeeking_ = function() { 6371 this.addClass("vjs-seeking"), this.trigger("seeking"); 6372 }, Player.prototype.handleTechSeeked_ = function() { 6373 this.removeClass("vjs-seeking"), this.trigger("seeked"); 6374 }, Player.prototype.handleTechFirstPlay_ = function() { 6375 this.options_.starttime && (log$1.warn("Passing the `starttime` option to the player will be deprecated
6375in 6.0"), 6376 this.currentTime(this.options_.starttime)), this.addClass("vjs-has-started"), this.trigger("firstplay"); 6377 }, Player.prototype.handleTechPause_ = function() { 6378 this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.trigger("pause"); 6379 }, Player.prototype.handleTechEnded_ = function() { 6380 this.addClass("vjs-ended"), this.options_.loop ? (this.currentTime(0), this.play()) : this.paused() || this.pause(), 6381 this.trigger("ended"); 6382 }, Player.prototype.handleTechDurationChange_ = function() { 6383 this.duration(this.techGet_("duration")); 6384 }, Player.prototype.handleTechClick_ = function(event) {}, Player.prototype.handleTechTap_ = function() { 6385 this.userActive(!this.userActive()); 6386 }, Player.prototype.handleTechTouchStart_ = function() { 6387 this.userWasActive = this.userActive(); 6388 }, Player.prototype.handleTechTouchMove_ = function() { 6389 this.userWasActive && this.reportUserActivity(); 6390 }, Player.prototype.handleTechTouchEnd_ = function(event) { 6391 event.preventDefault(); 6392 }, Player.prototype.handleFullscreenChange_ = function() { 6393 this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen"); 6394 }, Player.prototype.handleStageClick_ = function() { 6395 this.reportUserActivity(); 6396 }, Player.prototype.handleTechFullscreenChange_ = function(event, data) { 6397 data && this.isFullscreen(data.isFullscreen), this.trigger("fullscreenchange"); 6398 }, Player.prototype.handleTechError_ = function() { 6399 var error = this.tech_.error(); 6400 this.error(error); 6401 }, Player.prototype.handleTechTextData_ = function() { 6402 var data = null; 6403 1 < arguments.length && (data = arguments[1]), this.trigger("textdata", data); 6404 }, Player.prototype.getCache = function() { 6405 return this.cache_; 6406 }, Player.prototype.techCall_ = function(method, arg) { 6407 this.ready(function() { 6408 if (method in allowedSetters) return function(middleware, tech, method, arg) { 6409 return tech[method](middleware.reduce(middlewareIterator(method), arg)); 6410 }(this.middleware_, this.tech_, method, arg); 6411 if (method in allowedMediators) return mediate(this.middleware_, this.tech_, method, arg); 6412 try { 6413 this.tech_ && this.tech_[method](arg); 6414 } catch (e) { 6415 throw log$1(e), e; 6416 } 6417 }, !0); 6418 }, Player.prototype.techGet_ = function(method) { 6419 if (this.tech_ && this.tech_.isReady_) { 6420 if (method in allowedGetters) return function(middleware, tech, method) { 6421 return middleware.reduceRight(middlewareIterator(method), tech[method]()); 6422 }(this.middleware_, this.tech_, method); 6423 if (method in allowedMediators) return mediate(this.middleware_, this.tech_, method); 6424 try { 6425 return this.tech_[method](); 6426 } catch (e) { 6427 if (void 0 === this.tech_[method]) throw log$1("Video.js: " + method + " method not defined for " + this.techName_ + " playback technology.", e), 6428 e; 6429 if ("TypeError" === e.name) throw log$1("Video.js: " + method + " unavailable on " + this.techName_ + " playback technology element.", e), 6430 this.tech_.isReady_ = !1, e; 6431 throw log$1(e), e; 6432 } 6433 } 6434 }, Player.prototype.play = function() { 6435 var _this5 = this; 6436 if (this.playOnLoadstart_ && this.off("loadstart", this.playOnLoadstart_), this.isReady_) { 6437 if (!this.changingSrc_ && (this.src() || this.currentSrc())) return this.techGet_("play"); 6438 this.playOnLoadstart_ = function() { 6439 _this5.playOnLoadstart_ = null, silencePromise(_this5.play()); 6440 }, this.one("loadstart", this.playOnLoadstart_); 6441 } else { 6442 if (this.playWaitingForReady_) return; 6443 this.playWaitingForReady_ = !0, this.ready(function() { 6444 _this5.playWaitingForReady_ = !1, silencePromise(_this5.play()); 6445 }); 6446 } 6447 }, Player.prototype.pause = function() { 6448 this.techCall_("pause"); 6449 }, Player.prototype.paused = function() { 6450 return !1 !== this.techGet_("paused"); 6451 }, Player.prototype.played = function() { 6452 return this.techGet_("played") || createTimeRanges(0, 0); 6453 }, Player.prototype.scrubbing = function(isScrubbing) { 6454 if (void 0 === isScrubbing) return this.scrubbing_; 6455 this.scrubbing_ = !!isScrubbing, isScrubbing ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing"); 6456 }, Player.prototype.currentTime = function(seconds) { 6457 return void 0 !== seconds ? (seconds < 0 && (seconds = 0), void this.techCall_("setCurrentTime", seconds)) : (this.cache_.currentTime = this.techGet_("currentTime") || 0, 6458 this.cache_.currentTime); 6459 }, Player.prototype.duration = function(seconds) { 6460 if (void 0 === seconds) return void 0 !== this.cache_.duration ? this.cache_.duration : NaN; 6461 (seconds = parseFloat(seconds)) < 0 && (seconds = 1 / 0), seconds !== this.cache_.duration && ((this.cache_.duration = seconds) === 1 / 0 ? this.addClass("vjs-live") : this.removeClass("vjs-live"), 6462 this.trigger("durationchange")); 6463 }, Player.prototype.remainingTime = function() { 6464 return this.duration() - this.currentTime(); 6465 }, Player.prototype.remainingTimeDisplay = function() { 6466 return Math.floor(this.duration()) - Math.floor(this.currentTime()); 6467 }, Player.prototype.buffered = function() { 6468 var buffered = this.techGet_("buffered"); 6469 return buffered && buffered.length || (buffered = createTimeRanges(0, 0)), buffered; 6470 }, Player.prototype.bufferedPercent = function() { 6471 return bufferedPercent(this.buffered(), this.duration()); 6472 }, Player.prototype.bufferedEnd = function() { 6473 var buffered = this.buffered(), duration = this.duration(), end = buffered.end(buffered.length - 1); 6474 return duration < end && (end = duration), end; 6475 }, Player.prototype.volume = function(percentAsDecimal) { 6476 var vol = void 0; 6477 return void 0 !== percentAsDecimal ? (vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))), 6478 this.cache_.volume = vol, this.techCall_("setVolume", vol), void (0 < vol && this.lastVolume_(vol))) : (vol = parseFloat(this.techGet_("volume")), 6479 isNaN(vol) ? 1 : vol); 6480 }, Player.prototype.muted = function(_muted) { 6481 if (void 0 === _muted) return this.techGet_("muted") || !1; 6482 this.techCall_("setMuted", _muted); 6483 }, Player.prototype.defaultMuted = function(_defaultMuted) { 6484 return void 0 !== _defaultMuted ? this.techCall_("setDefaultMuted", _defaultMuted) : this.techGet_("defaultMuted") || !1; 6485 }, Player.prototype.lastVolume_ = function(percentAsDecimal) { 6486 if (void 0 === percentAsDecimal || 0 === percentAsDecimal) return this.cache_.lastVolume; 6487 this.cache_.lastVolume = percentAsDecimal; 6488 }, Player.prototype.supportsFullScreen = function() { 6489 return this.techGet_("supportsFullScreen") || !1; 6490 }, Player.prototype.isFullscreen = function(isFS) { 6491 if (void 0 === isFS) return !!this.isFullscreen_; 6492 this.isFullscreen_ = !!isFS; 6493 }, Player.prototype.requestFullscreen = function() { 6494 var fsApi = FullscreenApi; 6495 this.isFullscreen(!0), fsApi.requestFullscreen ? (on(document_1, fsApi.fullscreenchange, bind(this, function documentFullscreenChange(e) { 6496 this.isFullscreen(document_1[fsApi.fullscreenElement]), !1 === this.isFullscreen() && off(document_1, fsApi.fullscreenchange, documentFullscreenChange), 6497 this.trigger("fullscreenchange"); 6498 })), this.el_[fsApi.requestFullscreen]()) : this.tech_.supportsFullScreen() ? this.techCall_("enterFullScreen") : (this.enterFullWindow(), 6499 this.trigger("fullscreenchange")); 6500 }, Player.prototype.exitFullscreen = function() { 6501 var fsApi = FullscreenApi; 6502 this.isFullscreen(!1), fsApi.requestFullscreen ? document_1[fsApi.exitFullscreen]() : this.tech_.supportsFullScreen() ? this.techCall_("exitFullScreen") : (this.exitFullWindow(), 6503 this.trigger("fullscreenchange")); 6504 }, Player.prototype.enterFullWindow = function() { 6505 this.isFullWindow = !0, this.docOrigOverflow = document_1.documentElement.style.overflow, 6506 on(document_1, "keydown", bind(this, this.fullWindowOnEscKey)), document_1.documentElement.style.overflow = "hidden", 6507 addClass(document_1.body, "vjs-full-window"), this.trigger("enterFullWindow"); 6508 }, Player.prototype.fullWindowOnEscKey = function(event) { 6509 27 === event.keyCode && (!0 === this.isFullscreen() ? this.exitFullscreen() : this.exitFullWindow()); 6510 }, Player.prototype.exitFullWindow = function() { 6511 this.isFullWindow = !1, off(document_1, "keydown", this.fullWindowOnEscKey), document_1.documentElement.style.overflow = this.docOrigOverflow, 6512 removeClass(document_1.body, "vjs-full-window"), this.trigger("exitFullWindow"); 6513 }, Player.prototype.canPlayType = function(type) { 6514 for (var can = void 0, i = 0, j = this.options_.techOrder; i < j.length; i++) { 6515 var techName = j[i], tech = Tech.getTech(techName); 6516 if (tech || (tech = Component.getComponent(techName)), tech) { 6517 if (tech.isSupported() && (can = tech.canPlayType(type))) return can; 6518 } else log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.'); 6519 } 6520 return ""; 6521 }, Player.prototype.selectSource = function(sources) { 6522 var fn, _this6 = this, techs = this.options_.techOrder.map(function(techName) { 6523 return [ techName, Tech.getTech(techName) ]; 6524 }).filter(function(_ref) { 6525 var techName = _ref[0], tech = _ref[1]; 6526 return tech ? tech.isSupported() : (log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.'), 6527 !1); 6528 }), findFirstPassingTechSourcePair = function(outerArray, innerArray, tester) { 6529 var found = void 0; 6530 return outerArray.some(function(outerChoice) { 6531 return innerArray.some(function(innerChoice) { 6532 if (found = tester(outerChoice, innerChoice)) return !0; 6533 }); 6534 }), found; 6535 }, finder = function(_ref2, source) { 6536 var techName = _ref2[0]; 6537 if (_ref2[1].canPlaySource(source, _this6.options_[techName.toLowerCase()])) return { 6538 source: source, 6539 tech: techName 6540 }; 6541 }; 6542 return (this.options_.sourceOrder ? findFirstPassingTechSourcePair(sources, techs, (fn = finder, 6543 function(a, b) { 6544 return fn(b, a); 6545 })) : findFirstPassingTechSourcePair(techs, sources, finder)) || !1; 6546 }, Player.prototype.src = function(source) { 6547 var _this7 = this; 6548 if (void 0 === source) return this.cache_.src || ""; 6549 var sources = function filterSource(src) { 6550 if (Array.isArray(src)) { 6551 var newsrc = [];
6552 src.forEach(function(srcobj) { 6553 srcobj = filterSource(srcobj), Array.isArray(srcobj) ? newsrc = newsrc.concat(srcobj) : isObject(srcobj) && newsrc.push(srcobj); 6554 }), src = newsrc; 6555 } else src = "string" == typeof src && src.trim() ? [ { 6556 src: src 6557 } ] : isObject(src) && "string" == typeof src.src && src.src && src.src.trim() ? [ src ] : []; 6558 return src; 6559 }(source); 6560 sources.length ? (this.cache_.sources = sources, this.changingSrc_ = !0, this.cache_.source = sources[0], 6561 setSource(this, sources[0], function(middlewareSource, mws) { 6562 var middleware, tech; 6563 if (_this7.middleware_ = mws, _this7.src_(middlewareSource)) return 1 < sources.length ? _this7.src(sources.slice(1)) : (_this7.setTimeout(function() { 6564 this.error({ 6565 code: 4, 6566 message: this.localize(this.options_.notSupportedMessage) 6567 }); 6568 }, 0), void _this7.triggerReady()); 6569 _this7.changingSrc_ = !1, _this7.cache_.src = middlewareSource.src, middleware = mws, 6570 tech = _this7.tech_, middleware.forEach(function(mw) { 6571 return mw.setTech && mw.setTech(tech); 6572 }); 6573 })) : this.setTimeout(function() { 6574 this.error({ 6575 code: 4, 6576 message: this.localize(this.options_.notSupportedMessage) 6577 }); 6578 }, 0); 6579 }, Player.prototype.src_ = function(source) { 6580 var str1, str2, sourceTech = this.selectSource([ source ]); 6581 return !sourceTech || (str1 = sourceTech.tech, str2 = this.techName_, toTitleCase(str1) !== toTitleCase(str2) ? (this.changingSrc_ = !0, 6582 this.loadTech_(sourceTech.tech, sourceTech.source)) : this.ready(function() { 6583 this.tech_.constructor.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", source) : this.techCall_("src", source.src), 6584 "auto" === this.options_.preload && this.load(); 6585 }, !0), !1); 6586 }, Player.prototype.load = function() { 6587 this.techCall_("load"); 6588 }, Player.prototype.reset = function() { 6589 this.loadTech_(this.options_.techOrder[0], null), this.techCall_("reset"); 6590 }, Player.prototype.currentSources = function() { 6591 var source = this.currentSource(), sources = []; 6592 return 0 !== Object.keys(source).length && sources.push(source), this.cache_.sources || sources; 6593 }, Player.prototype.currentSource = function() { 6594 return this.cache_.source || {}; 6595 }, Player.prototype.currentSrc = function() { 6596 return this.currentSource() && this.currentSource().src || ""; 6597 }, Player.prototype.currentType = function() { 6598 return this.currentSource() && this.currentSource().type || ""; 6599 }, Player.prototype.preload = function(value) { 6600 return void 0 !== value ? (this.techCall_("setPreload", value), void (this.options_.preload = value)) : this.techGet_("preload"); 6601 }, Player.prototype.autoplay = function(value) { 6602 return void 0 !== value ? (this.techCall_("setAutoplay", value), this.options_.autoplay = value, 6603 void this.ready(this.forceAutoplayInChrome_)) : this.techGet_("autoplay", value); 6604 }, Player.prototype.forceAutoplayInChrome_ = function() { 6605 this.paused() && (this.autoplay() || this.options_.autoplay) && IS_CHROME && !IS_ANDROID && this.play(); 6606 }, Player.prototype.playsinline = function(value) { 6607 return void 0 !== value ? (this.techCall_("setPlaysinline", value), this.options_.playsinline = value, 6608 this) : this.techGet_("playsinline"); 6609 }, Player.prototype.loop = function(value) { 6610 return void 0 !== value ? (this.techCall_("setLoop", value), void (this.options_.loop = value)) : this.techGet_("loop"); 6611 }, Player.prototype.poster = function(src) { 6612 if (void 0 === src) return this.poster_; 6613 src || (src = ""), this.poster_ = src, this.techCall_("setPoster", src), this.trigger("posterchange"); 6614 }, Player.prototype.handleTechPosterChange_ = function() { 6615 !this.poster_ && this.tech_ && this.tech_.poster && (this.poster_ = this.tech_.poster() || "", 6616 this.trigger("posterchange")); 6617 }, Player.prototype.controls = function(bool) { 6618 if (void 0 === bool) return !!this.controls_; 6619 bool = !!bool, this.controls_ !== bool && (this.controls_ = bool, this.usingNativeControls() && this.techCall_("setControls", bool), 6620 this.controls_ ? (this.removeClass("vjs-controls-disabled"), this.addClass("vjs-controls-enabled"), 6621 this.trigger("controlsenabled"), this.usingNativeControls() || this.addTechControl
6621sListeners_()) : (this.removeClass("vjs-controls-enabled"), 6622 this.addClass("vjs-controls-disabled"), this.trigger("controlsdisabled"), this.usingNativeControls() || this.removeTechControlsListeners_())); 6623 }, Player.prototype.usingNativeControls = function(bool) { 6624 if (void 0 === bool) return !!this.usingNativeControls_; 6625 bool = !!bool, this.usingNativeControls_ !== bool && (this.usingNativeControls_ = bool, 6626 this.usingNativeControls_ ? (this.addClass("vjs-using-native-controls"), this.trigger("usingnativecontrols")) : (this.removeClass("vjs-using-native-controls"), 6627 this.trigger("usingcustomcontrols"))); 6628 }, Player.prototype.error = function(err) { 6629 return void 0 === err ? this.error_ || null : null === err ? (this.error_ = err, 6630 this.removeClass("vjs-error"), void (this.errorDisplay && this.errorDisplay.close())) : (this.error_ = new MediaError(err), 6631 this.addClass("vjs-error"), log$1.error("(CODE:" + this.error_.code + " " + MediaError.errorTypes[this.error_.code] + ")", this.error_.message, this.error_), 6632 void this.trigger("error")); 6633 }, Player.prototype.reportUserActivity = function(event) { 6634 this.userActivity_ = !0; 6635 }, Player.prototype.userActive = function(bool) { 6636 if (void 0 === bool) return this.userActive_; 6637 if ((bool = !!bool) !== this.userActive_) { 6638 if (this.userActive_ = bool, this.userActive_) return this.userActivity_ = !0, this.removeClass("vjs-user-inactive"), 6639 this.addClass("vjs-user-active"), void this.trigger("useractive"); 6640 this.tech_ && this.tech_.one("mousemove", function(e) { 6641 e.stopPropagation(), e.preventDefault(); 6642 }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), 6643 this.trigger("userinactive"); 6644 } 6645 }, Player.prototype.listenForUserActivity_ = function() { 6646 var mouseInProgress = void 0, lastMoveX = void 0, lastMoveY = void 0, handleActivity = bind(this, this.reportUserActivity); 6647 this.on("mousedown", function() { 6648 handleActivity(), this.clearInterval(mouseInProgress), mouseInProgress = this.setInterval(handleActivity, 250); 6649 }), this.on("mousemove", function(e) { 6650 e.screenX === lastMoveX && e.screenY === lastMoveY || (lastMoveX = e.screenX, lastMoveY = e.screenY, 6651 handleActivity()); 6652 }), this.on("mouseup", function(event) { 6653 handleActivity(), this.clearInterval(mouseInProgress); 6654 }), this.on("keydown", handleActivity), this.on("keyup", handleActivity); 6655 var inactivityTimeout = void 0; 6656 this.setInterval(function() { 6657 if (this.userActivity_) { 6658 this.userActivity_ = !1, this.userActive(!0), this.clearTimeout(inactivityTimeout); 6659 var timeout = this.options_.inactivityTimeout; 6660 timeout <= 0 || (inactivityTimeout = this.setTimeout(function() { 6661 this.userActivity_ || this.userActive(!1); 6662 }, timeout)); 6663 } 6664 }, 250); 6665 }, Player.prototype.playbackRate = function(rate) { 6666 if (void 0 === rate) return this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("playbackRate") : 1; 6667 this.techCall_("setPlaybackRate", rate); 6668 }, Player.prototype.defaultPlaybackRate = function(rate) { 6669 return void 0 !== rate ? this.techCall_("setDefaultPlaybackRate", rate) : this.tech_ && this.tech_.featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1; 6670 }, Player.prototype.isAudio = function(bool) { 6671 if (void 0 === bool) return !!this.isAudio_; 6672 this.isAudio_ = !!bool; 6673 }, Player.prototype.addTextTrack = function(kind, label, language) { 6674 if (this.tech_) return this.tech_.addTextTrack(kind, label, language); 6675 }, Player.prototype.addRemoteTextTrack = function(options, manualCleanup) { 6676 if (this.tech_) return this.tech_.addRemoteTextTrack(options, manualCleanup); 6677 }, Player.prototype.removeRemoteTextTrack = function() { 6678 var _ref3$track = (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}).track, track = void 0 === _ref3$track ? arguments[0] : _ref3$track; 6679 if (this.tech_) return this.tech_.removeRemoteTextTrack(track); 6680 }, Player.prototype.getVideoPlaybackQuality = function() { 6681 return this.techGet_("getVideoPlaybackQuality"); 6682 }, Player.prototype.videoWidth = function() { 6683 return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0; 6684 }, Player.prototype.videoHeight = function() { 6685 return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0; 6686 }, Player.prototype.language = function(code) { 6687 if (void 0 === code) return this.language_; 6688 this.language_ = String(code).toLowerCase(); 6689 }, Player.prototype.languages = function() { 6690 return mergeOptions(Player.prototype.options_.languages, this.languages_); 6691 }, Player.prototype.toJSON = function() { 6692 var options = mergeOptions(this.options_), tracks = options.tracks; 6693 options.tracks = []; 6694 for (var i = 0; i < tracks.length; i++) { 6695 var track = tracks[i]; 6696 (track = mergeOptions(track)).player = void 0, options.tracks[i] = track; 6697 } 6698 return options; 6699 }, Player.prototype.createModal = function(content, options) { 6700 var _this8 = this; 6701 (options = options || {}).content = content || ""; 6702 var modal = new ModalDialog(this, options); 6703 return this.addChild(modal), modal.on("dispose", function() { 6704 _this8.removeChild(modal); 6705 }), modal.open(), modal; 6706 }, Player.getTagSettings = function(tag) { 6707 var baseOptions = { 6708 sources: [], 6709 tracks: [] 6710 }, tagOptions = getAttributes(tag), dataSetup = tagOptions["data-setup"]; 6711 if (hasClass(tag, "vjs-fluid") && (tagOptions.fluid = !0), null !== dataSetup) { 6712 var _safeParseTuple = tuple(dataSetup || "{}"), err = _safeParseTuple[0], data = _safeParseTuple[1]; 6713 err && log$1.error(err), assign(tagOptions, data); 6714 } 6715 if (assign(baseOptions, tagOptions), tag.hasChildNodes()) for (var children = tag.childNodes, i = 0, j = children.length; i < j; i++) { 6716 var child = children[i], childName = child.nodeName.toLowerCase(); 6717 "source" === childName ? baseOptions.sources.push(getAttributes(child)) : "track" === childName && baseOptions.tracks.push(getAttributes(child)); 6718 } 6719 return baseOptions; 6720 }, Player.prototype.flexNotSupported_ = function() { 6721 var elem = document_1.createElement("i"); 6722 return !("flexBasis" in elem.style || "webkitFlexBasis" in elem.style || "mozFlexBasis" in elem.style || "msFlexBasis" in elem.style || "msFlexOrder" in elem.style); 6723 }, Player; 6724 }(Component);
6725 ALL.names.forEach(function(name$$1) { 6726 var props = ALL[name$$1]; 6727 Player.prototype[props.getterName] = function() { 6728 return this.tech_ ? this.tech_[props.getterName]() : (this[props.privateName] = this[props.privateName] || new props.ListClass(), 6729 this[props.privateName]); 6730 }; 6731 }), Player.players = {}; 6732 var navigator$1 = window_1.navigator; 6733 Player.prototype.options_ = { 6734 techOrder: Tech.defaultTechOrder_, 6735 html5: {}, 6736 flash: {}, 6737 inactivityTimeout: 2e3, 6738 playbackRates: [], 6739 children: [ "mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "controlBar", "errorDisplay", "textTrackSettings" ], 6740 language: navigator$1 && (navigator$1.languages && navigator$1.languages[0] || navigator$1.userLanguage || navigator$1.language) || "en", 6741 languages: {}, 6742 notSupportedMessage: "No compatible source was found for this media." 6743 }, IS_IE8 || Player.prototype.options_.children.push("resizeManager"), [ "ended", "seeking", "seekable", "networkState", "readyState" ].forEach(function(fn) { 6744 Player.prototype[fn] = function() { 6745 return this.techGet_(fn); 6746 }; 6747 }), TECH_EVENTS_RETRIGGER.forEach(function(event) { 6748 Player.prototype["handleTech" + toTitleCase(event) + "_"] = function() { 6749 return this.trigger(event); 6750 }; 6751 }), Component.registerComponent("Player", Player); 6752 var pluginStorage = {}, pluginExists = function(name) { 6753 return pluginStorage.hasOwnProperty(name); 6754 }, getPlugin = function(name) { 6755 return pluginExists(name) ? pluginStorage[name] : void 0; 6756 }, markPluginAsActive = function(player, name) { 6757 player.activePlugins_ = player.activePlugins_ || {}, player.activePlugins_[name] = !0; 6758 }, triggerSetupEvent = function(player, hash, before) { 6759 var eventName = (before ? "before" : "") + "pluginsetup"; 6760 player.trigger(eventName, hash), player.trigger(eventName + ":" + hash.name, hash); 6761 }, createPluginFactory = function(name, PluginSubClass) { 6762 return PluginSubClass.prototype.name = name, function() { 6763 triggerSetupEvent(this, { 6764 name: name, 6765 plugin: PluginSubClass, 6766 instance: null 6767 }, !0); 6768 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key]; 6769 var instance = new (Function.prototype.bind.apply(PluginSubClass, [ null ].concat([ this ].concat(args))))(); 6770 return this[name] = function() { 6771 return instance; 6772 }, triggerSetupEvent(this, instance.getEventHash()), instance; 6773 }; 6774 }, Plugin = function() { 6775 function Plugin(player) { 6776 if (classCallCheck(this, Plugin), this.constructor === Plugin) throw new Error("Plugin must be sub-classed; not directly instantiated."); 6777 this.player = player, evented(this), delete this.trigger, stateful(this, this.constructor.defaultState), 6778 markPluginAsActive(player, this.name), this.dispose = bind(this, this.dispose), 6779 player.on("dispose", this.dispose); 6780 } 6781 return Plugin.prototype.version = function() { 6782 return this.constructor.VERSION; 6783 }, Plugin.prototype.getEventHash = function() { 6784 var hash = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; 6785 return hash.name = this.name, hash.plugin = this.constructor, hash.instance = this, 6786 hash; 6787 }, Plugin.prototype.trigger = function(event) { 6788 var hash = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; 6789 return trigger(this.eventBusEl_, event, this.getEventHash(hash)); 6790 }, Plugin.prototype.handleStateChanged = function(e) {}, Plugin.prototype.dispose = function() { 6791 var name = this.name, player = this.player; 6792 this.trigger("dispose"), this.off(), player.off("dispose", this.dispose), player.activePlugins_[name] = !1, 6793 this.player = this.state = null, player[name] = createPluginFactory(name, pluginStorage[name]); 6794 }, Plugin.isBasic = function(plugin) { 6795 var p = "string" == typeof plugin ? getPlugin(plugin) : plugin; 6796 return "function" == typeof p && !Plugin.prototype.isPrototypeOf(p.prototype); 6797 }, Plugin.registerPlugin = function(name, plugin) { 6798 if ("string" != typeof name) throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + (void 0 === name ? "undefined" : _typeof(name)) + "."); 6799 if (pluginExists(name)) log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!'); else if (Player.prototype.hasOwnProperty(name)) throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!'); 6800 if ("function" != typeof plugin) throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + (void 0 === plugin ? "undefined" : _typeof(plugin)) + "."); 6801 return pluginStorage[name] = plugin, "plugin" !== name && (Plugin.isBasic(plugin) ? Player.prototype[name] = function(name, plugin) { 6802 var basicPluginWrapper = function() { 6803 triggerSetupEvent(this, { 6804 name: name, 6805 plugin: plugin, 6806 instance: null 6807 }, !0); 6808 var instance = plugin.apply(this, arguments); 6809 return markPluginAsActive(this, name), triggerSetupEvent(this, { 6810 name: name, 6811 plugin: plugin, 6812 instance: instance 6813 }), instance; 6814 };
6815 return Object.keys(plugin).forEach(function(prop) { 6816 basicPluginWrapper[prop] = plugin[prop]; 6817 }), basicPluginWrapper; 6818 }(name, plugin) : Player.prototype[name] = createPluginFactory(name, plugin)), plugin; 6819 }, Plugin.deregisterPlugin = function(name) { 6820 if ("plugin" === name) throw new Error("Cannot de-register base plugin."); 6821 pluginExists(name) && (delete pluginStorage[name], delete Player.prototype[name]); 6822 }, Plugin.getPlugins = function() { 6823 var names = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : Object.keys(pluginStorage), result = void 0; 6824 return names.forEach(function(name) { 6825 var plugin = getPlugin(name); 6826 plugin && ((result = result || {})[name] = plugin); 6827 }), result; 6828 }, Plugin.getPluginVersion = function(name) { 6829 var plugin = getPlugin(name); 6830 return plugin && plugin.VERSION || ""; 6831 }, Plugin; 6832 }(); 6833 Plugin.getPlugin = getPlugin, Plugin.BASE_PLUGIN_NAME = "plugin", Plugin.registerPlugin("plugin", Plugin), 6834 Player.prototype.usingPlugin = function(name) { 6835 return !!this.activePlugins_ && !0 === this.activePlugins_[name]; 6836 }, Player.prototype.hasPlugin = function(name) { 6837 return !!pluginExists(name); 6838 }; 6839 "undefined" == typeof HTMLVideoElement && isReal() && (document_1.createElement("video"), 6840 document_1.createElement("audio"), document_1.createElement("track"), document_1.createElement("video-js")); 6841 var normalizeId = function(id) { 6842 return 0 === id.indexOf("#") ? id.slice(1) : id; 6843 }; 6844 function videojs(id, options, ready) { 6845 var player = videojs.getPlayer(id); 6846 if (player) return options && log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.'), 6847 ready && player.ready(ready), player; 6848 var el = "string" == typeof id ? $("#" + normalizeId(id)) : id; 6849 if (!isEl(el)) throw new TypeError("The element or ID supplied is not valid. (videojs)"); 6850 document_1.body.contains(el) || log$1.warn("The element supplied is not included in the DOM"), 6851 options = options || {}, videojs.hooks("beforesetup").forEach(function(hookFunction) { 6852 var opts = hookFunction(el, mergeOptions(options)); 6853 isObject(opts) && !Array.isArray(opts) ? options = mergeOptions(options, opts) : log$1.error("please return an object in beforesetup hooks"); 6854 }); 6855 var PlayerComponent = Component.getComponent("Player"); 6856 return player = new PlayerComponent(el, options, ready), videojs.hooks("setup").forEach(function(hookFunction) { 6857 return hookFunction(player); 6858 }), player; 6859 } 6860 if (videojs.hooks_ = {}, videojs.hooks = function(type, fn) { 6861 return videojs.hooks_[type] = videojs.hooks_[type] || [], fn && (videojs.hooks_[type] = videojs.hooks_[type].concat(fn)), 6862 videojs.hooks_[type]; 6863 }, videojs.hook = function(type, fn) { 6864 videojs.hooks(type, fn); 6865 }, videojs.hookOnce = function(type, fn) { 6866 videojs.hooks(type, [].concat(fn).map(function(original) { 6867 return function wrapper() { 6868 return videojs.removeHook(type, wrapper), original.apply(void 0, arguments); 6869 }; 6870 })); 6871 }, videojs.removeHook = function(type, fn) { 6872 var index = videojs.hooks(type).indexOf(fn); 6873 return !(index <= -1) && (videojs.hooks_[type] = videojs.hooks_[type].slice(), videojs.hooks_[type].splice(index, 1), 6874 !0); 6875 }, !0 !== window_1.VIDEOJS_NO_DYNAMIC_STYLE && isReal()) { 6876 var style = $(".vjs-styles-defaults"); 6877 if (!style) { 6878 style = createStyleElement("vjs-styles-defaults"); 6879 var head = $("head"); 6880 head && head.insertBefore(style, head.firstChild), setTextContent(style, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n "); 6881 } 6882 } 6883 return autoSetupTimeout(1, videojs), videojs.VERSION = version, videojs.options = Player.prototype.options_, 6884 videojs.getPlayers = function() { 6885 return Player.players; 6886 }, videojs.getPlayer = function(id) { 6887 var players = Player.players, tag = void 0; 6888 if ("string" == typeof id) {
6889 var nId = normalizeId(id), player = players[nId]; 6890 if (player) return player; 6891 tag = $("#" + nId); 6892 } else tag = id; 6893 if (isEl(tag)) { 6894 var _tag = tag, _player = _tag.player, playerId = _tag.playerId; 6895 if (_player || players[playerId]) return _player || players[playerId]; 6896 } 6897 }, videojs.getAllPlayers = function() { 6898 return Object.keys(Player.players).map(function(k) { 6899 return Player.players[k]; 6900 }).filter(Boolean); 6901 }, videojs.players = Player.players, videojs.getComponent = Component.getComponent, 6902 videojs.registerComponent = function(name$$1, comp) { 6903 Tech.isTech(comp) && log$1.warn("The " + name$$1 + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"), 6904 Component.registerComponent.call(Component, name$$1, comp); 6905 }, videojs.getTech = Tech.getTech, videojs.registerTech = Tech.registerTech, videojs.use = function(type, middleware) { 6906 middlewares[type] = middlewares[type] || [], middlewares[type].push(middleware); 6907 }, !IS_IE8 && Object.defineProperty ? (Object.defineProperty(videojs, "middleware", { 6908 value: {}, 6909 writeable: !1, 6910 enumerable: !0 6911 }), Object.defineProperty(videojs.middleware, "TERMINATOR", { 6912 value: TERMINATOR, 6913 writeable: !1, 6914 enumerable: !0 6915 })) : videojs.middleware = { 6916 TERMINATOR: TERMINATOR 6917 }, videojs.browser = browser, videojs.TOUCH_ENABLED = TOUCH_ENABLED, videojs.extend = function(superClass) { 6918 var subClassMethods = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, subClass = function() { 6919 superClass.apply(this, arguments); 6920 }, methods = {}; 6921 for (var name in "object" === (void 0 === subClassMethods ? "undefined" : _typeof(subClassMethods)) ? (subClassMethods.constructor !== Object.prototype.constructor && (subClass = subClassMethods.constructor), 6922 methods = subClassMethods) : "function" == typeof subClassMethods && (subClass = subClassMethods), 6923 function(subClass, superClass) { 6924 if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + (void 0 === superClass ? "undefined" : _typeof(superClass))); 6925 subClass.prototype = Object.create(superClass && superClass.prototype, { 6926 constructor: { 6927 value: subClass, 6928 enumerable: !1, 6929 writable: !0, 6930 configurable: !0 6931 } 6932 }), superClass && (subClass.super_ = superClass); 6933 }(subClass, superClass), methods) methods.hasOwnProperty(name) && (subClass.prototype[name] = methods[name]); 6934 return subClass; 6935 }, videojs.mergeOptions = mergeOptions, videojs.bind = bind, videojs.registerPlugin = Plugin.registerPlugin, 6936 videojs.plugin = function(name$$1, plugin) { 6937 return log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"), 6938 Plugin.registerPlugin(name$$1, plugin); 6939 }, videojs.getPlugins = Plugin.getPlugins, videojs.getPlugin = Plugin.getPlugin, 6940 videojs.getPluginVersion = Plugin.getPluginVersion, videojs.addLanguage = function(code, data) { 6941 var _mergeOptions; 6942 return code = ("" + code).toLowerCase(), videojs.options.languages = mergeOptions(videojs.options.languages, ((_mergeOptions = {})[code] = data, 6943 _mergeOptions)), videojs.options.languages[code]; 6944 }, videojs.log = log$1, videojs.createTimeRange = videojs.createTimeRanges = createTimeRanges, 6945 videojs.formatTime = formatTime, videojs.parseUrl = parseUrl, videojs.isCrossOrigin = isCrossOrigin, 6946 videojs.EventTarget = EventTarget, videojs.on = on, videojs.one = one, videojs.off = off, 6947 videojs.trigger = trigger, videojs.xhr = xhr, videojs.TextTrack = TextTrack, videojs.AudioTrack = AudioTrack, 6948 videojs.VideoTrack = VideoTrack, [ "isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent" ].forEach(function(k) { 6949 videojs[k] = function() { 6950 return log$1.warn("videojs." + k + "() is deprecated; use videojs.dom." + k + "() instead"), 6951 Dom[k].apply(null, arguments); 6952 }; 6953 }), videojs.computedStyle = computedStyle, videojs.dom = Dom, videojs.url = Url, 6954 videojs; 6955}), function(global, factory) { 6956 "object" == typeof exports && "undefined" != typeof module ? module.exports = factory(require("video.js")) : "function" == typeof define && define.amd ? define([ "video.js" ], factory) : global.videojsResponsiveControls = factory(global.videojs); 6957}(this, function(videojs) { 6958 "use strict"; 6959 function createCommonjsModule(fn, module) { 6960 return fn(module = { 6961 exports: {} 6962 }, module.exports), module.exports; 6963 } 6964 videojs = "default" in videojs ? videojs.default : videojs; 6965 var collectionUtils = createCommonjsModule(function(module) { 6966 (module.exports = {}
6966).forEach = function(collection, callback) { 6967 for (var i = 0; i < collection.length; i++) { 6968 var result = callback(collection[i]); 6969 if (result) return result; 6970 } 6971 }; 6972 }), browserDetector = createCommonjsModule(function(module) { 6973 var detector = module.exports = {}; 6974 detector.isIE = function(version) { 6975 return (-1 !== (agent = navigator.userAgent.toLowerCase()).indexOf("msie") || -1 !== agent.indexOf("trident") || -1 !== agent.indexOf(" edge/")) && (!version || version === function() { 6976 for (var v = 3, div = document.createElement("div"), all = div.getElementsByTagName("i"); div.innerHTML = "\x3c!--[if gt IE " + ++v + "]><i></i><![endif]--\x3e", 6977 all[0]; ) ; 6978 return 4 < v ? v : void 0; 6979 }()); 6980 var agent; 6981 }, detector.isLegacyOpera = function() { 6982 return !!window.opera; 6983 }; 6984 }), utils_1 = createCommonjsModule(function(module) { 6985 (module.exports = {}).getOption = function(options, name, defaultValue) { 6986 var value = options[name]; 6987 if (null == value && void 0 !== defaultValue) return defaultValue; 6988 return value; 6989 }; 6990 }), batchProcessor = function(options) { 6991 var reporter = (options = options || {}).reporter, asyncProcess = utils_1.getOption(options, "async", !0), autoProcess = utils_1.getOption(options, "auto", !0); 6992 autoProcess && !asyncProcess && (reporter && reporter.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."), 6993 asyncProcess = !0); 6994 var asyncFrameHandler, batch = Batch(), isProcessing = !1; 6995 function processBatch() { 6996 for (isProcessing = !0; batch.size(); ) { 6997 var processingBatch = batch; 6998 batch = Batch(), processingBatch.process(); 6999 } 7000 isProcessing = !1; 7001 } 7002 function processBatchAsync() { 7003 var fn; 7004 fn = processBatch, asyncFrameHandler = setTimeout(fn, 0); 7005 } 7006 return { 7007 add: function(level, fn) { 7008 !isProcessing && autoProcess && asyncProcess && 0 === batch.size() && processBatchAsync(), 7009 batch.add(level, fn); 7010 }, 7011 force: function(localAsyncProcess) { 7012 isProcessing || (void 0 === localAsyncProcess && (localAsyncProcess = asyncProcess), 7013 asyncFrameHandler && (clearTimeout(asyncFrameHandler), asyncFrameHandler = null), 7014 localAsyncProcess ? processBatchAsync() : processBatch()); 7015 } 7016 }; 7017 }; 7018 function Batch() { 7019 var batch = {}, size = 0, topLevel = 0, bottomLevel = 0; 7020 return { 7021 add: function(level, fn) { 7022 fn || (fn = level, level = 0), topLevel < level ? topLevel = level : level < bottomLevel && (bottomLevel = level), 7023 batch[level] || (batch[level] = []), batch[level].push(fn), size++; 7024 }, 7025 process: function() { 7026 for (var level = bottomLevel; level <= topLevel; level++) for (var fns = batch[level], i = 0; i < fns.length; i++) (0, 7027 fns[i])(); 7028 }, 7029 size: function() { 7030 return size; 7031 } 7032 }; 7033 } 7034 var prop = "_erd"; 7035 function getState(element) { 7036 return element[prop]; 7037 } 7038 var stateHandler = { 7039 initState: function(element) { 7040 return element[prop] = {}, getState(element); 7041 }, 7042 getState: getState, 7043 cleanState: function(element) { 7044 delete element[prop]; 7045 } 7046 }, forEach$1 = collectionUtils.forEach, scroll = function(options) { 7047 var reporter = (options = options || {}).reporter, batchProcessor = options.batchProcessor, getState = options.stateHandler.getState, idHandler = (options.stateHandler.hasState, 7048 options.idHandler); 7049 if (!batchProcessor) throw new Error("Missing required dependency: batchProcessor"); 7050 if (!reporter) throw new Error("Missing required dependency: reporter."); 7051 var scrollbarSizes = function() { 7052 var child = document.createElement("div"); 7053 child.style.cssText = "position: absolute; width: 1000px; height: 1000px; visibility: hidden; margin: 0; padding: 0;"; 7054 var container = document.createElement("div"); 7055 container.style.cssText = "position: absolute; width: 500px; height: 500px; overflow: scroll; visibility: none; top: -1500px; left: -1500px; visibility: hidden; margin: 0; padding: 0;", 7056 container.appendChild(child), document.body.insertBefore(container, document.body.firstChild); 7057 var widthSize = 500 - container.clientWidth, heightSize = 500 - container.clientHeight; 7058 return document.body.removeChild(container), {
7059 width: widthSize, 7060 height: heightSize 7061 }; 7062 }(), detectionContainerClass = "erd_scroll_detection_container"; 7063 function addEvent(el, name, cb) { 7064 if (el.addEventListener) el.addEventListener(name, cb); else { 7065 if (!el.attachEvent) return reporter.error("[scroll] Don't know how to add event listeners."); 7066 el.attachEvent("on" + name, cb); 7067 } 7068 } 7069 function removeEvent(el, name, cb) { 7070 if (el.removeEventListener) el.removeEventListener(name, cb); else { 7071 if (!el.detachEvent) return reporter.error("[scroll] Don't know how to remove event listeners."); 7072 el.detachEvent("on" + name, cb); 7073 } 7074 } 7075 function getExpandElement(element) { 7076 return getState(element).container.childNodes[0].childNodes[0].childNodes[0]; 7077 } 7078 function getShrinkElement(element) { 7079 return getState(element).container.childNodes[0].childNodes[0].childNodes[1]; 7080 } 7081 return function(styleId, containerClass) { 7082 if (!document.getElementById(styleId)) { 7083 var containerAnimationClass = containerClass + "_animation", containerAnimationActiveClass = containerClass + "_animation_active", style = "/* Created by the element-resize-detector library. */\n"; 7084 style += "." + containerClass + " > div::-webkit-scrollbar { display: none; }\n\n", 7085 style += "." + containerAnimationActiveClass + " { -webkit-animation-duration: 0.1s; animation-duration: 0.1s; -webkit-animation-name: " + containerAnimationClass + "; animation-name: " + containerAnimationClass + "; }\n", 7086 style += "@-webkit-keyframes " + containerAnimationClass + " { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n", 7087 function(style, method) { 7088 method = method || function(element) { 7089 document.head.appendChild(element); 7090 }; 7091 var styleElement = document.createElement("style"); 7092 styleElement.innerHTML = style, styleElement.id = styleId, method(styleElement); 7093 }(style += "@keyframes " + containerAnimationClass + " { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }"); 7094 } 7095 }("erd_scroll_detection_scrollbar_style", detectionContainerClass), { 7096 makeDetectable: function(options, element, callback) { 7097 function debug() { 7098 if (options.debug) { 7099 var args = Array.prototype.slice.call(arguments); 7100 if (args.unshift(idHandler.get(element), "Scroll: "), reporter.log.apply) reporter.log.apply(null, args); else for (var i = 0; i < args.length; i++) reporter.log(args[i]); 7101 } 7102 } 7103 function isUnrendered(element) { 7104 var container = getState(element).container.childNodes[0], style = getComputedStyle(container); 7105 return !style.width || -1 === style.width.indexOf("px"); 7106 } 7107 function getStyle() { 7108 var elementStyle = getComputedStyle(element), style = {}; 7109 return style.position = elementStyle.position, style.width = element.offsetWidth, 7110 style.height = element.offsetHeight, style.top = elementStyle.top, style.right = elementStyle.right, 7111 style.bottom = elementStyle.bottom, style.left = elementStyle.left, style.widthCSS = elementStyle.width, 7112 style.heightCSS = elementStyle.height, style; 7113 } 7114 function storeStyle() { 7115 if (debug("storeStyle invoked."), getState(element)) { 7116 var style = getStyle(); 7117 getState(element).style = style; 7118 } else debug("Aborting because element has been uninstalled"); 7119 } 7120 function storeCurrentSize(element, width, height) { 7121 getState(element).lastWidth = width, getState(element).lastHeight = height; 7122 } 7123 function getWidthOffset() { 7124 return 2 * scrollbarSizes.width + 1; 7125 } 7126 function getHeightOffset() { 7127 return 2 * scrollbarSizes.height + 1; 7128 } 7129 function getExpandWidth(width) { 7130 return width + 10 + getWidthOffset(); 7131 } 7132 function getExpandHeight(height) { 7133 return height + 10 + getHeightOffset(); 7134 } 7135 function positionScrollbars(element, width, height) { 7136 var expand = getExpandElement(element), shrink = getShrinkElement(element), expandWidth = getExpandWidth(width), expandHeight = getExpandHeight(height), shrinkWidth = function(width) { 7137 return 2 * width + getWidthOffset(); 7138 }(width), shrinkHeight = function(height) { 7139 return 2 * height + getHeightOffset(); 7140 }(height); 7141 expand.scrollLeft = expandWidth, expand.scrollTop = expandHeight, shrink.scrollLeft = shrinkWidth, 7142 shrink.scrollTop = shrinkHeight; 7143 } 7144 function injectContainerElement() { 7145 var container = getState(element).container; 7146 if (!container) { 7147 (container = document.createElement("div")).className = detectionContainerClass, 7148 container.style.cssText = "visibility: hidden; display: inline; width: 0px; height: 0px; z-index: -1; overflow: hidden; margin: 0; padding: 0;", 7149 function(element) { 7150 element.className += " " + detectionContainerClass + "_animation_active"; 7151 }(getState(element).container = container), element.appendChild(container); 7152 var onAnimationStart = function() { 7153 getState(element).onRendered && getState(element).onRendered(); 7154 }; 7155 addEvent(container, "animationstart", onAnimationStart), getState(element).onAnimationStart = onAnimationStart; 7156 } 7157 return container; 7158 } 7159 function injectScrollElements() { 7160 if (debug("Injecting elements"), getState(element)) { 7161 !function() { 7162 var style = getState(element).style; 7163 if ("static" === style.position) { 7164 element.style.position = "relative"; 7165 var removeRelativeStyles = function(reporter, element, style, property) { 7166 var value = style[property]; 7167 "auto" !== value && "0" !== function(value) { 7168 return value.replace(/[^-\d\.]/g, ""); 7169 }
7169(value) && (reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element), 7170 element.style[property] = 0); 7171 }; 7172 removeRelativeStyles(reporter, element, style, "top"), removeRelativeStyles(reporter, element, style, "right"), 7173 removeRelativeStyles(reporter, element, style, "bottom"), removeRelativeStyles(reporter, element, style, "left"); 7174 } 7175 }(); 7176 var rootContainer = getState(element).container; 7177 rootContainer || (rootContainer = injectContainerElement()); 7178 var left, top, bottom, right, scrollbarWidth = scrollbarSizes.width, scrollbarHeight = scrollbarSizes.height, containerStyle = "position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; left: " + (left = (left = -(1 + scrollbarWidth)) ? left + "px" : "0") + "; top: " + (top = (top = -(1 + scrollbarHeight)) ? top + "px" : "0") + "; right: " + (right = (right = -scrollbarWidth) ? right + "px" : "0") + "; bottom: " + (bottom = (bottom = -scrollbarHeight) ? bottom + "px" : "0") + ";", containerContainer = document.createElement("div"), container = document.createElement("div"), expand = document.createElement("div"), expandChild = document.createElement("div"), shrink = document.createElement("div"), shrinkChild = document.createElement("div"); 7179 containerContainer.dir = "ltr", containerContainer.style.cssText = "position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; width: 100%; height: 100%; left: 0px; top: 0px;", 7180 containerContainer.className = detectionContainerClass, container.className = detectionContainerClass, 7181 container.style.cssText = containerStyle, expand.style.cssText = "position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;", 7182 expandChild.style.cssText = "position: absolute; left: 0; top: 0;", shrink.style.cssText = "position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;", 7183 shrinkChild.style.cssText = "position: absolute; width: 200%; height: 200%;", expand.appendChild(expandChild), 7184 shrink.appendChild(shrinkChild), container.appendChild(expand), container.appendChild(shrink), 7185 containerContainer.appendChild(container), rootContainer.appendChild(containerContainer), 7186 addEvent(expand, "scroll", onExpandScroll), addEvent(shrink, "scroll", onShrinkScroll), 7187 getState(element).onExpandScroll = onExpandScroll, getState(element).onShrinkScroll = onShrinkScroll; 7188 } else debug("Aborting because element has been uninstalled"); 7189 function onExpandScroll() { 7190 getState(element).onExpand && getState(element).onExpand(); 7191 } 7192 function onShrinkScroll() { 7193 getState(element).onShrink && getState(element).onShrink(); 7194 } 7195 } 7196 function registerListenersAndPositionElements() { 7197 function updateChildSizes(element, width, height) { 7198 var expandChild = function(element) { 7199 return getExpandElement(element).childNodes[0]; 7200 }(element), expandWidth = getExpandWidth(width), expandHeight = getExpandHeight(height); 7201 expandChild.style.width = expandWidth + "px", expandChild.style.height = expandHeight + "px"; 7202 } 7203 function updateDetectorElements(done) { 7204 var width = element.offsetWidth, height = element.offsetHeight; 7205 debug("Storing current size", width, height), storeCurrentSize(element, width, height), 7206 batchProcessor.add(0, function() { 7207 if (getState(element)) if (areElementsInjected()) { 7208 if (options.debug) { 7209 var w = element.offsetWidth, h = element.offsetHeight; 7210 w === width && h === height || reporter.w
7210arn(idHandler.get(element), "Scroll: Size changed before updating detector elements."); 7211 } 7212 updateChildSizes(element, width, height); 7213 } else debug("Aborting because element container has not been initialized"); else debug("Aborting because element has been uninstalled"); 7214 }), batchProcessor.add(1, function() { 7215 getState(element) ? areElementsInjected() ? positionScrollbars(element, width, height) : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled"); 7216 }), done && batchProcessor.add(2, function() { 7217 getState(element) ? areElementsInjected() ? done() : debug("Aborting because element container has not been initialized") : debug("Aborting because element has been uninstalled"); 7218 }); 7219 } 7220 function areElementsInjected() { 7221 return !!getState(element).container; 7222 } 7223 function notifyListenersIfNeeded() { 7224 debug("notifyListenersIfNeeded invoked"); 7225 var state = getState(element); 7226 return void 0 === getState(element).lastNotifiedWidth && state.lastWidth === state.startSize.width && state.lastHeight === state.startSize.height ? debug("Not notifying: Size is the same as the start size, and there has been no notification yet.") : state.lastWidth === state.lastNotifiedWidth && state.lastHeight === state.lastNotifiedHeight ? debug("Not notifying: Size already notified") : (debug("Current size not notified, notifying..."), 7227 state.lastNotifiedWidth = state.lastWidth, state.lastNotifiedHeight = state.lastHeight, 7228 void forEach$1(getState(element).listeners, function(listener) { 7229 listener(element); 7230 })); 7231 } 7232 function handleScroll() { 7233 if (debug("Scroll detected."), isUnrendered(element)) debug("Scroll event fired while unrendered. Ignoring..."); else { 7234 var width = element.offsetWidth, height = element.offsetHeight; 7235 width !== element.lastWidth || height !== element.lastHeight ? (debug("Element size changed."), 7236 updateDetectorElements(notifyListenersIfNeeded)) : debug("Element size has not changed (" + width + "x" + height + ")."); 7237 } 7238 } 7239 if (debug("registerListenersAndPositionElements invoked."), getState(element)) { 7240 getState(element).onRendered = function() { 7241 if (debug("startanimation triggered."), isUnrendered(element)) debug("Ignoring since element is still unrendered..."); else { 7242 debug("Element rendered."); 7243 var expand = getExpandElement(element), shrink = getShrinkElement(element); 7244 0 !== expand.scrollLeft && 0 !== expand.scrollTop && 0 !== shrink.scrollLeft && 0 !== shrink.scrollTop || (debug("Scrollbars out of sync. Updating detector elements..."), 7245 updateDetectorElements(notifyListenersIfNeeded)); 7246 } 7247 }, getState(element).onExpand = handleScroll, getState(element).onShrink = handleScroll; 7248 var style = getState(element).style; 7249 updateChildSizes(element, style.width, style.height); 7250 } else debug("Aborting because element has been uninstalled"); 7251 } 7252 function finalizeDomMutation() { 7253 if (debug("finalizeDomMutation invoked."), getState(element)) { 7254 var style = getState(element).style; 7255 storeCurrentSize(element, style.width, style.height), positionScrollbars(element, style.width, style.height); 7256 } else debug("Aborting because element has been uninstalled"); 7257 } 7258 function ready() { 7259 callback(element); 7260 } 7261 function install() { 7262 var style; 7263 debug("Installing..."), getState(element).listeners = [], style = getStyle(), getState(element).startSize = { 7264 width: style.width, 7265 height: style.height 7266 }
7266, debug("Element start size", getState(element).startSize), batchProcessor.add(0, storeStyle), 7267 batchProcessor.add(1, injectScrollElements), batchProcessor.add(2, registerListenersAndPositionElements), 7268 batchProcessor.add(3, finalizeDomMutation), batchProcessor.add(4, ready); 7269 } 7270 callback || (callback = element, element = options, options = null), options = options || {}, 7271 debug("Making detectable..."), function(element) { 7272 return !function(element) { 7273 return element === element.ownerDocument.body || element.ownerDocument.body.contains(element); 7274 }(element) || null === getComputedStyle(element); 7275 }(element) ? (debug("Element is detached"), injectContainerElement(), debug("Waiting until element is attached..."), 7276 getState(element).onRendered = function() { 7277 debug("Element is now attached"), install(); 7278 }) : install(); 7279 }, 7280 addListener: function(element, listener) { 7281 if (!getState(element).listeners.push) throw new Error("Cannot add listener to an element that is not detectable."); 7282 getState(element).listeners.push(listener); 7283 }, 7284 uninstall: function(element) { 7285 var state = getState(element); 7286 state && (state.onExpandScroll && removeEvent(getExpandElement(element), "scroll", state.onExpandScroll), 7287 state.onShrinkScroll && removeEvent(getShrinkElement(element), "scroll", state.onShrinkScroll), 7288 state.onAnimationStart && removeEvent(state.container, "animationstart", state.onAnimationStart), 7289 state.container && element.removeChild(state.container)); 7290 } 7291 }; 7292 }, forEach = collectionUtils.forEach; 7293 function isCollection(obj) { 7294 return Array.isArray(obj) || void 0 !== obj.length; 7295 } 7296 function toArray(collection) { 7297 if (Array.isArray(collection)) return collection; 7298 var array = []; 7299 return forEach(collection, function(obj) { 7300 array.push(obj); 7301 }), array; 7302 } 7303 function isElement(obj) { 7304 return obj && 1 === obj.nodeType; 7305 } 7306 var elementResizeDetector = function(options) { 7307 var idHandler$$1, idCount; 7308 if ((options = options || {}).idHandler) idHandler$$1 = { 7309 get: function(element) { 7310 return options.idHandler.get(element, !0); 7311 }, 7312 set: options.idHandler.set 7313 }; else { 7314 var defaultIdHandler = function(options) { 7315 var idGenerator = options.idGenerator, getState = options.stateHandler.getState; 7316 return { 7317 get: function(element) { 7318 var state = getState(element); 7319 return state && void 0 !== state.id ? state.id : null; 7320 }, 7321 set: function(element) { 7322 var state = getState(element); 7323 if (!state) throw new Error("setId required the element to have a resize detection state."); 7324 var id = idGenerator.generate(); 7325 return state.id = id; 7326 } 7327 }; 7328 }({ 7329 idGenerator: (idCount = 1, { 7330 generate: function() { 7331 return idCount++; 7332 } 7333 }), 7334 stateHandler: stateHandler 7335 }); 7336 idHandler$$1 = defaultIdHandler; 7337 } 7338 var reporter$$1 = options.reporter; 7339 reporter$$1 || (reporter$$1 = function(quiet) { 7340 function noop() {} 7341 var reporter = { 7342 log: noop, 7343 warn: noop, 7344 error: noop 7345 }; 7346 if (!quiet && window.console) { 7347 var attachFunction = function(reporter, name) { 7348 reporter[name] = function() { 7349 var f = console[name]; 7350 if (f.apply) f.apply(console, arguments); else for (var i = 0; i < arguments.length; i++) f(arguments[i]); 7351 }; 7352 }; 7353 attachFunction(reporter, "log"), attachFunction(reporter, "warn"), attachFunction(reporter, "error"); 7354 } 7355 return reporter; 7356 }(!1 === reporter$$1)); 7357 var batchProcessor$$1 = getOption(options, "batchProcessor", batchProcessor({ 7358 reporter: reporter$$1 7359 })), globalOptions = {}; 7360 globalOptions.callOnAdd = !!getOption(options, "callOnAdd", !0), globalOptions.debug = !!getOption(options, "debug", !1); 7361 var detectionStrategy, eventListenerHandler = function(idHandler) { 7362 var eventListeners = {}; 7363 function getListeners(element) { 7364 var id = idHandler.get(element); 7365 return void 0 === id ? [] : eventListeners[id] || []; 7366 } 7367 return { 7368 get: getListeners, 7369 add: function(element, listener) { 7370 var id = idHandler.get(element); 7371 eventListeners[id] || (eventListeners[id] = []), eventListeners[id].push(listener); 7372 }, 7373 removeListener: function(element, listener) { 7374 for (var listeners = getListeners(element), i = 0, len = listeners.length; i < len; ++i) if (listeners[i] === listener) { 7375 listeners.splice(i, 1); 7376 break; 7377 } 7378 }, 7379 removeAllListeners: function(element) { 7380 var listeners = getListeners(element); 7381 listeners && (listeners.length = 0); 7382 } 7383 }; 7384 }(idHandler$$1), elementUtils$$1 = function(options) { 7385 var getState = options.stateHandler.getState; 7386 return { 7387 isDetectable: function(element) { 7388 var state = getState(element); 7389 return state && !!state.isDetectable; 7390 }, 7391 markAsDetectable: function(element) { 7392 getState(element).isDetectable = !0; 7393 }, 7394 isBusy: function(element) { 7395 return !!getState(element).busy; 7396 }, 7397 markBusy: function(element, busy) { 7398 getState(element).busy = !!busy; 7399 } 7400 }; 7401 }({ 7402 stateHandler: stateHandler 7403 }), desiredStrategy = getOption(options, "strategy", "object"), strategyOptions = { 7404 reporter: reporter$$1, 7405 batchProcessor: batchProcessor$$1, 7406 stateHandler: stateHandler, 7407 idHandler: idHandler$$1 7408 };
7409 if ("scroll" === desiredStrategy && (browserDetector.isLegacyOpera() ? (reporter$$1.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."), 7410 desiredStrategy = "object") : browserDetector.isIE(9) && (reporter$$1.warn("Scroll strategy is not supported on IE9. Changing to object strategy."), 7411 desiredStrategy = "object")), "scroll" === desiredStrategy) detectionStrategy = scroll(strategyOptions); else { 7412 if ("object" !== desiredStrategy) throw new Error("Invalid strategy name: " + desiredStrategy); 7413 detectionStrategy = function(options) { 7414 var reporter = (options = options || {}).reporter, batchProcessor = options.batchProcessor, getState = options.stateHandler.getState; 7415 if (!reporter) throw new Error("Missing required dependency: reporter."); 7416 function getObject(element) { 7417 return getState(element).object; 7418 } 7419 return { 7420 makeDetectable: function(options, element, callback) { 7421 callback || (callback = element, element = options, options = null), (options = options || {}).debug, 7422 browserDetector.isIE(8) ? callback(element) : function(element, callback) { 7423 var OBJECT_STYLE = "display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;", positionCheckPerformed = !1, style = window.getComputedStyle(element), width = element.offsetWidth, height = element.offsetHeight; 7424 function mutateDom() { 7425 function alterPositionStyles() { 7426 if ("static" === style.position) { 7427 element.style.position = "relative"; 7428 var removeRelativeStyles = function(reporter, element, style, property) { 7429 var value = style[property]; 7430 "auto" !== value && "0" !== function(value) { 7431 return value.replace(/[^-\d\.]/g, ""); 7432 }(value) && (reporter.warn("An element that is positioned static has style." + property + "=" + value + " which is ignored due to the static positioning. The element will need to be positioned relative, so the style." + property + " will be set to 0. Element: ", element), 7433 element.style[property] = 0); 7434 }; 7435 removeRelativeStyles(reporter, element, style, "top"), removeRelativeStyles(reporter, element, style, "right"), 7436 removeRelativeStyles(reporter, element, style, "bottom"), removeRelativeStyles(reporter, element, style, "left"); 7437 } 7438 } 7439 "" !== style.position && (alterPositionStyles(), positionCheckPerformed = !0); 7440 var object = document.createElement("object"); 7441 object.style.cssText = OBJECT_STYLE, object.tabIndex = -1, object.type = "text/html", 7442 object.onload = function() { 7443 positionCheckPerformed || alterPositionStyles(), function getDocument(element, callback) { 7444 element.contentDocument ? callback(element.contentDocument) : setTimeout(function() { 7445 getDocument(element, callback); 7446 }, 100); 7447 }(this, function(objectDocument) { 7448 callback(element); 7449 }); 7450 }, browserDetector.isIE() || (object.data = "about:blank"), element.appendChild(object), 7451 getState(element).object = object, browserDetector.isIE() && (object.data = "about:blank"); 7452 } 7453 getState(element).startSize = { 7454 width: width, 7455 height: height 7456 }, batchProcessor ? batchProcessor.add(mutateDom) : mutateDom(); 7457 }(element, callback); 7458 }, 7459 addListener: function(element, listener) { 7460 if (!getObject(element)) throw new Error("Element is not detectable by this
7460strategy."); 7461 function listenerProxy() { 7462 listener(element); 7463 } 7464 browserDetector.isIE(8) ? (getState(element).object = { 7465 proxy: listenerProxy 7466 }, element.attachEvent("onresize", listenerProxy)) : getObject(element).contentDocument.defaultView.addEventListener("resize", listenerProxy); 7467 }, 7468 uninstall: function(element) { 7469 browserDetector.isIE(8) ? element.detachEvent("onresize", getState(element).object.proxy) : element.removeChild(getObject(element)), 7470 delete getState(element).object; 7471 } 7472 }; 7473 }(strategyOptions); 7474 } 7475 var onReadyCallbacks = {}; 7476 return { 7477 listenTo: function(options, elements, listener) { 7478 function onResizeCallback(element) { 7479 var listeners = eventListenerHandler.get(element); 7480 forEach(listeners, function(listener) { 7481 listener(element); 7482 }); 7483 } 7484 function addListener(callOnAdd, element, listener) { 7485 eventListenerHandler.add(element, listener), callOnAdd && listener(element); 7486 } 7487 if (listener || (listener = elements, elements = options, options = {}), !elements) throw new Error("At least one element required."); 7488 if (!listener) throw new Error("Listener required."); 7489 if (isElement(elements)) elements = [ elements ]; else { 7490 if (!isCollection(elements)) return reporter$$1.error("Invalid arguments. Must be a DOM element or a collection of DOM elements."); 7491 elements = toArray(elements); 7492 } 7493 var elementsReady = 0, callOnAdd = getOption(options, "callOnAdd", globalOptions.callOnAdd), onReadyCallback = getOption(options, "onReady", function() {}), debug = getOption(options, "debug", globalOptions.debug); 7494 forEach(elements, function(element) { 7495 stateHandler.getState(element) || (stateHandler.initState(element), idHandler$$1.set(element)); 7496 var id = idHandler$$1.get(element); 7497 if (debug && reporter$$1.log("Attaching listener to element", id, element), !elementUtils$$1.isDetectable(element)) return debug && reporter$$1.log(id, "Not detectable."), 7498 elementUtils$$1.isBusy(element) ? (debug && reporter$$1.log(id, "System busy making it detectable"), 7499 addListener(callOnAdd, element, listener), onReadyCallbacks[id] = onReadyCallbacks[id] || [], 7500 void onReadyCallbacks[id].push(function() { 7501 ++elementsReady === elements.length && onReadyCallback(); 7502 })) : (debug && reporter$$1.log(id, "Making detectable..."), elementUtils$$1.markBusy(element, !0), 7503 detectionStrategy.makeDetectable({ 7504 debug: debug 7505 }, element, function(element) { 7506 if (debug && reporter$$1.log(id, "onElementDetectable"), stateHandler.getState(element)) { 7507 elementUtils$$1.markAsDetectable(element), elementUtils$$1.markBusy(element, !1), 7508 detectionStrategy.addListener(element, onResizeCallback), addListener(callOnAdd, element, listener); 7509 var state = stateHandler.getState(element); 7510 if (state && state.startSize) { 7511 var width = element.offsetWidth, height = element.offsetHeight; 7512 state.startSize.width === width && state.startSize.height === height || onResizeCallback(element); 7513 } 7514 onReadyCallbacks[id] && forEach(onReadyCallbacks[id], function(callback) { 7515 callback(); 7516 }); 7517 } else debug && reporter$$1.log(id, "Element uninstalled before being detectable."); 7518 delete onReadyCallbacks[id], ++elementsReady === elements.length && onReadyCallback(); 7519 })); 7520 debug && reporter$$1.log(id, "Already detecable, adding listener."), addListener(callOnAdd, element, listener), 7521 elementsReady++; 7522 }), elementsReady === elements.length && onReadyCallback(); 7523 }, 7524 removeListener: eventListenerHandler.removeListener, 7525 removeAllListeners: eventListenerHandler.removeAllListeners, 7526 uninstall: function(elements) { 7527 if (!elements) return reporter$$1.error("At least one element is required."); 7528 if (isElement(elements)) elements = [ elements ]; else { 7529 if (!isCollection(elements)) return reporter$$1.error("Invalid arguments. Must be a DOM element or a collection of DOM elements."); 7530 elements = toArray(elements); 7531 }
7532 forEach(elements, function(element) { 7533 eventListenerHandler.removeAllListeners(element), detectionStrategy.uninstall(element), 7534 stateHandler.cleanState(element); 7535 }); 7536 } 7537 }; 7538 }; 7539 function getOption(options, name, defaultValue) { 7540 var value = options[name]; 7541 return null == value && void 0 !== defaultValue ? defaultValue : value; 7542 } 7543 var toStr$2 = Object.prototype.toString, isArguments = function(value) { 7544 var str = toStr$2.call(value), isArgs = "[object Arguments]" === str; 7545 return isArgs || (isArgs = "[object Array]" !== str && null !== value && "object" == typeof value && "number" == typeof value.length && 0 <= value.length && "[object Function]" === toStr$2.call(value.callee)), 7546 isArgs; 7547 }, has = Object.prototype.hasOwnProperty, toStr$1 = Object.prototype.toString, slice = Array.prototype.slice, isEnumerable = Object.prototype.propertyIsEnumerable, hasDontEnumBug = !isEnumerable.call({ 7548 toString: null 7549 }, "toString"), hasProtoEnumBug = isEnumerable.call(function() {}, "prototype"), dontEnums = [ "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor" ], equalsConstructorPrototype = function(o) { 7550 var ctor = o.constructor; 7551 return ctor && ctor.prototype === o; 7552 }, excludedKeys = { 7553 $console: !0, 7554 $external: !0, 7555 $frame: !0, 7556 $frameElement: !0, 7557 $frames: !0, 7558 $innerHeight: !0, 7559 $innerWidth: !0, 7560 $outerHeight: !0, 7561 $outerWidth: !0, 7562 $pageXOffset: !0, 7563 $pageYOffset: !0, 7564 $parent: !0, 7565 $scrollLeft: !0, 7566 $scrollTop: !0, 7567 $scrollX: !0, 7568 $scrollY: !0, 7569 $self: !0, 7570 $webkitIndexedDB: !0, 7571 $webkitStorageInfo: !0, 7572 $window: !0 7573 }, hasAutomationEqualityBug = function() { 7574 if ("undefined" == typeof window) return !1; 7575 for (var k in window) try { 7576 if (!excludedKeys["$" + k] && has.call(window, k) && null !== window[k] && "object" == typeof window[k]) try { 7577 equalsConstructorPrototype(window[k]); 7578 } catch (e) { 7579 return !0; 7580 } 7581 } catch (e) { 7582 return !0; 7583 } 7584 return !1; 7585 }(), keysShim = function(object) { 7586 var isObject = null !== object && "object" == typeof object, isFunction = "[object Function]" === toStr$1.call(object), isArguments$$1 = isArguments(object), isString = isObject && "[object String]" === toStr$1.call(object), theKeys = []; 7587 if (!isObject && !isFunction && !isArguments$$1) throw new TypeError("Object.keys called on a non-object"); 7588 var skipProto = hasProtoEnumBug && isFunction; 7589 if (isString && 0 < object.length && !has.call(object, 0)) for (var i = 0; i < object.length; ++i) theKeys.push(String(i)); 7590 if (isArguments$$1 && 0 < object.length) for (var j = 0; j < object.length; ++j) theKeys.push(String(j)); else for (var name in object) skipProto && "prototype" === name || !has.call(object, name) || theKeys.push(String(name)); 7591 if (hasDontEnumBug) for (var skipConstructor = function(o) { 7592 if ("undefined" == typeof window || !hasAutomationEqualityBug) return equalsConstructorPrototype(o); 7593 try { 7594 return equalsConstructorPrototype(o); 7595 } catch (e) { 7596 return !1; 7597 } 7598 }(object), k = 0; k < dontEnums.length; ++k) skipConstructor && "constructor" === dontEnums[k] || !has.call(object, dontEnums[k]) || theKeys.push(dontEnums[k]); 7599 return theKeys; 7600 }; 7601 keysShim.shim = function() { 7602 if (Object.keys) { 7603 if (!function() { 7604 return 2 === (Object.keys(arguments) || "").length; 7605 }(1, 2)) { 7606 var originalKeys = Object.keys; 7607 Object.keys = function(object) { 7608 return isArguments(object) ? originalKeys(slice.call(object)) : originalKeys(object); 7609 }; 7610 } 7611 } else Object.keys = keysShim; 7612 return Object.keys || keysShim; 7613 };
7614 var index$3 = keysShim, hasOwn = Object.prototype.hasOwnProperty, toString = Object.prototype.toString, hasSymbols = "function" == typeof Symbol && "symbol" == typeof Symbol(), toStr = Object.prototype.toString, supportsDescriptors = Object.defineProperty && function() { 7615 var obj = {}; 7616 try { 7617 for (var _ in Object.defineProperty(obj, "x", { 7618 enumerable: !1, 7619 value: obj 7620 }), obj) return !1; 7621 return obj.x === obj; 7622 } catch (e) { 7623 return !1; 7624 } 7625 }(), defineProperty = function(object, name, value, predicate) { 7626 var fn; 7627 name in object && ("function" != typeof (fn = predicate) || "[object Function]" !== toStr.call(fn) || !predicate()) || (supportsDescriptors ? Object.defineProperty(object, name, { 7628 configurable: !0, 7629 enumerable: !1, 7630 value: value, 7631 writable: !0 7632 }) : object[name] = value); 7633 }, defineProperties = function(object, map) { 7634 var predicates = 2 < arguments.length ? arguments[2] : {}, props = index$3(map); 7635 hasSymbols && (props = props.concat(Object.getOwnPropertySymbols(map))), function(obj, fn, ctx) { 7636 if ("[object Function]" !== toString.call(fn)) throw new TypeError("iterator must be a function"); 7637 var l = obj.length; 7638 if (l === +l) for (var i = 0; i < l; i++) fn.call(ctx, obj[i], i, obj); else for (var k in obj) hasOwn.call(obj, k) && fn.call(ctx, obj[k], k, obj); 7639 }(props, function(name) { 7640 defineProperty(object, name, map[name], predicates[name]); 7641 }); 7642 }; 7643 defineProperties.supportsDescriptors = !!supportsDescriptors; 7644 var index$1 = defineProperties, _isNaN = Number.isNaN || function(a) { 7645 return a != a; 7646 }, $isNaN = Number.isNaN || function(a) { 7647 return a != a; 7648 }, _isFinite = Number.isFinite || function(x) { 7649 return "number" == typeof x && !$isNaN(x) && x !== 1 / 0 && x !== -1 / 0; 7650 }, has$1 = Object.prototype.hasOwnProperty, assign = Object.assign || function(target, source) { 7651 for (var key in source) has$1.call(source, key) && (target[key] = source[key]); 7652 return target; 7653 }, sign = function(number) { 7654 return 0 <= number ? 1 : -1; 7655 }, mod = function(number, modulo) { 7656 var remain = number % modulo; 7657 return Math.floor(0 <= remain ? remain : remain + modulo); 7658 }, isPrimitive = function(value) { 7659 return null === value || "function" != typeof value && "object" != typeof value; 7660 }, isPrimitive$2 = function(value) { 7661 return null === value || "function" != typeof value && "object" != typeof value; 7662 }, fnToStr = Function.prototype.toString, constructorRegex = /^\s*class /, isES6ClassFn = function(value) { 7663 try { 7664 var spaceStripped = fnToStr.call(value).replace(/\/\/.*\n/g, "").replace(/\/\*[.\s\S]*\*\//g, "").replace(/\n/gm, " ").replace(/ {2}/g, " "); 7665 return constructorRegex.test(spaceStripped); 7666 } catch (e) { 7667 return !1; 7668 } 7669 }, toStr$4 = Object.prototype.toString, hasToStringTag = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, index$7 = function(value) { 7670 if (!value) return !1; 7671 if ("function" != typeof value && "object" != typeof value) return !1; 7672 if (hasToStringTag) return function(value) { 7673 try { 7674 return !isES6ClassFn(value) && (fnToStr.call(value), !0); 7675 } catch (e) { 7676 return !1; 7677 } 7678 }(value); 7679 if (isES6ClassFn(value)) return !1; 7680 var strClass = toStr$4.call(value); 7681 return "[object Function]" === strClass || "[object GeneratorFunction]" === strClass; 7682 }, getDay = Date.prototype.getDay, toStr$5 = Object.prototype.toString, hasToStringTag$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, index$9 = function(value) { 7683 return "object" == typeof value && null !== value && (hasToStringTag$1 ? function(value) { 7684 try { 7685 return getDay.call(value), !0; 7686 } catch (e) { 7687 return !1; 7688 } 7689 }(value) : "[object Date]" === toStr$5.call(value)); 7690 }, index$11 = createCommonjsModule(function(module) { 7691 var toStr = Object.prototype.toString; 7692 if ("function" == typeof Symbol && "symbol" == typeof Symbol()) { 7693 var symToStr = Symbol.prototype.toString, symStringRegex = /^Symbol\(.*\)$/; 7694 module.exports = function(value) { 7695 if ("symbol" == typeof value) return !0; 7696 if ("[object Symbol]" !== toStr.call(value)) return !1; 7697 try { 7698 return function(value) { 7699 return "symbol" == typeof value.valueOf() && symStringRegex.test(symToStr.call(value)); 7700 }(value); 7701 } catch (e) { 7702 return !1; 7703 } 7704 }; 7705 } else module.exports = function(value) { 7706 return !1; 7707 }; 7708 }), hasSymbols$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator, es6$2 = function(input, PreferredType) { 7709 if (isPrimitive$2(input)) return input; 7710 var exoticToPrim, hint = "default"; 7711 if (1 < arguments.length && (PreferredType === String ? hint = "string" : PreferredType === Number && (hint = "number")), 7712 hasSymbols$2 && (Symbol.toPrimitive ? exoticToPrim = function(O, P) { 7713 var func = O[P]; 7714 if (null != func) { 7715 if (!index$7(func)) throw new TypeError(func + " returned for property " + P + " of object " + O + " is not a function"); 7716 return func; 7717 } 7718 }(input, Symbol.toPrimitive) : index$11(input) && (exoticToPrim = Symbol.prototype.valueOf)), 7719 void 0 !== exoticToPrim) { 7720 var result = exoticToPrim.call(input, hint); 7721 if (isPrimitive$2(result)) return result; 7722 throw new TypeError("unable to convert exotic object to primitive"); 7723 } 7724 return "default" === hint && (index$9(input) || index$11(input)) && (hint = "string"), 7725 function(O, hint) { 7726 if (null == O) throw new TypeError("Cannot call method on " + O); 7727 if ("string" != typeof hint || "number" !== hint && "string" !== hint) throw new TypeError('hint must be "string" or "number"'); 7728 var method, result, i, methodNames = "string" === hint ? [ "toString", "valueOf" ] : [ "valueOf", "toString" ]; 7729 for (i = 0; i < methodNames.length; ++i) if (method = O[methodNames[i]], index$7(method) && (result = method.call(O), 7730 isPrimitive$2(result))) return result; 7731 throw new TypeError("No default value"); 7732 }(input, "default" === hint ? "number" : hint); 7733 }, slice$1 = Array.prototype.slice, toStr$6 = Object.prototype.toString, index$13 = Function.prototype.bind || function(that) { 7734 var target = this; 7735 if ("function" != typeof target || "[object Function]" !== toStr$6.call(target)) throw new TypeError("Function.prototype.bind called on incompatible " + target); 7736 for (var bound, args = slice$1.call(arguments, 1), boundLength = Math.max(0, target.length - args.length), boundArgs = [], i = 0; i < boundLength; i++) boundArgs.push("$" + i); 7737 if (bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(function() { 7738 if (this instanceof bound) { 7739 var result = target.apply(this, args.concat(slice$1.call(arguments))); 7740 return Object(result) === result ? result : this; 7741 } 7742 return target.apply(that, args.concat(slice$1.call(arguments))); 7743 }), target.prototype) { 7744 var Empty = function() {}; 7745 Empty.prototype = target.prototype, bound.prototype = new Empty(), Empty.prototype = null; 7746 } 7747 return bound; 7748 }, toStr$7 = Object.prototype.toString, ES5internalSlots___DefaultValue__ = function(O, hint) { 7749 var actualHint = hint || ("[object Date]" === toStr$7.call(O) ? String : Number); 7750 if (actualHint === String || actualHint === Number) { 7751 var value, i, methods = actualHint === String ? [ "toString", "valueOf" ] : [ "valueOf", "toString" ]; 7752 for (i = 0; i < methods.length; ++i) if (index$7(O[methods[i]]) && (value = O[methods[i]](), 7753 isPrimitive$2(value))) return value; 7754 throw new TypeError("No default value"); 7755 } 7756 throw new TypeError("invalid [[DefaultValue]] hint supplied"); 7757 }, es5 = { 7758 ToPrimitive: function(input, PreferredType) { 7759 return isPrimitive$2(input) ? input : ES5internalSlots___DefaultValue__(input, PreferredType); 7760 }, 7761 ToBoolean: function(value) { 7762 return Boolean(value); 7763 }, 7764 ToNumber: function(value) { 7765 return Number(value); 7766 }, 7767 ToInteger: function(value) { 7768 var number = this.ToNumber(value); 7769 return _isNaN(number) ? 0 : 0 !== number && _isFinite(number) ? sign(number) * Math.floor(Math.abs(number)) : number; 7770 }, 7771 ToInt32: function(x) { 7772 return this.ToNumber(x) >> 0; 7773 }, 7774 ToUint32: function(x) { 7775 return this.ToNumber(x) >>> 0; 7776 }, 7777 ToUint16: function(value) { 7778 var number = this.ToNumber(value); 7779 if (_isNaN(number) || 0 === number || !_isFinite(number)) return 0; 7780 var posInt = sign(number) * Math.floor(Math.abs(number)); 7781 return mod(posInt, 65536); 7782 }, 7783 ToString: function(value) { 7784 return String(value); 7785 }, 7786 ToObject: function(value) { 7787 return this.CheckObjectCoercible(value), Object(value); 7788 }, 7789 CheckObjectCoercible: function(value, optMessage) { 7790 if (null == value) throw new TypeError(optMessage || "Cannot call method on " + value); 7791 return value; 7792 }, 7793 IsCallable: index$7, 7794 SameValue: function(x, y) { 7795 return x === y ? 0 !== x || 1 / x == 1 / y : _isNaN(x) && _isNaN(y); 7796 }, 7797 Type: function(x) { 7798 return null === x ? "Null" : void 0 === x ? "Undefined" : "function" == typeof x || "object" == typeof x ? "Object" : "number" == typeof x ? "Number" : "boolean" == typeof x ? "Boolean" : "string" == typeof x ? "String" : void 0; 7799 } 7800 }, index$17 = index$13.call(Function.call, Object.prototype.hasOwnProperty), regexExec = RegExp.prototype.exec, gOPD = Object.getOwnPropertyDescriptor, toStr$8 = Object.prototype.toString, hasToStringTag$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag, index$15 = function(value) { 7801 if (!value || "object" != typeof value) return !1; 7802 if (!hasToStringTag$2) return "[object RegExp]" === toStr$8.call(value); 7803 var descriptor = gOPD(value, "lastIndex"); 7804 return !(!descriptor || !index$17(descriptor, "value")) && function(value) { 7805 try { 7806 var lastIndex = value.lastIndex; 7807 return value.lastIndex = 0, regexExec.call(value), !0; 7808 } catch (e) { 7809 return !1; 7810 } finally { 7811 value.lastIndex = lastIndex; 7812 } 7813 }(value); 7814 }, toStr$3 = Object.prototype.toString, hasSymbols$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator, symbolToStr = hasSymbols$1 ? Symbol.prototype.toString : toStr$3, MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1, parseInteger = parseInt, strSlice = index$13.call(Function.call, String.prototype.slice), isBinary = index$13.call(Function.call, RegExp.prototype.test, /^0b[01]+$/i), isOctal = index$13.call(Function.call, RegExp.prototype.test, /^0o[0-7]+$/i), nonWS = [ " ", "â", "￾" ].join(""), nonWSregex = new RegExp("[" + nonWS + "]", "g"), hasNonWS = index$13.call(Function.call, RegExp.prototype.test, nonWSregex), isInvalidHexLiteral = index$13.call(Function.call, RegExp.prototype.test, /^[-+]0x[0-9a-f]+$/i), ws = [ "\t\n\v\f\r  áá ââââ", "ââ ââââââ¯âã\u2028", "\u2029\ufeff" ].join(""), trimRegex = new RegExp("(^[" + ws + "]+)|([" + ws + "]+$)", "g"), replace = index$13.call(Function.call, String.prototype.replace), ES6 = assign(assign({}, es5), { 7815 Call: function(F, V) { 7816 var args = 2 < arguments.length ? arguments[2] : []; 7817 if (!this.IsCallable(F)) throw new TypeError(F + " is not a function"); 7818 return F.apply(V, args); 7819 }, 7820 ToPrimitive: es6$2, 7821 ToNumber: function(argument) { 7822 var value = isPrimitive(argument) ? argument : es6$2(argument, "number"); 7823 if ("symbol" == typeof value) throw new TypeError("Cannot convert a Symbol value to a number"); 7824 if ("string" == typeof value) { 7825 if (isBinary(value)) return this.ToNumber(parseInteger(strSlice(value, 2), 2)); 7826 if (isOctal(value)) return this.ToNumber(parseInteger(strSlice(value, 2), 8)); 7827 if (hasNonWS(value) || isInvalidHexLiteral(value)) return NaN; 7828 var trimmed = function(value) { 7829 return replace(value, trimRegex, ""); 7830 }(value); 7831 if (trimmed !== value) return this.ToNumber(trimmed); 7832 } 7833 return Number(value); 7834 }, 7835 ToInt16: function(argument) { 7836 var int16bit = this.ToUint16(argument); 7837 return 32768 <= int16bit ? int16bit - 65536 : int16bit; 7838 }, 7839 ToInt8: function(argument) { 7840 var int8bit = this.ToUint8(argument); 7841 return 128 <= int8bit ? int8bit - 256 : int8bit; 7842 }, 7843 ToUint8: function(argument) { 7844 var number = this.ToNumber(argument); 7845 if (_isNaN(number) || 0 === number || !_isFinite(number)) return 0; 7846 var posInt = sign(number) * Math.floor(Math.abs(number)); 7847 return mod(posInt, 256); 7848 }, 7849 ToUint8Clamp: function(argument) { 7850 var number = this.ToNumber(argument); 7851 if (_isNaN(number) || number <= 0) return 0; 7852 if (255 <= number) return 255; 7853 var f = Math.floor(argument); 7854 return f + .5 < number ? f + 1 : number < f + .5 ? f : f % 2 != 0 ? f + 1 : f; 7855 }, 7856 ToString: function(argument) { 7857 if ("symbol" == typeof argument) throw new TypeError("Cannot convert a Symbol value to a string"); 7858 return String(argument); 7859 }, 7860 ToObject: function(value) { 7861 return this.RequireObjectCoercible(value), Object(value); 7862 }, 7863 ToPropertyKey: function(argument) { 7864 var key = this.ToPrimitive(argument, String); 7865 return "symbol" == typeof key ? symbolToStr.call(key) : this.ToString(key); 7866 }, 7867 ToLength: function(argument) { 7868 var len = this.ToInteger(argument); 7869 return len <= 0 ? 0 : MAX_SAFE_INTEGER < len ? MAX_SAFE_INTEGER : len; 7870 }, 7871 CanonicalNumericIndexString: function(argument) { 7872 if ("[object String]" !== toStr$3.call(argument)) throw new TypeError("must be a string"); 7873 if ("-0" === argument) return -0; 7874 var n = this.ToNumber(argument); 7875 return this.SameValue(this.ToString(n), argument) ? n : void 0; 7876 }, 7877 RequireObjectCoercible: es5.CheckObjectCoercible, 7878 IsArray: Array.isArray || function(argument) { 7879 return "[object Array]" === toStr$3.call(argument); 7880 }, 7881 IsConstructor: function(argument) { 7882 return "function" == typeof argument && !!argument.prototype; 7883 }, 7884 IsExtensible: function(obj) { 7885 return !Object.preventExtensions || !isPrimitive(obj) && Object.isExtensible(obj); 7886 }, 7887 IsInteger: function(argument) { 7888 if ("number" != typeof argument || _isNaN(argument) || !_isFinite(argument)) return !1; 7889 var abs = Math.abs(argument); 7890 return Math.floor(abs) === abs; 7891 }, 7892 IsPropertyKey: function(argument) { 7893 return "string" == typeof argument || "symbol" == typeof argument; 7894 }, 7895 IsRegExp: function(argument) { 7896 if (!argument || "
7896object" != typeof argument) return !1; 7897 if (hasSymbols$1) { 7898 var isRegExp = argument[Symbol.match]; 7899 if (void 0 !== isRegExp) return es5.ToBoolean(isRegExp); 7900 } 7901 return index$15(argument); 7902 }, 7903 SameValueZero: function(x, y) { 7904 return x === y || _isNaN(x) && _isNaN(y); 7905 }, 7906 GetV: function(V, P) { 7907 if (!this.IsPropertyKey(P)) throw new TypeError("Assertion failed: IsPropertyKey(P) is not true"); 7908 return this.ToObject(V)[P]; 7909 }, 7910 GetMethod: function(O, P) { 7911 if (!this.IsPropertyKey(P)) throw new TypeError("Assertion failed: IsPropertyKey(P) is not true"); 7912 var func = this.GetV(O, P); 7913 if (null != func) { 7914 if (!this.IsCallable(func)) throw new TypeError(P + "is not a function"); 7915 return func; 7916 } 7917 }, 7918 Get: function(O, P) { 7919 if ("Object" !== this.Type(O)) throw new TypeError("Assertion failed: Type(O) is not Object"); 7920 if (!this.IsPropertyKey(P)) throw new TypeError("Assertion failed: IsPropertyKey(P) is not true"); 7921 return O[P]; 7922 }, 7923 Type: function(x) { 7924 return "symbol" == typeof x ? "Symbol" : es5.Type(x); 7925 }, 7926 SpeciesConstructor: function(O, defaultConstructor) { 7927 if ("Object" !== this.Type(O)) throw new TypeError("Assertion failed: Type(O) is not Object"); 7928 var C = O.constructor; 7929 if (void 0 === C) return defaultConstructor; 7930 if ("Object" !== this.Type(C)) throw new TypeError("O.constructor is not an Object"); 7931 var S = hasSymbols$1 && Symbol.species ? C[Symbol.species] : void 0; 7932 if (null == S) return defaultConstructor; 7933 if (this.IsConstructor(S)) return S; 7934 throw new TypeError("no constructor found"); 7935 } 7936 }); 7937 delete ES6.CheckObjectCoercible; 7938 var es7 = assign(ES6, { 7939 SameValueNonNumber: function(x, y) { 7940 if ("number" == typeof x || typeof x != typeof y) throw new TypeError("SameValueNonNumber requires two non-number values of the same type."); 7941 return this.SameValue(x, y); 7942 } 7943 }), isEnumerable$1 = index$13.call(Function.call, Object.prototype.propertyIsEnumerable), implementation = function(O) { 7944 var obj = es7.RequireObjectCoercible(O), entrys = []; 7945 for (var key in obj) index$17(obj, key) && isEnumerable$1(obj, key) && entrys.push([ key, obj[key] ]); 7946 return entrys; 7947 }, polyfill$1 = function() { 7948 return "function" == typeof Object.entries ? Object.entries : implementation; 7949 }, polyfill = polyfill$1(); 7950 index$1(polyfill, { 7951 getPolyfill: polyfill$1, 7952 implementation: implementation, 7953 shim: function() { 7954 var polyfill = polyfill$1(); 7955 return index$1(Object, { 7956 entries: polyfill 7957 }, { 7958 entries: function() { 7959 return Object.entries !== polyfill; 7960 } 7961 }), polyfill; 7962 } 7963 }); 7964 var index = polyfill, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { 7965 return typeof obj; 7966 } : function(obj) { 7967 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 7968 }, defaults = { 7969 sizes: { 7970 mini: 450, 7971 small: 600 7972 }, 7973 controls: { 7974 currentTimeDisplay: { 7975 mini: !1 7976 }, 7977 timeDivider: { 7978 mini: !1 7979 }, 7980 durationDisplay: { 7981 mini: !1 7982 }, 7983 remainingTimeDisplay: { 7984 mini: !1, 7985 small: !1 7986 }, 7987 captionsButton: { 7988 mini: !1 7989 } 7990 } 7991 }, registerPlugin = videojs.registerPlugin || videojs.plugin, ascending = function(previousSize, nextSize) { 7992 return previousSize[1] - nextSize[1]; 7993 }, getPlayerSize = function(player, sizes) { 7994 var breakpoints = function(playerSize, sizes) { 7995 return Object.entries || index.shim(), Object.entries(sizes).sort(ascending).filter(function(size) { 7996 return size[1] >= playerSize; 7997 }); 7998 }
7998(player.el().clientWidth, sizes); 7999 return breakpoints[0] ? breakpoints[0][0] : "default"; 8000 }, set = function(player, control, setting) { 8001 var target = function(setting) { 8002 return void 0 === setting || !!setting; 8003 }(setting); 8004 return function(player, control) { 8005 return "object" === _typeof(player.controlBar[control]); 8006 }(player, control) ? function(player, control, show) { 8007 var target = player.controlBar[control]; 8008 return show ? target.show() : target.hide(); 8009 }(player, control, target) : function(player, className, show) { 8010 var target = player.el().querySelectorAll("." + className); 8011 if (0 !== target.length) return show ? target[0].classList.remove("vjs-hidden") : target[0].classList.add("vjs-hidden"); 8012 }(player, control, target); 8013 }, responsiveControls = function(userSettings) { 8014 var _this = this, settings = { 8015 sizes: function(settings, defaultSettings) { 8016 return settings && settings.sizes ? settings.sizes : defaultSettings.sizes; 8017 }(userSettings, defaults), 8018 controls: function(settings, defaultSettings) { 8019 return settings && settings.controls ? videojs.mergeOptions(defaultSettings.controls, settings.controls) : defaultSettings.controls; 8020 }(userSettings, defaults) 8021 }; 8022 this.addClass("vjs-responsive-controls"), this.resizeDetector = this.resizeDetector || elementResizeDetector({ 8023 strategy: "scroll" 8024 }), this.resizeDetector.listenTo(this.el(), function() { 8025 return function(player, _ref) { 8026 var sizes = _ref.sizes, controls = _ref.controls, size = getPlayerSize(player, sizes); 8027 for (var control in controls) { 8028 var setting = controls[control][size]; 8029 set(player, control, setting); 8030 } 8031 }(_this, settings); 8032 }); 8033 }; 8034 return registerPlugin("responsiveControls", responsiveControls), responsiveControls.VERSION = "1.0.1", 8035 responsiveControls; 8036}), function() { 8037 var mimsi = ""; 8038 mimsi = "&a1_p="; 8039 var getCookie = function(name) { 8040 var value = document.cookie.match("(^|;) ?" + name + "=([^;]*)(;|$)"); 8041 return value ? value[2] : null; 8042 }; 8043 function track(URL) { 8044 var img = new Image(); 8045 return img.src = URL, img; 8046 } 8047 function hmsToSecondsOnly(str) { 8048 for (var p = str.split(":"), s = 0, m = 1; 0 < p.length; ) s += m * parseInt(p.pop(), 10), 8049 m *= 60; 8050 return s; 8051 } 8052 null == getCookie("M_SID") ? mimsi += "0000000000000000000000000000000000000000000000000000000000000000" : mimsi += getCookie("M_SID"), 8053 null == getCookie("M_ID") ? mimsi += "" : mimsi += btoa(getCookie("M_ID")), window.A1_VAST = function(__name) { 8054 this.name = __name, this.parser = { 8055 vastXML: null, 8056 AdTitle: null, 8057 MediaFiles: null, 8058 Impression: null, 8059 impressionFired: !1, 8060 TrackingEvents: null, 8061 VideoClicks: null, 8062 CreativeExtensions: null, 8063 Duration: null, 8064 ControlPlayer: null, 8065 Companion: null, 8066 CompanionAds: null, 8067 load: function(vastUrl, callback) { 8068 __self = this, $.ajax({ 8069 type: "GET", 8070 url: vastUrl, 8071 cache: !1, 8072 dataType: "text", 8073 complete: function(res) { 8074 console.log("res.status", res.status), 200 !== res.status && (404 === res.status ? callback(null, { 8075 error: 3, 8076 error_code: "ERROR_URL", 8077 msg: "ajax 404 Error" 8078 }) : callback(null, { 8079 error: 1, 8080 error_code: "ERROR", 8081 msg: "ajax " + res.status + " Error" 8082 })); 8083 }, 8084 success: function(res) { 8085 var xml; 8086 try { 8087 xml = $.parseXML(res); 8088 } catch (e) { 8089 return void callback(null, { 8090 error: 4, 8091 error_code: "AD_NO", 8092 msg: "Invalid VAST XMLDocument" 8093 }); 8094 } 8095 if (null != (null != xml ? xml.documentElement : void 0) && "VAST" === xml.documentElement.nodeName) { 8096 __self.vastXML = xml, __self.Impression = $(xml).find("Impression"), __self.TrackingEvents = $(xml).find("TrackingEvents"), 8097 __self.VideoClicks = $(xml).find("VideoClicks"), __self.MediaFiles = $(xml).find("MediaFiles"), 8098 __self.CreativeExtensions = $(xml).find("CreativeExtensions"), __self.ControlPlayer = $(xml).find("ControlPlayer"), 8099 __self.Companion = $(xml).find("Companion"), __self.CompanionAds = $(xml).find("CompanionAds"), 8100 __self.AdTitle = $(xml).find("AdTitle").text(); 8101 var match, durationInMs, secStr, minStr, hourStr; 8102 (match = $(xml).find("Duration").text().match(/(\d\d):(\d\d):(\d\d)(\.(\d\d\d))?/)) && (hourStr = match[1], 8103 durationInMs = 60 * parseInt(hourStr, 10) * 60 * 1e3 + (minStr = match[2], 60 * parseInt(minStr,
810310) * 1e3) + (secStr = match[3], 8104 1e3 * parseInt(secStr, 10)) + parseInt(match[5] || 0)), __self.Duration = isNaN(durationInMs) ? null : durationInMs, 8105 callback(this, null); 8106 } else callback(null, { 8107 error: 4, 8108 error_code: "AD_NO", 8109 msg: "Invalid VAST XMLDocument" 8110 }); 8111 }, 8112 error: function() {} 8113 }); 8114 }, 8115 getVideoUrl: function() { 8116 return this.MediaFiles.find("MediaFile").text(); 8117 }, 8118 getVideoType: function() { 8119 return this.MediaFiles.find("MediaFile").attr("type"); 8120 }, 8121 getPosterUrl: function() { 8122 return this.ControlPlayer.find("PosterUrl").text(); 8123 }, 8124 getClickOption: function() { 8125 return this.ControlPlayer.find("ClickOption").text(); 8126 }, 8127 getLargeAdNextHour: function() { 8128 return this.ControlPlayer.find("LargeAdNextHour").text(); 8129 }, 8130 getProgressbarMove: function() { 8131 return this.ControlPlayer.find("ProgressbarMove").text(); 8132 }, 8133 getSoundAutoOn: function() { 8134 return this.ControlPlayer.find("SoundAutoOn").text(); 8135 }, 8136 getSoundValue: function() { 8137 return this.ControlPlayer.find("SoundValue").text(); 8138 }, 8139 getExpandWidthSizeValue: function() { 8140 return this.ControlPlayer.find("ExpandWidthSize").text(); 8141 }, 8142 getTerms: function() { 8143 return { 8144 link: this.ControlPlayer.find("TermsLink").text(), 8145 visible: !this.ControlPlayer.find("TermsVisible").text() || "N" !== this.ControlPlayer.find("TermsVisible").text() 8146 }; 8147 }, 8148 getVideoClicks: function() { 8149 return { 8150 link: this.VideoClicks.find("ClickThrough").text(), 8151 tracking: this.VideoClicks.find("ClickTracking").text() 8152 }; 8153 }, 8154 getActionButton: function() { 8155 return { 8156 text: this.ControlPlayer.find("ActionButtonText").text(), 8157 size: this.ControlPlayer.find("ActionButtonTextSize").text() ? parseInt(this.ControlPlayer.find("ActionButtonTextSize").text()) : 10, 8158 position: this.ControlPlayer.find("ActionButtonPosition").text() ? this.ControlPlayer.find("ActionButtonPosition").text() : 4, 8159 visible: !this.ControlPlayer.find("ActionButtonVisible").text() || "N" !== this.ControlPlayer.find("ActionButtonVisible").text() 8160 }; 8161 }, 8162 getTime: function() { 8163 return { 8164 position: this.ControlPlayer.find("TimePosition").text() ? this.ControlPlayer.find("TimePosition").text() : 3, 8165 visible: !this.ControlPlayer.find("TimeVisible").text() || "N" !== this.ControlPlayer.find("TimeVisible").text() 8166 }; 8167 }, 8168 getViewPlay: function() { 8169 return this.ControlPlayer.find("ViewPlay").text(); 8170 }, 8171 fireImpression: function() { 8172 if (!a1platform.impressionFired) { 8173 var impression = this.Impression.text(); 8174 impression && "" != impression && track(impression + mimsi), a1platform.impressionFired = !0; 8175 } 8176 }, 8177 fireTrackingEvent: function(videoCurrentTime) { 8178 var currentTime = Math.floor(videoCurrentTime); 8179 if (0 == currentTime) { 8180 var startUrl = this.TrackingEvents.find('Tracking[event="start"]').text(); 8181 startUrl && "" != startUrl && track(startUrl + mimsi); 8182 } 8183 if (currentTime == Math.floor(this.Duration / 1e3 / 4)) { 8184 var firstQuartileUrl = this.TrackingEvents.find('Tracking[event="firstQuartile"]').text(); 8185 firstQuartileUrl && "" != firstQuartileUrl && track(firstQuartileUrl + mimsi); 8186 } 8187 if (currentTime == Math.floor(this.Duration / 1e3 / 2)) { 8188 var midpointUrl = this.TrackingEvents.find('Tracking[event="midpoint"]').text(); 8189 midpointUrl && "" != midpointUrl && track(midpointUrl + mimsi); 8190 } 8191 if (currentTime == Math.floor(this.Duration / 1e3 * 3 / 4)) { 8192 var thirdQuartileUrl = this.TrackingEvents.find('Tracking[event="thirdQuartile"]').text(); 8193 thirdQuartileUrl && "" != thirdQuartileUrl && track(thirdQuartileUrl + mimsi); 8194 } 8195 var progress = this.TrackingEvents.find('Tracking[event="progress"]'); 8196 for (i = 0; i < progress.length; i++) -1 == progress.eq(i).attr("offset").toUpperCase().indexOf("V") && currentTime == hmsToSecondsOnly(
8196progress.eq(i).attr("offset")) && track(progress.eq(i).text() + mimsi); 8197 }, 8198 fireTrackingEventSkip: function() { 8199 var skipUrl = this.TrackingEvents.find('Tracking[event="skip"]').text(); 8200 skipUrl && "" != skipUrl && track(skipUrl + mimsi); 8201 }, 8202 fireTrackingEventComplete: function() { 8203 var completeUrl = this.TrackingEvents.find('Tracking[event="complete"]').text(); 8204 completeUrl && "" != completeUrl && track(completeUrl + mimsi); 8205 } 8206 }; 8207 }; 8208}(), function() { 8209 var md = new MobileDetect(window.navigator.userAgent); 8210 window.a1platform = { 8211 mobile: md.mobile(), 8212 iframeMode: !1, 8213 isSafari: navigator.vendor && -1 < navigator.vendor.indexOf("Apple") && navigator.userAgent && !navigator.userAgent.match("CriOS") 8214 }, window.addEventListener("message", function(event) { 8215 if (event.data && event.data.name) switch (event.data.name) { 8216 case "a1CreateVideoBannerLargeAd": 8217 var params = event.data.params; 8218 a1CreateVideoBannerLargeAd(params.button, params.url, params.cb); 8219 break; 8220 8221 case "comAdBBSSubjectPlay": 8222 window.videoPlayer.player.play(), $("button.__a1-mouse-over-counter-action").removeClass("__a1-active"); 8223 } 8224 }), window.a1platform.createAd = function(target, url, cb) { 8225 var VAST_PARSER = new A1_VAST("a1 Ad").parser; 8226 VAST_PARSER.load(url, function(res, error) { 8227 if (res) switch (console.log("VAST_PARSER.AdTitle", VAST_PARSER.AdTitle), VAST_PARSER.AdTitle) { 8228 case "A1_VideoRectangle": 8229 $('<div id="__A1RectangleBanner" class="__a1-rectangle-banner"></div>').appendTo(target), 8230 window.a1CreateRectangleAdWithVast(VAST_PARSER); 8231 break; 8232 8233 case "A1_VideoTopBanner": 8234 $('<div id="__A1TopBanner" class="__a1-top-banner"></div>').appendTo(target), window.a1CreateVideoBannerTopAdWithVast(VAST_PARSER); 8235 break; 8236 8237 case "A1_VideoExtendedBanner": 8238 $('<div id="__A1VideoBanner" class="__a1-video-banner"></div>').appendTo(target), 8239 window.a1CreateVideoBannerAdWithVast(VAST_PARSER); 8240 break; 8241 8242 case "A1_VideoExtendedBanner_if": 8243 $('<div id="__A1VideoBanner" class="__a1-video-banner"></div>').appendTo(target), 8244 window.a1CreateVideoBannerIfAdWithVast(VAST_PARSER); 8245 break; 8246 8247 case "A1_VideoExtendedBanner_if_board": 8248 $('<div id="__A1VideoBanner_board" class="__a1-video-banner"></div>').appendTo(target), 8249 window.a1CreateVideoBannerIfBAdWithVast(VAST_PARSER); 8250 break; 8251 8252 case "A1_VideoBounce": 8253 $('<div id="__A1BounceBanner" class="__a1-bounce-banner"></div>').appendTo(target), 8254 window.a1CreateBounceAdWithVast(VAST_PARSER); 8255 break; 8256 8257 case "A1_VideoInBanner": 8258 $('<div id="__A1InBanner" class="__a1-in-banner"></div>').appendTo(target), window.a1CreateInBannerAdWithVast(VAST_PARSER); 8259 break; 8260 8261 case "A1_VideoBigInBanner": 8262 $('<div id="__A1BigInBanner" class="__a1-big-in-banner"></div>').appendTo(target), 8263 window.a1CreateBigInBannerAdWithVast(VAST_PARSER); 8264 break; 8265 8266 case "A1_VideoInFeed": 8267 $('<div id="__A1InfeedBanner" class="__a1-infeed-banner"></div>').appendTo(target), 8268 window.a1CreateInfeedAdWithVast(VAST_PARSER); 8269 break; 8270 8271 case "A1_VideoExpandBanner": 8272 $('<div id="__A1VideoExpandBanner" class="__a1-video-e-banner"></div>').appendTo(target), 8273 window.a1CreateVideoBannerExpandAdWithVast(VAST_PARSER); 8274 break; 8275 8276 case "A1_ClickMobileBanner": 8277 $('<div id="__A1ClickMobileBanner" class="__a1-video-cm-banner"></div>').appendTo(target), 8278 window.a1CreateClickMobileBannerAdWithVast(VAST_PARSER); 8279 } else cb(res, error); 8280 }); 8281 }, window.a1platform.createRectangleAd = function(target, url, cb) { 8282 $('<div id="__A1RectangleBanner" class="__a1-rectangle-banner"></div>').appendTo(target), 8283 window.a1CreateRectangleAd(url, cb); 8284 }, window.a1platform.createVideoBannerTopAd = function(target, url, cb) { 8285 $('<div id="__A1TopBanner" class="__a1-top-banner"></div>').appendTo(target), window.a1CreateVideoBannerTopAd(url, cb); 8286 }, window.a1platform.createVideoBannerAd = function(target, url, cb) { 8287 $('<div id="__A1VideoBanner" class="__a1-video-banner"></div>').appendTo(target), 8288 window.a1CreateVideoBannerAd(url, cb); 8289 }, window.a1platform.createVideoBannerIfAd = function(target, url, cb) { 8290 $('<div id="__A1VideoBanner" class="__a1-video-banner"></div>').appendTo(target), 8291 window.a1CreateVideoBannerIfAd(url, cb); 8292 }, window.a1platform.createVideoBannerIfBAd = function(target, url, cb) { 8293 $('<div id="__A1VideoBanner_board" class="__a1-video-banner"></div>').appendTo(target), 8294 window.a1CreateVideoBannerIfBAd(url, cb); 8295 }, window.a1platform.createBounceAd = function(target, url, cb) { 8296 $('<div id="__A1BounceBanner" class="__a1-bounce-banner"></div>').appendTo(target), 8297 window.a1CreateBounceAd(url, cb); 8298 }, window.a1platform.createInBannerAd = function(target, url, cb) { 8299 $('<div id="__A1InBanner" class="__a1-in-banner"></div>').appendTo(target), window.a1CreateInBannerAd(url, cb); 8300 }, window.a1platform.createBigInBannerAd = function(target, url, cb) { 8301 $('<div id="__A1BigInBanner" class="__a1-big-in-banner"></div>').appendTo(target), 8302 window.a1CreateBigInBannerAd(url, cb); 8303 }, window.a1platform.createInfeedAd = function(target, url, cb) { 8304 $('<div id="__A1InfeedBanner" class="__a1-infeed-banner"></div>').appendTo(target), 8305 window.a1CreateInfeedAd(url, cb); 8306 }, window.a1platform.createVideoBannerExpandAd = function(target, url, cb) { 8307 $('<div id="__A1VideoExpandBanner" class="__a1-video-e-banner"></div>').appendTo(target), 8308 window.a1CreateVideoBannerExpandAd(url, cb); 8309 }, window.a1platform.initIframeAdController = function(target, domain, controller) { 8310 var iframe = $('<iframe src="' + domain + controller + '" style="position:fixed;opacity: 0;visibility: hidden; z-index: -1; width:0;height:0;" name="__a1_iframe_ad_controller"></iframe>').appendTo(target); 8311 iframe.on("load", function() { 8312 $(window).trigger("scroll"); 8313 }), $(window).on("load", function() { 8314 $(window).trigger("scroll"); 8315 }), $(window).on("scroll", function() { 8316 if (console.log("__a1_iframe_ad_controller", __a1_iframe_ad_controller), __a1_iframe_ad_controller && __a1_iframe_ad_controller.window) { 8317 var message = { 8318 scroll_top: $(window).scrollTop(), 8319 window_height: $(window).innerHeight(), 8320 video_container_offset_top: $(target).offset().top, 8321 video_container_height: $(target).height() 8322 }; 8323 console.log("message", message), __a1_iframe_ad_controller.postMessage(message, domain); 8324 } 8325 }), iframe.on("load", function() { 8326 $(window).trigger("scroll"); 8327 }); 8328 }; 8329}(), function() { 8330 function createAd(VAST_PARSER) { 8331 var videoPlayer, parentEl = $("#__A1RectangleBanner"), bannerContainer = $('<
8331div class="__a1-rectangle-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-rectangle-banner-video-container __a1-rectangle-player"></div>').appendTo(bannerContainer), posterUrl = VAST_PARSER.getPosterUrl(), poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(bannerContainer); 8332 poster.css({ 8333 "background-image": "url(" + posterUrl + ")" 8334 }); 8335 var soundAutoOn = VAST_PARSER.ControlPlayer.find("SoundAutoOn").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, videoClicks = VAST_PARSER.getVideoClicks(), termsLink = VAST_PARSER.getTerms(), actionButton = VAST_PARSER.getActionButton(); 8336 termsLink.visible && $('<a class="__a1-banner-terms-link">A1</a>').attr("href", termsLink.link).attr("target", "_blank").appendTo(bannerContainer), 8337 actionButton.visible && $('<a class="__a1-banner-action-button"></a>').attr("href", videoClicks.link).attr("target", "_blank").css({ 8338 "font-size": actionButton.size + "px" 8339 }).html(actionButton.text).appendTo(bannerContainer); 8340 var iconPosition = VAST_PARSER.ControlPlayer.find("IconPosition").text(); 8341 bannerContainer.addClass("__a1-pos-" + iconPosition); 8342 var firstPlay = !1, checkScroll = !0, isVideoPlaying = !1, videoCreated = !1; 8343 var checkAutoPlay = VAST_PARSER.ControlPlayer.find("AutoPlay").text(), getViewPlay = VAST_PARSER.getViewPlay(); 8344 getViewPlay = parseInt(getViewPlay), window.a1RectanglePlayerScrolled = function(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight) { 8345 if (scrollTop = parseInt(scrollTop), 0 != checkScroll) if (scrollTop = parseFloat(scrollTop), 8346 windowHeight = parseFloat(windowHeight), videoContainerOffsetTop = parseFloat(videoContainerOffsetTop), 8347 videoContainerHeight = parseFloat(videoContainerHeight), 0 == isVideoPlaying) { 8348 if (videoContainerOffsetTop - windowHeight + videoContainerHeight * getViewPlay / 100 <= scrollTop && scrollTop <= videoContainerOffsetTop + videoContainerHeight * getViewPlay / 100) if (videoPlayer) { 8349 if (0 == firstPlay && "N" == checkAutoPlay) return; 8350 videoPlayer.play(); 8351 } else !function() { 8352 if (!videoCreated) { 8353 videoCreated = !0; 8354 var videoPlayerEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="100%" height="100%"></video>').appendTo(videoContainer); 8355 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoPlayerEl.attr("muted", !0), 8356 0 == repeatLimit && videoPlayerEl.attr("loop", !0); 8357 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), soundValue = (VAST_PARSER.getProgressbarMove(), 8358 VAST_PARSER.getSoundValue()), playerSize = VAST_PARSER.ControlPlayer.find("PlayerSize").text(); 8359 null != playerSize && null != playerSize && "" != playerSize || (playerSize = "300,250"); 8360 var playerSizes = playerSize.split(","); 8361 parentEl.css({ 8362 width: playerSizes[0], 8363 height: playerSizes[1] 8364 }), videojs(videoPlayerEl[0], { 8365 controls: !0, 8366 autoplay: !1, 8367 preload: "auto", 8368 fluid: !0, 8369 class: "video-js vjs-default-skin", 8370 sources: { 8371 type: videoType, 8372 src: videoUrl 8373 } 8374 }).ready(function() { 8375 videoPlayer = this; 8376 var videoClicks = VAST_PARSER.VideoClicks; 8377 if (2 == VAST_PARSER.ControlPlayer.find("PlayerClick").text() && videoClicks) { 8378 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 8379 poster.attr({ 8380 href: clickThrough, 8381 target: "_blank" 8382 }).on("click", function(e) { 8383 if (videoPlayer.paused()) return e.preventDefault(), videoPlayer.play(), !1; 8384 $.get(clickTracking), videoPlayer.pause(), checkScroll = !1; 8385 }); 8386 } else poster.on("click", function(e) { 8387 e.preventDefault(), videoPlayer.paused() ? videoPlayer.play() : (videoPlayer.pause(), 8388 checkScroll = !1); 8389 }); 8390 function onLoadedMetadata() { 8391 console.log("loadedmetadata"); 8392 var timeAsset = VAST_PARSER.getTime(); 8393 if (timeAsset.visible) { 8394 var duration = videoPlayer.duration(); 8395 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
8396 var timer = $('<div class="__a1-video-control-timer __a1-active"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset.position).appendTo(bannerContainer); 8397 function updateTimer(time) { 8398 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 8399 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 8400 var timeStr = time + "ì´"; 8401 $(".__a1-time", timer).html(timeStr); 8402 } 8403 updateTimer(duration), setInterval(function() { 8404 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 8405 }, 1e3 / 24); 8406 } 8407 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 8408 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")); 8409 } 8410 $(".vjs-progress-control", bannerContainer).remove(), $(".vjs-big-play-button", bannerContainer).remove(), 8411 $(".vjs-fullscreen-control", bannerContainer).remove(), $(".vjs-volume-control", bannerContainer).remove(), 8412 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 8413 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 8414 videoPlayer.responsiveControls({ 8415 controls: { 8416 remainingTimeDisplay: { 8417 mini: !1, 8418 small: !1 8419 }, 8420 "vjs-resolution-button": { 8421 mini: !1 8422 }, 8423 "vjs-language-container": { 8424 mini: !1 8425 } 8426 } 8427 }), videoPlayer.on("play", function(e) { 8428 console.log(e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 8429 VAST_PARSER.fireImpression()), firstPlay = !0, videoPlayer.controlBar.show(), videoPlayer.controlBar.volumePanel.show(), 8430 videoPlayer.controlBar.volumePanel.volumeControl.show(), videoPlayer.controlBar.volumePanel.muteToggle.show(), 8431 poster.removeClass("__a1-active"); 8432 }), videoPlayer.on("playing", function(e) { 8433 $(".__a1-video-control-timer").addClass("__a1-active"), isVideoPlaying = checkScroll = !0; 8434 }), videoPlayer.on("pause", function(e) {}), videoPlayer.on("ended", function(e) { 8435 videoPlayCount++, 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 8436 videoPlayer.pause(), checkScroll = !1) : videoPlayer.play(); 8437 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 8438 if (0 < videoPlayer.currentTime()) { 8439 var currentTime = Math.floor(videoPlayer.currentTime()); 8440 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 8441 videoPlayer.prevCurrentTime = currentTime); 8442 } 8443 }), videoPlayer.on("useractive", function(e) { 8444 console.log(e); 8445 }), videoPlayer.on("userinactive", function(e) { 8446 console.log(e); 8447 }), videoPlayer.on("ended", function(e) { 8448 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 8449 }), window.a1platform.iframeMode && window.a1CheckScrollByLocalStorage(), $(window).trigger("scroll"), 8450 bannerContainer.addClass("__a1-loaded"), $(".__a1-poster", bannerContainer).insertAfter($("video", bannerContainer)); 8451 }); 8452 } 8453 }(); 8454 } else (scrollTop < videoContainerOffsetTop - windowHeight + videoContainerHeight * getViewPlay / 100 || videoContainerOffsetTop + videoContainerHeight * getViewPlay / 100 < scrollTop) && videoPlayer && (isVideoPlaying = !1, 8455 videoPlayer.pause(), console.log("videoPaused")); 8456 }, window.a1platform.iframeMode ? (window.addEventListener("storage", function(e) { 8457 window.a1CheckScrollByLocalStorage(); 8458 }), window.a1CheckScrollByLocalStorage = function() { 8459 var scrollTop = localStorage.getItem("__a1_scroll_top"), windowHeight = localStorage.getItem("__a1_window_height"), videoContainerOffsetTop = localStorage.getItem("__a1_video_container_offset_top"), videoContainerHeight = localStorage.getItem("__a1_video_container_height"); 8460 window.a1RectanglePlayerScrolled(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight), 8461 console.log("a1RectanglePlayerScrolled", scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight); 8462 }, window.a1CheckScrollByLocalStorage()) : $(window).on("scroll", function() { 8463 var scrollTop = $(window).scrollTop(), windowHeight = $(window).innerHeight(), videoContainerOffsetTop = videoContainer.offset().top, videoContainerHeight = videoContainer.height(); 8464 window.a1RectanglePlayerScrolled(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight); 8465 }).trigger("scroll"); 8466 } 8467 window.a1CreateRectangleAd = function(url, cb) { 8468 var VAST_PARSER = new A1_VAST("a1 Rectangle Ad").parser; 8469 VAST_PARSER.load(url, function(res, error) { 8470 res ? createAd(VAST_PARSER) : cb(res, error); 8471 }); 8472 }, window.a1CreateRectangleAdWithVast = function(VAST_PARSER) { 8473 createAd(VAST_PARSER); 8474 }; 8475}(), function() { 8476 function createAd(VAST_PARSER) { 8477 var videoPlayer, videoEl, parentEl = $("#__A1VideoBanner"), controlPlayerInfo = VAST_PARSER.ControlPlayer, videoBanner = $('<
8477div class="__a1-video-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-video-banner-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-banner-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer); 8478 !function() { 8479 videoEl = $('<video id="videoPlayer" playsInline muted class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper); 8480 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), clickOption = VAST_PARSER.getClickOption(), LargeAdNextHour = Number(VAST_PARSER.getLargeAdNextHour()), videoClicks = VAST_PARSER.VideoClicks; 8481 videojs(videoEl[0], { 8482 controls: !0, 8483 autoplay: !1, 8484 preload: "auto", 8485 class: "video-js vjs-default-skin", 8486 sources: { 8487 type: videoType, 8488 src: videoUrl 8489 } 8490 }).ready(function() { 8491 if (videoClicks) { 8492 var bannerPoster, clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 8493 "" != posterUrl ? (bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"><img src="' + posterUrl + '"></a>').appendTo(videoWrapper)).css({ 8494 "background-image": "url(" + posterUrl + ")" 8495 }) : bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"></a>').appendTo(videoWrapper), 8496 0 == clickOption && bannerPoster.attr({ 8497 href: clickThrough, 8498 target: "_blank" 8499 }).on("click", function(e) { 8500 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8501 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8502 $.get(clickTracking), videoPlayer.pause(); 8503 } 8504 }), 1 == clickOption && (bannerPoster.addClass("__a1-mouse-over-counter-action"), 8505 bannerPoster.attr({}).on("click", function(e) { 8506 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8507 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8508 mouseMoveCheckTF = 0, showFullScreenVideo(), videoPlayer.pause(); 8509 } 8510 })); 8511 } 8512 videoPlayer = this, "Y" == VAST_PARSER.ControlPlayer.find("AutoPlay").text() && videoPlayer.play(), 8513 videoPlayer.responsiveControls({ 8514 controls: { 8515 remainingTimeDisplay: { 8516 mini: !1, 8517 small: !1 8518 }, 8519 "vjs-resolution-button": { 8520 mini: !1 8521 }, 8522 "vjs-language-container": { 8523 mini: !1 8524 } 8525 } 8526 }), $(".vjs-progress-control", videoContainer).remove(), $(".vjs-big-play-button", videoContainer).remove(); 8527 var extendedPlayerVASTurl = controlPlayerInfo.find("ExtendedPlayerVASTurl").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, playInduceHide = controlPlayerInfo.find("PlayInduceHide").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduceImgUrl2 = controlPlayerInfo.find("PlayInduceImgUrl2").text(), playInduceImgChange = controlPlayerInfo.find("PlayInduceImgChange").text(), playInduceImgSize = controlPlayerInfo.find("PlayInduceImgSize").text(), playInducePosition = controlPlayerInfo.find("PlayInducePosition").text(), playInduceImgSizes = playInduceImgSize.split(","), playInducePositions = playInducePosition.split(","); 8528 console.log(videoPlayer.controlBar.fullscreenToggle); 8529 var fullscreenButton = $('<button class="__a1-mouse-over-counter-action vjs-fullscreen-control vjs-control vjs-button __a1-fullscreen-button" type="button" aria-l
8529ive="polite" title="Fullscreen" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text">Fullscreen</span></button>').insertBefore(videoPlayer.controlBar.fullscreenToggle.el_); 8530 if (playInduceImgUrl1 && "" != playInduceImgUrl1) { 8531 var playInduce = $('<span class="__a1-play-induce __a1-mouse-over-counter-action"></span>').appendTo(videoWrapper); 8532 $('<img src="' + playInduceImgUrl1 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img">').appendTo(playInduce); 8533 } 8534 function showFullScreenVideo() { 8535 fullscreenButton.hasClass("__a1-active") || (mouseOverCountTick && (clearTimeout(mouseOverCountTick), 8536 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null), 8537 mouseOverCounter && mouseOverCounter.removeClass("__a1-active"), videoPlayer.pause(), 8538 window.a1CreateVideoBannerLargeAd(fullscreenButton, extendedPlayerVASTurl, function() {}), 8539 fullscreenButton.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action")); 8540 } 8541 playInduceImgUrl2 && "" != playInduceImgUrl2 && ($('<img src="' + playInduceImgUrl2 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img-over">').appendTo(playInduce), 8542 playInduceImgChange && 0 < playInduceImgChange && setInterval(function() { 8543 playInduce.toggleClass("__a1-toggle"); 8544 }, 1e3 * playInduceImgChange)), playInducePosition && playInduce.css({ 8545 right: playInducePositions[0] + "%", 8546 bottom: playInducePositions[1] + "%", 8547 width: playInduceImgSizes[0], 8548 height: playInduceImgSizes[1] 8549 }), "Y" == playInduceHide && playInduce.addClass("__a1-hide"), playInduce.css({ 8550 cursor: "pointer" 8551 }).on("click", function(e) { 8552 e.preventDefault(), showFullScreenVideo(); 8553 }), fullscreenButton.on("click", function(e) { 8554 e.preventDefault(), showFullScreenVideo(); 8555 }); 8556 var mouseOverCount = controlPlayerInfo.find("MouseOverCount").text(); 8557 console.log("mouseOverCount", mouseOverCount); 8558 var mouseOverCountTick = null, mouseMoveCheck = null, mouseMoveCheckTF = 0; 8559 if (mouseOverCount && 0 < parseInt(mouseOverCount)) { 8560 parseInt(mouseOverCount); 8561 var mouseOverCounter = $('<div class="__a1-mouse-over-counter"><span class="__a1-track"><span class="__a1-bar"></span></span></div>').appendTo(videoBanner); 8562 $(document).on("mouseenter", ".__a1-mouse-over-counter-action", function(e) { 8563 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8564 0 == mouseMoveCheckTF && (mouseMoveCheckTF = 1, clearTimeout(mouseOverCountTick), 8565 mouseOverCountTick = null, mouseOverCounter.find(".__a1-bar").width(0), parseInt(mouseOverCount), 8566 mouseOverCountTick = setTimeout(function() { 8567 fullscreenButton.hasClass("__a1-active") || (mouseMoveCheckTF = 0, clearTimeout(mouseOverCountTick), 8568 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8569 mouseOverCounter.removeClass("__a1-active"), showFullScreenVideo()); 8570 }, 1e3 * mouseOverCount), mouseOverCounter.find(".__a1-bar").css("width", 0).stop().animate({ 8571 width: "100%" 8572 }, 1e3 * mouseOverCount), mouseOverCounter.addClass("__a1-active"))); 8573 }), $(document).on("mousemove", ".__a1-mouse-over-counter-action", function(e) { 8574 fullscreenButton.hasClass("__a1-active") || mouseOverCounter.css({ 8575 top: e.pageY - videoBanner.offset().top - 5, 8576 left: e.pageX - videoBanner.offset().left 8577 }); 8578 }), $(document).on("mouseleave", ".__a1-mouse-over-counter-action", function(e) { 8579 mouseMoveCheck = setTimeout(function() { 8580 mouseMoveCheckTF = 0, fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), 8581 mouseOverCountTick = null, mouseOverCounter.removeClass("__a1-active")); 8582 }, 200); 8583 }); 8584 } 8585 var name, value, firstPlay = !1; 8586 function onLoadedMetadata() { 8587 var timeAsset_visible = !0, timeAsset_position = 1; 8588 if (console.log("timeAsset.visible", timeAsset_visible), timeAsset_visible) { 8589 var duration = videoPlayer.duration(); 8590 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
8591 var videoControlTimer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset_position).insertBefore(".vjs-volume-panel"); 8592 function updateTimer(time) { 8593 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 8594 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 8595 var timeStr = (time = (time = "00" + time).substr(time.length - 2, 2)) + ":" + (duration = (duration = "00" + duration).substr(duration.length - 2, 2)); 8596 $(".__a1-time", videoControlTimer).html(timeStr); 8597 } 8598 updateTimer(duration), setInterval(function() { 8599 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 8600 }, 1e3 / 24); 8601 } 8602 } 8603 videoPlayer.on("play", function(e) { 8604 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression(), videoPlayer.controlBar.hide(), 8605 videoPlayer.controlBar.fullscreenToggle.hide(), "Y" == progressbarMove && videoPlayer.controlBar.progressControl.disable()), 8606 firstPlay = !0; 8607 }), videoPlayer.on("playing", function(e) { 8608 bannerPoster.removeClass("__a1-active"), 1 == clickOption && bannerPoster.addClass("__a1-mouse-over-counter-action"), 8609 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 8610 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 8611 }), videoPlayer.on("pause", function(e) { 8612 bannerPoster.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action"); 8613 }), videoPlayer.on("ended", function(e) { 8614 videoPlayCount++, console.log("repeatLimit", repeatLimit, videoPlayCount), 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 8615 videoPlayer.pause()) : videoPlayer.play(); 8616 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 8617 if (0 < videoPlayer.currentTime()) { 8618 var currentTime = Math.floor(videoPlayer.currentTime()); 8619 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 8620 videoPlayer.prevCurrentTime = currentTime); 8621 } 8622 }), videoPlayer.on("useractive", function(e) { 8623 console.log(e); 8624 }), videoPlayer.on("userinactive", function(e) { 8625 console.log(e); 8626 }), videoPlayer.on("ended", function(e) { 8627 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 8628 }), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 8629 $(".__a1-video-banner-poster", videoContainer).insertAfter($("video", videoContainer)), 8630 "1" != (name = "LVB", (value = document.cookie.match("(^|;) ?" + name + "=([^;]*)(;|$)")) ? value[2] : null) && (showFullScreenVideo(), 8631 function(name, value, exp) { 8632 var date = new Date(); 8633 date.setHours(date.getHours() + exp), document.cookie = name + "=" + value + ";expires=" + date.toUTCString() + ";path=/"; 8634 }("LVB", "1", LargeAdNextHour)); 8635 }); 8636 }(); 8637 } 8638 window.a1CreateVideoBannerAd = function(url, cb) { 8639 var VAST_PARSER = new A1_VAST("a1 Video Banner Ad").parser; 8640 VAST_PARSER.load(url, function(res, error) { 8641 res && createAd(VAST_PARSER), cb(res, error); 8642 }); 8643 }, window.a1CreateVideoBannerAdWithVast = function(VAST_PARSER) { 8644 createAd(VAST_PARSER); 8645 }; 8646}(), function() { 8647 function createAd(VAST_PARSER) { 8648 var videoPlayer, videoEl, parentEl = $("#__A1VideoBanner"), controlPlayerInfo = VAST_PARSER.ControlPlayer, videoBanner = $('<
8648div class="__a1-video-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-video-banner-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-banner-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer); 8649 !function() { 8650 videoEl = $('<video id="videoPlayer" playsInline muted class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper); 8651 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), clickOption = VAST_PARSER.getClickOption(), LargeAdNextHour = Number(VAST_PARSER.getLargeAdNextHour()), videoClicks = VAST_PARSER.VideoClicks; 8652 videojs(videoEl[0], { 8653 controls: !0, 8654 autoplay: !1, 8655 preload: "auto", 8656 class: "video-js vjs-default-skin", 8657 sources: { 8658 type: videoType, 8659 src: videoUrl 8660 } 8661 }).ready(function() { 8662 if (videoClicks) { 8663 var bannerPoster, clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 8664 "" != posterUrl ? (bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"><img src="' + posterUrl + '"></a>').appendTo(videoWrapper)).css({ 8665 "background-image": "url(" + posterUrl + ")" 8666 }) : bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"></a>').appendTo(videoWrapper), 8667 0 == clickOption && bannerPoster.attr({ 8668 href: clickThrough, 8669 target: "_blank" 8670 }).on("click", function(e) { 8671 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8672 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8673 $.get(clickTracking), videoPlayer.pause(); 8674 } 8675 }), 1 == clickOption && (bannerPoster.addClass("__a1-mouse-over-counter-action"), 8676 bannerPoster.attr({}).on("click", function(e) { 8677 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8678 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8679 mouseMoveCheckTF = 0, showFullScreenVideo(), videoPlayer.pause(); 8680 } 8681 })); 8682 } 8683 videoPlayer = this, "Y" == VAST_PARSER.ControlPlayer.find("AutoPlay").text() && videoPlayer.play(), 8684 videoPlayer.responsiveControls({ 8685 controls: { 8686 remainingTimeDisplay: { 8687 mini: !1, 8688 small: !1 8689 }, 8690 "vjs-resolution-button": { 8691 mini: !1 8692 }, 8693 "vjs-language-container": { 8694 mini: !1 8695 } 8696 } 8697 }), $(".vjs-progress-control", videoContainer).remove(), $(".vjs-big-play-button", videoContainer).remove(); 8698 var extendedPlayerVASTurl = controlPlayerInfo.find("ExtendedPlayerVASTurl").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, playInduceHide = controlPlayerInfo.find("PlayInduceHide").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduceImgUrl2 = controlPlayerInfo.find("PlayInduceImgUrl2").text(), playInduceImgChange = controlPlayerInfo.find("PlayInduceImgChange").text(), playInduceImgSize = controlPlayerInfo.find("PlayInduceImgSize").text(), playInducePosition = controlPlayerInfo.find("PlayInducePosition").text(), playInduceImgSizes = playInduceImgSize.split(","), playInducePositions = playInducePosition.split(","); 8699 console.log(videoPlayer.controlBar.fullscreenToggle); 8700 var fullscreenButton = $('<button class="__a1-mouse-over-counter-action vjs-fullscreen-control vjs-control vjs-button __a1-fullscreen-button" type="button" aria-l
8700ive="polite" title="Fullscreen" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text">Fullscreen</span></button>').insertBefore(videoPlayer.controlBar.fullscreenToggle.el_); 8701 if (playInduceImgUrl1 && "" != playInduceImgUrl1) { 8702 var playInduce = $('<span class="__a1-play-induce __a1-mouse-over-counter-action"></span>').appendTo(videoWrapper); 8703 $('<img src="' + playInduceImgUrl1 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img">').appendTo(playInduce); 8704 } 8705 function showFullScreenVideo() { 8706 fullscreenButton.hasClass("__a1-active") || (mouseOverCountTick && (clearTimeout(mouseOverCountTick), 8707 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null), 8708 mouseOverCounter && mouseOverCounter.removeClass("__a1-active"), videoPlayer.pause(), 8709 window.parent.postMessage({ 8710 name: "a1CreateVideoBannerLargeAd", 8711 params: { 8712 button: void 0, 8713 url: extendedPlayerVASTurl, 8714 cb: void 0 8715 } 8716 }, "*"), fullscreenButton.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action")); 8717 } 8718 playInduceImgUrl2 && "" != playInduceImgUrl2 && ($('<img src="' + playInduceImgUrl2 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img-over">').appendTo(playInduce), 8719 playInduceImgChange && 0 < playInduceImgChange && setInterval(function() { 8720 playInduce.toggleClass("__a1-toggle"); 8721 }, 1e3 * playInduceImgChange)), playInducePosition && playInduce.css({ 8722 right: playInducePositions[0] + "%", 8723 bottom: playInducePositions[1] + "%", 8724 width: playInduceImgSizes[0], 8725 height: playInduceImgSizes[1] 8726 }), "Y" == playInduceHide && playInduce.addClass("__a1-hide"), playInduce.css({ 8727 cursor: "pointer" 8728 }).on("click", function(e) { 8729 e.preventDefault(), showFullScreenVideo(); 8730 }), fullscreenButton.on("click", function(e) { 8731 e.preventDefault(), showFullScreenVideo(); 8732 }); 8733 var mouseOverCount = controlPlayerInfo.find("MouseOverCount").text(); 8734 console.log("mouseOverCount", mouseOverCount); 8735 var mouseOverCountTick = null, mouseMoveCheck = null, mouseMoveCheckTF = 0; 8736 if (mouseOverCount && 0 < parseInt(mouseOverCount)) { 8737 parseInt(mouseOverCount); 8738 var mouseOverCounter = $('<div class="__a1-mouse-over-counter"><span class="__a1-track"><span class="__a1-bar"></span></span></div>').appendTo(videoBanner); 8739 $(document).on("mouseenter", ".__a1-mouse-over-counter-action", function(e) { 8740 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8741 0 == mouseMoveCheckTF && (mouseMoveCheckTF = 1, clearTimeout(mouseOverCountTick), 8742 mouseOverCountTick = null, mouseOverCounter.find(".__a1-bar").width(0), parseInt(mouseOverCount), 8743 mouseOverCountTick = setTimeout(function() { 8744 fullscreenButton.hasClass("__a1-active") || (mouseMoveCheckTF = 0, clearTimeout(mouseOverCountTick), 8745 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8746 mouseOverCounter.removeClass("__a1-active"), showFullScreenVideo()); 8747 }, 1e3 * mouseOverCount), mouseOverCounter.find(".__a1-bar").css("width", 0).stop().animate({ 8748 width: "100%" 8749 }, 1e3 * mouseOverCount), mouseOverCounter.addClass("__a1-active"))); 8750 }), $(document).on("mousemove", ".__a1-mouse-over-counter-action", function(e) { 8751 fullscreenButton.hasClass("__a1-active") || mouseOverCounter.css({ 8752 top: e.pageY - videoBanner.offset().top - 5, 8753 left: e.pageX - videoBanner.offset().left 8754 }); 8755 }), $(document).on("mouseleave", ".__a1-mouse-over-counter-action", function(e) { 8756 mouseMoveCheck = setTimeout(function() { 8757 mouseMoveCheckTF = 0, fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), 8758 mouseOverCountTick = null, mouseOverCounter.removeClass("__a1-active")); 8759 }, 200); 8760 }); 8761 } 8762 var name, value, firstPlay = !1; 8763 function onLoadedMetadata() { 8764 var timeAsset_visible = !0, timeAsset_position = 1; 8765 if (console.log("timeAsset.visible", timeAsset_visible), timeAsset_visible) { 8766 var duration = videoPlayer.duration(); 8767 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
8768 var videoControlTimer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset_position).insertBefore(".vjs-volume-panel"); 8769 function updateTimer(time) { 8770 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 8771 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 8772 var timeStr = (time = (time = "00" + time).substr(time.length - 2, 2)) + ":" + (duration = (duration = "00" + duration).substr(duration.length - 2, 2)); 8773 $(".__a1-time", videoControlTimer).html(timeStr); 8774 } 8775 updateTimer(duration), setInterval(function() { 8776 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 8777 }, 1e3 / 24); 8778 } 8779 } 8780 videoPlayer.on("play", function(e) { 8781 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression(), videoPlayer.controlBar.hide(), 8782 videoPlayer.controlBar.fullscreenToggle.hide(), "Y" == progressbarMove && videoPlayer.controlBar.progressControl.disable()), 8783 firstPlay = !0; 8784 }), videoPlayer.on("playing", function(e) { 8785 bannerPoster.removeClass("__a1-active"), 1 == clickOption && bannerPoster.addClass("__a1-mouse-over-counter-action"), 8786 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 8787 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 8788 }), videoPlayer.on("pause", function(e) { 8789 bannerPoster.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action"); 8790 }), videoPlayer.on("ended", function(e) { 8791 videoPlayCount++, console.log("repeatLimit", repeatLimit, videoPlayCount), 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 8792 videoPlayer.pause()) : videoPlayer.play(); 8793 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 8794 if (0 < videoPlayer.currentTime()) { 8795 var currentTime = Math.floor(videoPlayer.currentTime()); 8796 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 8797 videoPlayer.prevCurrentTime = currentTime); 8798 } 8799 }), videoPlayer.on("useractive", function(e) { 8800 console.log(e); 8801 }), videoPlayer.on("userinactive", function(e) { 8802 console.log(e); 8803 }), videoPlayer.on("ended", function(e) { 8804 console.log(e), VAST_PARSER.fireTrackingEventComplete(), nis_reload(); 8805 }), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 8806 $(".__a1-video-banner-poster", videoContainer).insertAfter($("video", videoContainer)), 8807 0 <= LargeAdNextHour && "1" != (name = "LVB", (value = document.cookie.match("(^|;) ?" + name + "=([^;]*)(;|$)")) ? value[2] : null) && (showFullScreenVideo(), 8808 function(name, value, exp) { 8809 var date = new Date(); 8810 date.setHours(date.getHours() + exp), document.cookie = name + "=" + value + ";expires=" + date.toUTCString() + ";path=/"; 8811 }("LVB", "1", LargeAdNextHour)); 8812 }); 8813 }(); 8814 } 8815 window.a1CreateVideoBannerIfAd = function(url, cb) { 8816 var VAST_PARSER = new A1_VAST("a1 Video Banner Ad").parser; 8817 VAST_PARSER.load(url, function(res, error) { 8818 res && createAd(VAST_PARSER), cb(res, error); 8819 }); 8820 }, window.a1CreateVideoBannerIfAdWithVast = function(VAST_PARSER) { 8821 createAd(VAST_PARSER); 8822 }; 8823}(), function() { 8824 function createAd(VAST_PARSER) { 8825 var videoPlayer, videoEl, parentEl = $("#__A1VideoBanner_board"), controlPlayerInfo = VAST_PARSER.ControlPlayer, videoBanner = $('<
8825div class="__a1-video-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-video-banner-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-banner-video-wrapper-board"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image-board"></div>').appendTo(videoContainer); 8826 !function() { 8827 videoEl = $('<video id="videoPlayer" playsInline muted class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper); 8828 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), clickOption = VAST_PARSER.getClickOption(), videoClicks = VAST_PARSER.VideoClicks; 8829 videojs(videoEl[0], { 8830 controls: !0, 8831 autoplay: !1, 8832 preload: "auto", 8833 class: "video-js vjs-default-skin", 8834 sources: { 8835 type: videoType, 8836 src: videoUrl 8837 } 8838 }).ready(function() { 8839 if (videoClicks) { 8840 var bannerPoster, clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 8841 "" != posterUrl ? (bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"><img src="' + posterUrl + '"></a>').appendTo(videoWrapper)).css({ 8842 "background-image": "url(" + posterUrl + ")" 8843 }) : bannerPoster = $('<a class="__a1-video-banner-poster __a1-active"></a>').appendTo(videoWrapper), 8844 0 == clickOption && bannerPoster.attr({ 8845 href: clickThrough, 8846 target: "_blank" 8847 }).on("click", function(e) { 8848 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8849 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8850 $.get(clickTracking), videoPlayer.pause(); 8851 } 8852 }), 1 == clickOption && (bannerPoster.addClass("__a1-mouse-over-counter-action"), 8853 bannerPoster.attr({}).on("click", function(e) { 8854 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 8855 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 8856 mouseMoveCheckTF = 0, showFullScreenVideo(), videoPlayer.pause(); 8857 } 8858 })); 8859 } 8860 videoPlayer = this, "Y" == VAST_PARSER.ControlPlayer.find("AutoPlay").text() && videoPlayer.play(), 8861 videoPlayer.responsiveControls({ 8862 controls: { 8863 remainingTimeDisplay: { 8864 mini: !1, 8865 small: !1 8866 }, 8867 "vjs-resolution-button": { 8868 mini: !1 8869 }, 8870 "vjs-language-container": { 8871 mini: !1 8872 } 8873 } 8874 }), $(".vjs-progress-control", videoContainer).remove(), $(".vjs-big-play-button", videoContainer).remove(); 8875 var extendedPlayerVASTurl = controlPlayerInfo.find("ExtendedPlayerVASTurl").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, playInduceHide = controlPlayerInfo.find("PlayInduceHide").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduceImgUrl2 = controlPlayerInfo.find("PlayInduceImgUrl2").text(), playInduceImgChange = controlPlayerInfo.find("PlayInduceImgChange").text(), playInduceImgSize = controlPlayerInfo.find("PlayInduceImgSize").text(), playInducePosition = controlPlayerInfo.find("PlayInducePosition").text(), playInduceImgSizes = playInduceImgSize.split(","), playInducePositions = playInducePosition.split(","); 8876 console.log(videoPlayer.controlBar.fullscreenToggle); 8877 var fullscreenButton = $('<button class="__a1-mouse-over-counter-action vjs-fullscreen-control vjs-control vjs-button __a1-fullscreen-button" type="button" aria-l
8877ive="polite" title="Fullscreen" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text">Fullscreen</span></button>').insertBefore(videoPlayer.controlBar.fullscreenToggle.el_); 8878 if (playInduceImgUrl1 && "" != playInduceImgUrl1) { 8879 var playInduce = $('<span class="__a1-play-induce __a1-mouse-over-counter-action"></span>').appendTo(videoWrapper); 8880 $('<img src="' + playInduceImgUrl1 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img">').appendTo(playInduce); 8881 } 8882 function showFullScreenVideo() { 8883 fullscreenButton.hasClass("__a1-active") || (mouseOverCountTick && (clearTimeout(mouseOverCountTick), 8884 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null), 8885 mouseOverCounter && mouseOverCounter.removeClass("__a1-active"), videoPlayer.pause(), 8886 window.parent.postMessage({ 8887 name: "a1CreateVideoBannerLargeAd", 8888 params: { 8889 button: void 0, 8890 url: extendedPlayerVASTurl, 8891 cb: void 0 8892 } 8893 }, "*"), fullscreenButton.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action")); 8894 } 8895 playInduceImgUrl2 && "" != playInduceImgUrl2 && ($('<img src="' + playInduceImgUrl2 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img-over">').appendTo(playInduce), 8896 playInduceImgChange && 0 < playInduceImgChange && setInterval(function() { 8897 playInduce.toggleClass("__a1-toggle"); 8898 }, 1e3 * playInduceImgChange)), playInducePosition && playInduce.css({ 8899 right: playInducePositions[0] + "%", 8900 bottom: playInducePositions[1] + "%", 8901 width: playInduceImgSizes[0], 8902 height: playInduceImgSizes[1] 8903 }), "Y" == playInduceHide && playInduce.addClass("__a1-hide"), playInduce.css({ 8904 cursor: "pointer" 8905 }).on("click", function(e) { 8906 e.preventDefault(), showFullScreenVideo(); 8907 }), fullscreenButton.on("click", function(e) { 8908 e.preventDefault(), showFullScreenVideo(); 8909 }); 8910 var mouseOverCount = controlPlayerInfo.find("MouseOverCount").text(); 8911 console.log("mouseOverCount", mouseOverCount); 8912 var mouseOverCountTick = null, mouseMoveCheck = null, mouseMoveCheckTF = 0; 8913 if (mouseOverCount && 0 < parseInt(mouseOverCount)) { 8914 parseInt(mouseOverCount); 8915 var mouseOverCounter = $('<div class="__a1-mouse-over-counter"><span class="__a1-track"><span class="__a1-bar"></span></span></div>').appendTo(videoBanner); 8916 $(document).on("mouseenter", ".__a1-mouse-over-counter-action", function(e) { 8917 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8918 0 == mouseMoveCheckTF && (mouseMoveCheckTF = 1, clearTimeout(mouseOverCountTick), 8919 mouseOverCountTick = null, mouseOverCounter.find(".__a1-bar").width(0), parseInt(mouseOverCount), 8920 mouseOverCountTick = setTimeout(function() { 8921 fullscreenButton.hasClass("__a1-active") || (mouseMoveCheckTF = 0, clearTimeout(mouseOverCountTick), 8922 mouseOverCountTick = null, clearTimeout(mouseMoveCheck), mouseMoveCheck = null, 8923 mouseOverCounter.removeClass("__a1-active"), showFullScreenVideo()); 8924 }, 1e3 * mouseOverCount), mouseOverCounter.find(".__a1-bar").css("width", 0).stop().animate({ 8925 width: "100%" 8926 }, 1e3 * mouseOverCount), mouseOverCounter.addClass("__a1-active"))); 8927 }), $(document).on("mousemove", ".__a1-mouse-over-counter-action", function(e) { 8928 fullscreenButton.hasClass("__a1-active") || mouseOverCounter.css({ 8929 top: e.pageY - videoBanner.offset().top - 5, 8930 left: e.pageX - videoBanner.offset().left 8931 }); 8932 }), $(document).on("mouseleave", ".__a1-mouse-over-counter-action", function(e) { 8933 mouseMoveCheck = setTimeout(function() { 8934 mouseMoveCheckTF = 0, fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), 8935 mouseOverCountTick = null, mouseOverCounter.removeClass("__a1-active")); 8936 }, 200); 8937 }); 8938 } 8939 var firstPlay = !1; 8940 function onLoadedMetadata() { 8941 var timeAsset_visible = !0, timeAsset_position = 1; 8942 if (console.log("timeAsset.visible", timeAsset_visible), timeAsset_visible) { 8943 var duration = videoPlayer.duration(); 8944 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
8945 var videoControlTimer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset_position).insertBefore(".vjs-volume-panel"); 8946 function updateTimer(time) { 8947 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 8948 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 8949 var timeStr = (time = (time = "00" + time).substr(time.length - 2, 2)) + ":" + (duration = (duration = "00" + duration).substr(duration.length - 2, 2)); 8950 $(".__a1-time", videoControlTimer).html(timeStr); 8951 } 8952 updateTimer(duration), setInterval(function() { 8953 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 8954 }, 1e3 / 24); 8955 } 8956 } 8957 videoPlayer.on("play", function(e) { 8958 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression(), videoPlayer.controlBar.hide(), 8959 videoPlayer.controlBar.fullscreenToggle.hide(), "Y" == progressbarMove && videoPlayer.controlBar.progressControl.disable()), 8960 firstPlay = !0; 8961 }), videoPlayer.on("playing", function(e) { 8962 bannerPoster.removeClass("__a1-active"), 1 == clickOption && bannerPoster.addClass("__a1-mouse-over-counter-action"), 8963 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 8964 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 8965 }), videoPlayer.on("pause", function(e) { 8966 bannerPoster.addClass("__a1-active"), 1 == clickOption && bannerPoster.removeClass("__a1-mouse-over-counter-action"); 8967 }), videoPlayer.on("ended", function(e) { 8968 videoPlayCount++, console.log("repeatLimit", repeatLimit, videoPlayCount), 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 8969 videoPlayer.pause()) : videoPlayer.play(); 8970 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 8971 if (0 < videoPlayer.currentTime()) { 8972 var currentTime = Math.floor(videoPlayer.currentTime()); 8973 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 8974 videoPlayer.prevCurrentTime = currentTime); 8975 } 8976 }), videoPlayer.on("useractive", function(e) { 8977 console.log(e); 8978 }), videoPlayer.on("userinactive", function(e) { 8979 console.log(e); 8980 }), videoPlayer.on("ended", function(e) { 8981 console.log(e), VAST_PARSER.fireTrackingEventComplete(), nis_reload(); 8982 }), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 8983 $(".__a1-video-banner-poster", videoContainer).insertAfter($("video", videoContainer)); 8984 }); 8985 }(); 8986 } 8987 window.a1CreateVideoBannerIfBAd = function(url, cb) { 8988 var VAST_PARSER = new A1_VAST("a1 Video Banner Ad").parser; 8989 VAST_PARSER.load(url, function(res, error) { 8990 res && createAd(VAST_PARSER), cb(res, error); 8991 }); 8992 }, window.a1CreateVideoBannerIfBAdWithVast = function(VAST_PARSER) { 8993 createAd(VAST_PARSER); 8994 }; 8995}(), function() { 8996 var videoPlayer, controllerButton = null, playerLoaded = !1, parentEl = $("#__A1VideoLargeBanner"); 8997 window.a1CreateVideoBannerLargeAd = function(button, url, cb) { 8998 controllerButton = button; 8999 var VAST_PARSER = new A1_VAST("a1 Video Banner Large Ad").parser; 9000 0 == playerLoaded ? VAST_PARSER.load(url, function(res, error) { 9001 res && function(VAST_PARSER) { 9002 function closeAdLargeboard() { 9003 try { 9004 $("div.__a1-video-banner-large-video-container").removeClass("active"), $("div#__A1VideoLargeBanner_board").slide
9004Up(500); 9005 try { 9006 videojs("videoPlayerLarge_board_html5_api").pause(); 9007 } catch (ex) { 9008 console.log(ex); 9009 } 9010 $(controllerButton).removeClass("__a1-active"), null == window.videoPlayer ? document.getElementById("comAdBBSSubject_board").contentWindow.window.videoPlayer.player.play() : window.videoPlayer.player.play(); 9011 } catch (e) { 9012 console.log(e); 9013 } 9014 } 9015 closeAdLargeboard(), parentEl.slideUp(0); 9016 var controlPlayerInfo = VAST_PARSER.ControlPlayer, soundAutoOn = controlPlayerInfo.find("SoundAutoOn").text(), videoBanner = $('<div class="__a1-video-banner-large-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-video-banner-large-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-banner-large-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer), videoEl = null, videoPlayerEl = null; 9017 !function() { 9018 videoEl = $('<video id="videoPlayerLarge" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"></video>').appendTo(videoWrapper); 9019 var testc = videojs.getPlayers(); 9020 console.log(testc), console.log("window.a1platform.mobile ", window.a1platform.mobile), 9021 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoEl.attr("muted", !0); 9022 videoPlayerEl = $("#videoPlayerLarge"); 9023 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), soundValue = VAST_PARSER.getSoundValue(); 9024 videoPlayerEl.attr({ 9025 poster: posterUrl 9026 }); 9027 var videoClicks = VAST_PARSER.VideoClicks, posterUrl = VAST_PARSER.getPosterUrl(); 9028 if (videoClicks) { 9029 var poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(videoContainer); 9030 poster.css({ 9031 "background-image": "url(" + posterUrl + ")" 9032 }); 9033 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9034 poster.attr({ 9035 href: clickThrough, 9036 target: "_blank" 9037 }).on("click", function(e) { 9038 $.get(clickTracking), videoPlayer && videoPlayer.pause(); 9039 }); 9040 } 9041 videojs(videoPlayerEl[0], { 9042 controls: !0, 9043 autoplay: !1, 9044 preload: "auto", 9045 class: "video-js vjs-default-skin", 9046 sources: { 9047 type: videoType, 9048 src: videoUrl 9049 } 9050 }).ready(function() { 9051 playerLoaded = !0, (videoPlayer = this).play(), videoPlayer.responsiveControls({ 9052 controls: { 9053 remainingTimeDisplay: { 9054 mini: !1, 9055 small: !1 9056 }, 9057 "vjs-resolution-button": { 9058 mini: !1 9059 }, 9060 "vjs-language-container": { 9061 mini: !1 9062 } 9063 } 9064 }); 9065 var firstPlay = !1; 9066 videoPlayer.on("play", function(e) { 9067 console.log(e), closeAdLargeboard(), firstPlay || (videoPlayer.volume(soundValue / 100), 9068 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoPlayer.volume(0), 9069 VAST_PARSER.fireImpression()), firstPlay = !0, "N" == progressbarMove && videoPlayer.controlBar.progressControl.disable(), 9070 poster.removeClass("__a1-active"), clearTimeout(void 0); 9071 }), videoPlayer.on("playing", function(e) { 9072 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 9073 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 9074 }), videoPlayer.on("pause", function(e) {}); 9075 var playerRetain = controlPlayerInfo.find("PlayerRetain").text(); 9076 function onLoadedMetadata() {} 9077 videoPlayer.on("ended", function(e) { 9078 console.log("ended", e), videoPlayer.load(), "N" == playerRetain && btnClose.trigger("click"); 9079 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9080 if (0 < videoPlayer.currentTime()) { 9081 var currentTime = Math.floor(videoPlayer.currentTime()); 9082 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9083 videoPlayer.prevCurrentTime = currentTime); 9084 } 9085 }), videoPlayer.on("useractive", function(e) { 9086 console.log(e); 9087 }), videoPlayer.on("userinactive", function(e) { 9088 console.log(e); 9089 }), videoPlayer.on("ended", function(e) { 9090 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9091 }), videoPlayer.readyState() < 1 && videoPlayer.one("loadedmetadata", onLoadedMetadata); 9092 var playInduceTextUrl = controlPlayerInfo.find("PlayInduceTextUrl").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduce = $('<
9092div class="__a1-add-img-webzine"></div>').appendTo(videoContainer); 9093 $('<img src="' + playInduceImgUrl1 + '" class="__a1-img-webzine">').appendTo(playInduce), 9094 $('<div class="__a1-add-text">' + playInduceTextUrl + "</div>").appendTo(playInduce), 9095 $(".__a1-img-webzine").mouseenter(function() { 9096 $(".__a1-add-text").css("display", "block"); 9097 }), $(".__a1-img-webzine").mouseleave(function() { 9098 $(".__a1-add-text").css("display", "none"); 9099 }); 9100 }); 9101 var btnClose = $('<a href="#" class="__a1-btn-close">×</a>').appendTo(videoContainer); 9102 btnClose.on("click", function(e) { 9103 !function(e) { 9104 e.preventDefault(), videoContainer.removeClass("active"), parentEl.slideUp(500), 9105 videoPlayer.pause(), $(controllerButton).removeClass("__a1-active"), null == window.videoPlayer ? document.getElementById("comAdBBSSubject").contentWindow.window.postMessage({ 9106 name: "comAdBBSSubjectPlay" 9107 }, "*") : window.videoPlayer.player.play(); 9108 }(e); 9109 }), parentEl.slideDown(500), $(".__a1-poster", videoContainer).insertAfter($("video", videoContainer)); 9110 }(); 9111 }(VAST_PARSER), cb && "function" == typeof cb && cb(res, error); 9112 }) : (parentEl.slideDown(500), videoPlayer.currentTime(0), videoPlayer.play()); 9113 }; 9114}(), function() { 9115 var videoPlayer, controllerButton = null, playerLoaded = !1, parentEl = $("#__A1VideoLargeBanner_board"); 9116 window.a1CreateVideoBannerLargeBAd = function(button, url, cb) { 9117 controllerButton = button; 9118 var VAST_PARSER = new A1_VAST("a1 Video Banner Large Ad").parser; 9119 0 == playerLoaded ? VAST_PARSER.load(url, function(res, error) { 9120 res && function(VAST_PARSER) { 9121 function closeAdLarge() { 9122 try { 9123 $("div.__a1-video-banner-large-video-container").removeClass("active"), $("div#__A1VideoLargeBanner").slideUp(500); 9124 try { 9125 videojs("videoPlayerLarge_html5_api").pause(); 9126 } catch (ex) { 9127 console.log(ex); 9128 } 9129 $(controllerButton).removeClass("__a1-active"), null == window.videoPlayer ? document.getElementById("comAdBBSSubject").contentWindow.window.videoPlayer.player.play() : window.videoPlayer.player.play(); 9130 } catch (e) { 9131 console.log(e); 9132 } 9133 } 9134 closeAdLarge(), parentEl.slideUp(0); 9135 var controlPlayerInfo = VAST_PARSER.ControlPlayer, soundAutoOn = controlPlayerInfo.find("SoundAutoOn").text(), videoBanner = $('<div class="__a1-video-banner-large-container"></div>
9135').appendTo(parentEl), videoContainer = $('<div class="__a1-video-banner-large-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-banner-large-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer), videoEl = null, videoPlayerEl = null; 9136 !function() { 9137 videoEl = $('<video id="videoPlayerLarge_board" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"></video>').appendTo(videoWrapper); 9138 var testc = videojs.getPlayers(); 9139 console.log(testc), console.log("window.a1platform.mobile ", window.a1platform.mobile), 9140 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoEl.attr("muted", !0); 9141 videoPlayerEl = $("#videoPlayerLarge_board"); 9142 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), soundValue = VAST_PARSER.getSoundValue(); 9143 videoPlayerEl.attr({ 9144 poster: posterUrl 9145 }); 9146 var videoClicks = VAST_PARSER.VideoClicks, posterUrl = VAST_PARSER.getPosterUrl(); 9147 if (videoClicks) { 9148 var poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(videoContainer); 9149 poster.css({ 9150 "background-image": "url(" + posterUrl + ")" 9151 }); 9152 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9153 poster.attr({ 9154 href: clickThrough, 9155 target: "_blank" 9156 }).on("click", function(e) { 9157 $.get(clickTracking), videoPlayer && videoPlayer.pause(); 9158 }); 9159 } 9160 videojs(videoPlayerEl[0], { 9161 controls: !0, 9162 autoplay: !1, 9163 preload: "auto", 9164 class: "video-js vjs-default-skin", 9165 sources: { 9166 type: videoType, 9167 src: videoUrl 9168 } 9169 }).ready(function() { 9170 playerLoaded = !0, (videoPlayer = this).play(), videoPlayer.responsiveControls({ 9171 controls: { 9172 remainingTimeDisplay: { 9173 mini: !1, 9174 small: !1 9175 }, 9176 "vjs-resolution-button": { 9177 mini: !1 9178 }, 9179 "vjs-language-container": { 9180 mini: !1 9181 } 9182 } 9183 }); 9184 var firstPlay = !1; 9185 videoPlayer.on("play", function(e) { 9186 console.log(e), closeAdLarge(), firstPlay || (videoPlayer.volume(soundValue / 100), 9187 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoPlayer.volume(0), 9188 VAST_PARSER.fireImpression()), firstPlay = !0, "N" == progressbarMove && videoPlayer.controlBar.progressControl.disable(), 9189 poster.removeClass("__a1-active"), clearTimeout(void 0); 9190 }), videoPlayer.on("playing", function(e) { 9191 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 9192 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 9193 }), videoPlayer.on("pause", function(e) {}); 9194 var playerRetain = controlPlayerInfo.find("PlayerRetain").text(); 9195 function onLoadedMetadata() {} 9196 videoPlayer.on("ended", function(e) { 9197 console.log("ended", e), videoPlayer.load(), "N" == playerRetain && btnClose.trigger("click"); 9198 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9199 if (0 < videoPlayer.currentTime()) { 9200 var currentTime = Math.floor(videoPlayer.currentTime()); 9201 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9202 videoPlayer.prevCurrentTime = currentTime); 9203 } 9204 }), videoPlayer.on("useractive", function(e) { 9205 console.log(e); 9206 }), videoPlayer.on("userinactive", function(e) { 9207 console.log(e); 9208 }), videoPlayer.on("ended", function(e) { 9209 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9210 }), videoPlayer.readyState() < 1 && videoPlayer.one("loadedmetadata", onLoadedMetadata); 9211 var playInduceTextUrl = controlPlayerInfo.find("PlayInduceTextUrl").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduce = $('<
9211div class="__a1-add-img-board"></div>').appendTo(videoContainer); 9212 $('<img src="' + playInduceImgUrl1 + '" class="__a1-img-board">').appendTo(playInduce), 9213 $('<div class="__a1-add-text">' + playInduceTextUrl + "</div>").appendTo(playInduce), 9214 $(".__a1-img-board").mouseenter(function() { 9215 $(".__a1-add-text").css("display", "block"); 9216 }), $(".__a1-img-board").mouseleave(function() { 9217 $(".__a1-add-text").css("display", "none"); 9218 }); 9219 }); 9220 var btnClose = $('<a href="#" class="__a1-btn-close">×</a>').appendTo(videoContainer); 9221 btnClose.on("click", function(e) { 9222 !function(e) { 9223 e.preventDefault(), videoContainer.removeClass("active"), parentEl.slideUp(500), 9224 videoPlayer.pause(), $(controllerButton).removeClass("__a1-active"), null == window.videoPlayer ? document.getElementById("comAdBBSSubject_board").contentWindow.window.videoPlayer.player.play() : window.videoPlayer.player.play(); 9225 }(e); 9226 }), parentEl.slideDown(500), $(".__a1-poster", videoContainer).insertAfter($("video", videoContainer)); 9227 }(); 9228 }(VAST_PARSER), cb(res, error); 9229 }) : (parentEl.slideDown(500), videoPlayer.currentTime(0), videoPlayer.play()); 9230 }; 9231}(), function() { 9232 function createAd(VAST_PARSER) { 9233 var videoPlayer, parentEl = $("#__A1TopBanner"), controlPlayerInfo = VAST_PARSER.ControlPlayer, companionInfo = VAST_PARSER.Companion, BannerImgSrc = companionInfo.find("StaticResource").text(), bannerClickSrc = companionInfo.find("CompanionClickThrough").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduceImgUrl2 = controlPlayerInfo.find("PlayInduceImgUrl2").text(), playInduceImgChange = controlPlayerInfo.find("PlayInduceImgChange").text(), playInduceImgSize = controlPlayerInfo.find("PlayInduceImgSize").text(), playInducePosition = controlPlayerInfo.find("PlayInducePosition").text(), AdDisplayType = controlPlayerInfo.find("AdDisplayType").text(), soundAutoOn = controlPlayerInfo.find("SoundAutoOn").text(), bannerClick = controlPlayerInfo.find("BannerClick").text(), playerMaximumHeight = controlPlayerInfo.find("PlayerMaximumHeight").text(), bannerWidth = companionInfo.attr("width"), bannerHeight = companionInfo.attr("height"), responsive = companionInfo.attr("responsive"); 9234 bannerWidth = parseInt(bannerWidth), bannerHeight = parseInt(bannerHeight), 2 == AdDisplayType && parentEl.addClass("__a1-under-video"); 9235 var topBanner = $('<div class="__a1-top-banner-container"></div>').appendTo(parentEl), topBannerA = $('<a class="__a1-mouse-over-counter-action"></a>').attr({ 9236 href: bannerClickSrc, 9237 target: "_blank" 9238 }).appendTo(topBanner), bannerImg = $("<img>").attr("src", BannerImgSrc).appendTo(topBannerA); 9239 2 == bannerClick && topBannerA.on("click", function(e) { 9240 e.preventDefault(), btnVideoLink.trigger("click"); 9241 }); 9242 var playInduceImgSizes = playInduceImgSize.split(","), btnVideoLink = $('<a class="__a1-mouse-over-counter-action __a1-top-banner-video-link __a1-animated __a1-infinite __a1-anim-bounce" href="#"></a>').appendTo(topBanner); 9243 playInduceImgUrl1 && "" != playInduceImgUrl1 && $('<img src="' + playInduceImgUrl1 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img">').appendTo(btnVideoLink), 9244 playInduceImgUrl2 && "" != playInduceImgUrl2 && ($('<img src="' + playInduceImgUrl2 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img-over">').appendTo(btnVideoLink), 9245 playInduceImgChange && 0 < playInduceImgChange && setInterval(function() { 9246 btnVideoLink.toggleClass("__a1-toggle"); 9247 }, 1e3 * playInduceImgChange)), playInducePosition && btnVideoLink.css({ 9248 right: playInducePosition, 9249 width: playInduceImgSizes[0], 9250 height: playInduceImgSizes[1] 9251 }), btnVideoLink.on("click", function(e) { 9252 e.preventDefault(), console.log($(this).closest(".__a1-top-banner-container")), 9253 $(this).closest(".__a1-top-banner").find(".__a1-top-banner-video-container").addClass("__a1-active").slideDown(500), 9254 clearTimeout(mouseOverCountTick), mouseOverCountTick = null, mouseOverCounter.removeClass("__a1-active"), 9255 videoPlayer ? videoPlayer.play() : function() {
9256 videoEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper), 9257 console.log("window.a1platform.mobile ", window.a1platform.mobile), ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoEl.attr("muted", !0), 9258 videoPlayerEl = $("#videoPlayer"); 9259 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), soundValue = VAST_PARSER.getSoundValue(); 9260 videoPlayerEl.attr({ 9261 poster: posterUrl 9262 }); 9263 var videoClicks = VAST_PARSER.VideoClicks, playerClick = VAST_PARSER.ControlPlayer.find("PlayerClick").text(), poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(videoContainer); 9264 if (poster.css({ 9265 "background-image": "url(" + posterUrl + ")" 9266 }), 2 == playerClick && videoClicks) { 9267 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9268 poster.attr({ 9269 href: clickThrough, 9270 target: "_blank" 9271 }).on("click", function(e) { 9272 $.get(clickTracking), videoPlayer && (videoPlayer.muted() || 0 == videoPlayer.volume()) && videoPlayer.pause(); 9273 }); 9274 } else poster.on("click", function(e) { 9275 e.preventDefault(), videoPlayer.paused() ? videoPlayer.play() : videoPlayer.pause(); 9276 }); 9277 if (videojs(videoPlayerEl[0], { 9278 controls: !0, 9279 autoplay: !1, 9280 preload: "auto", 9281 class: "video-js vjs-default-skin", 9282 sources: { 9283 type: videoType, 9284 src: videoUrl 9285 } 9286 }).ready(function() { 9287 (videoPlayer = this).play(), videoPlayer.responsiveControls({ 9288 controls: { 9289 remainingTimeDisplay: { 9290 mini: !1, 9291 small: !1 9292 }, 9293 "vjs-resolution-button": { 9294 mini: !1 9295 }, 9296 "vjs-language-container": { 9297 mini: !1 9298 } 9299 } 9300 }); 9301 var firstPlay = !1; 9302 videoPlayer.on("play", function(e) { 9303 console.log(e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 9304 VAST_PARSER.fireImpression()), firstPlay = !0, "N" == progressbarMove && videoPlayer.controlBar.progressControl.disable(), 9305 poster.removeClass("__a1-active"); 9306 }), videoPlayer.on("playing", function(e) { 9307 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 9308 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 9309 }), videoPlayer.on("pause", function(e) {}); 9310 var playerRetain = controlPlayerInfo.find("PlayerRetain").text(); 9311 function onLoadedMetadata() {} 9312 videoPlayer.on("ended", function(e) { 9313 console.log("ended", e), videoPlayer.load(), "N" == playerRetain && (videoContainer.removeClass("__a1-active"), 9314 videoContainer.slideUp(500)); 9315 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9316 if (0 < videoPlayer.currentTime()) { 9317 var currentTime = Math.floor(videoPlayer.currentTime()); 9318 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9319 videoPlayer.prevCurrentTime = currentTime); 9320 } 9321 }), videoPlayer.on("useractive", function(e) { 9322 console.log(e); 9323 }), videoPlayer.on("userinactive", function(e) { 9324 console.log(e); 9325 }), videoPlayer.on("ended", function(e) { 9326 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9327 }), videoPlayer.readyState() < 1 && videoPlayer.one("loadedmetadata", onLoadedMetadata); 9328 }), "Y" == VAST_PARSER.ControlPlayer.find("CloseButton").text()) { 9329 var btnClose = $('<a href="#" class="__a1-btn-close">×</a>').appendTo(videoContainer); 9330 btnClose.on("click", function(e) { 9331 e.preventDefault(), videoContainer.removeClass("__a1-active"), videoContainer.slideUp(500), 9332 videoPlayer.pause(); 9333 }); 9334 } 9335 $(".__a1-poster", videoContainer).insertAfter($("video", videoContainer)); 9336 }(); 9337 });
9338 var videoContainer = $('<div class="__a1-top-banner-video-container"></div>').insertBefore(topBanner), videoWrapper = $('<div class="__a1-top-banner-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer); 9339 console.log("responsive", responsive), "false" == responsive ? (topBanner.css({ 9340 width: bannerWidth + "px", 9341 height: bannerHeight + "px" 9342 }), bannerImg.attr({ 9343 width: bannerWidth + "px", 9344 height: bannerHeight + "px" 9345 })) : (0 < playerMaximumHeight && videoWrapper.css({ 9346 "max-height": playerMaximumHeight + "px" 9347 }), console.log("playerMaximumHeight", playerMaximumHeight)), videoContainer.slideUp(0); 9348 var videoEl = null, videoPlayerEl = null; 9349 var bannerMouseOverCount = controlPlayerInfo.find("BannerMouseOverCount").text(), playInduceMouseOverCount = controlPlayerInfo.find("PlayInduceMouseOverCount").text(); 9350 topBannerA.attr("data-mouse-over-count", bannerMouseOverCount), btnVideoLink.attr("data-mouse-over-count", playInduceMouseOverCount), 9351 0 == bannerMouseOverCount && topBannerA.removeClass("__a1-mouse-over-counter-action"), 9352 0 == playInduceMouseOverCount && btnVideoLink.removeClass("__a1-mouse-over-counter-action"), 9353 console.log("bannerMouseOverCount", bannerMouseOverCount), console.log("playInduceMouseOverCount", playInduceMouseOverCount); 9354 var mouseOverCountTick = null, mouseOverCounter = $('<div class="__a1-mouse-over-counter"><span class="__a1-track"><span class="__a1-bar"></span></span></div>').appendTo(topBannerA); 9355 $(document).on("mouseenter", ".__a1-mouse-over-counter-action", function(e) { 9356 if (!videoContainer.hasClass("__a1-active")) { 9357 clearTimeout(mouseOverCountTick), mouseOverCountTick = null, mouseOverCounter.find(".__a1-bar").width(0); 9358 var mouseOverCount = $(this).attr("data-mouse-over-count"); 9359 parseInt(mouseOverCount), mouseOverCountTick = setTimeout(function() { 9360 !function() { 9361 if (videoContainer.hasClass("__a1-active")) return; 9362 clearTimeout(mouseOverCountTick), mouseOverCountTick = null, mouseOverCounter.removeClass("__a1-active"), 9363 btnVideoLink.trigger("click"); 9364 }(); 9365 }, 1e3 * mouseOverCount), mouseOverCounter.find(".__a1-bar").css("width", 0).stop().animate({ 9366 width: "100%" 9367 }, 1e3 * mouseOverCount), mouseOverCounter.addClass("__a1-active"); 9368 } 9369 }), $(document).on("mousemove", ".__a1-mouse-over-counter-action", function(e) { 9370 videoContainer.hasClass("__a1-active") || mouseOverCounter.css({ 9371 top: e.pageY - topBannerA.offset().top - 5, 9372 left: e.pageX - topBannerA.offset().left 9373 }); 9374 }), $(document).on("mouseleave", ".__a1-mouse-over-counter-action", function(e) { 9375 videoContainer.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), mouseOverCountTick = null, 9376 mouseOverCounter.removeClass("__a1-active")); 9377 }); 9378 } 9379 window.a1CreateVideoBannerTopAd = function(url, cb) { 9380 var VAST_PARSER = new A1_VAST("a1 Video Banner Top Ad").parser; 9381 VAST_PARSER.load(url, function(res, error) { 9382 res && ("VideoBannerTop" == VAST_PARSER.Companion.attr("goodsId") ? createAd(VAST_PARSER) : $("#__A1TopBanner").remove()), 9383 cb(res, error); 9384 }); 9385 }, window.a1CreateVideoBannerTopAdWithVast = function(VAST_PARSER) { 9386 createAd(VAST_PARSER); 9387 }; 9388}(), function() { 9389 function createAd(VAST_PARSER) { 9390 var videoPlayer, videoEl, parentEl = $("#__A1VideoExpandBanner"), controlPlayerInfo = VAST_PARSER.ControlPlayer, videoBanner = $('<
9390div class="__a1-video-e-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-video-e-banner-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-e-banner-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer), btnClose = $('<div class="__a1-btn-close __a1-hide">×</div>').appendTo(videoContainer); 9391 !function() { 9392 videoEl = $('<video id="videoPlayer" playsInline muted class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper); 9393 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), progressbarMove = VAST_PARSER.getProgressbarMove(), expandWidthSizeValue = VAST_PARSER.getExpandWidthSizeValue(), videoClicks = VAST_PARSER.VideoClicks; 9394 if (videoClicks) { 9395 var bannerPoster = $('<a href="#" class="__a1-video-e-banner-poster __a1-active"><img src="' + posterUrl + '"></a>').appendTo(videoWrapper); 9396 bannerPoster.css({ 9397 "background-image": "url(" + posterUrl + ")" 9398 }); 9399 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9400 bannerPoster.attr({ 9401 href: clickThrough, 9402 target: "_blank" 9403 }).on("click", function(e) { 9404 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 9405 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 9406 $.get(clickTracking), (videoPlayer.muted() || 0 == videoPlayer.volume()) && videoPlayer.pause(); 9407 } 9408 }); 9409 } 9410 videojs(videoEl[0], { 9411 controls: !0, 9412 autoplay: !1, 9413 preload: "auto", 9414 class: "video-js vjs-default-skin", 9415 sources: { 9416 type: videoType, 9417 src: videoUrl 9418 } 9419 }).ready(function() { 9420 videoPlayer = this, "Y" == VAST_PARSER.ControlPlayer.find("AutoPlay").text() && videoPlayer.play(), 9421 videoPlayer.responsiveControls({ 9422 controls: { 9423 remainingTimeDisplay: { 9424 mini: !1, 9425 small: !1, 9426 default: !1 9427 }, 9428 "vjs-resolution-button": { 9429 mini: !1 9430 }, 9431 "vjs-language-container": { 9432 mini: !1 9433 } 9434 } 9435 }), $(".vjs-progress-control", videoContainer).remove(), $(".vjs-big-play-button", videoContainer).remove(), 9436 controlPlayerInfo.find("ExtendedPlayerVASTurl").text(); 9437 var repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, playInduceHide = controlPlayerInfo.find("PlayInduceHide").text(), playInduceImgUrl1 = controlPlayerInfo.find("PlayInduceImgUrl1").text(), playInduceImgUrl2 = controlPlayerInfo.find("PlayInduceImgUrl2").text(), playInduceImgChange = controlPlayerInfo.find("PlayInduceImgChange").text(), playInduceImgSize = controlPlayerInfo.find("PlayInduceImgSize").text(), playInducePosition = controlPlayerInfo.find("PlayInducePosition").text(), playInduceImgSizes = playInduceImgSize.split(","), playInducePositions = playInducePosition.split(","); 9438 console.log(videoPlayer.controlBar.fullscreenToggle); 9439 var fullscreenButton = $('<button class="__a1-mouse-over-counter-action vjs-fullscreen-control vjs-control vjs-button __a1-fullscreen-button" type="button" aria-l
9439ive="polite" title="Fullscreen" aria-disabled="false"><span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text">Fullscreen</span></button>').insertBefore(videoPlayer.controlBar.fullscreenToggle.el_); 9440 if (playInduceImgUrl1 && "" != playInduceImgUrl1) { 9441 var playInduce = $('<span class="__a1-play-induce __a1-mouse-over-counter-action"></span>').appendTo(videoWrapper); 9442 $('<img src="' + playInduceImgUrl1 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img">').appendTo(playInduce); 9443 } 9444 function showActionScreenVideo() { 9445 fullscreenButton.hasClass("__a1-active") || (mouseOverCountTick && (clearTimeout(mouseOverCountTick), 9446 mouseOverCountTick = null), mouseOverCounter && mouseOverCounter.removeClass("__a1-active"), 9447 $(videoContainer).animate({ 9448 width: expandWidthSizeValue + "px", 9449 marginLeft: "-=" + calculatedWidth + "px" 9450 }, 400), playInduce.addClass("__a1-hide"), videoPlayer.paused() && videoPlayer.play(), 9451 fullscreenButton.addClass("__a1-active"), btnClose.removeClass("__a1-hide")); 9452 } 9453 playInduceImgUrl2 && "" != playInduceImgUrl2 && ($('<img src="' + playInduceImgUrl2 + '" width="' + playInduceImgSizes[0] + '" height="' + playInduceImgSizes[1] + '" class="__a1-img-over">').appendTo(playInduce), 9454 playInduceImgChange && 0 < playInduceImgChange && setInterval(function() { 9455 playInduce.toggleClass("__a1-toggle"); 9456 }, 1e3 * playInduceImgChange)), playInducePosition && playInduce.css({ 9457 right: playInducePositions[0] + "%", 9458 bottom: playInducePositions[1] + "%", 9459 width: playInduceImgSizes[0], 9460 height: playInduceImgSizes[1] 9461 }), "Y" == playInduceHide && playInduce.addClass("__a1-hide"), playInduce.css({ 9462 cursor: "pointer" 9463 }).on("click", function(e) { 9464 e.preventDefault(), showActionScreenVideo(); 9465 }), fullscreenButton.on("click", function(e) { 9466 e.preventDefault(), showActionScreenVideo(); 9467 }); 9468 var defaultWidth = $(videoContainer).width(), calculatedWidth = expandWidthSizeValue - defaultWidth; 9469 btnClose.on("click", function(e) { 9470 fullscreenButton.hasClass("__a1-active") && (fullscreenButton.removeClass("__a1-active"), 9471 btnClose.addClass("__a1-hide"), $(videoContainer).animate({ 9472 width: defaultWidth + "px", 9473 marginLeft: "+=" + calculatedWidth + "px" 9474 }, 400), playInduce.removeClass("__a1-hide")); 9475 }); 9476 var mouseOverCount = controlPlayerInfo.find("MouseOverCount").text(); 9477 console.log("mouseOverCount", mouseOverCount); 9478 var mouseOverCountTick = null; 9479 if (mouseOverCount && 0 < parseInt(mouseOverCount)) { 9480 parseInt(mouseOverCount); 9481 var mouseOverCounter = $('<div class="__a1-mouse-over-counter"><span class="__a1-track"><span class="__a1-bar"></span></span></div>').appendTo(videoBanner); 9482 $(document).on("mouseenter", ".__a1-mouse-over-counter-action", function(e) { 9483 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), mouseOverCountTick = null, 9484 mouseOverCounter.find(".__a1-bar").width(0), parseInt(mouseOverCount), mouseOverCountTick = setTimeout(function() { 9485 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), mouseOverCountTick = null, 9486 mouseOverCounter.removeClass("__a1-active"), showActionScreenVideo()); 9487 }, 1e3 * mouseOverCount), mouseOverCounter.find(".__a1-bar").css("width", 0).stop().animate({ 9488 width: "100%" 9489 }, 1e3 * mouseOverCount), mouseOverCounter.addClass("__a1-active")); 9490 }), $(document).on("mousemove", ".__a1-mouse-over-counter-action", function(e) { 9491 fullscreenButton.hasClass("__a1-active") || mouseOverCounter.css({ 9492 top: e.pageY - videoBanner.offset().top - 5, 9493 left: e.pageX - videoBanner.offset().left 9494 }); 9495 }), $(document).on("mouseleave", ".__a1-mouse-over-counter-action", function(e) { 9496 fullscreenButton.hasClass("__a1-active") || (clearTimeout(mouseOverCountTick), mouseOverCountTick = null, 9497 mouseOverCounter.removeClass("__a1-active")); 9498 }); 9499 } 9500 var firstPlay = !1; 9501 function onLoadedMetadata() { 9502 var timeAsset_visible = !0, timeAsset_position = 1; 9503 if (console.log("timeAsset.visible", timeAsset_visible), timeAsset_visible) { 9504 var duration = videoPlayer.duration(); 9505 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
9506 var videoControlTimer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset_position).insertBefore(".vjs-volume-panel"); 9507 function updateTimer(time) { 9508 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 9509 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 9510 var timeStr = (time = (time = "00" + time).substr(time.length - 2, 2)) + ":" + (duration = (duration = "00" + duration).substr(duration.length - 2, 2)); 9511 $(".__a1-time", videoControlTimer).html(timeStr); 9512 } 9513 updateTimer(duration), setInterval(function() { 9514 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 9515 }, 1e3 / 24); 9516 } 9517 } 9518 videoPlayer.on("play", function(e) { 9519 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression(), videoPlayer.controlBar.show(), 9520 videoPlayer.controlBar.fullscreenToggle.hide(), "Y" == progressbarMove && videoPlayer.controlBar.progressControl.disable()), 9521 firstPlay = !0; 9522 }), videoPlayer.on("playing", function(e) { 9523 $(".__a1-video-control-timer").addClass("__a1-active"), bannerPoster.removeClass("__a1-active"), 9524 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 9525 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 9526 }), videoPlayer.on("pause", function(e) { 9527 bannerPoster.addClass("__a1-active"); 9528 }), videoPlayer.on("ended", function(e) { 9529 videoPlayCount++, console.log("repeatLimit", repeatLimit, videoPlayCount), 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 9530 videoPlayer.pause()) : videoPlayer.play(); 9531 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9532 if (0 < videoPlayer.currentTime()) { 9533 var currentTime = Math.floor(videoPlayer.currentTime()); 9534 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9535 videoPlayer.prevCurrentTime = currentTime); 9536 } 9537 }), videoPlayer.on("useractive", function(e) { 9538 console.log(e); 9539 }), videoPlayer.on("userinactive", function(e) { 9540 console.log(e); 9541 }), videoPlayer.on("ended", function(e) { 9542 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9543 }), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 9544 $(".__a1-video-e-banner-poster", videoContainer).insertAfter($("video", videoContainer)); 9545 }); 9546 }(); 9547 } 9548 window.a1CreateVideoBannerExpandAd = function(url, cb) { 9549 var VAST_PARSER = new A1_VAST("a1 Video Expand Banner Ad").parser; 9550 VAST_PARSER.load(url, function(res, error) { 9551 res && createAd(VAST_PARSER), cb(res, error); 9552 }); 9553 }, window.a1CreateVideoBannerExpandAdWithVast = function(VAST_PARSER) { 9554 createAd(VAST_PARSER); 9555 }; 9556}(), function() { 9557 var callback; 9558 function createAd(VAST_PARSER) { 9559 var videoPlayer, parentEl = $("#__A1InBanner"), bannerContainer = $('<
9559div class="__a1-in-banner-container"></div>').appendTo(parentEl), CompanionAds = VAST_PARSER.CompanionAds, companionWidth = CompanionAds.find("Companion").attr("width"), companionHeight = CompanionAds.find("Companion").attr("height"); 9560 bannerContainer.css({ 9561 width: companionWidth, 9562 height: companionHeight 9563 }); 9564 var staticResource = CompanionAds.find("StaticResource").text(), companionClickThrough = CompanionAds.find("CompanionClickThrough").text(), inBannerImgContainer = $('<a class="__a1-in-banner-img-container"></a>').attr("href", companionClickThrough).attr("target", "_blank").appendTo(bannerContainer); 9565 $("<img>").attr("src", staticResource).appendTo(inBannerImgContainer).css({ 9566 width: companionWidth, 9567 height: companionHeight 9568 }); 9569 var imageSizes = VAST_PARSER.ControlPlayer.find("ThumbnailImageSize").text().split(","), imageWidth = imageSizes[0], imageHeight = imageSizes[1], leftPos = (companionWidth - imageWidth) * VAST_PARSER.ControlPlayer.find("VideoPlayerPosition").text() / 100, videoTbContainer = $('<
9569div class="__a1-in-banner-video-tb-container"></div>').appendTo(bannerContainer); 9570 videoTbContainer.css({ 9571 width: imageWidth, 9572 height: imageHeight, 9573 left: leftPos 9574 }); 9575 var videoPlayerEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" muted preload="auto" width="' + imageWidth + '" height="' + imageHeight + '"></video>').appendTo(videoTbContainer), videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.ControlPlayer.find("ThumbnailImageURL").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0; 9576 0 == repeatLimit && videoPlayerEl.attr("loop", !0), videoPlayerEl.attr({ 9577 poster: posterUrl 9578 }); 9579 var tbClickEl = $('<a href="#" class="__a1-in-banner-tb"><img src="' + posterUrl + '"></a>').appendTo(videoTbContainer), VideoClicks = VAST_PARSER.VideoClicks, extendedPlayerVASTurl = VAST_PARSER.ControlPlayer.find("ExtendedPlayerVASTurl").text(); 9580 if (VideoClicks) { 9581 var clickTracking = VideoClicks.find("ClickTracking").text(); 9582 tbClickEl.on("click", function(e) { 9583 e.preventDefault(), $.get(clickTracking), window.a1CreateInBannerExtendedPlayerAd(extendedPlayerVASTurl, callback); 9584 }); 9585 } 9586 videojs(videoPlayerEl[0], { 9587 controls: !1, 9588 autoplay: !0, 9589 preload: "auto", 9590 class: "video-js vjs-default-skin", 9591 sources: { 9592 type: videoType, 9593 src: videoUrl 9594 } 9595 }).ready(function() { 9596 (videoPlayer = this).responsiveControls({ 9597 controls: { 9598 remainingTimeDisplay: { 9599 mini: !1, 9600 small: !1 9601 }, 9602 "vjs-resolution-button": { 9603 mini: !1 9604 }, 9605 "vjs-language-container": { 9606 mini: !1 9607 } 9608 } 9609 }); 9610 var firstPlay = !1; 9611 videoPlayer.on("play", function(e) { 9612 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression()), firstPlay = !0, 9613 bannerContainer.addClass("__a1-active"); 9614 }), videoPlayer.on("playing", function(e) {}), videoPlayer.on("pause", function(e) {}), 9615 videoPlayer.on("ended", function(e) { 9616 videoPlayCount++, 0 < repeatLimit && repeatLimit <= videoPlayCount ? (bannerContainer.removeClass("__a1-active"), 9617 videoPlayer.pause()) : videoPlayer.play(); 9618 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9619 var currentTime = Math.floor(videoPlayer.currentTime()); 9620 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9621 videoPlayer.prevCurrentTime = currentTime); 9622 }), videoPlayer.on("useractive", function(e) { 9623 console.log(e); 9624 }), videoPlayer.on("userinactive", function(e) { 9625 console.log(e); 9626 }), videoPlayer.on("ended", function(e) { 9627 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9628 }); 9629 }); 9630 } 9631 window.a1CreateInBannerAd = function(url, cb) { 9632 var VAST_PARSER = new A1_VAST("a1 In Banner Ad").parser; 9633 callback = cb, VAST_PARSER.load(url, function(res, error) { 9634 res && ("InBanner" == VAST_PARSER.Companion.attr("goodsId") ? createAd(VAST_PARSER) : $("#__A1InBanner").remove()), 9635 cb(res, error); 9636 }); 9637 }, window.a1CreateInBannerAdWithVast = function(VAST_PARSER) { 9638 createAd(VAST_PARSER); 9639 }; 9640 var firstPlay = !(window.a1CreateInBannerExtendedPlayerAd = function(url, cb) { 9641 console.log("a1CreateInBannerExtendedPlayerAd"), $(".__a1-in-banner-extended-player").remove(); 9642 var VAST_PARSER = new A1_VAST("a1 In Banner Extended Player Ad").parser; 9643 VAST_PARSER.load(url, function(res, error) { 9644 res ? function(VAST_PARSER) {
9645 var videoPlayer, extendedPlayerContainer = $('<div class="__a1-in-banner-extended-player-container"></div>').appendTo("body"), parentEl = $('<div class="__a1-in-banner-extended-player"></div>').appendTo(extendedPlayerContainer), bannerContainer = $('<div class="__a1-rectangle-banner-container"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-rectangle-banner-video-container __a1-rectangle-player"></div>').appendTo(bannerContainer), posterUrl = VAST_PARSER.getPosterUrl(), poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(bannerContainer); 9646 poster.css({ 9647 "background-image": "url(" + posterUrl + ")" 9648 }); 9649 var soundAutoOn = VAST_PARSER.ControlPlayer.find("SoundAutoOn").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, videoClicks = VAST_PARSER.getVideoClicks(), termsLink = VAST_PARSER.getTerms(), actionButton = VAST_PARSER.getActionButton(); 9650 termsLink.visible && $('<a class="__a1-banner-terms-link">A1</a>').attr("href", termsLink.link).attr("target", "_blank").appendTo(bannerContainer); 9651 actionButton.visible && $('<a class="__a1-banner-action-button"></a>').attr("href", videoClicks.link).attr("target", "_blank").css({ 9652 "font-size": actionButton.size + "px" 9653 }).html(actionButton.text).appendTo(bannerContainer); 9654 var iconPosition = VAST_PARSER.ControlPlayer.find("IconPosition").text(); 9655 console.log("iconPosition", iconPosition), bannerContainer.addClass("__a1-pos-" + iconPosition), 9656 $('<a href="#" class="__a1-btn-close">×</a>').appendTo(extendedPlayerContainer).on("click", function(e) { 9657 extendedPlayerContainer.remove(); 9658 }), function() { 9659 var videoPlayerEl = $('<video id="extendedVideoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="100%" height="100%"></video>').appendTo(videoContainer); 9660 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoPlayerEl.attr("muted", !0); 9661 0 == repeatLimit && videoPlayerEl.attr("loop", !0); 9662 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), soundValue = (VAST_PARSER.getProgressbarMove(), 9663 VAST_PARSER.getSoundValue()), playerSize = VAST_PARSER.ControlPlayer.find("PlayerSize").text(); 9664 null != playerSize && null != playerSize && "" != playerSize || (playerSize = "300,250"); 9665 var playerSizes = playerSize.split(","); 9666 parentEl.css({ 9667 width: playerSizes[0], 9668 height: playerSizes[1] 9669 }); 9670 var checkAutoPlay = VAST_PARSER.ControlPlayer.find("AutoPlay").text(); 9671 videojs(videoPlayerEl[0], { 9672 controls: !0, 9673 autoplay: "Y" == checkAutoPlay, 9674 preload: "auto", 9675 fluid: !0, 9676 class: "video-js vjs-default-skin", 9677 sources: { 9678 type: videoType, 9679 src: videoUrl 9680 } 9681 }).ready(function() { 9682 extendedPlayerContainer.addClass("__a1-active"), videoPlayer = this; 9683 var videoClicks = VAST_PARSER.VideoClicks, playerClick = VAST_PARSER.ControlPlayer.find("PlayerClick").text(); 9684 if (2 == playerClick && videoClicks) { 9685 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9686 poster.attr({ 9687 href: clickThrough, 9688 target: "_blank" 9689 }).on("click", function(e) { 9690 if (videoPlayer.paused()) return e.preventDefault(), videoPlayer.play(), !1; 9691 $.get(clickTracking), videoPlayer.pause(); 9692 }); 9693 } else poster.on("click", function(e) { 9694 e.preventDefault(), videoPlayer.paused() ? videoPlayer.play() : videoPlayer.pause(); 9695 }); 9696 function onLoadedMetadata() { 9697 console.log("loadedmetadata"); 9698 var timeAsset = VAST_PARSER.getTime(); 9699 if (timeAsset.visible) { 9700 var duration = videoPlayer.duration(); 9701 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
9702 var timer = $('<div class="__a1-video-control-timer __a1-active"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset.position).appendTo(bannerContainer); 9703 function updateTimer(time) { 9704 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 9705 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 9706 var timeStr = time + "ì´"; 9707 $(".__a1-time", timer).html(timeStr); 9708 } 9709 updateTimer(duration), setInterval(function() { 9710 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 9711 }, 1e3 / 24); 9712 } 9713 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9714 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")); 9715 } 9716 $(".vjs-progress-control", bannerContainer).remove(), $(".vjs-big-play-button", bannerContainer).remove(), 9717 $(".vjs-fullscreen-control", bannerContainer).remove(), $(".vjs-volume-control", bannerContainer).remove(), 9718 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9719 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 9720 videoPlayer.responsiveControls({ 9721 controls: { 9722 remainingTimeDisplay: { 9723 mini: !1, 9724 small: !1 9725 }, 9726 "vjs-resolution-button": { 9727 mini: !1 9728 }, 9729 "vjs-language-container": { 9730 mini: !1 9731 } 9732 } 9733 }), videoPlayer.on("play", function(e) { 9734 console.log("video play", e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 9735 VAST_PARSER.fireImpression()), firstPlay = !0, videoPlayer.controlBar.show(), videoPlayer.controlBar.volumePanel.show(), 9736 videoPlayer.controlBar.volumePanel.volumeControl.show(), videoPlayer.controlBar.volumePanel.muteToggle.show(), 9737 poster.removeClass("__a1-active"), console.log("poster is deactivate"); 9738 }), videoPlayer.on("playing", function(e) { 9739 $(".__a1-video-control-timer").addClass("__a1-active"), !0; 9740 }), videoPlayer.on("pause", function(e) {}), videoPlayer.on("ended", function(e) { 9741 videoPlayCount++, 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 9742 videoPlayer.pause(), !1) : videoPlayer.play(); 9743 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9744 if (0 < videoPlayer.currentTime()) { 9745 var currentTime = Math.floor(videoPlayer.currentTime()); 9746 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9747 videoPlayer.prevCurrentTime = currentTime); 9748 } 9749 }), videoPlayer.on("useractive", function(e) { 9750 console.log(e); 9751 }), videoPlayer.on("userinactive", function(e) { 9752 console.log(e); 9753 }), videoPlayer.on("ended", function(e) { 9754 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9755 }), bannerContainer.addClass("__a1-loaded"), $(".__a1-poster", bannerContainer).insertAfter($("video", bannerContainer)); 9756 }); 9757 }(); 9758 }(VAST_PARSER) : cb(res, error); 9759 }); 9760 }); 9761}(), function() { 9762 function createAd(VAST_PARSER) { 9763 var videoPlayer, parentEl = $("#__A1BigInBanner"), bigBannerImg = VAST_PARSER.Companion.find("StaticResource").text(), bigBannerWidth = VAST_PARSER.Companion.attr("width"), bigBannerHeight = VAST_PARSER.Companion.attr("height"), bigBannerLink = VAST_PARSER.Companion.find("CompanionCl
9763ickThrough").text(); 9764 $('<a href="' + bigBannerLink + '" target="_blank" class="__a1-big-banner-img"><img src="' + bigBannerImg + '" width="' + bigBannerWidth + '" height="' + bigBannerHeight + '"></a>').appendTo(parentEl); 9765 parentEl.width(bigBannerWidth), parentEl.height(bigBannerHeight); 9766 var videoEnlargeContainer = $('<div class="__a1-big-in-video-enlarge-container"></div>').appendTo(parentEl), btnClose = $('<a href="#" class="__a1-btn-close">×</a>').appendTo(videoEnlargeContainer), bannerContainer = $('<div class="__a1-big-in-banner-container"></div>').appendTo(videoEnlargeContainer), videoContainer = $('<div class="__a1-big-in-banner-video-container __a1-rectangle-player"></div>').appendTo(bannerContainer), posterUrl = VAST_PARSER.ControlPlayer.find("ThumbnailImageURL").text(), thumbnailImageSize = VAST_PARSER.ControlPlayer.find("ThumbnailImageSize").text(), videoPlayerLeftPosition = VAST_PARSER.ControlPlayer.find("VideoPlayerLeftPosition").text(), videoPlayerTopPosition = VAST_PARSER.ControlPlayer.find("VideoPlayerTopPosition").text(); 9767 thumbnailImageSizes = thumbnailImageSize.split(","); 9768 var thumbnailImageSizeWidth = parseInt(thumbnailImageSizes[0]), thumbnailImageSizeHeight = parseInt(thumbnailImageSizes[1]); 9769 bannerContainer.css({ 9770 left: videoPlayerLeftPosition + "%", 9771 top: videoPlayerTopPosition + "%", 9772 width: thumbnailImageSizeWidth + "px", 9773 height: thumbnailImageSizeHeight + "px" 9774 }); 9775 var poster = $('<a href="#" class="__a1-poster"><img src="' + posterUrl + '" width="' + thumbnailImageSizeWidth + '" height="' + thumbnailImageSizeHeight + '"></a>').prependTo(bannerContainer); 9776 poster.css({ 9777 "background-image": "url(" + posterUrl + ")" 9778 }); 9779 var soundAutoOn = VAST_PARSER.ControlPlayer.find("SoundAutoOn").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, videoClicks = VAST_PARSER.getVideoClicks(), termsLink = VAST_PARSER.getTerms(), actionButton = VAST_PARSER.getActionButton(); 9780 termsLink.visible && $('<a class="__a1-banner-terms-link">A1</a>').attr("href", termsLink.link).attr("target", "_blank").appendTo(bannerContainer), 9781 actionButton.visible && $('<a class="__a1-banner-action-button"></a>').attr("href", videoClicks.link).attr("target", "_blank").css({ 9782 "font-size": actionButton.size + "px" 9783 }).html(actionButton.text).appendTo(bannerContainer); 9784 var iconPosition = VAST_PARSER.ControlPlayer.find("IconPosition").text(); 9785 console.log("iconPosition", iconPosition), bannerContainer.addClass("__a1-pos-" + iconPosition), 9786 btnClose.on("click", function(e) { 9787 e.preventDefault(), videoEnlargeContainer.removeClass("__a1-active"), videoPlayer.pause(); 9788 }); 9789 var playerTouch = VAST_PARSER.ControlPlayer.find("PlayerTouch").text(), videoCreated = !1; 9790 poster.on("click", function(e) { 9791 e.preventDefault(), videoCreated ? 0 == $(".video-js").hasClass("vjs-playing") ? videoPlayer.play() : videoPlayer.pause() : (videoCreated = !0, 9792 function() { 9793 var videoEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls autoplay preload="auto" width="' + thumbnailImageSizeWidth + '" height="' + thumbnailImageSizeHeight + '"></video>').appendTo(videoContainer); 9794 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoEl.attr("muted", !0), 9795 0 == repeatLimit && videoEl.attr("loop", !0); 9796 var videoPlayerEl = $("#videoPlayer"), videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), soundValue = (VAST_PARSER.getProgressbarMove(), 9797 VAST_PARSER.getSoundValue()); 9798 videojs(videoPlayerEl[0], { 9799 controls: !0, 9800 autoplay: !0, 9801 preload: "auto", 9802 class: "video-js vjs-default-skin", 9803 sources: { 9804 type: videoType, 9805 src: videoUrl 9806 } 9807 }).ready(function() { 9808 function onLoadedMetadata() { 9809 var timeAsset = VAST_PARSER.getTime(); 9810 if (timeAsset.visible) { 9811 var duration = videoPlayer.duration(); 9812 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
9813 var timer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset.position).appendTo(bannerContainer); 9814 function updateTimer(time) { 9815 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 9816 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 9817 var timeStr = time + "ì´"; 9818 $(".__a1-time", timer).html(timeStr); 9819 } 9820 updateTimer(duration), setInterval(function() { 9821 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 9822 }, 1e3 / 24); 9823 } 9824 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9825 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")); 9826 } 9827 videoPlayer = this, $(".vjs-progress-control", bannerContainer).remove(), $(".vjs-big-play-button", bannerContainer).remove(), 9828 $(".vjs-fullscreen-control", bannerContainer).remove(), $(".vjs-volume-control", bannerContainer).remove(), 9829 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9830 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 9831 videoPlayer.responsiveControls({ 9832 controls: { 9833 remainingTimeDisplay: { 9834 mini: !1, 9835 small: !1 9836 }, 9837 "vjs-resolution-button": { 9838 mini: !1 9839 }, 9840 "vjs-language-container": { 9841 mini: !1 9842 } 9843 } 9844 }); 9845 var firstPlay = !1; 9846 videoPlayer.on("play", function(e) { 9847 console.log(e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 9848 VAST_PARSER.fireImpression()), firstPlay = !0, videoPlayer.controlBar.show(), videoPlayer.controlBar.volumePanel.show(), 9849 videoPlayer.controlBar.volumePanel.volumeControl.show(), videoPlayer.controlBar.volumePanel.muteToggle.show(); 9850 }), videoPlayer.on("playing", function(e) { 9851 $(".__a1-video-control-timer").addClass("__a1-active"); 9852 }), videoPlayer.on("pause", function(e) {}), videoPlayer.on("ended", function(e) { 9853 videoPlayCount++, 0 < repeatLimit && repeatLimit <= videoPlayCount ? ($(".__a1-rectangle-banner-video-container.__a1-active").removeClass("__a1-active"), 9854 videoPlayer.pause()) : videoPlayer.play(); 9855 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9856 if (0 < videoPlayer.currentTime()) { 9857 var currentTime = Math.floor(videoPlayer.currentTime()); 9858 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9859 videoPlayer.prevCurrentTime = currentTime); 9860 } 9861 }), videoPlayer.on("useractive", function(e) { 9862 console.log(e); 9863 }), videoPlayer.on("userinactive", function(e) { 9864 console.log(e); 9865 }), videoPlayer.on("ended", function(e) { 9866 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9867 }), $(window).trigger("scroll"), bannerContainer.addClass("__a1-loaded"), $(".__a1-poster", bannerContainer).insertAfter($("video", bannerContainer)); 9868 }); 9869 }()), 2 == playerTouch && (videoEnlargeContainer.addClass("__a1-active"), videoPlayer.play()); 9870 }); 9871 } 9872 window.a1CreateBigInBannerAd = function(url, cb) { 9873 var VAST_PARSER = new A1_VAST("a1 Big In Banner Ad").parser; 9874 VAST_PARSER.load(url, function(res, error) { 9875 res ? createAd(VAST_PARSER) : cb(res, error); 9876 }); 9877 }, window.a1CreateBigInBannerAdWithVast = function(VAST_PARSER) { 9878 createAd(VAST_PARSER); 9879 }; 9880}(), function() { 9881 window.a1CreateBounceAd = function(url, cb) { 9882 var VAST_PARSER = new A1_VAST("a1 Bounce Ad").parser; 9883 VAST_PARSER.load(url, function(res, error) { 9884 res && createAd(VAST_PARSER), cb(res, error); 9885 }); 9886 }; 9887 var firstPlay = !(window.a1CreateBounceAdWithVast = function(VAST_PARSER) { 9888 createAd(VAST_PARSER); 9889 }); 9890 function createAd(VAST_PARSER) { 9891 var videoPlayer, parentEl = $("#__A1BounceBanner"), soundAutoOn = VAST_PARSER.getSoundAutoOn(), videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), soundValue = (VAST_PARSER.getProgressbarMove(),
9892 VAST_PARSER.getSoundValue()), bannerContainer = $('<div class="__a1-bounce-container __a1-rectangle-player"></div>').appendTo(parentEl), videoContainer = $('<div class="__a1-bounce-video-container"></div>').appendTo(bannerContainer), videoPlayerEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="100%" height="100%"></video>').appendTo(videoContainer); 9893 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoPlayerEl.attr("muted", !0); 9894 var termsLink = VAST_PARSER.getTerms(), actionButton = VAST_PARSER.getActionButton(), videoClicks = VAST_PARSER.getVideoClicks(); 9895 termsLink.visible && $('<a class="__a1-banner-terms-link"></a>').attr("href", termsLink.link).attr("target", "_blank").appendTo(videoContainer), 9896 actionButton.visible && $('<a class="__a1-banner-action-button"></a>').attr("href", videoClicks.link).attr("target", "_blank").addClass("__a1-pos-" + actionButton.position).css({ 9897 "font-size": actionButton.size + "px" 9898 }).html(actionButton.text).appendTo(videoContainer); 9899 var iconPosition = VAST_PARSER.ControlPlayer.find("IconPosition").text(); 9900 bannerContainer.addClass("__a1-pos-" + iconPosition); 9901 var posterUrl = VAST_PARSER.getPosterUrl(), poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(bannerContainer); 9902 poster.css({ 9903 "background-image": "url(" + posterUrl + ")" 9904 }), videojs(videoPlayerEl[0], { 9905 controls: !0, 9906 autoplay: !1, 9907 preload: "auto", 9908 fluid: !0, 9909 class: "video-js vjs-default-skin", 9910 sources: { 9911 type: videoType, 9912 src: videoUrl 9913 } 9914 }).ready(function() { 9915 videoPlayer = this; 9916 var videoClicks = VAST_PARSER.VideoClicks; 9917 if (2 == VAST_PARSER.ControlPlayer.find("PlayerClick").text() && videoClicks) { 9918 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 9919 poster.attr({ 9920 href: clickThrough, 9921 target: "_blank" 9922 }).on("click", function(e) { 9923 if (videoPlayer.paused()) return e.preventDefault(), videoPlayer.play(), !1; 9924 $.get(clickTracking), videoPlayer.pause(); 9925 }); 9926 } else poster.on("click", function(e) { 9927 e.preventDefault(), videoPlayer.paused() ? videoPlayer.play() : videoPlayer.pause(); 9928 }); 9929 function onLoadedMetadata() { 9930 var timeAsset = VAST_PARSER.getTime(); 9931 if (timeAsset.visible) { 9932 var duration = videoPlayer.duration(), timer = $('<div class="__a1-video-control-timer __a1-active"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset.position).appendTo(videoContainer); 9933 function updateTimer(time) { 9934 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 9935 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 9936 var timeStr = time + "ì´"; 9937 $(".__a1-time", timer).html(timeStr); 9938 } 9939 updateTimer(duration), videoPlayer.on("timeupdate", function(e) { 9940 updateTimer(duration - videoPlayer.currentTime()), timer.show(); 9941 }); 9942 } 9943 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9944 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")); 9945 } 9946 $(".vjs-progress-control", bannerContainer).remove(), $(".vjs-big-play-button", bannerContainer).remove(), 9947 $(".vjs-fullscreen-control", bannerContainer).remove(), $(".vjs-volume-control", bannerContainer).remove(), 9948 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 9949 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 9950 videoPlayer.responsiveControls({ 9951 controls: { 9952 remainingTimeDisplay: { 9953 mini: !1, 9954 small: !1 9955 }, 9956 "vjs-resolution-button": { 9957 mini: !1 9958 }, 9959 "vjs-language-container": { 9960 mini: !1 9961 } 9962 } 9963 }), videoPlayer.on("play", function(e) { 9964 console.log(e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 9965 VAST_PARSER.fireImpression()), firstPlay = !0, videoPlayer.controlBar.show(), videoPlayer.controlBar.volumePanel.show(), 9966 videoPlayer.controlBar.volumePanel.volumeControl.show(), videoPlayer.controlBar.volumePanel.muteToggle.show(), 9967 poster.removeClass("__a1-active"); 9968 }), videoPlayer.on("playing", function(e) {}), videoPlayer.on("pause", function(e) {}), 9969 videoPlayer.on("ended", function(e) { 9970 $(".__a1-bounce-video-container.active").removeClass("active"), clearTimeout(disappearTimeTick), 9971 disappearTimeTick = null; 9972 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 9973 var currentTime = Math.floor(videoPlayer.currentTime()); 9974 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 9975 videoPlayer.prevCurrentTime = currentTime); 9976 }), videoPlayer.on("useractive", function(e) { 9977 console.log(e); 9978 }), videoPlayer.on("userinactive", function(e) { 9979 console.log(e); 9980 }), videoPlayer.on("ended", function(e) { 9981 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 9982 }), $(".__a1-poster", bannerContainer).insertAfter($("video", bannerContainer)); 9983 var checkAutoPlay = VAST_PARSER.ControlPlayer.find("AutoPlay").text(), disappearTime = VAST_PARSER.ControlPlayer.find("DisappearTime").text(); 9984 console.log("disappearTime", disappearTime), disappearTime = disappearTime && 0 < disappearTime ? 1e3 * parseInt(disappearTime) : 0; 9985 var disappearTimeTick = null, isChecked = !1; 9986 $(window).on("scroll", function() { 9987 var scrollTop = $(window).scrollTop(), windowHeight = $(window).innerHeight(); 9988 if (parentEl.offset().top - windowHeight + parentEl.height() - 50 <= scrollTop) { 9989 if (isChecked) return; 9990 isChecked = !0, "Y" == checkAutoPlay && videoPlayer.play(), bannerContainer.addClass("__a1-active"), 9991 clearTimeout(disappearTimeTick), disappearTimeTick = null; 9992 } else { 9993 if (disappearTimeTick) return; 9994 disappearTimeTick = setTimeout(function() { 9995 isChecked = !1, videoPlayer.pause(), bannerContainer.removeClass("__a1-active"); 9996 }, disappearTime); 9997 } 9998 }); 9999 }); 10000 } 10001}(), function() { 10002 function createAd(VAST_PARSER) { 10003 var videoPlayer, parentEl = $("#__A1InfeedBanner"), parentElWrapper = $('<
10003div class="__a1-infeed-banner-root"></div>').insertBefore(parentEl); 10004 parentEl.appendTo(parentElWrapper); 10005 var bannerContainer = $('<div class="__a1-infeed-banner-container"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>
10005').appendTo(parentEl), videoContainer = $('<div class="__a1-infeed-banner-video-container __a1-rectangle-player"></div>').appendTo(bannerContainer), posterUrl = VAST_PARSER.getPosterUrl(), poster = $('<a href="#" class="__a1-poster __a1-active"><img src="' + posterUrl + '"></a>').prependTo(bannerContainer); 10006 poster.css({ 10007 "background-image": "url(" + posterUrl + ")" 10008 }); 10009 var updateTimerTick, soundAutoOn = VAST_PARSER.ControlPlayer.find("SoundAutoOn").text(), repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0, termsLink = VAST_PARSER.getTerms(); 10010 termsLink.visible && $('<a class="__a1-banner-terms-link">A1</a>').attr("href", termsLink.link).attr("target", "_blank").appendTo(bannerContainer); 10011 var iconPosition = VAST_PARSER.ControlPlayer.find("IconPosition").text(); 10012 bannerContainer.addClass("__a1-pos-" + iconPosition); 10013 var companionURL = VAST_PARSER.ControlPlayer.find("CompanionURL").text(), companionContainer = $('<div class="__a1-companion-container"></div>').insertAfter(parentEl); 10014 console.log("companionURL", companionURL), companionContainer.load(companionURL, function(res) { 10015 console.log(res); 10016 }); 10017 var closeButtonVisible = VAST_PARSER.ControlPlayer.find("CloseButtonVisible").text(); 10018 VAST_PARSER.ControlPlayer.find("CloseButtonPosition").text(); 10019 "Y" == closeButtonVisible && $('<a class="__a1-btn-close __a1-pos-' + iconPosition + '">×</a>').appendTo(parentElWrapper).on("click", function(e) { 10020 e.preventDefault(), videoPlayer && (videoPlayer.dispose(), videoPlayer = null), 10021 updateTimerTick && (clearInterval(updateTimerTick), updateTimerTick = null), parentElWrapper.slideUp(300, function() { 10022 parentElWrapper.remove(); 10023 }); 10024 }); 10025 var checkScroll = !0, isVideoPlaying = !1, videoCreated = !1, firstPlay = !1; 10026 var checkAutoPlay = VAST_PARSER.ControlPlayer.find("AutoPlay").text(), getViewPlay = VAST_PARSER.getViewPlay(); 10027 getViewPlay = parseInt(getViewPlay), window.a1RectanglePlayerScrolled = function(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight) { 10028 if (scrollTop = parseInt(scrollTop), 0 != checkScroll) if (scrollTop = parseFloat(scrollTop), 10029 windowHeight = parseFloat(windowHeight), videoContainerOffsetTop = parseFloat(videoContainerOffsetTop), 10030 videoContainerHeight = parseFloat(videoContainerHeight), 0 == isVideoPlaying) { 10031 if (videoContainerOffsetTop - windowHeight + videoContainerHeight * getViewPlay / 100 <= scrollTop && scrollTop <= videoContainerOffsetTop + videoContainerHeight * getViewPlay / 100) if (videoPlayer) { 10032 if (0 == firstPlay && "N" == checkAutoPlay) return; 10033 videoPlayer.play(); 10034 } else !function() { 10035 if (!videoCreated) { 10036 videoCreated = !0; 10037 var videoEl = $('<video id="videoPlayer" playsInline class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="100%" height="100%"></video>').appendTo(videoContainer); 10038 ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari) && videoEl.attr("muted", !0), 10039 0 == repeatLimit && videoEl.attr("loop", !0); 10040 var videoPlayerEl = $("#videoPlayer"), videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), soundValue = (VAST_PARSER.getProgressbarMove(), 10041 VAST_PARSER.getSoundValue()); 10042 videojs(videoPlayerEl[0], { 10043 controls: !0, 10044 autoplay: !1, 10045 preload: "auto", 10046 fluid: !0, 10047 class: "video-js vjs-default-skin", 10048 sources: { 10049 type: videoType, 10050 src: videoUrl 10051 } 10052 }).ready(function() { 10053 videoPlayer = this; 10054 var videoClicks = VAST_PARSER.VideoClicks; 10055 if (2 == VAST_PARSER.ControlPlayer.find("PlayerClick").text() && videoClicks) { 10056 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 10057 poster.attr({ 10058 href: clickThrough, 10059 target: "_blank" 10060 }).on("click", function(e) { 10061 if (videoPlayer.paused()) return e.preventDefault(), videoPlayer.play(), !1; 10062 $.get(clickTracking), videoPlayer.pause(), checkScroll = !1; 10063 }); 10064 } else poster.on("click", function(e) { 10065 e.preventDefault(), 0 == $(".video-js").hasClass("vjs-playing") ? videoPlayer.play() : (videoPlayer.pause(), 10066 checkScroll = !1); 10067 }); 10068 function onLoadedMetadata() { 10069 var timeAsset = VAST_PARSER.getTime(); 10070 if (timeAsset.visible) { 10071 var duration = videoPlayer.duration(); 10072 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
10073 var timer = $('<div class="__a1-video-control-timer __a1-active"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset.position).appendTo(bannerContainer); 10074 function updateTimer(time) { 10075 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 10076 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 10077 var timeStr = time + "ì´"; 10078 $(".__a1-time", timer).html(timeStr); 10079 } 10080 updateTimer(duration), updateTimerTick = setInterval(function() { 10081 videoPlayer && updateTimer(duration - Math.floor(videoPlayer.currentTime())); 10082 }, 1e3 / 24); 10083 } 10084 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 10085 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")); 10086 } 10087 $(".vjs-progress-control", bannerContainer).remove(), $(".vjs-big-play-button", bannerContainer).remove(), 10088 $(".vjs-fullscreen-control", bannerContainer).remove(), $(".vjs-volume-control", bannerContainer).remove(), 10089 window.a1platform.mobile && ($(".vjs-volume-panel", bannerContainer).removeClass("vjs-hidden"), 10090 $(".vjs-mute-control", bannerContainer).removeClass("vjs-hidden")), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 10091 videoPlayer.responsiveControls({ 10092 controls: { 10093 remainingTimeDisplay: { 10094 mini: !1, 10095 small: !1 10096 }, 10097 "vjs-resolution-button": { 10098 mini: !1 10099 }, 10100 "vjs-language-container": { 10101 mini: !1 10102 } 10103 } 10104 }), videoPlayer.on("play", function(e) { 10105 console.log(e), firstPlay || ("N" == soundAutoOn || window.a1platform.mobile || window.a1platform.isSafari ? videoPlayer.volume(0) : videoPlayer.volume(soundValue / 100), 10106 VAST_PARSER.fireImpression()), firstPlay = !0, videoPlayer.controlBar.show(), videoPlayer.controlBar.volumePanel.show(), 10107 videoPlayer.controlBar.volumePanel.volumeControl.show(), videoPlayer.controlBar.volumePanel.muteToggle.show(), 10108 poster.removeClass("__a1-active"); 10109 }), videoPlayer.on("playing", function(e) { 10110 $(".__a1-video-control-timer").addClass("__a1-active"), isVideoPlaying = checkScroll = !0; 10111 }), videoPlayer.on("pause", function(e) {}), videoPlayer.on("ended", function(e) { 10112 videoPlayCount++, 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 10113 videoPlayer.pause(), checkScroll = !1) : videoPlayer.play(); 10114 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 10115 if (0 < videoPlayer.currentTime()) { 10116 var currentTime = Math.floor(videoPlayer.currentTime()); 10117 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 10118 videoPlayer.prevCurrentTime = currentTime); 10119 } 10120 }), videoPlayer.on("useractive", function(e) { 10121 console.log(e); 10122 }), videoPlayer.on("userinactive", function(e) { 10123 console.log(e); 10124 }), videoPlayer.on("ended", function(e) { 10125 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 10126 }), window.a1platform.iframeMode && window.a1CheckScrollByLocalStorage(), $(window).trigger("scroll"), 10127 bannerContainer.addClass("__a1-loaded"), $(".__a1-poster", bannerContainer).insertAfter($("video", bannerContainer)); 10128 }); 10129 } 10130 }(); 10131 } else (scrollTop < videoContainerOffsetTop - windowHeight + videoContainerHeight * getViewPlay / 100 || videoContainerOffsetTop + videoContainerHeight * getViewPlay / 100 < scrollTop) && videoPlayer && (isVideoPlaying = !1, 10132 videoPlayer.pause(), console.log("videoPaused")); 10133 }, window.a1platform.iframeMode ? (window.addEventListener("storage", function(e) { 10134 window.a1CheckScrollByLocalStorage(); 10135 }), window.a1CheckScrollByLocalStorage = function() { 10136 var scrollTop = localStorage.getItem("__a1_scroll_top"), windowHeight = localStorage.getItem("__a1_window_height"), videoContainerOffsetTop = localStorage.getItem("__a1_video_container_offset_top"), videoContainerHeight = localStorage.getItem("__a1_video_container_height"); 10137 window.a1RectanglePlayerScrolled(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight), 10138 console.log("a1RectanglePlayerScrolled", scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight); 10139 }, window.a1CheckScrollByLocalStorage()) : $(window).on("scroll", function() { 10140 var scrollTop = $(window).scrollTop(), windowHeight = $(window).innerHeight(), videoContainerOffsetTop = videoContainer.offset().top, videoContainerHeight = videoContainer.height(); 10141 window.a1RectanglePlayerScrolled(scrollTop, windowHeight, videoContainerOffsetTop, videoContainerHeight); 10142 }).trigger("scroll"); 10143 } 10144 window.a1CreateInfeedAd = function(url, cb) { 10145 var VAST_PARSER = new A1_VAST("a1 Infeed Ad").parser; 10146 VAST_PARSER.load(url, function(res, error) { 10147 res ? createAd(VAST_PARSER) : cb(res, error); 10148 }); 10149 }, window.a1CreateInfeedAdWithVast = function(VAST_PARSER) { 10150 createAd(VAST_PARSER); 10151 }; 10152}(), function() { 10153 function createAd(VAST_PARSER) { 10154 var videoPlayer, videoEl, parentEl = $("#__A1ClickMobileBanner"), videoBanner = (VAST_PARSER.ControlPlayer, 10155 $('<div class="__a1-video-cm-banner-container"></div>
10155').appendTo(parentEl)), videoContainer = $('<div class="__a1-video-cm-banner-video-container"></div>').appendTo(videoBanner), videoWrapper = $('<div class="__a1-video-cm-banner-video-wrapper"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAYAAAA7KqwyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RkMxRUJERTkzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RkMxRUJERUEzOUU0MTFFOEFCMUJDRUI1QzlDNTZGQzUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpGQzFFQkRFNzM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpGQzFFQkRFODM5RTQxMUU4QUIxQkNFQjVDOUM1NkZDNSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnarSGUAAAAzSURBVHjaYmRgYHgKxLwM5IHPjEDiPwMFgAlkCgX6PzMxUAiGgQEUxwILED+jJB0ABBgAAlsHwfzTrMsAAAAASUVORK5CYII=\n" class="__a1-16-9-image"></div>').appendTo(videoContainer); 10156 !function() { 10157 videoEl = $('<video id="videoPlayer" playsInline muted class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="970" height="546"></video>').appendTo(videoWrapper); 10158 var videoUrl = VAST_PARSER.getVideoUrl(), videoType = VAST_PARSER.getVideoType(), posterUrl = VAST_PARSER.getPosterUrl(), videoClicks = VAST_PARSER.VideoClicks; 10159 if (videoClicks) { 10160 var bannerPoster = $('<a href="#" class="__a1-video-cm-banner-poster __a1-active"><img src="' + posterUrl + '"></a>').appendTo(videoWrapper); 10161 bannerPoster.css({ 10162 "background-image": "url(" + posterUrl + ")" 10163 }); 10164 var clickThrough = videoClicks.find("ClickThrough").text(), clickTracking = videoClicks.find("ClickTracking").text(); 10165 bannerPoster.attr({ 10166 href: clickThrough, 10167 target: "_blank" 10168 }).on("click", function(e) { 10169 if (console.log("videoPlayer.paused : ", videoPlayer.paused), videoPlayer) { 10170 if (videoPlayer.paused()) return videoPlayer.play(), e.preventDefault(), !1; 10171 $.get(clickTracking), (videoPlayer.muted() || 0 == videoPlayer.volume()) && videoPlayer.pause(); 10172 } 10173 }); 10174 } 10175 videojs(videoEl[0], { 10176 controls: !0, 10177 autoplay: !1, 10178 preload: "auto", 10179 class: "video-js vjs-default-skin", 10180 sources: { 10181 type: videoType, 10182 src: videoUrl 10183 } 10184 }).ready(function() { 10185 videoPlayer = this, "Y" == VAST_PARSER.ControlPlayer.find("AutoPlay").text() && videoPlayer.play(), 10186 videoPlayer.responsiveControls({ 10187 controls: { 10188 remainingTimeDisplay: { 10189 mini: !1, 10190 small: !1 10191 }, 10192 "vjs-resolution-button": { 10193 mini: !1 10194 }, 10195 "vjs-language-container": { 10196 mini: !1 10197 } 10198 } 10199 }), $(".vjs-progress-control", videoContainer).remove(), $(".vjs-big-play-button", videoContainer).remove(); 10200 var repeatLimit = VAST_PARSER.ControlPlayer.find("RepeatLimit").text(), videoPlayCount = 0; 10201 console.log(videoPlayer.controlBar.fullscreenToggle); 10202 var firstPlay = !1; 10203 function onLoadedMetadata() { 10204 var timeAsset_visible = !0, timeAsset_position = 1; 10205 if (console.log("timeAsset.visible", timeAsset_visible), timeAsset_visible) { 10206 var duration = videoPlayer.duration(); 10207 duration = Math.ceil(VAST_PARSER.Duration / 1e3);
10208 var videoControlTimer = $('<div class="__a1-video-control-timer"><span class="__a1-time"></span></div>').addClass("__a1-pos-" + timeAsset_position).insertBefore(".vjs-volume-panel"); 10209 function updateTimer(time) { 10210 time = Math.max(0, time), time = Math.min(duration, time), time = Math.floor(time), 10211 (isNaN(time) || 0 == isFinite(time)) && (time = 0); 10212 var timeStr = (time = (time = "00" + time).substr(time.length - 2, 2)) + ":" + (duration = (duration = "00" + duration).substr(duration.length - 2, 2)); 10213 $(".__a1-time", videoControlTimer).html(timeStr); 10214 } 10215 updateTimer(duration), setInterval(function() { 10216 updateTimer(duration - Math.floor(videoPlayer.currentTime())); 10217 }, 1e3 / 24); 10218 } 10219 } 10220 videoPlayer.on("play", function(e) { 10221 firstPlay || (videoPlayer.volume(0), VAST_PARSER.fireImpression(), videoPlayer.controlBar.show()), 10222 firstPlay = !0; 10223 }), videoPlayer.on("playing", function(e) { 10224 $(".__a1-video-control-timer").addClass("__a1-active"), bannerPoster.removeClass("__a1-active"), 10225 window.a1platform.mobile && ($(".vjs-volume-panel", videoContainer).removeClass("vjs-hidden").addClass("__a1-mobile-active"), 10226 $(".vjs-mute-control", videoContainer).removeClass("vjs-hidden"), $(".vjs-volume-control", videoContainer).removeClass("vjs-hidden")); 10227 }), videoPlayer.on("pause", function(e) { 10228 bannerPoster.addClass("__a1-active"); 10229 }), videoPlayer.on("ended", function(e) { 10230 videoPlayCount++, console.log("repeatLimit", repeatLimit, videoPlayCount), 0 < repeatLimit && repeatLimit <= videoPlayCount ? (videoContainer.removeClass("__a1-active"), 10231 videoPlayer.pause()) : videoPlayer.play(); 10232 }), videoPlayer.prevCurrentTime = -1, videoPlayer.on("timeupdate", function(e) { 10233 if (0 < videoPlayer.currentTime()) { 10234 var currentTime = Math.floor(videoPlayer.currentTime()); 10235 currentTime != videoPlayer.prevCurrentTime && (VAST_PARSER.fireTrackingEvent(videoPlayer.currentTime()), 10236 videoPlayer.prevCurrentTime = currentTime); 10237 } 10238 }), videoPlayer.on("useractive", function(e) { 10239 console.log(e); 10240 }), videoPlayer.on("userinactive", function(e) { 10241 console.log(e); 10242 }), videoPlayer.on("ended", function(e) { 10243 console.log(e), VAST_PARSER.fireTrackingEventComplete(); 10244 }), videoPlayer.readyState() < 1 ? videoPlayer.one("loadedmetadata", onLoadedMetadata) : onLoadedMetadata(), 10245 $(".__a1-video-cm-banner-poster", videoContainer).insertAfter($("video", videoContainer)); 10246 }); 10247 }(); 10248 } 10249 window.a1CreateClickMobileBannerAd = function(url, cb) { 10250 var VAST_PARSER = new A1_VAST("a1 Mobile Click Video Banner Ad").parser; 10251 VAST_PARSER.load(url, function(res, error) { 10252 res && createAd(VAST_PARSER), cb(res, error); 10253 }); 10254 }, window.a1CreateClickMobileBannerAdWithVast = function(VAST_PARSER) { 10255 createAd(VAST_PARSER); 10256 }; 10257}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.