12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863 |
-
- Namespace.register("U.MD.UI.slider");
- U.MD.UI.slider = function (box, imgarr, attr) {
-
- var _speed = attr.speed;
- var _arrow = attr.arrow;
- var _dot = attr.dot;
- var _moveFun = attr.moveFun;
-
- var _sliderimgul = $$("ul", { className: 'U_MD_UI_slider_ImgList' }, box);
-
- imgarr.unshift(imgarr[imgarr.length - 1]);
-
- imgarr.push(imgarr[1]);
-
- for (i = 0; i < imgarr.length; i++) {
- var _sliderimgli = $$("li", { className: '' }, _sliderimgul),
- _sliderImg = $$("img", { className: '', src: imgarr[i] }, _sliderimgli);
- }
-
- var _sliderbtnul = $$("ul", { className: 'U_MD_UI_slider_Btn' }, box),
- _sliderbtnlil = $$("li", { className: 'U_MD_UI_slider_Left', innerHTML: '<' }, _sliderbtnul),
- _sliderbtnlir = $$("li", { className: 'U_MD_UI_slider_Right', innerHTML: '>' }, _sliderbtnul);
-
- var _sliderpointul = $$("ul", { className: 'U_MD_UI_slider_Point' }, box);
-
- for (i = 0; i < imgarr.length - 3; i++) {
-
- if (i == 0) {
- $$("li", { className: 'U_MD_UI_slider_On' }, _sliderpointul)[0];
- }
- $$("li", { className: '' }, _sliderpointul)[i];
- }
-
- var _boxidwidth = box.offsetWidth;
-
- var _boxidheight = box.offsetHeight;
-
- var _sliderimglist = box.getElementsByClassName("U_MD_UI_slider_ImgList")[0];
- var _sliderimgli = _sliderimglist.getElementsByTagName("li");
-
- var _sliderbtn = document.getElementsByClassName("U_MD_UI_slider_Btn")[0];
-
- var _sliderpoint = box.getElementsByClassName('U_MD_UI_slider_Point')[0];
-
- var _btnli = _sliderbtn.getElementsByTagName("li");
-
- var _listlen = _sliderimglist.getElementsByTagName("li").length;
-
- var _listindex = 1;
-
- var _pointdot = _sliderpoint.getElementsByTagName("li");
-
- var _dotlen = _pointdot.length;
-
- var _dotindex = 0;
-
- var timer = null;
-
- if (_dot) {
- _sliderpoint.style.display = "block";
- } else {
- _sliderpoint.style.display = "none";
- }
-
-
- var _sliderli = _sliderimglist.getElementsByTagName("li");
-
- for (var i = 0; i < _sliderli.length; i++) {
- _sliderli[i].style.width = _boxidwidth + "px";
- _sliderli[i].style.height = _boxidheight + "px";
- }
-
- _sliderimglist.style.width = (_boxidwidth * imgarr.length) + "px";
-
- _sliderimglist.style.left = -_boxidwidth + "px";
-
- _sliderbtn.style.width = _boxidwidth + "px";
-
-
- box.onmouseover = function () {
-
- if (_arrow) {
- _sliderbtn.style.display = "block";
- } else {
- _sliderbtn.style.display = "none";
- }
-
- clearInterval(timer);
- }
-
- box.onmouseout = function () {
- _sliderbtn.style.display = "none";
-
- timer = setInterval(auto, _speed);
- }
-
- var sTime = new Date();
-
- _btnli[0].onclick = function () {
-
- var nTime = new Date();
-
- if (nTime - sTime > 500) {
-
- _listindex--;
- _dotindex--;
- if (_listindex == 0) {
-
- move(_sliderimglist, { left: -_boxidwidth * _listindex }, function () {
- _listindex = _listlen - 2;
- this.style.left = -_listindex * _boxidwidth + "px";
- });
- } else {
- move(_sliderimglist, { left: -_boxidwidth * _listindex });
- }
-
- _dotindex = _dotindex == -1 ? _dotlen - 1 : _dotindex;
- moveBtn(_dotindex);
- _moveFun && _moveFun(_dotindex + 1);
- }
- sTime = new Date();
- }
-
- _btnli[1].onclick = function () {
-
- var nTime = new Date();
-
- if (nTime - sTime > 500) {
-
- _listindex++;
- _dotindex++;
-
- _dotindex = _dotindex % _dotlen;
-
- if (_listindex == _listlen - 1) {
- move(_sliderimglist, { left: -_boxidwidth * _listindex }, function () {
- _listindex = 1;
- this.style.left = -_listindex * _boxidwidth + "px";
- });
- } else {
- move(_sliderimglist, { left: -_boxidwidth * _listindex });
- }
-
- moveBtn(_dotindex);
- _moveFun && _moveFun(_dotindex + 1);
- }
- sTime = new Date();
- }
-
- timer = setInterval(auto, _speed);
- if (_dotindex == 0) {
- console.log(_dotindex + 1);
- }
-
- function auto() {
-
-
- _listindex = ++_listindex % _listlen;
- _dotindex++;
-
- _dotindex = _dotindex % _dotlen;
-
- if (_listindex == _listlen - 1) {
- move(_sliderimglist, { left: -_boxidwidth * _listindex }, function () {
- _listindex = 1;
- this.style.left = -_listindex * _boxidwidth + "px";
- });
- } else {
- move(_sliderimglist, { left: -_boxidwidth * _listindex });
- }
- moveBtn(_dotindex);
- _moveFun && _moveFun(_dotindex + 1);
- }
-
- for (var i = 0; i < _dotlen; i++) {
- _pointdot[i]._listindex = i;
-
- _pointdot[i].onclick = function () {
- _dotindex = this._listindex;
- _listindex = _dotindex + 1;
- move(_sliderimglist, { left: -_boxidwidth * _listindex });
- moveBtn(_dotindex);
-
- }
- }
-
- function moveBtn(_dotindex) {
- for (var j = 0; j < _dotlen; j++) {
- _pointdot[j].className = "";
- }
- _pointdot[_dotindex].className = "U_MD_UI_slider_On";
- }
- }
- function move(dom, json, callback) {
-
- clearInterval(dom.timer);
- dom.timer = setInterval(function () {
-
- var mark = true;
- for (var attr in json) {
- var cur = null;
- if (attr == "opacity") {
- cur = getStyle(dom, attr) * 100;
- } else {
- cur = parseInt(getStyle(dom, attr)) || 0;
- }
- var target = json[attr];
-
-
- var speed = (target - cur) * .2;
- speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
- if (cur != target) {
- if (attr == "opacity") {
- dom.style.filter = "alpha(opacity = " + (cur + speed) + ")";
- dom.style[attr] = (cur + speed) / 100;
- } else {
- dom.style[attr] = cur + speed + "px";
- }
-
- mark = false;
- }
-
-
- }
- if (mark) {
- clearInterval(dom.timer);
- callback && callback.call(dom);
- }
- }, 100 / 3);
- }
- function getStyle(dom, attr) {
- return dom.currentStyle ? dom.currentStyle[attr] : getComputedStyle(dom, null)[attr];
- };
- Namespace.register("U.MD.UI.calendar");
- U.MD.UI.Calendar = U.MD.UI.calendar = function (el, parentnode, datetimeboolean) {
- if (!el)
- return
- if (typeof datetimeboolean == 'boolean' && datetimeboolean == false) {
- U.MD.UI.calendar.datetimeformat = datetimeboolean
- } else {
- U.MD.UI.calendar.datetimeformat = true;
- }
- U.MD.UI.calendar.create(el, parentnode);
- }
- U.MD.UI.calendar.NOW = new Date();
- U.MD.UI.calendar.CURRENTYEAR = U.MD.UI.calendar.NOW.getFullYear();
- U.MD.UI.calendar.CURRENTMONTH = U.MD.UI.calendar.NOW.getMonth();
- U.MD.UI.calendar.CURRENTDAY = U.MD.UI.calendar.NOW.getDate();
- U.MD.UI.calendar.year = U.MD.UI.calendar.CURRENTYEAR;
- U.MD.UI.calendar.month = U.MD.UI.calendar.CURRENTMONTH;
- U.MD.UI.calendar.day = U.MD.UI.calendar.CURRENTDAY;
- U.MD.UI.calendar.hour = '00';
- U.MD.UI.calendar.minute = '00';
- U.MD.UI.calendar.second = '00';
- U.MD.UI.calendar.datetimeformat = true;
- U.MD.UI.calendar.fouseinp = null;
- U.MD.UI.calendar.board = null;
- U.MD.UI.calendar.tit = null;
- U.MD.UI.calendar.mark = 1;
- U.MD.UI.calendar.template = [
-
- '<div class="U_MD_UI_calendar_features">' +
- '<div class="U_MD_UI_calendar_closeBtn" id="U_MD_UI_calendar_closeBtn">关闭</div>' +
- '<div class="U_MD_UI_calendar_features_a">' +
- '<div class="U_MD_UI_calendar_prev U_MD_UI_calendar_btn" id="prevDate"></div>' +
- '<div class="U_MD_UI_calendar_tit" id="calendar_tit"></div>' +
- '<input type="text" id="calendar_tit_btn" style="display: none;">' +
- '<div class="U_MD_UI_calendar_next U_MD_UI_calendar_btn" id="nextDate"></div>' +
- '</div>' +
- '<i></i>' +
- '</div>',
-
- '<div id="calendar_day">' +
- '<ul class="U_MD_UI_calendar_week">' +
- '<li>日</li>' +
- '<li>一</li>' +
- '<li>二</li>' +
- '<li>三</li>' +
- '<li>四</li>' +
- '<li>五</li>' +
- '<li>六</li>' +
- '</ul>' +
- '<ul class="U_MD_UI_calendar_c" id="calendar_week_c"></ul>' +
- '</div>',
-
- '<div class="U_MD_UI_calendar_month" id="calendar_month" style="display: none">' +
- '<ul class="U_MD_UI_calendar_month_c">' +
- '<li><span>1月</span></li>' +
- '<li><span>2月</span></li>' +
- '<li><span>3月</span></li>' +
- '<li><span>4月</span></li>' +
- '<li><span>5月</span></li>' +
- '<li><span>6月</span></li>' +
- '<li><span>7月</span></li>' +
- '<li><span>8月</span></li>' +
- '<li><span>9月</span></li>' +
- '<li><span>10月</span></li>' +
- '<li><span>11月</span></li>' +
- '<li><span>12月</span></li>' +
- '</ul>' +
- '</div>',
-
- '<div id="calendar_year" class="U_MD_UI_calendar_month" style="display: none">' +
- '<ul class="U_MD_UI_calendar_month_c">' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '<li></li>' +
- '</ul>' +
- '</div>',
-
- '<span id="U_MD_UI_calendar_timeText" class="U_MD_UI_calendar_timeText">选择时间</span>' +
- '<div class="U_MD_UI_calendar_timeBox">' +
- '<div id="U_MD_UI_calendar_clearText" class="U_MD_UI_calendar_timeBtn">清空</div>' +
- '<div id="U_MD_UI_calendar_nowTime" class="U_MD_UI_calendar_timeBtn">现在</div>' +
- '<div id="U_MD_UI_calendar_okBtn" class="U_MD_UI_calendar_timeBtn">确定</div>' +
- '</div>',
-
- '<div id="calendar_timeChoose" class="U_MD_UI_calendar_timeChoose" style="display: none">' +
- '</div>'
- ];
- U.MD.UI.calendar.create = function (els, parentnode) {
- if (els == U.MD.UI.calendar.fouseinp && U.MD.UI.calendar.board.style.display == 'block')
- return
- if (parentnode && U.MD.UI.calendar.board) {
- U.MD.UI.calendar.board.parentNode.removeChild(U.MD.UI.calendar.board);
- U.MD.UI.calendar.board = null;
- }
- var _top = document.documentElement.scrollTop || document.body.scrollTop,
- _left = document.documentElement.scrollLeft || document.body.scrollLeft;
- var _offsetHtml = [Math.abs(els.getBoundingClientRect().left) + _left, Math.abs(els.getBoundingClientRect().top) + _top];
- U.MD.UI.calendar.fouseinp = els;
- if (!U.MD.UI.calendar.board) {
- U.MD.UI.calendar.showBoard(els, _offsetHtml, parentnode);
- } else {
- U.MD.UI.calendar.resetData(_offsetHtml);
- }
- U.MD.UI.calendar.showDay();
- }
- U.MD.UI.calendar.toggleChooseText = function (that) {
- var _child = U.selectEl('.U_MD_UI_calendar_c_a')[0].children,
- _len = _child.length;
- if (that.innerText == '返回日期') {
- U.MD.UI.calendar.changeDisplay(_lastTemplate, _child[_len - 1]);
- that.innerText = "选择时间";
- U.selectEl(that).removeClass("U_MD_UI_calendar_timeTextClick");
- return;
- }
- for (var i = 0; i < _len - 1; i++) {
- _child[i].style.display != 'none' && (_child[i].style.display = 'none', _lastTemplate = _child[i]);
- }
- _child[_len - 1].style.display = 'block';
- that.innerText = "返回日期";
- U.selectEl(that).addClass("U_MD_UI_calendar_timeTextClick");
- }
- U.MD.UI.calendar.resetData = function (offsethtml) {
- U.MD.UI.calendar.board.style.display = 'block';
- U.MD.UI.calendar.mark = 1;
- U.selectEl('#calendar_day')[0].style.display = 'block';
- U.selectEl('#calendar_month')[0].style.display = 'none';
- U.selectEl('#calendar_year')[0].style.display = 'none';
- U.MD.UI.calendar.board.style.left = offsethtml[0] + 'px';
- U.MD.UI.calendar.board.style.top = offsethtml[1] + U.MD.UI.calendar.fouseinp.clientHeight + 10 + 'px';
- U.MD.UI.calendar.year = U.MD.UI.calendar.CURRENTYEAR;
- U.MD.UI.calendar.month = U.MD.UI.calendar.CURRENTMONTH;
- U.MD.UI.calendar.ChooseDefault(true);
- }
- U.MD.UI.calendar.createChooseTime = function (addel) {
- var _dataObj = [
- ["时", "分", "秒"],
- [24, 60, 60],
- ["hour", "minute", "second"]
- ],
- _lastTemplate;
- var _ct = $$('div', { id: 'calendar_time', className: 'U_MD_UI_calendar_time', innerHTML: U.MD.UI.calendar.template[4] }, U.MD.UI.calendar.board);
- for (var i = 0; i < _dataObj[0].length; i++) {
- var _row = $$('div', { className: "U_MD_UI_calendar_timeRow" }, addel);
- $$('span', { className: "U_MD_UI_calendar_timeRowText", innerText: _dataObj[0][i] }, _row);
- var _rowCon = $$('div', { className: "U_MD_UI_calendar_timeRowCon" }, _row),
- _ul = $$('ul', { className: "U_MD_UI_calendar_timeRowUl", name: _dataObj[2][i] }, _rowCon);
- for (var j = 0; j < _dataObj[1][i]; j++) {
- var _text = j.toString().length == 1 ? '0' + j : j;
- $$('li', {
- innerText: _text,
- onclick: function () {
- var _parentUl = this.parentNode,
- _activeLi = _parentUl.querySelector('.U_MD_UI_calendar_timeRowActive');
- U.selectEl(_activeLi).removeClass('U_MD_UI_calendar_timeRowActive');
- U.selectEl(this).addClass('U_MD_UI_calendar_timeRowActive');
- switch (_parentUl.name) {
- case 'hour':
- U.MD.UI.calendar.hour = this.innerText;
- break;
- case 'minute':
- U.MD.UI.calendar.minute = this.innerText;
- break;
- case 'second':
- U.MD.UI.calendar.second = this.innerText;
- break;
- }
- }
- }, _ul);
- }
- }
- if (!U.MD.UI.calendar.datetimeformat) {
- _ct.style.display = 'none';
- }
- U.selectEl('#U_MD_UI_calendar_timeText')[0].onclick = function () {
- U.MD.UI.calendar.toggleChooseText(this)
- }
- U.selectEl('#U_MD_UI_calendar_clearText')[0].onclick = function () {
- U.MD.UI.calendar.fouseinp.value ? U.MD.UI.calendar.fouseinp.value = '' : U.MD.UI.calendar.fouseinp.innerText = '';
- U.MD.UI.calendar.ChooseDefault(true);
- U.MD.UI.calendar.board.style.display = 'none';
- }
- U.selectEl('#U_MD_UI_calendar_nowTime')[0].onclick = function () {
- U.MD.UI.calendar.outPutDate(true);
- }
- U.selectEl('#U_MD_UI_calendar_okBtn')[0].onclick = function () {
- U.MD.UI.calendar.outPutDate(false);
- }
- }
- U.MD.UI.calendar.showBoard = function (input, offsetHtml, parentnode) {
- var _template = U.MD.UI.calendar.template,
-
- _parentNode = parentnode || document.body,
- _templateHTML = _template[1] + _template[2] + _template[3] + _template[5];
- if (!parentnode) {
- U.MD.UI.calendar.board = $$('div', { "className": "U_MD_UI_calendar_bigboard", style: { left: offsetHtml[0] + "px", top: offsetHtml[1] + input.clientHeight + 10 + "px" } }, _parentNode);
- } else {
- U.MD.UI.calendar.board = $$('div', { "className": "U_MD_UI_calendar_bigboard" }, parentnode);
- }
- U.MD.UI.calendar.board.innerHTML = _template[0];
- _dayC = $$('div', { "className": 'U_MD_UI_calendar_c_a', innerHTML: _templateHTML }, U.MD.UI.calendar.board);
- U.MD.UI.calendar.tit = U.selectEl('#calendar_tit')[0];
- _mc = U.selectEl('#calendar_month > ul > li');
- _titInp = U.selectEl('#calendar_tit_btn')[0];
- _timer = null;
- U.MD.UI.calendar.createChooseTime($('#calendar_timeChoose')[0]);
- U.MD.UI.calendar.tit.onclick = function () {
- clearTimeout(_timer);
- if (U.MD.UI.calendar.mark == 1) {
- U.MD.UI.calendar.tit.innerText = U.MD.UI.calendar.year;
- U.MD.UI.calendar.changeDisplay($('#calendar_month')[0], U.selectEl('#calendar_day')[0]);
- U.MD.UI.calendar.mark = 2;
- U.MD.UI.calendar.ChooseDefault();
- } else if (U.MD.UI.calendar.mark == 2) {
- _timer = setTimeout(function () {
- U.MD.UI.calendar.changeDisplay($('#calendar_year')[0], U.selectEl('#calendar_month')[0]);
- U.MD.UI.calendar.dateTenYear();
- U.MD.UI.calendar.mark = 3;
- U.MD.UI.calendar.ChooseDefault();
- }, 250);
- }
- }
- U.MD.UI.calendar.tit.ondblclick = function () {
- clearTimeout(_timer);
- if (U.MD.UI.calendar.mark === 2) {
- _obj = U.MD.UI.calendar.changeDisplay(_titInp, this, 'inline-block');
- _obj[0].value = this.innerText;
- _obj[0].focus();
- }
- }
- _titInp.onkeydown = function (e) {
- switch (e.keyCode) {
- case 13:
-
- var _arr2 = U.MD.UI.calendar.changeDisplay(U.MD.UI.calendar.tit, this, 'inline-block');
- _arr2[0].innerText = U.MD.UI.calendar.year = !isNaN(parseInt(this.value)) ? parseInt(this.value) : U.MD.UI.calendar.CURRENTYEAR;
- break;
- }
- };
- _titInp.onblur = function () {
- var _arr3 = U.MD.UI.calendar.changeDisplay(U.MD.UI.calendar.tit, this, 'inline-block');
- _arr3[0].innerText = U.MD.UI.calendar.year = !isNaN(parseInt(this.value)) ? parseInt(this.value) : U.MD.UI.calendar.CURRENTYEAR;
- }
- U.selectEl('#prevDate')[0].onclick = function () {
- if (U.MD.UI.calendar.mark == 1) { _lessNum = -1 }
- else if (U.MD.UI.calendar.mark == 2) { _lessNum = -12 }
- else if (U.MD.UI.calendar.mark == 3) { _lessNum = -120 };
- U.MD.UI.calendar.fullDate(_lessNum, false);
- };
- U.selectEl('#nextDate')[0].onclick = function () {
- if (U.MD.UI.calendar.mark == 1) { _addNum = 1 }
- else if (U.MD.UI.calendar.mark == 2) { _addNum = 12 }
- else if (U.MD.UI.calendar.mark == 3) { _addNum = 120 };
- U.MD.UI.calendar.fullDate(_addNum, true);
- };
- for (var i = 0; i < _mc.length; i++) {
- _mc[i].onclick = function () {
- U.MD.UI.calendar.changeDisplay($('#calendar_day')[0], U.selectEl('#calendar_month')[0]);
- U.MD.UI.calendar.month = parseInt(this.innerText) - 1;
- U.MD.UI.calendar.showDay();
- U.MD.UI.calendar.mark = 1;
- }
- }
- U.selectEl('#U_MD_UI_calendar_closeBtn')[0].onclick = function () {
- U.UF.EV.stopBubble();
- U.MD.UI.calendar.board.style.display = 'none';
- }
- }
- U.MD.UI.calendar.showDay = function () {
- _monthFristDay = new Date(U.MD.UI.calendar.year, U.MD.UI.calendar.month, 1).getDay();
- _lastMonthDay = new Date(U.MD.UI.calendar.year, U.MD.UI.calendar.month, 0).getDate();
- _fullDay = new Date(U.MD.UI.calendar.year, U.MD.UI.calendar.month + 1, 0).getDate();
- _totalDay = (_t = _monthFristDay + _fullDay) % 7 === 0 ? _t : _t + (7 - _t % 7);
- _dayC = U.selectEl('#calendar_week_c')[0];
- _dayC.innerHTML = '';
- for (var _i = 0; _i < _totalDay; _i++) {
- _li = $$('li', {}, _dayC);
- if (_i < _monthFristDay) {
- $$('span', { "className": 'U_MD_UI_calendar_unavailable', innerText: (_lastMonthDay - _monthFristDay + _i + 1) }, _li);
- } else if (_i < (_fullDay + _monthFristDay)) {
- var _d = _i - _monthFristDay + 1,
- _week = new Date(U.MD.UI.calendar.year, U.MD.UI.calendar.month, _d).getDay(),
- _today = U.MD.UI.calendar.NOW.getDate() === _d && (U.MD.UI.calendar.CURRENTMONTH === U.MD.UI.calendar.month && U.MD.UI.calendar.CURRENTYEAR === U.MD.UI.calendar.year);
- _dayV = _d;
- if (_week === 6 || _week === 0) {
- _today ? $$('span', {
- "className": 'U_MD_UI_calendar_day U_MD_UI_calendar_today U_MD_UI_calendar_weekend',
- innerText: _d,
- "onclick": function () {
- U.MD.UI.calendar.day = this.innerText;
- U.MD.UI.calendar.outPutDate()
- }
- }, _li) : $$('span', {
- "className": 'U_MD_UI_calendar_day U_MD_UI_calendar_weekend',
- innerText: _d,
- "onclick": function () {
- U.MD.UI.calendar.day = this.innerText;
- U.MD.UI.calendar.outPutDate()
- }
- }, _li);
- } else if (_today) {
- $$('span', {
- "className": 'U_MD_UI_calendar_day U_MD_UI_calendar_today',
- innerText: _d,
- "onclick": function () {
- U.MD.UI.calendar.day = this.innerText;
- U.MD.UI.calendar.outPutDate()
- }
- }, _li)
- } else {
- $$('span', {
- "className": 'U_MD_UI_calendar_day',
- innerText: _d,
- "onclick": function () {
- U.MD.UI.calendar.day = this.innerText;
- U.MD.UI.calendar.outPutDate()
- }
- }, _li)
- }
- } else {
- $$('span', { "className": 'U_MD_UI_calendar_unavailable', innerText: (_i - (_fullDay + _monthFristDay) + 1) }, _li)
- }
- }
- U.MD.UI.calendar.tit.innerText = U.MD.UI.calendar.year + '-' + (U.MD.UI.calendar.month + 1) + '月';
- }
- U.MD.UI.calendar.fullDate = function (num, check) {
- var _year = (_n = Math.abs(num) / 12) >= 1 ? _n >>> 0 : 0,
-
- _month = Math.abs(num) % 12;
- !check && (_month = -_month);
- !check && (_year = -_year);
- U.MD.UI.calendar.month += _month;
- U.MD.UI.calendar.year += _year;
- if (check) {
- if (U.MD.UI.calendar.month > 11) {
- U.MD.UI.calendar.month = 0;
- U.MD.UI.calendar.year++;
- }
- } else {
- if (U.MD.UI.calendar.month < 0) {
- U.MD.UI.calendar.month = 11;
- U.MD.UI.calendar.year--;
- }
- }
- if (U.MD.UI.calendar.mark == 1) { U.MD.UI.calendar.showDay() };
- if (U.MD.UI.calendar.mark == 2) { U.MD.UI.calendar.tit.innerText = U.MD.UI.calendar.year };
- if (U.MD.UI.calendar.mark == 3) { U.MD.UI.calendar.dateTenYear() };
- }
- U.MD.UI.calendar.formartDate = function (symbol, isnow) {
- var _symbol, y, m, d, h, m, s;
- _symbol = symbol || '-'
- y = isnow ? U.MD.UI.calendar.CURRENTYEAR : U.MD.UI.calendar.year;
- m = isnow ? U.MD.UI.calendar.CURRENTMONTH + 1 : U.MD.UI.calendar.month + 1;
- d = isnow ? U.MD.UI.calendar.CURRENTDAY : U.MD.UI.calendar.day;
- m = (m.toString())[1] ? m : '0' + m;
- d = (d.toString())[1] ? d : '0' + d;
- var _dateStr = y + _symbol + m + _symbol + d;
- if (typeof U.MD.UI.calendar.datetimeformat == 'boolean' && U.MD.UI.calendar.datetimeformat) {
- if (isnow) {
- var _nowDate = new Date();
- U.MD.UI.calendar.hour = _nowDate.getHours();
- U.MD.UI.calendar.minute = _nowDate.getMinutes();
- U.MD.UI.calendar.second = _nowDate.getSeconds();
- }
- h = (U.MD.UI.calendar.hour.toString())[1] ? U.MD.UI.calendar.hour : '0' + U.MD.UI.calendar.hour;
- m = (U.MD.UI.calendar.minute.toString())[1] ? U.MD.UI.calendar.minute : '0' + U.MD.UI.calendar.minute;
- s = (U.MD.UI.calendar.second.toString())[1] ? U.MD.UI.calendar.second : '0' + U.MD.UI.calendar.second;
- _dateStr += " " + h + ":" + m + ":" + s;
- }
- return _dateStr;
- }
- U.MD.UI.calendar.outPutDate = function (isNow) {
- if (U.MD.UI.calendar.fouseinp.tagName === 'INPUT') {
- U.MD.UI.calendar.fouseinp.value = U.MD.UI.calendar.formartDate('-', isNow);
- } else {
- U.MD.UI.calendar.fouseinp.innerText = U.MD.UI.calendar.formartDate('-', isNow);
- }
- U.MD.UI.calendar.CheckedDay && U.MD.UI.calendar.CheckedDay();
- U.MD.UI.calendar.board.style.display = 'none';
- }
- U.MD.UI.calendar.changeDisplay = function (blockEl, noneEl, val) {
- val = val || 'block';
- if (blockEl && typeof blockEl === 'object') { blockEl.setAttribute('style', 'display:' + val) }
- if (noneEl && typeof noneEl === 'object') { noneEl.setAttribute('style', 'display:none') };
- return [blockEl, noneEl];
- }
- U.MD.UI.calendar.dateTenYear = function () {
- _yearArr = U.selectEl('#calendar_year > ul > li');
- _startYear = U.MD.UI.calendar.year - (U.MD.UI.calendar.year % 10);
- for (var i = 0; i < _yearArr.length; i++) {
- _yearArr[i].onclick = function () {
- U.MD.UI.calendar.mark = 2;
- U.MD.UI.calendar.year = parseInt(this.innerText);
- U.MD.UI.calendar.changeDisplay($('#calendar_month')[0], U.selectEl('#calendar_year')[0]);
- U.MD.UI.calendar.tit.innerText = this.innerText;
- }
- _yearArr[i].innerHTML = '';
- if (i == 0 || i == _yearArr.length - 1) {
- $$('span', { "className": "U_MD_UI_calendar_unavailable", innerText: (_startYear + i - 1) }, _yearArr[i]);
- } else if ((_startYear + i - 1) === U.MD.UI.calendar.CURRENTYEAR) {
- $$('span', { style: { "background-color": "#eed1bc" }, innerText: (_startYear + i - 1) }, _yearArr[i])
- } else {
- $$('span', { innerText: (_startYear + i - 1) }, _yearArr[i])
- }
- }
- U.MD.UI.calendar.tit.innerText = (t = (U.MD.UI.calendar.year - (U.MD.UI.calendar.year % 10))) + '-' + (t + 9);
- }
- U.MD.UI.calendar.ChooseDefault = function (deafultflag) {
- if (U.MD.UI.calendar.datetimeformat) {
- if (deafultflag) {
- U.MD.UI.calendar.hour = '00';
- U.MD.UI.calendar.minute = '00';
- U.MD.UI.calendar.second = '00';
- U.selectEl(U.MD.UI.calendar.board).find('.U_MD_UI_calendar_timeRowActive').removeClass('U_MD_UI_calendar_timeRowActive');
- !$('#U_MD_UI_calendar_timeText').length && U.MD.UI.calendar.createChooseTime($('#calendar_timeChoose')[0]);
- }
- U.selectEl('#calendar_time')[0].style.display = "block";
- U.selectEl('#calendar_timeChoose')[0].style.display = 'none';
- U.selectEl('#U_MD_UI_calendar_timeText')[0].innerText = "选择时间";
- U.selectEl('#U_MD_UI_calendar_timeText').removeClass("U_MD_UI_calendar_timeTextClick");
- } else {
- U.selectEl('#calendar_time')[0].style.display = 'none';
- U.selectEl('#calendar_timeChoose')[0].style.display = 'none';
- }
- }
- U.MD.UI.calendar.SetCallBack = function (funcname, func) {
- if (typeof func != 'function' || !"CheckedDay ".match(funcname + ' '))
- return 0;
- U.MD.UI.calendar[funcname] = func
- };
- Namespace.register("U.MD.UI.city");
- U.MD.UI.city = function (element) {
- U.UF.EV.stopBubble();
- if (!element || !element.tagName) {
- return;
- }
- if (_cityBox = U.selectEl("#U_MD_UI_city_cityBox")[0]) {
- var _rect = element.getBoundingClientRect();
- _cityBox.style.top = _rect.top + _rect.height + document.documentElement.scrollTop + "px";
-
- _cityBox.style.left = _rect.left + document.documentElement.scrollLeft + "px";
-
- U.selectEl(_cityBox).removeClass("U_MD_UI_city_hidden");
-
- U.MD.UI.city.Attr.inputNode = element;
- return;
- }
- var _city = U.MD.UI.city;
- _city.create(element);
- _city.Attr = {
- "inputNode": element
- };
- _city.init();
- };
- U.MD.UI.city.Attr = {};
- U.MD.UI.city.usedCity = null;
- U.MD.UI.city.province = null;
- U.MD.UI.city.city = {};
- U.MD.UI.city.area = {};
- U.MD.UI.city.htmlTemplate = ' <ul class="U_MD_UI_city_menuBox"> <!--控件的头部-->\n' +
- '\n' +
- ' <!--U_MD_UI_city_menuChecked 选中菜单的按钮时所用的"className":红色-->\n' +
- ' <!--U_MD_UI_city_filled 表示待填写class 为增删class占位置 防出错 以下都是-->\n' +
- ' <!--U_MD_UI_city_menuoChecked 选择城市后所添加的class 红色小圆点-->\n' +
- ' <li id="U_MD_UI_city_usedCityMenu" data-city-mark="U_MD_UI_city_usedCityCont" class="U_MD_UI_city_menuChecked" data-city-res="">\n' +
- ' <span>常用市</span>\n' +
- ' </li>\n' +
- '\n' +
- ' <li id="U_MD_UI_city_provinceMenu" data-city-mark="U_MD_UI_city_provinceCont" class="U_MD_UI_city_filled" data-city-res="">\n' +
- ' <span>省/直辖市</span>\n' +
- ' </li>\n' +
- '\n' +
- ' <li id="U_MD_UI_city_cityMenu" data-city-mark="U_MD_UI_city_cityCont" class="U_MD_UI_city_filled U_MD_UI_city_hidden" data-city-res="">\n' +
- ' <span>请选择</span>\n' +
- ' </li>\n' +
- '\n' +
- ' <li id="U_MD_UI_city_areaMenu" data-city-mark="U_MD_UI_city_areaCont" class="U_MD_UI_city_filled U_MD_UI_city_hidden" data-city-res="">\n' +
- ' <span>请选择</span>\n' +
- ' </li>\n' +
- ' </ul>\n' +
- '\n' +
- '\n' +
- ' <!--以下为主要内容区域-->\n' +
- ' <!-- ----------------------------------------------------------------------------- -->\n' +
- ' <ul id="U_MD_UI_city_usedCityCont" class="U_MD_UI_city_filled U_MD_UI_city_Cont"> <!-- <!–常用城市盒子节点–> -->\n' +
- ' <li id="U_MD_UI_city_liTemplate"><span>光明新区</span></li>\n' +
- ' <!-- U_MD_UI_city_liTemplate 为内容区域的li的模板 可无视 已display为none -->\n' +
- ' <!--U_MD_UI_city_Cont_ochecked 选中城市的按钮时所用的"className":红色-->\n' +
- ' </ul>\n' +
- '\n' +
- '\n' +
- ' <ul class="U_MD_UI_city_filled U_MD_UI_city_Cont U_MD_UI_city_hidden" id="U_MD_UI_city_provinceCont"> <!-- <!–存放省的盒子节点–> -->\n' +
- ' </ul>\n' +
- '\n' +
- '\n' +
- ' <ul class="U_MD_UI_city_filled U_MD_UI_city_Cont U_MD_UI_city_hidden" id="U_MD_UI_city_cityCont"> <!-- <!–存放市的盒子节点–> -->\n' +
- ' </ul>\n' +
- '\n' +
- '\n' +
- ' <ul class="U_MD_UI_city_filled U_MD_UI_city_Cont U_MD_UI_city_hidden" id="U_MD_UI_city_areaCont"> <!-- <!–存放地区的盒子节点–> -->\n' +
- ' </ul>';
- U.MD.UI.city.create = function (element) {
- var _cityBox = $$("div", { id: 'U_MD_UI_city_cityBox', className: 'U_MD_UI_city_cityBox U_MD_UI_city_hidden' }, document.body);
- _cityBox.innerHTML += U.MD.UI.city.htmlTemplate;
- var _rect = element.getBoundingClientRect();
- _cityBox.style.top = _rect.top + _rect.height + document.documentElement.scrollTop + "px";
-
- _cityBox.style.left = _rect.left + document.documentElement.scrollLeft + "px";
-
- U.MD.UI.city.Attr.inputNode = element;
-
- U.selectEl(_cityBox).removeClass("U_MD_UI_city_hidden");
-
- };
- U.MD.UI.city.init = function () {
- var _city = U.MD.UI.city;
- _city.getUsedCity();
- _city.inputEvent();
- _city.menuEvent();
- };
- U.MD.UI.city.inputEvent = function () {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _hidden = "U_MD_UI_city_hidden";
- var _cityBox = U.selectEl("#U_MD_UI_city_cityBox")[0];
- U.selectEl(document).bind('click', function () {
- U.selectEl(_cityBox).addClass(_hidden);
-
- }, false);
- U.selectEl(_cityBox).bind('click', function (e) {
- U.UF.EV.stopBubble(e);
-
- });
- U.selectEl("#U_MD_UI_city_areaCont")[0].onclick = function () {
- if ($("#U_MD_UI_city_areaCont")[0]) {
- U.selectEl("#U_MD_UI_city_cityBox")[0].style.display = "none";
- }
- }
- };
- U.MD.UI.city.menuEvent = function () {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _menuAllNode = U.selectEl("[data-city-mark]");
- var _hidden = "U_MD_UI_city_hidden";
- for (var i = 0, len = _menuAllNode.length; i < len; i++) {
- var _el = _menuAllNode[i];
- U.selectEl(_el).bind('click', function () {
- _city.menuClassControl(this, "U_MD_UI_city_menuChecked", "data-city-mark", _hidden);
- });
- if (_el.id === "U_MD_UI_city_provinceMenu") {
- U.selectEl(_el).bind('click', function () {
- _city.getProvince();
- })
- }
- }
- };
- U.MD.UI.city.getUsedCity = function () {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _usedCityMenu = U.selectEl("#U_MD_UI_city_usedCityMenu")[0];
- var _liTemplate = U.selectEl("#U_MD_UI_city_liTemplate")[0];
- var _usedCityCont = U.selectEl("#U_MD_UI_city_usedCityCont")[0];
- if (!_city.usedCity) {
- U.A.Request("http://cd.1473.cn/php", ["db.1473.cn", "UseStudio_Controls", "City_UsedCity"], function (r) {
- _city.usedCity = r.value;
- _city.allDataPrint(_usedCityMenu, _city.usedCity, _liTemplate, "usedCity", _usedCityCont);
- });
- }
- };
- U.MD.UI.city.getProvince = function () {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _provinceMenu = U.selectEl("#U_MD_UI_city_provinceMenu")[0];
- var _liTemplate = U.selectEl("#U_MD_UI_city_liTemplate")[0];
- var _provinceCont = U.selectEl("#U_MD_UI_city_provinceCont")[0];
- if (!_city.province) {
- U.A.Request("http://cd.1473.cn/php", ["db.1473.cn", "UseStudio_Controls", "City_Province"], function (r) {
- _city.province = r.value;
- _city.allDataPrint(_provinceMenu, _city.province, _liTemplate, "province", _provinceCont);
- });
- }
- };
- U.MD.UI.city.getCity = function (code) {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _cityMenu = U.selectEl("#U_MD_UI_city_cityMenu")[0];
- var _liTemplate = U.selectEl("#U_MD_UI_city_liTemplate")[0];
- var _cityCont = U.selectEl("#U_MD_UI_city_cityCont")[0];
- var _hidden = "U_MD_UI_city_hidden";
- if (!_city.city[code]) {
- _city.menuClassControl(_cityMenu, "U_MD_UI_city_menuChecked", "data-city-mark", _hidden);
- U.A.Request("http://cd.1473.cn/php", ["db.1473.cn", "UseStudio_Controls", "City_PidFind", code, 1], function (r) {
- _city.city[code] = r.value;
-
-
-
-
- _city.allDataPrint(_cityMenu, _city.city[code], _liTemplate, "city", _cityCont);
- });
- } else {
- _city.menuClassControl(_cityMenu, "U_MD_UI_city_menuChecked", "data-city-mark", _hidden);
- _city.allDataPrint(_cityMenu, _city.city[code], _liTemplate, "city", _cityCont);
- }
- };
- U.MD.UI.city.getarea = function (code) {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _areaMenu = U.selectEl("#U_MD_UI_city_areaMenu")[0];
- var _hidden = "U_MD_UI_city_hidden";
- var _liTemplate = U.selectEl("#U_MD_UI_city_liTemplate")[0];
- var _areaCont = U.selectEl("#U_MD_UI_city_areaCont")[0];
- if (!_city.area[code]) {
- _city.menuClassControl(_areaMenu, "U_MD_UI_city_menuChecked", "data-city-mark", _hidden);
- U.A.Request("http://cd.1473.cn/php", ["db.1473.cn", "UseStudio_Controls", "City_PidFind", code, 2], function (r) {
- _city.area[code] = r.value;
- _city.allDataPrint(_areaMenu, _city.area[code], _liTemplate, "area", _areaCont);
- });
- } else {
- _city.menuClassControl(_areaMenu, "U_MD_UI_city_menuChecked", "data-city-mark", _hidden);
- _city.allDataPrint(_areaMenu, _city.area[code], _liTemplate, "area", _areaCont);
- }
- };
- U.MD.UI.city.allDataPrint = function (menu, data, template, type, parent) {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _usedCityMenu = U.selectEl("#U_MD_UI_city_usedCityMenu")[0];
- var _provinceMenu = U.selectEl("#U_MD_UI_city_provinceMenu")[0];
- var _len = data.length;
- var _menu = menu;
- for (var i = 0; i < _len; i++) {
-
- var _span = _city.dataPrint(data[i], template, type, parent);
-
- _span.onclick = function () {
- var _type = U.selectEl(this).attr("data-city-type");
-
- var _code = U.selectEl(this).attr("data-city-code");
-
- U.selectEl(_menu.children[0]).addClass("U_MD_UI_city_menuoChecked");
-
- _menu.children[0].innerText = this.innerText;
-
- U.selectEl(_menu).attr("data-city-res", this.innerText);
-
- _city.contClassControl(this, "U_MD_UI_city_Cont_ochecked");
-
- switch (_type) {
-
- case "province":
- _city.getCity(_code);
-
- _city.initAllClass(_usedCityMenu);
-
- break;
- case "usedCity":
- if (this.innerText === "重庆") {
- _city.getCity(_code);
- } else {
- _city.getarea(_code);
- }
-
- _city.initAllClass(_provinceMenu);
-
- break;
- case "city":
- _city.getarea(_code);
-
- break;
- case "area":
- _city.getRes("data-city-res");
-
- break;
- }
- }
- }
- };
- U.MD.UI.city.dataPrint = function (data, template, type, parent) {
- var _city = U.MD.UI.city;
- var _liNode = _city.clone(template),
- _spanNode = _liNode.children[0];
- var _shortName = data.short_name;
- var _name = data.name;
- _liNode.id = type + data.id;
- _spanNode.innerText = _shortName;
- if (_shortName === "北京" || _shortName === "上海" || _shortName === "天津" || _shortName === "重庆") {
- if (parent.id === "U_MD_UI_city_cityCont") {
- _spanNode.innerText = _name;
- }
- }
- if (parent.id === "U_MD_UI_city_areaCont") {
- _spanNode.innerText = _name;
- }
- _spanNode.id = "span_" + type + data.id;
- U.selectEl(_spanNode).attr("data-city-code", data.id);
- U.selectEl(_spanNode).attr("data-city-type", type);
- parent.appendChild(_liNode);
- return _spanNode;
- };
- U.MD.UI.city.menuClassControl = function (el, cs, dataattr, hiddenCs) {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _cityMenu = U.selectEl("#U_MD_UI_city_cityMenu")[0];
- var _areaMenu = U.selectEl("#U_MD_UI_city_areaMenu")[0];
- var _cityCont = U.selectEl("#U_MD_UI_city_cityCont")[0];
- var _areaCont = U.selectEl("#U_MD_UI_city_areaCont")[0];
- var _oEl = U.selectEl("." + cs)[0];
-
- if (_oEl) { U.selectEl(_oEl).removeClass(cs) };
-
- U.selectEl(el).addClass(cs);
-
- var _oElCont = U.selectEl("#" + U.selectEl(_oEl).attr(dataattr))[0];
-
- var _elCont = U.selectEl("#" + U.selectEl(el).attr(dataattr))[0];
-
- U.selectEl(_oElCont).addClass(hiddenCs);
-
- U.selectEl(_elCont).removeClass(hiddenCs);
-
- var _id = el.id;
- switch (_id) {
- case "U_MD_UI_city_usedCityMenu":
- case "U_MD_UI_city_provinceMenu":
- U.selectEl(_cityMenu).addClass(hiddenCs);
- U.selectEl(_areaMenu).addClass(hiddenCs);
- U.selectEl(_cityCont).addClass(hiddenCs);
- U.selectEl(_areaCont).addClass(hiddenCs);
- _cityMenu.children[0].innerText = "请选择";
- _areaMenu.children[0].innerText = "请选择";
- _cityCont.innerHTML = "";
- _areaCont.innerHTML = "";
- U.selectEl(_cityMenu).attr("data-city-res", "");
- U.selectEl(_areaMenu).attr("data-city-res", "");
- break;
- case "U_MD_UI_city_cityMenu":
- U.selectEl(el).removeClass(hiddenCs);
- U.selectEl(_areaMenu).addClass(hiddenCs);
- U.selectEl(_areaCont).addClass(hiddenCs);
- _areaMenu.children[0].innerText = "请选择";
- _areaCont.innerHTML = "";
- break;
- case "U_MD_UI_city_areaMenu":
- U.selectEl(el).removeClass(hiddenCs);
- break;
- }
- };
- U.MD.UI.city.contClassControl = function (el, ocheckcs) {
- var _city = U.MD.UI.city;
- var _oEls = U.selectEl("." + ocheckcs);
-
- var _type = U.selectEl(el).attr("data-city-type");
-
- for (var i = 0, len = _oEls.length; i < len; i++) {
- var _otype = U.selectEl(_oEls[i]).attr("data-city-type");
- if (_oEls[i] && _otype === _type) {
-
- U.selectEl(_oEls[i]).removeClass(ocheckcs)
- }
- }
- U.selectEl(el).addClass(ocheckcs);
-
- };
- U.MD.UI.city.initAllClass = function (el) {
- var _city = U.MD.UI.city;
- el.className = "U_MD_UI_city_filled";
- el.children[0].className = "";
- U.selectEl(el).attr("data-city-res", "");
- var oEl = U.selectEl(".U_MD_UI_city_Cont_ochecked");
- for (var i = 0; i < oEl.length; i++) {
- U.selectEl(oEl[i]).removeClass("U_MD_UI_city_Cont_ochecked");
- }
- if (el.id === "U_MD_UI_city_provinceMenu") {
- el.children[0].innerText = "省/直辖市";
- }
- if (el.id === "U_MD_UI_city_usedCityMenu") {
- el.children[0].innerText = "常用市";
- }
- };
- U.MD.UI.city.getRes = function (dataattr) {
- var _city = U.MD.UI.city;
- var _attr = _city.Attr;
- var _inputNode = _attr.inputNode;
- var _cityBox = U.selectEl("#U_MD_UI_city_cityBox")[0];
- var _hidden = "U_MD_UI_city_hidden";
- var resAll = U.selectEl("[" + dataattr + "]");
- var _arr = [];
- for (var i = 0, len = resAll.length; i < len; i++) {
- var _val = U.selectEl(resAll[i]).attr(dataattr);
- if (_val) {
- _arr.push(_val);
- }
- }
- _inputNode.value = (_arr.join("-"));
- U.selectEl(_cityBox).addClass(_hidden);
- };
- U.MD.UI.city.clone = function (ele) {
- var node = ele.cloneNode();
- var child = ele.children;
- for (var i = 0; i < child.length; i++) {
- var childNode = child[i].cloneNode();
- node.appendChild(childNode);
- }
- return node;
- };;
- Namespace.register("U.MD.UI.ColorPicker");
- U.MD.UI.colorPicker = U.MD.UI.ColorPicker = function (barelement, callfun) {
- var div = $$("div", {
- style: {
- width: "180px",
- height: "140px",
- border: "1px solid #CDCDCD",
- backgroundColor: " #FFF",
- padding: "10px 10px 10px 5px",
- zIndex: 1
- },
- "className": "MD_ColorPicker"
- }, barelement);
- var _i,
- _colorarea = [
- "#ffffff",
- "#ffccc9",
- "#ffce93",
- "#fffc9e",
- "#ffffc7",
- "#9aff99",
- "#96fffb",
- "#cdffff",
- "#cbcefb",
- "#cfcfcf",
- "#fd6864",
- "#fe996b",
- "#fffe65",
- "#fcff2f",
- "#67fd9a",
- "#38fff8",
- "#68fdff",
- "#9698ed",
- "#c0c0c0",
- "#fe0000",
- "#f8a102",
- "#ffcc67",
- "#f8ff00",
- "#34ff34",
- "#68cbd0",
- "#34cdf9",
- "#6665cd",
- "#9b9b9b",
- "#cb0000",
- "#f56b00",
- "#ffcb2f",
- "#ffc702",
- "#32cb00",
- "#00d2cb",
- "#3166ff",
- "#6434fc",
- "#656565",
- "#9a0000",
- "#ce6301",
- "#cd9934",
- "#999903",
- "#009901",
- "#329a9d",
- "#3531ff",
- "#6200c9",
- "#343434",
- "#680100",
- "#963400",
- "#986536",
- "#646809",
- "#036400",
- "#34696d",
- "#00009b",
- "#303498",
- "#000000",
- "#330001",
- "#643403",
- "#663234",
- "#343300",
- "#013300",
- "#003532",
- "#010066",
- "#340096"
- ];
- var button;
- for (_i = 0; _i < _colorarea.length; _i++) {
- button = $$('button', {
- style: {
- background: _colorarea[_i],
- width: "15px",
- height: "15px",
- float: "left",
- margin: "5px 0 0 5px",
- border: " 1px solid transparent"
- }
- }, div);
- button.onclick = function (e) {
- div.style.display = 'none'
- U.UF.EV.stopBubble(e);
- callfun(this.style.background);
- }
- }
- U.selectEl(document).bind('click', function () {
- if (div.style.display != 'none')
- div.style.display = 'none'
- });
- U.UF.EV.stopBubble();
- return div;
- };
- Namespace.register("U.MD.UI.Font");
- Namespace.register("U.MD.UI.WordSize");
- U.MD.UI.Font = function () {
- var font = $$("select", { style: { fontFamily: "宋体", fontSize: "16px" }, "className": "MD_fontFamily" });
- $$("option", { value: "宋体", style: { fontFamily: "宋体" }, innerHTML: "宋体" }, font);
- $$("option", { value: "sans-serif", style: { fontFamily: "sans-serif" }, innerHTML: "sans-serif" }, font);
- $$("option", { value: "微软雅黑", style: { fontFamily: "微软雅黑" }, innerHTML: "微软雅黑" }, font);
- $$("option", { value: "楷体", style: { fontFamily: "楷体" }, innerHTML: "楷体" }, font);
- $$("option", { value: "黑体", style: { fontFamily: "黑体" }, innerHTML: "黑体" }, font);
- $$("option", { value: "隶书", style: { fontFamily: "隶书" }, innerHTML: "隶书" }, font);
- $$("option", { value: "andale mono", style: { fontFamily: "andale mono" }, innerHTML: "andale mono" }, font);
- $$("option", { value: "arial black", style: { fontFamily: "arial black" }, innerHTML: "arial black" }, font);
- return font;
- }
- U.MD.UI.WordSize = function () {
- var fontsize = $$("select", { "className": "MD_fontSize" });
- $$("option", { value: "56px", style: { fontSize: "14px" }, innerHTML: "初号" }, fontsize);
- $$("option", { value: "48px", style: { fontSize: "14px" }, innerHTML: "小初" }, fontsize);
- $$("option", { value: "34.7px", style: { fontSize: "14px" }, innerHTML: "一号" }, fontsize);
- $$("option", { value: "32px", style: { fontSize: "14px" }, innerHTML: "小一" }, fontsize);
- $$("option", { value: "29.3px", style: { fontSize: "14px" }, innerHTML: "二号" }, fontsize);
- $$("option", { value: "24px", style: { fontSize: "14px" }, innerHTML: "小二" }, fontsize);
- $$("option", { value: "21.3px", style: { fontSize: "14px" }, innerHTML: "三号" }, fontsize);
- $$("option", { value: "20px", style: { fontSize: "14px" }, innerHTML: "小三" }, fontsize);
- $$("option", { value: "18.7px", style: { fontSize: "14px" }, innerHTML: "四号" }, fontsize);
- $$("option", { value: "16px", style: { fontSize: "14px" }, innerHTML: "小四" }, fontsize);
- $$("option", { value: "14px", style: { fontSize: "14px" }, innerHTML: "五号" }, fontsize);
- $$("option", { value: "12px", style: { fontSize: "14px" }, innerHTML: "小五" }, fontsize);
- $$("option", { value: "10px", style: { fontSize: "14px" }, innerHTML: "10" }, fontsize);
- $$("option", { value: "12px", style: { fontSize: "14px" }, innerHTML: "12" }, fontsize);
- $$("option", { value: "14px", style: { fontSize: "14px" }, innerHTML: "14" }, fontsize);
- $$("option", { value: "16px", style: { fontSize: "14px" }, innerHTML: "16" }, fontsize);
- $$("option", { value: "18px", style: { fontSize: "14px" }, innerHTML: "18" }, fontsize);
- $$("option", { value: "20px", style: { fontSize: "14px" }, innerHTML: "20" }, fontsize);
- $$("option", { value: "22px", style: { fontSize: "14px" }, innerHTML: "22" }, fontsize);
- $$("option", { value: "24px", style: { fontSize: "14px" }, innerHTML: "24" }, fontsize);
- $$("option", { value: "26px", style: { fontSize: "14px" }, innerHTML: "26" }, fontsize);
- $$("option", { value: "28px", style: { fontSize: "14px" }, innerHTML: "28" }, fontsize);
- $$("option", { value: "36px", style: { fontSize: "14px" }, innerHTML: "36" }, fontsize);
- $$("option", { value: "42px", style: { fontSize: "14px" }, innerHTML: "42" }, fontsize);
- $$("option", { value: "48px", style: { fontSize: "14px" }, innerHTML: "48" }, fontsize);
- $$("option", { value: "72px", style: { fontSize: "14px" }, innerHTML: "72" }, fontsize);
- return fontsize;
- };
- Namespace.register("U.UF.UI")
- U.UF.UI.Confirm = U.UF.UI.confirm = function (content, determineFun, cancelFun) {
-
- var _confirm = $$("div", { "style": { "cssText": "width: 100%; background: rgb(255,255,255);overflow:hidden; " } });
-
- var _content = $$("div", { "style": { "cssText": "width: 100%;" } }, _confirm);
-
- if (U.UF.C.isElement(content)) {
-
- U.selectEl(_content).append(content);
- } else {
- _content.style.cssText = "text-align: center; margin: 10px;";
-
- _content.innerHTML = content || '内容';
- }
-
- var _footer = $$("div", { "style": { "cssText": "height:28px; margin:14px 0;" } }, _confirm);
-
- $$("div", {
- "style": {
- "cssText": "text-align: center; color: rgb(255,255,255); width: 92px; line-height:28px; background: rgb(48,126,208); float: right; margin-right:29px; "
- },
- innerHTML: "确定",
- onclick: function () {
- var _bool = true;
- if (U.UF.C.isFunction(determineFun)) {
- _bool = determineFun();
- }
- if (_bool !== false) {
- U.UF.F.closeWindow(_form.form);
- }
- }
- }, _footer);
-
- $$("div", {
- "style": {
- "cssText": "text-align: center; color: rgb(255,255,255); width: 92px; line-height:28px; background: rgb(48,126,208); background: rgb(170,170,170); float: right; margin-right:21px;margin-left:29px;"
- },
- "innerHTML": "取消",
- "onclick": function () {
- U.UF.C.isFunction(cancelFun) && cancelFun();
- U.UF.F.closeWindow(_form.form);
- }
- }, _footer);
-
- var _form = new U.UF.UI.form(
- "提示",
- _confirm, {
- "style": {
- "cssText": "font-size: 14px; background: rgb(255,255,255); width: 310px; position: absolute; box-shadow: 0 0 10px 3px rgb(0,0,0); "
- }
- }, {
- "istop": true,
- "isenlarge": false,
- "isstretching": false,
- "isnarrow": false
- }, {
- "style": {
- "cssText": " background: rgb(59,88,120); padding: 5px; color: rgb(255,255,255); "
- }
- });
- return _form;
- }
- U.UF.UI.Dialog = U.UF.UI.Dialog = function (content, callBackFun) {
- var _dialog = $$("div", { "style": { "cssText": "width: 100%; background: #fff; overflow:hidden; " } });
- var _content = $$("div", { "style": { "cssText": "text-align: center; margin: 30px 20px 30px 20px; " } }, _dialog);
-
- if (U.UF.C.isElement(content)) {
- U.selectEl(_content).append(content);
- } else {
- _content.innerHTML = content || '内容';
- }
-
- var footer = $$("div", { "style": { "cssText": "height:45px;" } }, _dialog);
-
- var _form = new U.UF.UI.form("提示框", _dialog, {
- "style": {
- "cssText": "font-size: 14px; width: 300px; background:#fff; position: absolute; top: 100px; left: 40%; box-shadow: 0 0 10px 3px black; "
- }
- },
- null, {
- "style": { "cssText": "background: #3b5878; padding: 10px; color:#fff;" }
- });
-
- $$("div", {
- "style": {
- "cssText": "text-align: center; color: #fff; width: 30%; padding: 5px; background: #307ed0; float: right; margin: 0 12px 12px 0;"
- },
- innerHTML: "确定",
- onclick: function () {
- U.UF.C.isFunction(callBackFun) && callBackFun();
- U.UF.F.closeWindow(_form.form);
- }
- }, footer);
- }
- U.UF.UI.alertClick = function (content, attr) {
-
- var _content = $$("div", { "class": "USBalert_text", "style": { width: "100%" } });
-
- if (U.UF.C.isElement(content)) {
-
- U.selectEl(_content).append(content);
- } else {
- $$("div", { "style": { cssText: "text-align:center;padding:10px; margin:10px auto; word-break:break-word;" }, innerHTML: content || '内容' }, _content);
- }
-
- var _footer = $$("div", { "class": "USBalert_onclicks", style: { height: "43px" } }, _content);
-
- var _form = new U.UF.UI.form("提示框", _content, {
- "style": {
- "cssText": "font-size: 16px; width:320px; background: rgb(255,255,255);box-shadow: 0 0 10px 3px rgb(0,0,0); "
- }
- }, {
- "isnarrow": false,
- "isenlarge": false,
- isstretching: false
- }, {
- "style": {
- "cssText": "background: rgb(59,88,120); padding: 10px; color: rgb(255,255,255);"
- }
- });
-
- $$("div", { "style": { "cssText": "text-align: center; color: #fff; width: 30%;max-width:150px; padding: 5px; background: #307ed0; float: right; margin: 0 12px 12px 0;" }, innerHTML: "确定", onclick: function () { U.UF.F.closeWindow(_form.form); } }, _footer);
- }
- U.Alert = U.alert = function (c, t) {
- !t ? t = 3000 : "";
- var bg = $$("div", {
- "style": {
- "cssText": "padding: 12px 25px 12px 25px;font-size: 16px;max-width:300px;min-width:100px;color: rgba(255,255,255,1);background: rgba(0,0,0,0.75);border-radius: 10px;position: absolute;top:20%;left:0px;right:0px;margin:0px auto;text-align:center; word-break: break-word; "
-
- },
- innerHTML: c
- }, document.body);
- U.UF.F.topWindow(bg);
- setTimeout(function () {
- bg.parentNode.removeChild(bg);
- }, t);
- }
-
-
- ;
- Namespace.register("U.MD.UI.email");
- U.MD.UI.email = function () {
- };
- Namespace.register("U.MD.UI.face");
- U.MD.UI.face = function (button, el) {
- var i, _el1, _el2;
- if ($("#U_MD_UI_face")[0]) {
- if ($("#U_MD_UI_face")[0].style.display == "none") {
- U.selectEl("#U_MD_UI_face")[0].style.display = "block";
- } else {
- U.selectEl("#U_MD_UI_face")[0].style.display = "none";
- }
- } else {
- var _el = $$("div", { "style": { "position": "relative" } }, U.selectEl(button)[0]);
- _el1 = $$("div", { "id": "U_MD_UI_face", "className": "U_MD_UI_face", "onmousedown": U.UF.EV.stopBubble }, _el);
- _el2 = $$("div", { "className": "U_MD_UI_face_H" }, _el1);
- for (i = 0; i <= 104; i++) {
- $$("button", {
- "className": "U_MD_UI_face_C",
- "style": { "opacity": "0" },
- "onclick": U.UF.C.closure(function (i) {
- U.UF.EV.stopBubble();
- U.MD.UI.face.printEmoticon(_el1, i, U.UF.E.getRangeAt(), el)
- }, [i])
- }, _el2);
- }
-
- U.selectEl('body').unbind('click', U.MD.UI.face.externalClick);
- U.selectEl('body').bind('click', U.MD.UI.face.externalClick);
- }
- el.focus();
- };
- U.MD.UI.face.externalClick = function (e) {
- if (window.event.srcElement.tagName != "BUTTON" && U.selectEl("#U_MD_UI_face")[0]) {
- U.selectEl("#U_MD_UI_face")[0].style.display = "none";
- }
- }
- U.MD.UI.face.printEmoticon = function (el1, i, range, el) {
- var _imageurl = "/img/ChatingFaceGif/[face](" + i + ").gif";
- if (!range) {
- $$("img", { "onerror": U.MD.C.imgError, "src": _imageurl, "contentEditable": "true" }, U.selectEl(el)[0]);
- } else {
- var img = '<img contentEditable="true" src="' + _imageurl + '">';
- U.UF.E.addRange(img, null, true);
- }
- U.selectEl(el1)[0].style.display = "none";
- };
- Namespace.register("U.UF.UI")
- U.UF.UI.form = function (title, content, formattr, formfun, headattr, contentattr, headbottomattr, parentel) {
- var _this = this;
-
- if (formattr && U.UF.UI.form.allForm[formattr.id]) {
- var _this = U.UF.UI.form.allForm[formattr.id];
- }
-
- else {
-
- this.id = formattr && formattr.id ? formattr.id : Guid.newGuid();
-
- U.UF.UI.form.allForm[this.id] = this;
- }
- _this.ififrame = (U.UF.C.isElement(_this.content) && ((_this.content.tagName == "IFRAME" && _this.content.src == content.src) || ($("iframe", _this.content)[0] && $("iframe", _this.content)[0].src == $("iframe", content)[0].src)));
- _this.form;
- _this.header;
- _this.middle;
- _this.title = title;
- _this.content = _this.ififrame ? _this.content : content;
- _this.formattr = formattr;
- _this.headattr = headattr;
- _this.contentattr = contentattr;
- _this.headbottomattr = headbottomattr;
-
-
- if (formfun == null) {
- formfun = {};
- }
- _this.istop = null;
- if (formfun.istop != null) {
- _this.istop = formfun.istop;
- }
- _this.isdrag = true;
- if (formfun.isdrag != null) {
- _this.isdrag = formfun.isdrag;
- }
- _this.isstretching = true;
- if (formfun.isstretching != null) {
- _this.isstretching = formfun.isstretching;
- }
- _this.isenlarge = true;
- if (formfun.isenlarge != null) {
- _this.isenlarge = formfun.isenlarge;
- }
- _this.isnarrow = true;
- _this.narrowcallback = formfun.narrowcallback;
- if (formfun.isnarrow != null) {
- _this.isnarrow = formfun.isnarrow;
- }
- _this.isclose = true;
- _this.closecallback = formfun.closecallback;
- if (formfun.isclose != null) {
- _this.isclose = formfun.isclose;
- }
- _this.parentel = parentel || document.body;
- _this.create();
- return _this;
- }
- U.UF.UI.form.allForm = {};
- U.UF.UI.form.prototype = {
-
- create: function () {
- var i,
- _iframe,
- _resizefun,
- _formel,
- _headel,
- _contentel,
- _contentchildel,
- _stretchingel,
- _stretchinginfo,
- _headbottom,
- _enlargeel,
- _mousedown,
- _formattr = this.formattr || {},
- _headattr = this.headattr || {},
- _contentattr = this.contentattr || {},
- _replaceel = U.UF.UI.form.allForm[_formattr.id] ? U.UF.UI.form.allForm[_formattr.id].form : null
- ;
- if (!this.ififrame) {
-
- if (_formattr.style) {
- _formattr.style.cssText = _formattr.style.cssText || "";
- _formattr.style.cssText = "width: 70%; position: absolute; background-color: #fff; z-index: 10; border-radius: 1px; overflow: hidden; -moz-box-shadow:rgb(38 38 38) 0px 0px 12px 1px; -webkit-box-shadow:rgb(38 38 38) 0px 0px 12px 1px; box-shadow:rgb(38 38 38) 0px 0px 12px 1px; -moz- -webkit- border-radius:5px;" + _formattr.style.cssText;
- } else {
- _formattr.style = {
- cssText: "width: 70%; position: absolute; background-color: #fff; z-index: 10; border-radius: 1px; overflow: hidden; -moz-box-shadow:rgb(38 38 38) 0px 0px 12px 1px; -webkit-box-shadow:rgb(38 38 38) 0px 0px 12px 1px; box-shadow:rgb(38 38 38) 0px 0px 12px 1px; -moz- -webkit- border-radius:5px;"
- };
- }
- _formattr.close = U.UF.C.apply(this, function () {
- U.UF.F.closeWindow(this.form);
- });
- _formattr.usform = "true";
- _formattr.id = _formattr.id || "";
- _formattr.style = _formattr.style || {};
- if (_formattr.onresize) {
- _resizefun = _formattr.onresize;
- _mousedown = _formattr.onmousedown;
- _formattr.onresize = U.UF.C.apply(this, function () {
- this.size();
- if (_resizefun) {
- _resizefun();
- }
- });
- _formattr.onmousedown = U.UF.C.apply(this, function () {
-
- if (this.istop !== false) {
- this.top();
- }
- if (_mousedown) {
- _mousedown();
- }
- });
- } else if (_formattr.onresize !== false) {
- _formattr.onresize = U.UF.C.apply(this, function () {
- this.size();
- });
- }
-
- var _formel = $$("div", this.formattr);
-
- if (this.istop === true) {
- _formel.style.zIndex = "9999";
- _formel["__top__"] = "false";
- } else if (this.istop === false) {
- _formel["__top__"] = "false";
- }
- this.form = _formel;
-
- if (this.title !== false) {
-
- if (_headattr.style) {
- _headattr.style.cssText = _headattr.style.cssText || "";
- _headattr.style.cssText = "text-indent: 10px; color: White; line-height: inherit; font-size: 14px; height: 30px; line-height: 36px; background-color: rgb(48 48 48); overflow: hidden; color: White; font-size: 14px; overflow: hidden; " + _headattr.style.cssText;
- } else {
- _headattr.style = {
- cssText: "text-indent: 10px; color: White; line-height: inherit; font-size: 14px; height: 30px; line-height: 36px; background-color: rgb(48 48 48); overflow: hidden; color: White; font-size: 14px; overflow: hidden; "
- }
- }
-
- if (this.isdrag) {
- _headattr.onmousedown = function () {
- U.UF.F.drag(_formel);
- };
- }
-
- _headel = $$("div", _headattr, _formel);
-
- if (U.UF.C.isString(this.title)) {
- _headel.innerHTML = this.title;
- }
-
- else if (U.UF.C.isElement(this.title)) {
- _headel.appendChild(this.title);
- }
- this.header = _headel;
- }
-
- _contentel = $$("div", { "style": { "cssText": "width: 100%; position: relative;" } });
-
- _contentattr.usbody = "true";
-
- if (_contentattr.style) {
- _contentattr.style.cssText = _contentattr.style.cssText || "";
-
- _contentattr.style.cssText = "text-align: left; overflow: hidden;" + _contentattr.style.cssText;
- } else {
- _contentattr.style = {
- cssText: "text-align: left; "
- };
- }
-
- _contentchildel = $$("div", _contentattr, _contentel);
-
- if (U.UF.C.isString(this.content)) {
- _contentchildel.innerHTML = this.content;
- }
-
- else if (U.UF.C.isElement(this.content)) {
- _contentchildel.appendChild(this.content);
- }
- this.middle = _contentchildel;
-
- if (this.title === false && this.isdrag) {
- _contentel.onmousedown = function () {
- U.UF.F.drag(_formel);
- };
- }
-
- if (this.isstretching !== false) {
-
- _stretchingel = $$("div", { style: { "cssText": "display: block;" } }, _formel);
-
- _stretchinginfo = {
- "top": "cursor: n-resize; left: 0px; top: 0px; width: 100%; height: 5px;",
- "rightTop": "cursor: ne-resize; right: -2px; top: -2px; width: 12px; height: 12px;",
- "leftTop": "cursor: nw-resize; top: 0px; left: 0px; width: 12px; height: 12px;",
- "left": "cursor: w-resize; left: 0px; top: 0px; width: 5px; height: 100%;",
- "right": "cursor: e-resize; right: 0px; top: 0px; width: 5px; height: 100%;",
- "bottom": "cursor: s-resize; left: 0px; bottom: 0px; width: 100%; height: 5px;",
- "leftBottom": "cursor: sw-resize; left: -2px; bottom: -2px; width: 12px; height: 12px;",
- "rightBottom": "cursor: se-resize; right: -2px; bottom: -2px; width: 12px; height: 12px;"
- }
-
- for (i in _stretchinginfo) {
- $$("div", {
- "style": {
- "cssText": "position: absolute; overflow: hidden; display: block; z-index: 10;" + _stretchinginfo[i]
- },
- "onmousedown": U.UF.C.closure(function (scope, typename) {
-
- U.UF.F.stretching(_formel, typename, U.UF.C.apply(scope, scope.size));
- }, [this, i])
- }, _stretchingel);
- }
- }
-
- if (this.title !== false) {
- _headbottom = $$("div", {
- "style": { "cssText": "position: absolute; top: 5px; right: 0px; width: 80px; display: table-cell; vertical-align: middle;" }
- }, _formel);
- }
- if (this.isclose !== false) {
-
- $$("div", {
- "style": {
- "cssText": "background-image:url(../../../img/close.png); _background-image:url(/img/close.png);width: 14px; height: 14px; background-repeat: no-repeat; background-size: 100%; float: right; margin-right: 5px;margin-top:6px; cursor: pointer;"
- },
- "title": "点击关闭",
- "onmousedown": U.UF.EV.stopBubble,
- "onclick": U.UF.C.apply(this, function () {
- this.windowstate = "close";
- U.UF.F.closeWindow(this.form);
- try {
-
- if (U.MD.D.T.taskbar.close) {
- U.MD.D.T.taskbar.close({ "forms": _formel });
-
- }
- } catch (e) { }
-
- if (U.UF.C.isFunction(this.closecallback)) {
- this.closecallback();
- }
- })
- }, _headbottom);
- }
-
- if (this.isenlarge !== false) {
-
- _enlargeel = $$("div", {
- "style": {
- "cssText": "background-image:url(../../../img/max.png); _background-image:url(/img/max.png); background-size: 100%; float: right; margin-right: 10px; width: 17px; height: 17px; cursor: pointer;margin-top: 4px;"
- },
- "title": "最大化",
- "onmousedown": U.UF.EV.stopBubble,
-
- "onclick": function () {
- this.windowstate = "max";
- U.UF.F.windowZooming(_formel);
- }
- }, _headbottom);
-
- if (_headel) {
-
- _headel.ondblclick = U.UF.C.apply(_headel, function () {
- U.UF.EV.stopBubble(event);
-
- if (event.srcElement == this || U.UF.EL.isChild(this, event.srcElement)) {
- _enlargeel.onclick();
- }
- });
- }
- }
-
- if (this.isnarrow !== false) {
-
- $$("div", {
- "style": {
- "cssText": "background-image:url(../../../img/min.png); _background-image:url(/img/min.png);background-size: 100%; float: right; margin-right: 10px; margin-top: 3px; width: 20px; height: 20px; cursor: pointer;background-repeat: no-repeat;"
- },
- "title": "最小化",
- "onmousedown": U.UF.EV.stopBubble,
- "onclick": U.UF.C.apply(this, function () {
- this.windowstate = "min";
- U.UF.F.windowMinimize(_formel);
-
- if (U.UF.C.isFunction(this.narrowcallback)) {
- this.narrowcallback();
- }
- })
- }, _headbottom);
- }
-
- if (_replaceel && _replaceel.parentNode != null) {
- _replaceel.parentNode.replaceChild(_formel, _replaceel);
- }
-
- else {
- this.parentel.appendChild(_formel);
- }
- _formel.appendChild(_contentel);
- }
- else {
-
- if (this.closecallback && this.windowstate == "close") {
- try {
- if (this.content.tagName == "IFRAME") {
- this.content.src += '';
- }
- else {
- $("iframe", _this.content)[0].src += '';
- }
- }
- catch (e) {
- }
- }
- _formel = _replaceel;
- }
-
- if (_formel.style.top == "" && _formel.style.left == "" && _formel.style.right == "" && _formel.style.bottom == "") {
-
- U.UF.F.windowTopCenter(_formel);
- }
-
- else {
- U.UF.F.topWindow(_formel);
- }
-
- this.size();
- },
-
- top: function () {
- U.UF.F.topWindow(this.form);
- },
-
- size: function () {
- var _headheight = 0;
-
- if (this.header) {
- _headheight = this.header.clientHeight;
- }
-
- if (this.header) {
- this.middle.style.height = this.form.clientHeight - this.header.clientHeight + "px";
- } else {
- this.middle.style.height = this.form.clientHeight + "px";
- }
- }
- }
- U.UF.UI.form.windowResize = function () {
- var i,
- _style,
- _bodywidth = US.width,
- _bodyheight = US.height,
- _sizeinfo,
- _width,
- _height,
- _formel,
- _forms = U.UF.UI.form.allForm
- ;
-
- for (i in _forms) {
- _formel = _forms[i].form;
- if ($(_formel).css("display") != "none") {
- _style = {};
- _width = U.selectEl(_formel).css("width");
- _height = U.selectEl(_formel).css("height");
-
- _width = _width.indexOf("%") > -1 ? _width.toInt() / 100 : _formel.offsetWidth / _bodywidth;
- _height = _height.indexOf("%") > -1 ? _height.toInt() / 100 : _formel.offsetWidth / _bodyheight;
-
- if (_formel.style.right == "" || _formel.style.right == "auto") {
- _style.left = _formel.offsetLeft + (document.body.offsetWidth - _bodywidth) * ((1 - _width) / 2) + "px";
- }
-
- if (_formel.style.bottom == "" || _formel.style.bottom == "auto") {
- _style.top = _formel.offsetTop + (document.body.offsetHeight - _bodyheight) * ((1 - _height) / 2) + "px";
- }
-
- U.selectEl(_formel).addAttrArray({ "style": _style });
- }
- }
- }
- U.UF.UI.form.closeWindows = function () {
- var i;
- for (i in U.UF.UI.form.allForm) {
- if (U.UF.UI.form.allForm[i].isclose) {
- U.UF.UI.form.allForm[i].form.close();
- }
- }
- }
- Namespace.register("U.MD.UI.music");
- U.MD.UI.music = function (musicList, index, autoplay, parentEl) {
- var _music = U.MD.UI.music;
- var _musicBox;
- if (_musicBox = U.selectEl("#U_MD_UI_music_musicBox")[0]) {
-
-
-
-
-
-
-
-
- _musicBox.remove();
- }
- _music.create(parentEl);
- _music.Attr = {
- 'musicList': musicList,
- 'musicIndex': index,
- 'autoplay': autoplay,
- 'currentTime': null,
- 'endTime': null
- };
- _music.init();
- };
- U.MD.UI.music.Attr = null;
- U.MD.UI.music.htmlTemplate = ' <div class="U_MD_UI_music_leftCont">\n' +
- ' <div class="U_MD_UI_music_CoverBox">\n' +
- ' <img src="/img/Controls/Audio/pc/电脑图标.png" alt="" id="U_MD_UI_music_Cover">\n' +
- ' </div> <!-- 音乐封面图片 -->\n' +
- ' </div>\n' +
- ' <div class="U_MD_UI_music_rightCont">\n' +
- ' <div class="U_MD_UI_music_Name" id="U_MD_UI_music_Name"></div> <!-- 音乐名字 -->\n' +
- ' <div class="U_MD_UI_music_leftBtn" id="U_MD_UI_music_leftBtn"></div> <!-- 左按钮 -->\n' +
- ' <div class="U_MD_UI_music_pauseBtn U_MD_UI_music_playBtn" id="U_MD_UI_music_playBtn"></div> <!-- 播放/暂停 按钮 -->\n' +
- ' <div class="U_MD_UI_music_rightBtn" id="U_MD_UI_music_rightBtn"></div> <!-- 右按钮 -->\n' +
- ' <div class="U_MD_UI_music_soundOpen" id="U_MD_UI_music_soundSwitch"></div> <!-- 声音开关按钮 -->\n' +
- ' <div class="U_MD_UI_music_soundBox" id="U_MD_UI_music_soundBox"> <!-- 声音条盒子节点 -->\n' +
- ' <div class="U_MD_UI_music_soundBar" id="U_MD_UI_music_soundBar" style="width: 31px;"></div> <!-- 声音条 -->\n' +
- ' <div class="U_MD_UI_music_soundBall" id="U_MD_UI_music_soundBall" style="left: 31px;"></div> <!-- 声音球 -->\n' +
- ' </div>\n' +
- ' <div class="U_MD_UI_music_listBtn"></div> <!-- 右上角的列表按钮 -->\n' +
- ' <div class="U_MD_UI_music_shrinkBtn" id="U_MD_UI_music_shrinkBtn"></div> <!-- 右上角的缩小按钮 -->\n' +
- ' <div class="U_MD_UI_music_closeBtn" id="U_MD_UI_music_closeBtn"></div> <!-- 右上角的关闭按钮 -->\n' +
- ' </div>\n' +
- ' <div class="U_MD_UI_music_progressBox" id="U_MD_UI_music_progressBox"> <!-- 时间条盒子节点 -->\n' +
- ' <div class="U_MD_UI_music_progressBar" id="U_MD_UI_music_progressBar" style="width: 0.64px;"></div> <!-- 时间条 -->\n' +
- ' <div class="U_MD_UI_music_progressBall" id="U_MD_UI_music_progressBall" style="left: 0.64px;"></div> <!-- 时间球 -->\n' +
- ' </div>\n' +
- ' <audio id="U_MD_UI_music_audio" autoplay="" src=""></audio>';
- U.MD.UI.music.create = function (parentEl) {
- var _parentEl = parentEl || document.body;
- var _formclass = { "style": { "border": "none" }, "id": "U_MD_UI_music_musicBox", "className": "U_MD_UI_music_musicBox" };
- var _formattr = { isclose: false, isstretching: false, isenlarge: false, isnarrow: false };
- var _headclass = { "style": { "height": "13px", "background-color": "#cc5b5b" } };
- U.MD.UI.music.player = new U.UF.UI.form(false, U.MD.UI.music.htmlTemplate, _formclass, _formattr, _headclass);
- U.selectEl("#U_MD_UI_music_musicBox")[0].style.overflow = "";
-
- };
- U.MD.UI.music.init = function () {
- var _music = U.MD.UI.music;
- var _attr = _music.Attr;
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- var _musicList = _attr.musicList;
- var _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- var _playBtn = U.selectEl("#U_MD_UI_music_playBtn");
- var _Name = U.selectEl("#U_MD_UI_music_Name");
- var _corver = U.selectEl("#U_MD_UI_music_Cover");
- if (!_attr.autoplay) {
- _audio[0].pause();
- }
- _music.openBtnEvent();
- _music.shrinkBtnEvent();
- _music.soundControl();
- _music.playEvent();
- _music.switchMusic();
- _music.progressControl();
- _audio.bind('durationchange', function () {
- _attr.endTime = this.duration;
- _musicIndex = _attr.musicIndex;
- _Name[0].innerText = _musicList[_musicIndex].title;
- });
- _audio.bind("ended", function () {
- _musicIndex = _attr.musicIndex;
- var _listLength = _musicList.length - 1;
- if (_musicIndex === _listLength) {
- _attr.musicIndex = 0;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- } else {
- _attr.musicIndex++;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- }
- });
- };
- U.MD.UI.music.openBtnEvent = function () {
- var _music = U.MD.UI.music;
-
-
-
- U.selectEl("#U_MD_UI_music_closeBtn").bind('click', function () {
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- if (!_audio[0].paused) {
- U.selectEl("#U_MD_UI_music_playBtn").addClass('U_MD_UI_music_playBtn');
- _audio[0].pause();
- }
- U.UF.F.closeWindow(_music.player.form);
- U.selectEl('#U_MD_D_T_taskbar_music').remove();
-
-
- });
- };
- U.MD.UI.music.shrinkBtnEvent = function () {
- U.selectEl('#U_MD_UI_music_shrinkBtn').bind('click', function () {
- U.UF.F.windowMinimize(U.MD.UI.music.player.form);
- });
- };
- U.MD.UI.music.playEvent = function () {
- var _music = U.MD.UI.music;
- var _attr = _music.Attr;
- var _playbtn = U.selectEl("#U_MD_UI_music_playBtn");
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- _playbtn.bind('click', function () {
- if (!_audio[0].paused) {
- _playbtn.addClass('U_MD_UI_music_playBtn');
- _audio[0].pause();
- } else {
- _playbtn.removeClass('U_MD_UI_music_playBtn');
- _audio[0].play();
- }
- });
- };
- U.MD.UI.music.switchMusic = function () {
- var _music = U.MD.UI.music;
- var _attr = _music.Attr;
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- var _rightBtn = U.selectEl("#U_MD_UI_music_rightBtn");
- var _leftBtn = U.selectEl("#U_MD_UI_music_leftBtn");
- var _musicList = _attr.musicList;
- var _musicIndex = _attr.musicIndex;
- var _listLength = _musicList.length - 1;
- _rightBtn.bind('click', function () {
- _musicIndex = _attr.musicIndex;
- if (_musicIndex === _listLength) {
- _attr.musicIndex = 0;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- } else {
- _attr.musicIndex++;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- }
- });
- _leftBtn.bind('click', function () {
- _musicIndex = _attr.musicIndex;
- if (_musicIndex === 0) {
- _attr.musicIndex = _listLength;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- } else {
- _attr.musicIndex--;
- _musicIndex = _attr.musicIndex;
- _audio[0].src = _musicList[_musicIndex].src;
- }
- });
- };
- U.MD.UI.music.soundControl = function () {
- var _music = U.MD.UI.music;
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- var _soundBox = U.selectEl("#U_MD_UI_music_soundBox");
- var _soundBall = U.selectEl("#U_MD_UI_music_soundBall");
- var _soundBar = U.selectEl("#U_MD_UI_music_soundBar");
- var _boxWidth = _soundBox[0].clientWidth;
- var _volume = 0.5;
- var _soundSwitch = U.selectEl("#U_MD_UI_music_soundSwitch");
- _audio[0].volume = _volume;
- _soundBall[0].style.left = (_boxWidth * _volume) + "px";
- _soundBar[0].style.width = (_boxWidth * _volume) + "px";
- _soundSwitch.bind('click', function () {
- _music.toggleClass(this, 'U_MD_UI_music_soundClose');
- if ($(this).hasClass('U_MD_UI_music_soundClose')) {
- this._volume = _audio[0].volume;
- this._soundBallX = parseFloat(_soundBall.css("left"));
- this._soundBarW = parseFloat(_soundBar.css("width"));
- _soundBall[0].style.left = 0;
- _soundBar[0].style.width = 0;
- _audio[0].volume = 0;
- } else {
- if (!this._volume) {
- return;
- }
- _audio[0].volume = this._volume;
- _soundBall[0].style.left = this._soundBallX + "px";
- _soundBar[0].style.width = this._soundBarW + "px";
- }
- });
- _soundBox.bind('mousedown', function (e) {
- var _boxLeft = _music.getOffsetLeft(this);
- var _boxRight = _boxLeft + _boxWidth;
- var _mouseX = e.pageX;
- _mouseX = Math.max(_mouseX, _boxLeft);
- _mouseX = Math.min(_mouseX, _boxRight);
- var _dis = _mouseX - _boxLeft;
- _volume = Math.round(parseFloat(_dis / _boxWidth) * 100) / 100;
- _soundBall[0].style.left = (_boxWidth * _volume) + "px";
- _soundBar[0].style.width = (_boxWidth * _volume) + "px";
- _audio[0].volume = _volume;
- if (_audio[0].volume <= 0) {
- _soundSwitch.addClass('U_MD_UI_music_soundClose');
- } else {
- _soundSwitch.removeClass('U_MD_UI_music_soundClose');
- }
- });
- _soundBall.bind('mousedown', function (e) {
- U.UF.EV.stopBubble(e);
- var _oMouseX = e.pageX;
- var _soundDrapMove = function (e) {
- U.UF.EV.stopDefault(e);
- var _mouseX = e.pageX;
- var _dis = _mouseX - _oMouseX + _oX;
- _dis = Math.max(0, _dis);
- _dis = Math.min(_boxWidth, _dis);
- _soundBall[0].style.left = _dis + "px";
- _soundBar[0].style.width = _dis + "px";
- _volume = Math.round(parseFloat(_dis / _boxWidth) * 100) / 100;
- _audio[0].volume = _volume;
- if (_audio[0].volume <= 0) {
- _soundSwitch.addClass('U_MD_UI_music_soundClose');
- } else {
- _soundSwitch.removeClass('U_MD_UI_music_soundClose');
- }
- };
- var _soundDragUp = function () {
- U.selectEl(document).unbind('mousemove', _soundDrapMove);
- U.selectEl(document).unbind('mouseup', _soundDragUp);
- };
- var _oX = parseFloat(_soundBall.css("left"));
- U.selectEl(document).bind('mousemove', _soundDrapMove);
- U.selectEl(document).bind('mouseup', _soundDragUp)
- });
- };
- U.MD.UI.music.progressControl = function () {
- var _music = U.MD.UI.music;
- var _attr = _music.Attr;
- var _audio = U.selectEl("#U_MD_UI_music_audio");
- var _progressBox = U.selectEl("#U_MD_UI_music_progressBox");
- var _progressBall = U.selectEl("#U_MD_UI_music_progressBall");
- var _progressBar = U.selectEl("#U_MD_UI_music_progressBar");
- var _playbtn = U.selectEl("#U_MD_UI_music_playBtn");
- var _boxWidth = _progressBox[0].clientWidth;
- var _barFlag = true,
- _currentTime;
- _audio.bind('timeupdate', function () {
- if (!this.paused) {
- _playbtn.removeClass('U_MD_UI_music_playBtn');
- } else {
- _playbtn.addClass('U_MD_UI_music_playBtn');
- }
- if (_barFlag) {
- _currentTime = this.currentTime;
- var _speed = Math.round(parseFloat(_currentTime / _attr.endTime) * 10000) / 10000;
- _progressBall[0].style.left = (_boxWidth * _speed) + "px";
- _progressBar[0].style.width = (_boxWidth * _speed) + "px";
- }
- });
- _progressBox.bind('mousedown', function (e) {
- var _boxLeft = _music.getOffsetLeft(this);
- var _boxRight = _boxLeft + _boxWidth;
- var _mouseX = e.pageX;
- _mouseX = Math.max(_mouseX, _boxLeft);
- _mouseX = Math.min(_mouseX, _boxRight);
- var _dis = _mouseX - _boxLeft;
- _speed = Math.round(parseFloat(_dis / _boxWidth) * 10000) / 10000;
- _progressBall[0].style.left = (_boxWidth * _speed) + "px";
- _progressBar[0].style.width = (_boxWidth * _speed) + "px";
- _audio[0].currentTime = _attr.endTime * _speed;
- });
- _progressBall.bind('mousedown', function (e) {
- _barFlag = false;
- U.UF.EV.stopBubble(e);
- var _oMouseX = e.pageX;
- var _progressDrapMove = function (e) {
- U.UF.EV.stopDefault(e);
- var _mouseX = e.pageX;
- var _dis = _mouseX - _oMouseX + _oX;
- _dis = Math.max(0, _dis);
- _dis = Math.min(_boxWidth, _dis);
- _progressBall[0].style.left = _dis + "px";
- _progressBar[0].style.width = _dis + "px";
- _speed = Math.round(parseFloat(_dis / _boxWidth) * 10000) / 10000;
- _progressBall[0].style.left = (_boxWidth * _speed) + "px";
- _progressBar[0].style.width = (_boxWidth * _speed) + "px";
- _currentTime = _attr.endTime * _speed;
- };
- var _progressDragUp = function () {
- _barFlag = true;
- _audio[0].currentTime = _currentTime;
- U.selectEl(document).unbind('mousemove', _progressDrapMove);
- U.selectEl(document).unbind('mouseup', _progressDragUp);
- };
- var _oX = parseFloat(_progressBall.css("left"));
- U.selectEl(document).bind('mousemove', _progressDrapMove);
- U.selectEl(document).bind('mouseup', _progressDragUp)
- });
- };
- U.MD.UI.music.getOffsetLeft = function (obj) {
- var tmp = obj.offsetLeft;
- var val = obj.offsetParent;
- while (val != null) {
- tmp += val.offsetLeft;
- val = val.offsetParent;
- }
- return tmp;
- };
- U.MD.UI.music.secondToDate = function (result) {
- var m = Math.floor((result / 60 % 60));
- var s = Math.floor((result % 60));
- if (m < 10) {
- m = "0" + m;
- }
- if (s < 10) {
- s = "0" + s;
- }
- return result = m + ":" + s;
- };
- U.MD.UI.music.toggleClass = function (ele, cls) {
- if ($(ele).hasClass(cls)) {
- U.selectEl(ele).removeClass(cls);
- } else {
- U.selectEl(ele).addClass(cls);
- }
- };;
- Namespace.register("U.UF.P");
- U.UF.P.apply = function (fun, arr, el) {
- return function () {
- fun.apply(el, arr);
- }
- }
- U.UF.P.pagepId = 0;
- U.UF.P.PPage = U.UF.P.page = function (el, num, pagenum, page, fun) {
- this.PageNum = 0;
- this.Index = 0;
- this.Pageall = 0;
- this.init(el, num, pagenum, page, fun);
- }
- U.UF.P.page.prototype = {
- init: function (el, num, pagenum, page, fun) {
- this.PageNum = page;
- this.Index = page - 1;
- var _el = U.selectEl(el)[0];
- var _pagesum = Math.ceil(num / pagenum);
- this.Pageall = _pagesum;
-
- if (_el.getElementsByClassName('U_MD_F_Y')[0]) {
- return false;
- }
- U.UF.P.pagepId++;
- var _page = $$("div", { "className": "U_MD_F_Y" }, _el);
- var _pagenode = $$("div", { "className": "U_MD_F_YL" }, _page);
- var _firstEle = $$("div", { "className": "U_MD_F_YLO U_MD_F_Y_Button", "innerHTML": "首页", "title": "首页", "pid": U.UF.P.pagepId + "1" }, _pagenode);
- var _previousEle = $$("div", { "className": "U_MD_F_YLT U_MD_F_Y_Button", "title": "上一页", "pid": U.UF.P.pagepId + "3" }, _pagenode);
- var _pagenum = $$("div", { "className": "U_MD_F_YN" }, _pagenode);
- var _startpage;
- var _endpage = Math.min(_pagesum, Math.max(page + 5, 10));
- for (_startpage = Math.max(1, Math.min(page - 5, _pagesum - 10)); _startpage <= _endpage; _startpage++) {
- (function (i, el) {
-
-
-
- var _centerEle = $$("div", {
- "innerHTML": i,
- "pid": U.UF.P.pagepId + "5"
- }, _pagenum);
- i == page && (_centerEle.className = "U_MD_F_Y_Button_Active");
- _centerEle.onclick = U.UF.P.apply(function (i) {
- U.UF.P.centerEle(el, _centerEle);
- }, [_startpage], el)
- })(_startpage, this);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var _nextEle = $$("div", { "className": "U_MD_F_YLS U_MD_F_Y_Button", "title": "下一页", "pid": U.UF.P.pagepId + "4" }, _pagenode);
- var _lastEle = $$("div", { "className": "U_MD_F_YLF U_MD_F_Y_Button", "innerHTML": "尾页", "title": "尾页", "pid": U.UF.P.pagepId + "2" }, _pagenode);
- var _pages = $$("div", { "className": "U_MD_F_YR" }, _page);
-
- $$("span", { "innerHTML": "到" }, _pages);
-
- var _input = $$("input", { "type": "text" }, _pages);
- $$("span", { "innerHTML": "页" }, _pages);
- var _rightEle = $$("div", { "className": "U_MD_F_YRZ", "pid": U.UF.P.pagepId + "6", "innerHTML": "确定" }, _pages);
- if (this.PageNum < _pagesum + 1) {
- var _list = U.selectEl(".list" + U.UF.P.pagepId);
- for (var j = 1; j < _list.length + 1; j++) {
- if (this.PageNum == j) {
- U.selectEl(_list[this.PageNum - 1]).addClass("U_MD_F_Y_Button_Active");
- }
- }
- }
- _firstEle.onclick = U.UF.P.apply(this.fPage, [_firstEle, _pagesum, fun], this);
- _previousEle.onclick = U.UF.P.apply(this.fPage, [_previousEle, _pagesum, fun], this);
-
- U.UF.P.centerEle = function (el, el1) {
- U.UF.P.apply(el.fPage, [el1, _pagesum, fun], el)();
- }
- _nextEle.onclick = U.UF.P.apply(this.fPage, [_nextEle, _pagesum, fun], this);
- _lastEle.onclick = U.UF.P.apply(this.fPage, [_lastEle, _pagesum, fun], this);
- _rightEle.onclick = U.UF.P.apply(this.fPage, [_rightEle, _pagesum, fun, _input], this);
- _input.onkeyup = function () {
- if (event.keyCode == "13") {
- _rightEle.onclick();
- }
- }
- },
-
- fPage: function (el, pagesum, fun, input) {
- _el1 = el.pid;
- _el = _el1.charAt(_el1.length - 1);
- if (_el == 5) {
- _list = U.selectEl($(el).Parent()).Parent().children[2].children;
- } else if (_el == 6) {
- _list = U.selectEl($(el).Parent()).Parent().children[0].children[2].children;
- } else {
- _list = U.selectEl(el).Parent().children[2].children;
- }
- U.selectEl(".U_MD_F_Y_Button_Active", U.selectEl(el).Parent(3)).removeClass("U_MD_F_Y_Button_Active");
- if (_el == 1) {
- if (this.Index == 0) { this.Index++ }
- if (this.PageNum > 1) {
- U.selectEl(_list[0]).addClass("U_MD_F_Y_Button_Active");
- this.Index = 0;
- this.PageNum = 1
- this.pagefun(this.PageNum, _list, el);
- fun(this.PageNum);
- return;
- }
- U.selectEl(_list[--this.Index]).addClass("U_MD_F_Y_Button_Active");
- } else if (_el == 2) {
- if (this.PageNum < this.Pageall) {
- this.Index = pagesum;
- this.PageNum = this.Pageall;
- this.pagefun(this.PageNum, _list, el);
- fun(this.PageNum);
- return
- } else {
- U.selectEl(_list[this.Index]).addClass("U_MD_F_Y_Button_Active");
- }
- } else if (_el == 3) {
- if (this.Index > 0) {
- U.selectEl(_list[--this.Index]).addClass("U_MD_F_Y_Button_Active");
- this.PageNum--;
- this.pagefun(this.PageNum, _list, el);
- fun(this.PageNum);
- return
- } else {
- U.selectEl(_list[this.Index]).addClass("U_MD_F_Y_Button_Active");
- }
- } else if (_el == 4) {
- if (this.PageNum < this.Pageall) {
- U.selectEl(_list[++this.Index]).addClass("U_MD_F_Y_Button_Active");
- this.PageNum++;
- this.pagefun(this.PageNum, _list, el);
- fun(this.PageNum);
- return
- } else {
- U.selectEl(_list[this.Index]).addClass("U_MD_F_Y_Button_Active");
- }
- } else if (_el == 5) {
- this.pagefun(el, _list, el);
- fun(this.PageNum);
- return
- } else if (_el == 6) {
- var _number = new RegExp("^[0-9]*$")
- if (input.value.match(_number)) {
- if (input.value >= 1 && input.value <= this.Pageall) {
- this.PageNum = input.value;
- this.pagefun(this.PageNum, _list, el);
- fun(this.PageNum);
- } else {
- U.alert("无效的输入");
- U.selectEl(_list[this.Index]).addClass("U_MD_F_Y_Button_Active");
- }
- }
- }
- },
-
- pagefun: function (el, list, pel) {
- var _list = list;
- var elNum = parseInt(el.innerHTML) || el;
- U.selectEl(".U_MD_F_Y_Button_Active", pel).removeClass("U_MD_F_Y_Button_Active");
- var _listLength = Math.ceil(_list.length / 2);
- var Index;
- var preIndex = this.Index;
- var difference = null;
- var lastPage = parseInt($(_list)[$(_list).length - 1].innerText);
-
- if (!(elNum < _listLength || (elNum > this.Pageall - _listLength && elNum <= this.Pageall))) {
-
-
- if (!(Math.ceil(lastPage / elNum) < lastPage - elNum) && this.Index != 0) {
- difference = elNum - parseInt(_list[_listLength - 1].innerText);
- [].__proto__.forEach.apply($(_list), [function (value, index, ar) {
- value.innerText = parseInt(value.innerText) + difference;
- }])
- this.Index = _listLength - 1;
- } else {
-
- difference = elNum - parseInt(_list[_listLength - 1].innerText);
- [].__proto__.forEach.apply($(_list), [function (value, index, ar) {
- value.innerText = parseInt(value.innerText) + difference;
- }])
- this.Index = _listLength - 1;
- }
- } else if (elNum > this.Pageall - _listLength && elNum <= this.Pageall) {
- var elthis = this;
- [].__proto__.forEach.apply($(_list), [
- function (value, index, ar) {
- value.innerText = elthis.Pageall + 1 - ar.length + index;
- }
- ])
- } else if (elNum < _listLength) {
- [].__proto__.forEach.apply($(_list), [function (value, index, ar) {
- value.innerText = index + 1;
- }])
- }
-
- [].__proto__.forEach.apply(_list, [function (value, index, ar) {
- if (parseInt(value.innerHTML) == elNum) {
- Index = index;
- }
- }])
- this.Index = Index;
- this.PageNum = elNum;
- U.selectEl(_list[this.Index]).addClass("U_MD_F_Y_Button_Active");
- }
- }
- Namespace.register("U.MD.UI.picture");
- U.MD.UI.picture = function (arr, startPicNum) {
- if ($('#U_MD_UI_PictureForm')[0]) {
- if ($('#U_MD_UI_PictureForm')[0].style.display === 'none')
- U.selectEl('#U_MD_UI_PictureForm')[0].style.display = 'block';
- U.MD.UI.picture.DIVBOX = {
- "USERPICS": arr,
- "PICAREA": U.selectEl('#U_MD_UI_Picture_picArea')[0],
-
- "PICBOX": U.selectEl('#U_MD_UI_Picture_picBox')[0],
-
- 'FA': U.selectEl('#U_MD_UI_Picture_fa')[0]
- };
- U.MD.UI.picture.initloadPic(arr, startPicNum)
- return;
- }
- if (!arr.length)
- return
- U.MD.UI.picture.create(arr, startPicNum);
- U.MD.UI.picture.DIVBOX.PICAREA.onmousedown = function (e) { U.MD.UI.picture.mDown(U.MD.UI.picture.DIVBOX.PICAREA, U.MD.UI.picture.DIVBOX.PICBOX, e) }
- U.MD.UI.picture.wheel();
- }
- U.MD.UI.picture.FA = [
- { src: "/img/pictureView/add.png", id: "U_MD_UI_Picture_add" },
- { src: "/img/pictureView/narrow.png", id: "U_MD_UI_Picture_narrow" },
- { src: "/img/pictureView/prev.png", id: "U_MD_UI_Picture_prev" },
- { src: "/img/pictureView/next.png", id: "U_MD_UI_Picture_next" },
- { src: "/img/pictureView/turnLeft.png", id: "U_MD_UI_Picture_turnLeft" },
- { src: "/img/pictureView/turnRight.png", id: "U_MD_UI_Picture_turnRight" }
- ];
- U.MD.UI.picture.picnumber = 0;
- U.MD.UI.picture.rotatenum = 0;
- U.MD.UI.picture.originalSize = []
- U.MD.UI.picture.pics = [];
- U.MD.UI.picture.scalingvalue = 50;
- U.MD.UI.picture.focuspicsrc = '';
- U.MD.UI.picture.focuspicsize = '';
- U.MD.UI.picture.create = function (arr, startPicNum) {
- var _c = $$('div', { style: { height: "100%", "overflow": "hidden" }, id: "U_MD_UI_Picture_bossBox" });
- var _box = $$('div', { id: "U_MD_UI_Picture_picBox", className: 'U_MD_UI_Picture_picBox' }, _c);
- $$('div', { id: 'U_MD_UI_Picture_picArea', className: 'U_MD_UI_Picture_picArea' }, _box);
- var _functionalarea = $$('div', { style: { height: "60px", width: "100%", position: "absolute", bottom: "0", "background-color": "#ffffff", "text-align": "center" }, id: "U_MD_UI_Picture_fa" }, _c);
- new U.UF.UI.form(
- "<span id='U_MD_UI_Picture_imgInfo'></span> - <span id='U_MD_UI_Picture_r'>100%</span>",
- _c, { style: { width: document.documentElement.clientWidth / 1.5 + 'px', height: document.documentElement.clientHeight / 1.5 + 'px', position: "absolute" }, id: "U_MD_UI_PictureForm" }, { isdrag: true, isstretching: true, isenlarge: true, isclose: true, isnarrow: true }, { style: { "padding": "10px", "background-color": "#22508c" } }
- );
- _box.style.height = _box.clientHeight - 60 + 'px';
-
- U.MD.UI.picture.DIVBOX = {
- "USERPICS": arr,
- "PICAREA": U.selectEl('#U_MD_UI_Picture_picArea')[0],
-
- "PICBOX": U.selectEl('#U_MD_UI_Picture_picBox')[0],
-
- 'FA': U.selectEl('#U_MD_UI_Picture_fa')[0]
- };
-
- var _oDiv = $$('div', { style: { display: "inline-block", "line-height": "40px", "margin-top": "10px" } }, U.MD.UI.picture.DIVBOX.FA);
-
- for (var j = 0; j < U.MD.UI.picture.FA.length; j++) {
-
- var _span = $$('span', { style: { "background-image": "url(" + U.MD.UI.picture.FA[j].src + ")", width: "40px", height: "40px", display: "inline-block", margin: "0 15px" }, id: U.MD.UI.picture.FA[j].id }, _oDiv);
- }
- U.MD.UI.picture.initloadPic(null, startPicNum);
-
- U.selectEl('#U_MD_UI_Picture_add')[0].onclick = U.UF.C.apply(this, function () {
- this.changeSize(U.MD.UI.picture.scalingvalue, U.MD.UI.picture.rotatenum)
- });
-
- U.selectEl('#U_MD_UI_Picture_narrow')[0].onclick = U.UF.C.apply(this, function () {
- this.changeSize(-U.MD.UI.picture.scalingvalue, U.MD.UI.picture.rotatenum)
- });
-
- U.selectEl('#U_MD_UI_Picture_prev')[0].onclick = U.UF.C.apply(this, function () {
- this.prevPic(0)
- });
-
- U.selectEl('#U_MD_UI_Picture_next')[0].onclick = U.UF.C.apply(this, function () {
- this.prevPic(1)
- });
-
- U.selectEl('#U_MD_UI_Picture_turnLeft')[0].onclick = U.UF.C.apply(this, function () {
- this.turn(1)
- });
-
- U.selectEl('#U_MD_UI_Picture_turnRight')[0].onclick = U.UF.C.apply(this, function () {
- this.turn(0)
- });
- _c.onresize = function () {
- _box.style.height = _c.clientHeight - 60 + 'px';
- };
- _box.onresize = function () {
- U.MD.UI.picture.checkHeight();
- }
- }
- U.MD.UI.picture.initloadPic = function (arr, startPicNum) {
- if (arr) {
- U.MD.UI.picture.DIVBOX.PICAREA.innerHTML = "";
- U.MD.UI.picture.DIVBOX.PICAREA.style = null;
- U.MD.UI.picture.picnumber = startPicNum || 0;
- U.MD.UI.picture.rotatenum = 0;
- U.MD.UI.picture.DIVBOX.USERPICS = arr
- } else {
- U.MD.UI.picture.picnumber = startPicNum >= 0 ? startPicNum : 0;
- }
-
- U.MD.UI.picture.createPic();
-
- U.MD.UI.picture.pics = U.selectEl('#U_MD_UI_Picture_picArea > ul > li > img');
- U.MD.UI.picture.pics[U.MD.UI.picture.picnumber].onload = U.UF.C.apply(this, function () {
-
- this.originalSize = this.getImgNaturalDimensions(U.MD.UI.picture.pics[U.MD.UI.picture.picnumber]);
-
- this.checkHeight();
- });
- }
- U.MD.UI.picture.createPic = function () {
-
- var _ul = $$('ul', { id: "ul" }, U.MD.UI.picture.DIVBOX.PICAREA);
-
- for (var i = 0; i < U.MD.UI.picture.DIVBOX.USERPICS.length; i++) {
-
- var _li = $$('li', {}, _ul);
- if (typeof U.MD.UI.picture.DIVBOX.USERPICS[i] === 'object') {
-
- if (i === U.MD.UI.picture.picnumber) {
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.UI.picture.DIVBOX.USERPICS[i].src }, _li);
- U.MD.UI.picture.focuspicsrc = U.MD.UI.picture.DIVBOX.USERPICS[i].src;
- if (U.MD.UI.picture.DIVBOX.USERPICS[i].size)
- U.MD.UI.picture.focuspicsize = U.MD.UI.picture.DIVBOX.USERPICS[i].size;
- } else {
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.UI.picture.DIVBOX.USERPICS[i].src, style: { display: "none" } }, _li);
- }
- } else if (typeof U.MD.UI.picture.DIVBOX.USERPICS[i] === 'string') {
- if (i === U.MD.UI.picture.picnumber) {
-
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.UI.picture.DIVBOX.USERPICS[i] }, _li);
- U.MD.UI.picture.focuspicsrc = U.MD.UI.picture.DIVBOX.USERPICS[i];
- } else {
- $$('img', { "onerror": U.MD.C.imgError, src: U.MD.UI.picture.DIVBOX.USERPICS[i], style: { display: "none" } }, _li);
- }
- }
- }
- }
- U.MD.UI.picture.turn = function (num) {
-
- if (num) {
- U.MD.UI.picture.rotatenum--;
- U.MD.UI.picture.rotatenum < 0 ? U.MD.UI.picture.rotatenum = 3 : U.MD.UI.picture.rotatenum;
- } else {
- U.MD.UI.picture.rotatenum++;
- U.MD.UI.picture.rotatenum > 3 ? U.MD.UI.picture.rotatenum = 0 : U.MD.UI.picture.rotatenum;
- }
- U.MD.UI.picture.rotating();
- }
- U.MD.UI.picture.rotating = function () {
-
- var val = "rotate(" + U.MD.UI.picture.rotatenum * 90 + "deg)";
-
- if (U.MD.UI.picture.rotatenum % 2 !== 0) {
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.width = U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - 20 + 'px';
-
- U.MD.UI.picture.compatibleRotate(U.MD.UI.picture.DIVBOX.PICAREA, val);
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = (U.MD.UI.picture.DIVBOX.PICAREA.clientWidth / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / 2) + 10 + 'px';
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth / 2 + 'px';
-
- if ((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i) == "8.") || (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i) == "7.")) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = "10px";
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / 2 + 'px';
- }
- } else {
-
- U.MD.UI.picture.DIVBOX.PICAREA.setAttribute('style', '');
-
- U.MD.UI.picture.compatibleRotate(U.MD.UI.picture.DIVBOX.PICAREA, val);
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.width = U.MD.UI.picture.originalSize[0] > U.MD.UI.picture.DIVBOX.PICAREA.clientWidth + 150 ? '1290px' : U.MD.UI.picture.DIVBOX.PICAREA.clientWidth + 150;
-
- U.MD.UI.picture.checkHeight();
- }
-
- U.selectEl('#U_MD_UI_Picture_r')[0].innerText = Math.round((U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / U.MD.UI.picture.originalSize[1]) * 100) + '%';
- }
- U.MD.UI.picture.compatibleRotate = function (el, val) {
-
- el.style.webkitTransform = val;
- el.style.MozTransform = val;
- el.style.mturnsTransform = val;
- el.style.OTransform = val;
- el.style.transform = val;
-
- if ((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i) == "8.") || (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i) == "7."))
- el.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(rotation=" + Math.abs(U.MD.UI.picture.rotatenum) + ")";
- }
- U.MD.UI.picture.prevPic = function (num) {
-
- U.MD.UI.picture.pics[U.MD.UI.picture.picnumber].style.display = 'none';
- if (num) {
-
- U.MD.UI.picture.picnumber++;
-
- if (U.MD.UI.picture.picnumber > U.MD.UI.picture.pics.length - 1)
- U.MD.UI.picture.picnumber = 0;
- } else {
-
- U.MD.UI.picture.picnumber--;
-
- if (U.MD.UI.picture.picnumber < 0)
- U.MD.UI.picture.picnumber = U.MD.UI.picture.pics.length - 1;
- }
- if (U.MD.UI.picture.DIVBOX.USERPICS[U.MD.UI.picture.picnumber].size)
- U.MD.UI.picture.focuspicsize = U.MD.UI.picture.DIVBOX.USERPICS[U.MD.UI.picture.picnumber].size;
- if (U.MD.UI.picture.DIVBOX.USERPICS[U.MD.UI.picture.picnumber].src)
- U.MD.UI.picture.focuspicsrc = U.MD.UI.picture.DIVBOX.USERPICS[U.MD.UI.picture.picnumber].src;
-
- U.MD.UI.picture.pics[U.MD.UI.picture.picnumber].style.display = 'block';
-
- U.MD.UI.picture.originalSize = U.MD.UI.picture.getImgNaturalDimensions(U.MD.UI.picture.pics[U.MD.UI.picture.picnumber]);
-
- U.MD.UI.picture.DIVBOX.PICAREA.setAttribute('style', '');
-
- U.MD.UI.picture.checkHeight();
-
- U.MD.UI.picture.rotatenum = 0;
- }
- U.MD.UI.picture.checkHeight = function () {
-
- var _proportion = U.MD.UI.picture.originalSize[0] / U.MD.UI.picture.originalSize[1];
-
- if (U.MD.UI.picture.originalSize[1] > U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - 40 || U.MD.UI.picture.originalSize[0] > U.MD.UI.picture.DIVBOX.PICBOX.clientWidth) {
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.width = Math.floor((U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - 40) * _proportion) + 'px';
- } else {
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.width = U.MD.UI.picture.originalSize[0] + 'px';
-
- }
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = (U.MD.UI.picture.DIVBOX.PICBOX.clientWidth - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth) / 2 + 'px';
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = (U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + 'px';
- if (typeof U.MD.UI.picture.DIVBOX.USERPICS[0] === 'object')
- U.selectEl('#U_MD_UI_Picture_imgInfo')[0].innerText = U.MD.UI.picture.focuspicsrc.toLowerCase().split('/').splice(-1)[0] + "(" + U.MD.UI.picture.originalSize[0] + "*" + U.MD.UI.picture.originalSize[1] + "px " + U.MD.UI.picture.focuspicsize + ")";
- else if (typeof U.MD.UI.picture.DIVBOX.USERPICS[0] === 'string')
- U.selectEl('#U_MD_UI_Picture_imgInfo')[0].innerText = U.MD.UI.picture.DIVBOX.USERPICS[U.MD.UI.picture.picnumber].toLowerCase().split('/').splice(-1)[0] + "(" + U.MD.UI.picture.originalSize[0] + "*" + U.MD.UI.picture.originalSize[1] + "px)";
- U.selectEl('#U_MD_UI_Picture_r')[0].innerText = Math.round((U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / U.MD.UI.picture.originalSize[1]) * 100) + '%';
- }
- U.MD.UI.picture.getImgNaturalDimensions = function (img) {
- var nWidth, nHeight;
- if (img.naturalWidth) {
- nWidth = img.naturalWidth;
- nHeight = img.naturalHeight
- } else {
- var image = new Image();
- image.src = img.src;
- nWidth = image.width;
- nHeight = image.height;
- }
- return [nWidth, nHeight]
- }
- U.MD.UI.picture.drag = function (dragEl, bossEl) {
- dragEl.onmousedown = function (e) {
- U.MD.UI.picture.mDown(dragEl, bossEl, e)
- }
- }
- U.MD.UI.picture.mDown = function (dragEl, bossEl, e) {
- e = e || window.event;
-
- var _distanceX = e.clientX - dragEl.offsetLeft;
-
- var _distanceY = e.clientY - dragEl.offsetTop;
- bossEl.onmousemove = function (e) {
- U.MD.UI.picture.mMove(dragEl, bossEl, _distanceX, _distanceY, e);
- }
-
- bossEl.onmouseup = function (e) {
- bossEl.onmousemove = null;
- bossEl.onmouseup = null;
- };
-
- if (e.preventDefault) {
-
- e.preventDefault();
- } else {
-
- dragEl.ondragstart = function () {
- return false;
- };
- dragEl.onselectstart = function () {
- return false;
- };
- }
- }
- U.MD.UI.picture.mMove = function (dragEl, bossEl, _distanceX, _distanceY, e) {
- e = e || window.event;
-
- var _left = e.clientX - _distanceX,
- _top = e.clientY - _distanceY;
-
- _left = U.MD.UI.picture.rotatenum % 2 === 0 ? Math.min(bossEl.clientWidth - bossEl.clientWidth / 8, _left) : Math.min(bossEl.clientWidth - bossEl.clientWidth / 8 - dragEl.clientWidth / 2 + dragEl.clientHeight / 2, _left);
-
- _left = U.MD.UI.picture.rotatenum % 2 === 0 ? Math.max(-dragEl.clientWidth + bossEl.clientWidth / 8, _left) : Math.max(-dragEl.clientWidth + bossEl.clientWidth / 8 + dragEl.clientWidth / 2 - dragEl.clientHeight / 2, _left);
-
- _top = U.MD.UI.picture.rotatenum % 2 === 0 ? Math.min(bossEl.clientHeight - bossEl.clientHeight / 8, _top) : Math.min(bossEl.clientHeight - bossEl.clientHeight / 8 + (dragEl.clientWidth - dragEl.clientHeight) / 2, _top);
-
- _top = U.MD.UI.picture.rotatenum % 2 === 0 ? Math.max(-dragEl.clientHeight + bossEl.clientHeight / 8, _top) : Math.max(-dragEl.clientHeight + bossEl.clientHeight / 8 - (dragEl.clientWidth - dragEl.clientHeight) / 2, _top);
-
- dragEl.style.left = _left + 'px';
- dragEl.style.top = _top + 'px';
- }
- U.MD.UI.picture.wheel = function () {
- U.MD.UI.picture.DIVBOX.PICBOX.onmousewheel = function () {
- this.getWheelDalta()
- }.bind(this);
- }
- U.MD.UI.picture.getWheelDalta = function (e) {
- e = e || window.event;
- var delta = 0;
-
- if (e.wheelDelta) {
-
- delta = e.wheelDelta / 120;
- if (window.opera) delta = -delta;
- } else if (e.detail) {
-
- delta = -e.detail / 3;
- }
-
- if (delta > 0) {
- U.MD.UI.picture.changeSize(U.MD.UI.picture.scalingvalue);
- } else {
- U.MD.UI.picture.changeSize(-U.MD.UI.picture.scalingvalue);
- }
-
- prevent(event);
- function prevent(evt) {
- if (evt.preventDefault) {
- evt.preventDefault();
- } else {
- evt.returnValue = false;
- }
- }
- }
- U.MD.UI.picture.changeSize = function (multiple) {
-
- var _addOver, _afterH, _afterW;
-
- _afterH = U.MD.UI.picture.DIVBOX.PICAREA.clientHeight;
- _afterW = U.MD.UI.picture.DIVBOX.PICAREA.clientWidth;
- _addOver = U.MD.UI.picture.DIVBOX.PICAREA.clientWidth + multiple;
-
- if ((_addOver / U.MD.UI.picture.originalSize[0]) * 100 < 20 && _addOver < 200) {
- return;
- } else if (((U.MD.UI.picture.DIVBOX.PICAREA.clientHeight + multiple) / U.MD.UI.picture.originalSize[1]) * 100 > 1000) {
- return
- }
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.width = _addOver + 'px';
-
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop - (U.MD.UI.picture.DIVBOX.PICAREA.clientHeight - _afterH) / 2 + 'px';
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft - multiple / 2 + 'px';
-
- if (((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i) == "8.") || (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i) == "7.")) && U.MD.UI.picture.rotatenum % 2 !== 0) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / 2 + 'px';
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICBOX.clientHeight / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth / 2 + 'px';
- }
-
- var topY = U.MD.UI.picture.DIVBOX.PICAREA.clientHeight + U.MD.UI.picture.DIVBOX.PICAREA.offsetTop <= U.MD.UI.picture.DIVBOX.PICBOX.clientHeight / 8 ||
- ((U.MD.UI.picture.DIVBOX.PICAREA.clientWidth - (U.MD.UI.picture.DIVBOX.PICAREA.clientWidth - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + U.MD.UI.picture.DIVBOX.PICAREA.offsetTop <= U.MD.UI.picture.DIVBOX.PICBOX.clientHeight / 8) && U.MD.UI.picture.rotatenum % 2 !== 0),
- bottomY = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop >= U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - U.MD.UI.picture.DIVBOX.PICBOX.clientHeight / 8 ||
- ((Math.abs(U.MD.UI.picture.DIVBOX.PICBOX.clientHeight - (U.MD.UI.picture.DIVBOX.PICAREA.clientWidth - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 - U.MD.UI.picture.DIVBOX.PICAREA.offsetTop) <= U.MD.UI.picture.DIVBOX.PICBOX.clientHeight / 8) && U.MD.UI.picture.rotatenum % 2 !== 0),
- leftX = U.MD.UI.picture.DIVBOX.PICAREA.clientWidth + U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft <= U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 8 ||
- (U.MD.UI.picture.DIVBOX.PICAREA.clientHeight + (U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft + (U.MD.UI.picture.DIVBOX.PICAREA.clientWidth - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight / 2) <= U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 8 && U.MD.UI.picture.rotatenum % 2 !== 0),
- rightX = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft >= U.MD.UI.picture.DIVBOX.PICBOX.clientWidth - U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 8 ||
- ((U.MD.UI.picture.DIVBOX.PICBOX.clientWidth - (U.MD.UI.picture.DIVBOX.PICAREA.clientWidth - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 - U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft) <= U.MD.UI.picture.DIVBOX.PICBOX.clientWidth / 8 && U.MD.UI.picture.rotatenum % 2 !== 0);
- if (topY) {
- if (U.MD.UI.picture.rotatenum % 2 === 0) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop + (_afterH - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + 'px';
- } else {
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop + (_afterW - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth) / 2 + 'px';
- }
- }
- if (bottomY) {
- if (U.MD.UI.picture.rotatenum % 2 === 0) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop - (_afterH - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + 'px';
- } else {
- U.MD.UI.picture.DIVBOX.PICAREA.style.top = U.MD.UI.picture.DIVBOX.PICAREA.offsetTop - (_afterW - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth) / 2 + 'px';
- }
- }
- if (leftX) {
- if (U.MD.UI.picture.rotatenum % 2 === 0) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft + (_afterW - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth) / 2 + 'px';
- } else {
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft + (_afterH - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + 'px';
- }
- }
- if (rightX) {
- if (U.MD.UI.picture.rotatenum % 2 === 0) {
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft - (_afterW - U.MD.UI.picture.DIVBOX.PICAREA.clientWidth) / 2 + 'px';
- } else {
- U.MD.UI.picture.DIVBOX.PICAREA.style.left = U.MD.UI.picture.DIVBOX.PICAREA.offsetLeft - (_afterH - U.MD.UI.picture.DIVBOX.PICAREA.clientHeight) / 2 + 'px';
- }
- }
- U.selectEl('#U_MD_UI_Picture_r')[0].innerText = Math.floor((U.MD.UI.picture.DIVBOX.PICAREA.clientWidth / U.MD.UI.picture.originalSize[0]) * 100) + '%';
- };
- Namespace.register("U.MD.UI.video");
- U.MD.UI.video = function (src, width, height, autoplay, parent) {
- var _autoplay = autoplay || false;
- var _intervalTemp = null;
- var _volumeTemp = null;
- var _moving = false;
- var _tempHeight = "";
- var _tempWidth = "";
- var _fullscreen = false;
-
- var _els = U.MD.UI.video.appendEle(src, width, height, _autoplay, parent);
-
- U.MD.UI.video.addEvent(_els, _intervalTemp, _volumeTemp, _moving, height, width, _fullscreen);
- return _els;
- };
- U.MD.UI.video.appendEle = function (src, width, height, autoplay, parent) {
- var els = {};
-
- els.videoDiv = $$("div", { "className": "U_MD_UI_video_VideoDiv", "style": { "width": width + "px", "height": height + "px" } }, parent);
-
- els.video = $$("video", {
- "src": src,
- "className": "U_MD_UI_video_VideoMain",
- "autoplay": autoplay,
- "preload": "auto"
- }, els.videoDiv);
-
- els.controls = $$("div", { "className": "U_MD_UI_video_VideoControls" }, els.videoDiv);
-
- els.playPauseBtn = $$("div", { "className": "U_MD_UI_video_PlayPauseButton U_MD_UI_video_PlayIcon" }, els.controls);
-
- els.currentTimeDiv = $$("div", { "className": "U_MD_UI_video_Time", "innerHTML": "00:00" }, els.controls);
-
- els.progress = $$("div", { "className": "U_MD_UI_video_Progress" }, els.controls);
-
- els.progressCurrentTime = $$("div", { "className": "U_MD_UI_video_ProgressCurrentTime" }, els.progress);
-
- els.progressCircle = $$("div", { "className": "U_MD_UI_video_ProgressCircle" }, els.progressCurrentTime);
-
- els.DurationDiv = $$("div", {
- "className": "U_MD_UI_video_Time",
- "innerHTML": "00:00",
- "onselectstart": "return false;"
- }, els.controls);
-
- els.soundControls = $$("div", { "className": "U_MD_UI_video_SoundControls" }, els.controls);
-
- els.soundProgress = $$("div", { "className": "U_MD_UI_video_SoundProgress" }, els.controls);
-
- els.soundProgressCurrent = $$("div", { "className": "U_MD_UI_video_SoundProgressCurrent", "style": { "width": "100%" } }, els.soundProgress);
-
- els.fullScreenBtn = $$("div", { "className": "U_MD_UI_video_FullScreen" }, els.controls);
- return els;
- };
- U.MD.UI.video.addEvent = function (els, intervalTemp, volumeTemp, moving, tempHeight, tempWidth, fullscreen) {
-
- els.playPauseBtn.onclick = function (event) {
- U.MD.UI.playPauseBtnClick(event, els);
- };
- if (els.videoDiv.onwebkitfullscreenchange !== undefined) {
- els.videoDiv.onwebkitfullscreenchange = function () {
- var rtn = U.MD.UI.video.fullscreenChange(fullscreen, tempHeight, tempWidth, els);
- fullscreen = rtn[0];
- tempHeight = rtn[1];
- tempWidth = rtn[2];
- }
- } else if (els.videoDiv.onfullscreenchange !== undefined) {
- els.videoDiv.onfullscreenchange = function () {
- var rtn = U.MD.UI.video.fullscreenChange(fullscreen, tempHeight, tempWidth, els);
- fullscreen = rtn[0];
- tempHeight = rtn[1];
- tempWidth = rtn[2];
- }
- } else if (els.videoDiv.onmozfullscreenchange !== undefined) {
- els.videoDiv.onmozfullscreenchange = function () {
- var rtn = U.MD.UI.video.fullscreenChange(fullscreen, tempHeight, tempWidth, els);
- fullscreen = rtn[0];
- tempHeight = rtn[1];
- tempWidth = rtn[2];
- }
- }
-
- els.fullScreenBtn.onclick = function () {
- U.MD.UI.video.fullscreenClick(fullscreen, els);
- };
-
- els.progressCircle.onmousedown = function (event) {
- U.MD.UI.video.circleMove(event, moving, els);
- };
-
- els.soundProgress.onmousedown = function (event) {
- U.MD.UI.video.soundProgressMove(event, els, moving);
- };
-
- els.progress.onmousedown = function (event) {
- U.MD.UI.video.progressMove(event, els, moving);
- };
-
- els.video.onpause = function () {
- els.playPauseBtn.className = "U_MD_UI_video_PlayPauseButton U_MD_UI_video_PlayIcon";
- clearInterval(intervalTemp);
- };
-
- els.video.onplay = function () {
- els.playPauseBtn.className = "U_MD_UI_video_PlayPauseButton U_MD_UI_video_PauseIcon";
- intervalTemp = U.MD.UI.video.setInterval(moving, els);
- };
-
- els.video.oncanplay = function () {
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
- };
-
- els.soundControls.onclick = function () {
- volumeTemp = U.MD.UI.video.muteClick(els, volumeTemp, moving);
- };
-
- els.videoDiv.onclick = function () {
-
- };
- };
- U.MD.UI.video.displayControls = function (event, els) {
- var _target = event.target;
- if (_target === els.video || _target === els.videoDiv) {
- if (els.controls.style.display === "none") {
- els.controls.style.display = "block";
- } else {
- els.controls.style.display = "none";
- }
- }
- };
- U.MD.UI.playPauseBtnClick = function (event, els) {
- var _el = event.target;
- if (_el.className === "U_MD_UI_video_PlayPauseButton U_MD_UI_video_PlayIcon") {
- els.video.play();
- } else {
- els.video.pause();
- }
- };
- U.MD.UI.video.muteClick = function (els, volumeTemp, moving) {
- if (els.video.volume !== 0) {
- volumeTemp = els.video.volume;
- els.video.volume = 0;
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
- } else if (els.video.volume === 0 && volumeTemp !== null) {
- els.video.volume = volumeTemp;
- volumeTemp = null;
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
- }
- return volumeTemp;
- };
- U.MD.UI.video.fullscreenClick = function (fullscreen, els) {
- if (!fullscreen) {
- if (els.videoDiv.requestFullScreen) {
- els.videoDiv.requestFullScreen();
- } else if (els.videoDiv.webkitRequestFullScreen) {
- els.videoDiv.webkitRequestFullScreen();
- } else if (els.videoDiv.mozRequestFullScreen) {
- els.videoDiv.mozRequestFullScreen();
- }
- } else {
- if (document.exitFullScreen) {
- document.exitFullScreen();
- } else if (document.webkitCancelFullScreen) {
- document.webkitCancelFullScreen();
- } else if (document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- } else if (document.mozExitFullScreen) {
- document.mozExitFullScreen();
- }
- }
- };
- U.MD.UI.video.fullscreenChange = function (fullscreen, tempHeight, tempWidth, els) {
- if (!fullscreen) {
-
-
- els.videoDiv.style.height = "100vh";
- els.videoDiv.style.width = "100vw";
- els.videoDiv.style.position = "absolute";
- els.videoDiv.style.top = "0";
- els.videoDiv.style.left = "0";
- els.videoDiv.style.zIndex = "999";
- } else {
- els.videoDiv.style.height = tempHeight + "px";
- els.videoDiv.style.width = tempWidth + "px";
- els.videoDiv.style.position = "";
- els.videoDiv.style.top = "";
- els.videoDiv.style.left = "";
- els.videoDiv.style.zIndex = "";
- }
- fullscreen = !fullscreen;
- return [fullscreen, tempHeight, tempWidth];
- };
- U.MD.UI.video.timeFormat = function (time) {
- var _sec = parseInt(time % 60);
- var _min = parseInt(parseInt(time) / 60);
- (_sec < 10) ? _sec = "0" + _sec : _sec;
- (_min < 10) ? _min = "0" + _min : _min;
- return _min + ":" + _sec;
- };
- U.MD.UI.video.flushInfo = function (moving, currentTimeDiv, DurationDiv, progressCurrentTime, soundProgressCurrent, video) {
- if (moving) return;
- currentTimeDiv.innerHTML = U.MD.UI.video.timeFormat(video.currentTime);
- DurationDiv.innerHTML = U.MD.UI.video.timeFormat(video.duration);
- progressCurrentTime.style.width = video.currentTime / video.duration * 100 + "%";
- soundProgressCurrent.style.width = video.volume * 100 + "%";
- };
- U.MD.UI.video.getScreenLeft = function (el) {
- var _rtnLeft = el.offsetLeft;
- var _parent = el.offsetParent;
- while (_parent != null) {
- _rtnLeft += _parent.offsetLeft;
- _parent = _parent.offsetParent;
- }
- return _rtnLeft;
- };
- U.MD.UI.video.setInterval = function (_moving, _els) {
- return setInterval(function () {
- U.MD.UI.video.flushInfo(_moving, _els.currentTimeDiv, _els.DurationDiv, _els.progressCurrentTime, _els.soundProgressCurrent, _els.video);
- }, 500);
- };
- U.MD.UI.video.circleMove = function (event, moving, els) {
- moving = true;
- var _e = event;
- var _content = event.currentTarget;
- var _startX = _e.pageX;
- var _currentProgress = _content.parentElement;
- var _progress = _currentProgress.parentElement;
- els.videoDiv.onmousemove = function (e) {
- if (e.pageX - U.MD.UI.video.getScreenLeft(_progress) < 0 || e.pageX - U.MD.UI.video.getScreenLeft(_progress) > _progress.offsetWidth) {
- return;
- }
- var _iL = e.pageX - _startX;
-
- if (!(_currentProgress.offsetWidth + _iL > _progress.offsetWidth || _currentProgress.offsetWidth + _iL < 0) && (e.currentTarget.children[0].offsetWidth <= e.currentTarget.children[0].offsetWidth)) {
-
- _currentProgress.style.width = (_currentProgress.offsetWidth + _iL) / _progress.offsetWidth * 100 + "%";
-
- els.video.currentTime = (_currentProgress.offsetWidth + _iL) / _progress.offsetWidth * els.video.duration;
- }
- _startX = e.pageX;
- };
- els.videoDiv.onmouseup = function () {
- moving = false;
- els.videoDiv.onmousemove = function () {
- };
- els.videoDiv.onmouseup = function () {
- };
- };
- };
- U.MD.UI.video.soundProgressMove = function (event, els, moving) {
- event.preventDefault();
- var _e = event;
- var _content = event.currentTarget;
- var _startX = _e.pageX;
- var _currentSound = els.soundProgressCurrent;
- var _x = event.offsetX;
- var _length = _content.offsetWidth;
- els.video.volume = _x / _length;
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
-
- els.videoDiv.onmousemove = function (e) {
- if (e.pageX - U.MD.UI.video.getScreenLeft(els.soundProgress) < 0 || e.pageX - U.MD.UI.video.getScreenLeft(els.soundProgress) > els.soundProgress.offsetWidth) {
- return;
- }
- var _iL = e.pageX - _startX;
- if (!(_currentSound.offsetWidth + _iL > _content.offsetWidth || _currentSound.offsetWidth + _iL < 0)) {
- _currentSound.style.width = (_currentSound.offsetWidth + _iL) / _content.offsetWidth * 100 + "%";
- els.video.volume = _currentSound.offsetWidth / _content.offsetWidth;
- }
- _startX = e.pageX;
- };
- els.videoDiv.onmouseup = function (e) {
- els.videoDiv.onmousemove = function () {
- };
- els.videoDiv.onmouseup = function () {
- };
- };
- };
- U.MD.UI.video.progressMove = function (event, els, moving) {
- event.preventDefault();
- if (event.target.className === "U_MD_UI_video_ProgressCircle") {
- return;
- }
- var _e = event;
- var _content = event.currentTarget;
- var _startX = _e.pageX;
- var _currentProgress = els.progressCurrentTime;
- var _x = event.layerX || event.offsetX;
- var _length = _content.offsetWidth;
- els.video.currentTime = els.video.duration * (_x / _length);
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
- els.videoDiv.onmousemove = function (e) {
- if (e.pageX - U.MD.UI.video.getScreenLeft(els.progress) < 0 || e.pageX - U.MD.UI.video.getScreenLeft(els.progress) > els.progress.offsetWidth) {
- return;
- }
- moving = true;
- var _iL = e.pageX - _startX;
- if (!(_currentProgress.offsetWidth + _iL > els.progress.offsetWidth || _currentProgress.offsetWidth + _iL < 0)) {
- _currentProgress.style.width = (_currentProgress.offsetWidth + _iL) / els.progress.offsetWidth * 100 + "%";
- els.video.currentTime = (_currentProgress.offsetWidth + _iL) / els.progress.offsetWidth * els.video.duration;
- }
- _startX = e.pageX;
- };
- els.videoDiv.onmouseup = function () {
- moving = false;
- U.MD.UI.video.flushInfo(moving, els.currentTimeDiv, els.DurationDiv, els.progressCurrentTime, els.soundProgressCurrent, els.video);
- els.videoDiv.onmousemove = function () {
- };
- els.videoDiv.onmouseup = function () {
- };
- };
- };
- ;
|