Best JavaScript code snippet using cypress
admin.js
Source:admin.js
1/** 2 * Video admin js file.3 *4 * @category Apptha5 * @package Contus video Gallery6 * @version 3.07 * @author Apptha Team <developers@contus.in>8 * @copyright Copyright (C) 2015 Apptha. All rights reserved.9 * @license GNU General Public License http://www.gnu.org/copyleft/gpl.html 10 */11function checkingarray(checkname) //for giving the coma seprerated selcted checkbox id's12{13 checkarr = document.getElementsByName(checkname);14 checkarray = "";15 if (checkarr.length > 0)16 {17 for (i = 0; i < checkarr.length; i++)18 {19 if (checkarr[i].checked)20 {21 checkarray += checkarr[i].value + ",";22 }23 }24 checkarray = checkarray.substring(0, checkarray.length - 1);25 return checkarray;26 }27 else28 {29 return false;30 }31}32function t1( t2 ) 33{ 34 if ( t2.value == "y" || t2 == "y" )35 {36 document.getElementById( 'upload2' ).style.display = "block";37 document.getElementById( 'supportformats' ).style.display = "";38 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "";39 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "";40 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "";41 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "";42 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";43 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";44 document.getElementById( 'filetypevalue' ).value = 2;45 document.getElementById( 'youtube' ).style.display = "none";46 document.getElementById( 'embedvideo' ).style.display = "none";47 document.getElementById( 'adstypebox' ).style.display = "block";48 document.getElementById( 'customurl' ).style.display = "none";49 } else if ( t2.value == "c" || t2 == "c" ) {50 if(document.getElementById( 'youtube' ))51 document.getElementById( 'youtube' ).style.display = "block";52 if(document.getElementById( 'upload2' ))53 document.getElementById( 'upload2' ).style.display = "block";54 if(document.getElementById( 'supportformats' ))55 document.getElementById( 'supportformats' ).style.display = "none";56 if(document.getElementById( 'supportformats' ))57 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";58 if(document.getElementById( 'supportformats' ))59 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";60 if(document.getElementById( 'supportformats' ))61 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";62 if(document.getElementById( 'supportformats' ))63 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";64 if(document.getElementById( 'supportformats' ))65 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";66 if(document.getElementById( 'supportformats' ))67 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";68 if(document.getElementById( 'supportformats' ))69 document.getElementById( 'embedvideo' ).style.display = "none";70 document.getElementById( 'customurl' ).style.display = "none";71 document.getElementById( 'adstypebox' ).style.display = "block";72 document.getElementById( 'filetypevalue' ).value = 1;73 } else if ( t2.value == "url" || t2 == "url" ) {74 document.getElementById( 'customurl' ).style.display = "block";75 document.getElementById( 'embedvideo' ).style.display = "none";76 document.getElementById( 'islive_visible' ).style.display = "none";77 document.getElementById( 'upload2' ).style.display = "block";78 document.getElementById( 'supportformats' ).style.display = "none";79 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";80 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";81 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";82 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";83 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";84 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";85 document.getElementById( 'stream1' ).style.display = "none";86 document.getElementById( 'hdvideourl' ).style.display = "";87 document.getElementById( 'adstypebox' ).style.display = "block";88 document.getElementById( 'youtube' ).style.display = "none";89 document.getElementById( 'filetypevalue' ).value = 3;90 } else if ( t2.value == "rtmp" || t2 == "rtmp" ) {91 document.getElementById( 'customurl' ).style.display = "block";92 document.getElementById( 'islive_visible' ).style.display = "";93 document.getElementById( 'stream1' ).style.display = "";94 document.getElementById( 'upload2' ).style.display = "block";95 document.getElementById( 'supportformats' ).style.display = "none";96 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";97 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";98 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";99 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";100 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";101 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";102 document.getElementById( 'embedvideo' ).style.display = "none";103 document.getElementById( 'hdvideourl' ).style.display = "none";104 document.getElementById( 'youtube' ).style.display = "none";105 document.getElementById( 'adstypebox' ).style.display = "block";106 document.getElementById( 'filetypevalue' ).value = 4;107 } else if ( t2.value == "embed" || t2 == "embed" ) {108 document.getElementById( 'embedvideo' ).style.display = "block";109 document.getElementById( 'islive_visible' ).style.display = "";110 document.getElementById( 'stream1' ).style.display = "";111 document.getElementById( 'customurl' ).style.display = "none";112 document.getElementById( 'hdvideourl' ).style.display = "none";113 document.getElementById( 'youtube' ).style.display = "none";114 document.getElementById( 'adstypebox' ).style.display = "none";115 document.getElementById( 'upload2' ).style.display = "block"116 document.getElementById( 'ffmpeg_disable_new3' ).style.display = ""117 document.getElementById( 'supportformats' ).style.display = "none";118 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";119 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";120 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";121 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "none";122 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "none";123 document.getElementById( 'filetypevalue' ).value = 5;124 }125}126function VideogoogleaddeleteIds(){127 var googleadactiondown = document.getElementById("videogoogleadactiondown").value;128 var googleadactionup = document.getElementById("videogoogleadactionup").value;129 var googleaddeleteID = checkingarray('videogooglead_id[]');130 if (googleadactiondown === "videogoogleaddelete" || googleadactionup === "videogoogleaddelete")131 {132 if (googleaddeleteID)133 {134 alert("You want to delete Google Adsense? ");135 return true;136 }137 else138 {139 alert("Please select a Google Adsense to delete");140 return false;141 }142 }else if(googleadactiondown ==="videogoogleadpublish" || googleadactionup ==="videogoogleadpublish" || googleadactiondown === "videogoogleadunpublish" || googleadactionup === "videogoogleadunpublish"){143 if(googleaddeleteID){144 return true;145 }else{146 alert("Please select a googlead to publish");147 return false;148 }149 }else {150 alert("Please select an action");151 }152 return false;153}154function PlaylistdeleteIds()155{156 playlistactiondown = document.getElementById("playlistactiondown").value;157 playlistactionup = document.getElementById("playlistactionup").value;158 playlistID = checkingarray('pid[]');159 if (playlistactiondown === "playlistdelete" || playlistactionup === "playlistdelete")160 {161 if (playlistID)162 {163 alert("You want to delete Category? ");164 return true;165 }166 else167 {168 alert("Please select a Category to delete");169 return false;170 }171 }else if(playlistactiondown ==="playlistpublish" || playlistactionup ==="playlistpublish" || playlistactiondown === "playlistunpublish" || playlistactionup === "playlistunpublish"){172 if(playlistID){173 return true;174 }else{175 alert("Please select a Category to publish");176 return false;177 }178 }else {179 alert("Please select an action");180 }181 return false;182}183function clear_upload() {184 document.getElementById("normalvideoform-value").value = '';185}186function Videoadtype(adtype)187{188 if (adtype === "prepostroll")189 {190 document.getElementById('admethod').value = "prepost";191 document.getElementById('videoadmethod').style.display = "block";192 document.getElementById('videoaddetails').style.display = "block";193 document.getElementById('adtargeturl').style.display = "block";194 document.getElementById('addescription').style.display = "block";195 document.getElementById('adtitle').style.display = "block";196 document.getElementById('videoimaaddetails').style.display = "none";197 Videoadtypemethod('urlad');198 }199 if (adtype === "midroll")200 {201 document.getElementById('upload2').style.display = "none";202 document.getElementById('videoadmethod').style.display = "none";203 document.getElementById('admethod').value = "midroll";204 document.getElementById('videoadurl').style.display = "none";205 document.getElementById('videoaddetails').style.display = "block";206 document.getElementById('adtargeturl').style.display = "block";207 document.getElementById('addescription').style.display = "block";208 document.getElementById('adtitle').style.display = "block";209 document.getElementById('videoimaaddetails').style.display = "none";210 }211 else if (adtype === "imaad")212 {213 document.getElementById('upload2').style.display = "none";214 document.getElementById('videoadmethod').style.display = "none";215 document.getElementById('admethod').value = "imaad";216 document.getElementById('videoadurl').style.display = "none";217 document.getElementById('videoaddetails').style.display = "block";218 document.getElementById('videoimaaddetails').style.display = "block";219 document.getElementById('adtargeturl').style.display = "none";220 document.getElementById('addescription').style.display = "none";221 document.getElementById('adtitle').style.display = "";222 document.getElementById('imaadTypevideo').checked = true;223 changeimaadtype('videoad');224 }225}226function Videoadtypemethod(adtype)227{228 if (adtype === "fileuplo")229 {230 document.getElementById('upload2').style.display = "block";231 document.getElementById('videoadurl').style.display = "none";232 document.getElementById('adtype').style.display = "file";233 }234 else if (adtype === "urlad")235 {236 document.getElementById('upload2').style.display = "none";237 document.getElementById('videoadurl').style.display = "block";238 document.getElementById('adtype').value = "url";239 }240}241function changeimaadtype(adtype)242{243 if (adtype === "textad")244 {245 document.getElementById('adimapath').style.display = "none";246 document.getElementById('adimawidth').style.display = "";247 document.getElementById('adimaheight').style.display = "";248 document.getElementById('adimapublisher').style.display = "";249 document.getElementById('adimacontentid').style.display = "";250 document.getElementById('adimachannels').style.display = "";251 document.getElementById('imaadTypetext').checked = true;252 }253 else if (adtype === "videoad")254 {255 document.getElementById('adimapath').style.display = "";256 document.getElementById('adimawidth').style.display = "none";257 document.getElementById('adimaheight').style.display = "none";258 document.getElementById('adimapublisher').style.display = "none";259 document.getElementById('adimacontentid').style.display = "none";260 document.getElementById('adimachannels').style.display = "none";261 document.getElementById('imaadTypevideo').checked = true;262 }263}264function validateadInput() { 265 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;266 267 if (document.getElementById('targeturl') && document.getElementById('targeturl').value !== '') {268 var thevideoadurl = document.getElementById("targeturl").value;269 if (!tomatch.test(thevideoadurl))270 {271 document.getElementById('targeterrormessage').innerHTML = 'Enter Valid Target URL';272 document.getElementById("targeturl").focus();273 return false;274 }275 } 276 if (document.getElementById('clickurl') && document.getElementById('clickurl').value !== '') {277 var thevideoadurl = document.getElementById("clickurl").value;278 if (!tomatch.test(thevideoadurl))279 {280 document.getElementById('clickerrormessage').innerHTML = 'Enter Valid Target URL';281 document.getElementById("clickurl").focus();282 return false;283 }284 } 285 if (document.getElementById('impressionurl') && document.getElementById('impressionurl').value !== '') {286 var thevideoadurl = document.getElementById("impressionurl").value;287 if (!tomatch.test(thevideoadurl))288 {289 document.getElementById('impressionerrormessage').innerHTML = 'Enter Valid Target URL';290 document.getElementById("impressionurl").focus();291 return false;292 }293 }294 if (document.getElementById('prepostroll') && document.getElementById('prepostroll').checked == true)295 {296 if (document.getElementById('filebtn') && document.getElementById('filebtn').checked === true && document.getElementById('normalvideoform-value').value === '')297 {298 document.getElementById('filepathuploaderrormessage').innerHTML = 'Upload file for Ad';299 return false;300 } 301 else if (document.getElementById('urlbtn') && document.getElementById('urlbtn').checked === true) 302 {303 if (document.getElementById('videoadfilepath').value === '') {304 document.getElementById('filepatherrormessage').innerHTML = 'Enter Ad URL';305 document.getElementById('videoadfilepath').focus();306 return false;307 } else {308 var thevideoadurl = document.getElementById("videoadfilepath").value;309 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;310 if (!tomatch.test(thevideoadurl))311 {312 document.getElementById('filepatherrormessage').style.display = 'block';313 document.getElementById('filepatherrormessage').innerHTML = 'Enter Valid Ad URL';314 document.getElementById("videoadfilepath").focus();315 return false;316 }317 }318 }319 var adstitle = document.getElementById('name').value;320 adstitle = adstitle.trim();321 if ( adstitle == '') {322 document.getElementById('nameerrormessage').style.display = "block";323 document.getElementById('nameerrormessage').innerHTML = 'Enter Ad Name';324 document.getElementById('name').focus();325 return false;326 }327 }328 if (document.getElementById('imaad') && document.getElementById('imaad').checked === true) {329 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('publisherId').value === '')330 {331 document.getElementById('imapublisherIderrormessage').innerHTML = 'Enter IMA Ad Publisher ID';332 document.getElementById('publisherId').focus();333 return false;334 } else if (document.getElementById('imaadTypetext').checked === true && document.getElementById('contentId').value === '')335 {336 document.getElementById('imacontentIderrormessage').innerHTML = 'Enter IMA Ad Content ID';337 document.getElementById('contentId').focus();338 return false;339 } else if (document.getElementById('imaadTypetext').checked === true && document.getElementById('channels').value === '')340 {341 document.getElementById('imachannelserrormessage').innerHTML = 'Enter IMA Ad Channel';342 document.getElementById('channels').focus();343 return false;344 } else {345 if (document.getElementById('imaadTypevideo').checked === true)346 {347 if (document.getElementById('imaadpath').value === '') {348 document.getElementById('imaadpatherrormessage').innerHTML = 'Enter IMA Ad Path';349 document.getElementById('imaadpath').focus();350 return false;351 } else {352 var thevideoadurl = document.getElementById("imaadpath").value;353 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;354 if (!tomatch.test(thevideoadurl))355 {356 document.getElementById('imaadpatherrormessage').innerHTML = 'Enter Valid IMA Ad URL';357 document.getElementById("imaadpath").focus();358 return false;359 }360 }361 }362 }363 }364 if (document.getElementById('name') && document.getElementById('name').value === '') {365 document.getElementById('nameerrormessage').style.display = "block";366 document.getElementById('nameerrormessage').innerHTML = 'Enter Ad Name';367 document.getElementById('name').focus();368 return false;369 }370}371function VideoaddeleteIds()372{373 videoadactiondown = document.getElementById("videoadactiondown").value;374 videoadactionup = document.getElementById("videoadactionup").value;375 videoadID = checkingarray('videoad_id[]');376 if (videoadactiondown === "videoaddelete" || videoadactionup === "videoaddelete")377 {378 if (videoadID)379 {380 alert("Do you want to delete Video ad? ");381 return true;382 }383 else384 {385 alert("Please select a Video ad to delete");386 return false;387 }388 }else if(videoadactiondown ==="videoadpublish" || videoadactionup ==="videoadpublish" || videoadactiondown === "videoadunpublish" || videoadactionup === "videoadunpublish"){389 if(videoadID){390 return true;391 }else{392 alert("Please select a Video ad to publish");393 return false;394 }395 }396 else397 {398 alert("Please select an action");399 }400 return false;401}402function getsubtitle1name() {403 document.getElementById('subtilelang1').style.display = "";404}405function getsubtitle2name() {406 document.getElementById('subtilelang2').style.display = "";407}408function VideodeleteIds()409{410 videoactiondown = document.getElementById("videoactiondown").value;411 videoactionup = document.getElementById("videoactionup").value;412 videoID = checkingarray('video_id[]');413 if (videoactiondown === "videodelete" || videoactionup === "videodelete")414 {415 if (videoID)416 {417 return true;418 }419 else420 {421 alert("Please select a Video to delete ");422 return false;423 }424 }else if(videoactiondown ==="videopublish" || videoactionup ==="videopublish" || videoactiondown === "videounpublish" || videoactionup === "videounpublish"){425 if(videoID){426 return true;427 }else{428 alert("Please select a video to publish");429 return false;430 }431 }else if(videoactiondown ==='videofeatured' || videoactionup ==="videofeatured" || videoactiondown === "videounfeatured" || videoactionup === "videounfeatured"){432 if(videoID){433 return true;434 }else{435 alert("Please select a video to featured");436 return false;437 }438 }439 else440 {441 alert("Please select an action");442 }443 return false;444}445function Videotype()446{447 if (document.getElementById('uploadbtn').checked === true)448 {449 document.getElementById('videoupload').style.display = "block";450 document.getElementById('videoyoutube').style.display = "none";451 document.getElementById('videourl').style.display = "none";452 document.getElementById('videoffmpeg').style.display = "none";453 }454 if (document.getElementById('youtubebtn').checked === true)455 {456 document.getElementById('videoupload').style.display = "none";457 document.getElementById('videoyoutube').style.display = "block";458 document.getElementById('videourl').style.display = "none";459 document.getElementById('videoffmpeg').style.display = "none";460 }461 if (document.getElementById('ffmpegbtn').checked === true)462 {463 document.getElementById('videoupload').style.display = "none";464 document.getElementById('videoyoutube').style.display = "none";465 document.getElementById('videourl').style.display = "none";466 document.getElementById('videoffmpeg').style.display = "block";467 }468 if (document.getElementById('urlbtn').checked === true)469 {470 document.getElementById('videoupload').style.display = "none";471 document.getElementById('videoyoutube').style.display = "none";472 document.getElementById('videourl').style.display = "block";473 document.getElementById('videoffmpeg').style.display = "none";474 }475}476var uploadqueue = [];477var uploadmessage = '';478function addQueue(whichForm, myfile)479{480 var extn = extension(myfile);481 if (whichForm === 'normalvideoform' || whichForm === 'hdvideoform')482 {483 if (extn !== 'mp3' && extn !== 'MP3' && extn !== 'flv' && extn !== 'FLV' && extn !== 'mp4' && extn !== 'MP4' && extn !== 'm4v' && extn !== 'M4V' && extn !== 'mp4v' && extn !== 'Mp4v' && extn !== 'm4a' && extn !== 'M4A' && extn !== 'mov' && extn !== 'MOV' && extn !== 'f4v' && extn != 'F4V') {484 alert(extn + " is not a valid Video Extension");485 return false;486 }487 } else if (whichForm === 'subtitle1form' || whichForm === 'subtitle2form')488 {489 if (extn !== 'srt' && extn !== 'SRT')490 {491 alert(extn + " is not a valid Video Extension");492 return false;493 }494 }495 else496 {497 if (extn !== 'jpg' && extn !== 'png' && extn !== 'jpeg')498 {499 alert(extn + " is not a valid Image Extension");500 return false;501 }502 }503 uploadqueue.push(whichForm);504 if (uploadqueue.length === 1)505 {506 processQueue();507 }508 else509 {510 holdQueue();511 }512}513function processQueue()514{515 if (uploadqueue.length > 0)516 {517 form_handler = uploadqueue[0];518 setStatus(form_handler, 'Uploading');519 submitUploadForm(form_handler);520 }521}522function holdQueue()523{524 form_handler = uploadqueue[uploadqueue.length - 1];525 setStatus(form_handler, 'Queued');526}527function updateQueue(statuscode, statusmessage, outfile)528{ 529 uploadmessage = statusmessage;530 form_handler = uploadqueue[0];531 if (statuscode === 0) {532 document.getElementById(form_handler + "-value").value = outfile;533 if (form_handler === 'subtitle1form') {534 getsubtitle1name();535 }536 if (form_handler === 'subtitle2form') {537 getsubtitle2name();538 }539 }540 541 setStatus(form_handler, statuscode);542 uploadqueue.shift();543 processQueue();544}545function submitUploadForm(form_handle)546{547 document.forms[form_handle].target = "uploadvideo_target";548 document.forms[form_handle].action = "admin-ajax.php?action=uploadvideo&_wpnonce=" + upload_nonce;549 document.forms[form_handle].submit();550}551function setStatus(form_handle, status)552{553 switch (form_handle)554 {555 case "normalvideoform":556 divprefix = 'f1';557 divmsg = 'uploadmessage';558 divmsg1 = 'filepathuploaderrormessage';559 break;560 case "hdvideoform":561 divprefix = 'f2';562 divmsg = divmsg1 = '';563 break;564 case "thumbimageform":565 divprefix = 'f3';566 divmsg = 'uploadthumbmessage';567 divmsg1 = '';568 break;569 case "previewimageform":570 divprefix = 'f4';571 divmsg = divmsg1 = '';572 break;573 case "subtitle1form":574 divprefix = 'f5';575 divmsg = divmsg1 = '';576 break;577 case "subtitle2form":578 divprefix = 'f6';579 divmsg = divmsg1 = '';580 break;581 }582 switch (status)583 {584 case "Queued":585 document.getElementById(divprefix + "-upload-form").style.display = "none";586 document.getElementById(divprefix + "-upload-progress").style.display = "";587 document.getElementById(divprefix + "-upload-status").innerHTML = "Queued";588 document.getElementById(divprefix + "-upload-message").style.display = "none";589 document.getElementById(divprefix + "-upload-filename").innerHTML = document.forms[form_handle].myfile.value;590 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'empty.gif';591 document.getElementById(divprefix + "-upload-cancel").innerHTML = '<a style="padding-right:10px;" href=javascript:cancelUpload("' + form_handle + '") name="submitcancel">Cancel</a>';592 break;593 case "Uploading":594 document.getElementById(divprefix + "-upload-form").style.display = "none";595 document.getElementById(divprefix + "-upload-progress").style.display = "";596 document.getElementById(divprefix + "-upload-status").innerHTML = "Uploading";597 document.getElementById(divprefix + "-upload-message").style.display = "none";598 document.getElementById(divprefix + "-upload-filename").innerHTML = document.forms[form_handle].myfile.value;599 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'loader.gif';600 document.getElementById(divprefix + "-upload-cancel").innerHTML = '<a style="padding-right:10px;" href=javascript:cancelUpload("' + form_handle + '") name="submitcancel">Cancel</a>';601 break;602 case "Retry":603 case "Cancelled":604 document.getElementById(divprefix + "-upload-form").style.display = "";605 document.getElementById(divprefix + "-upload-progress").style.display = "none";606 document.forms[form_handle].myfile.value = '';607 enableUpload(form_handle);608 break;609 case 0:610 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'success.gif';611 document.getElementById(divprefix + "-upload-status").innerHTML = "";612 document.getElementById(divprefix + "-upload-message").style.display = "";613 document.getElementById(divprefix + "-upload-message").style.backgroundColor = "#CEEEB2";614 document.getElementById(divprefix + "-upload-message").innerHTML = uploadmessage;615 if (divmsg !== '') {616 document.getElementById(divmsg).innerHTML = '';617 }618 document.getElementById(divprefix + "-upload-cancel").innerHTML = '';619 break;620 default:621 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'error.gif';622 document.getElementById(divprefix + "-upload-status").innerHTML = " ";623 document.getElementById(divprefix + "-upload-message").style.display = "";624 document.getElementById(divprefix + "-upload-message").innerHTML = uploadmessage + " <a href=javascript:setStatus('" + form_handle + "','Retry')>Retry</a>";625 document.getElementById(divprefix + "-upload-cancel").innerHTML = '';626 break;627 }628}629function enableUpload(whichForm, myfile)630{631 if (document.forms[whichForm].myfile.value != '')632 document.forms[whichForm].uploadBtn.disabled = "";633 else634 document.forms[whichForm].uploadBtn.disabled = "disabled";635}636function cancelUpload(whichForm)637{638 document.getElementById('uploadvideo_target').src = '';639 setStatus(whichForm, 'Cancelled');640 pos = uploadqueue.lastIndexOf(whichForm);641 if (pos === 0)642 {643 if (uploadqueue.length >= 1)644 {645 uploadqueue.shift();646 processQueue();647 }648 }649 else650 {651 uploadqueue.splice(pos, 1);652 }653}654function chkbut()655{656 if (uploadqueue.length <= 0)657 {658 if (document.getElementById('btn2').checked)659 {660 document.getElementById('youtube-value').value = document.getElementById('filepath1').value;661 return true;662 }663 if (document.getElementById('btn3').checked || document.getElementById('btn4').checked)664 {665 document.getElementById('customurl1').value = document.getElementById('filepath2').value;666 document.getElementById('customhd1').value = document.getElementById('filepath3').value;667 document.getElementById('customimage').value = document.getElementById('filepath4').value;668 document.getElementById('custompreimage').value = document.getElementById('filepath5').value;669 return true;670 }671 } else {672 alert("Wait for Uploading to Finish");673 return false;674 }675}676function extension(fname)677{678 var pos = fname.lastIndexOf(".");679 var strlen = fname.length;680 if (pos !== -1 && strlen !== pos + 1)681 {682 var ext = fname.split(".");683 var len = ext.length;684 var extension = ext[len - 1].toLowerCase();685 }686 else687 {688 extension = "No extension found";689 }690 return extension;691}692function validateInput() {693 document.getElementById('Youtubeurlmessage').innerHTML = '';694 if (document.getElementById('btn2').checked === true) {695 if (document.getElementById('filepath1').value === '') {696 document.getElementById('Youtubeurlmessage').innerHTML = 'Enter Youtube URL';697 document.getElementById('Youtubeurlmessage').style.display = "block";698 document.getElementById('filepath1').focus();699 return false;700 } else {701 var theurl = document.getElementById("filepath1").value;702 var regExp = /^.*(youtu.be\/|v\/|embed\/|watch\?|youtube.com\/user\/[^#]*#([^\/]*?\/)*)\??v?=?([^#\&\?]*).*/;703 var match = theurl.match(regExp);704 if (!match && theurl.indexOf("dailymotion.com") === -1 && theurl.indexOf("viddler.com") === -1) {705 document.getElementById('Youtubeurlmessage').innerHTML = 'Enter Valid Youtube URL';706 document.getElementById('filepath1').focus();707 return false;708 } else {709 document.getElementById("youtube-value").value = theurl;710 }711 }712 } else if (document.getElementById('btn1').checked === true && document.getElementById('f1-upload-form').style.display !== 'none' && document.getElementById('lbl_normal').innerHTML === '') {713 document.getElementById('uploadmessage').innerHTML = 'Upload Video';714 return false;715 } else if (document.getElementById('btn1').checked === true && document.getElementById('f3-upload-form').style.display !== 'none' && document.getElementById('thumbimageform-value').value === '') {716 document.getElementById('uploadthumbmessage').innerHTML = 'Upload Thumb Image';717 return false;718 } else if (document.getElementById('btn3').checked === true) {719 if (document.getElementById('filepath2').value === '') {720 document.getElementById('videourlmessage').innerHTML = 'Enter Video URL';721 document.getElementById('videourlmessage').style.display = "block";722 document.getElementById('filepath2').focus();723 return false;724 } else {725 var thevideourl = document.getElementById("filepath2").value;726 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;727 var allowedfileformat = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp4|.M4V|.M4A|.MOV|.mp4v|.M4V)$/;//Allowed fileformat728 if (!tomatch.test(thevideourl))729 {730 document.getElementById('videourlmessage').innerHTML = 'Enter Valid Video URL';731 document.getElementById('videourlmessage').style.display = "block";732 document.getElementById("filepath2").focus();733 return false;734 }735 736 }737 var thehdvideourl = document.getElementById("filepath3").value;738 if (thehdvideourl !== '') {739 var tohdmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;740 if (!tohdmatch.test(thehdvideourl))741 {742 document.getElementById('videohdurlmessage').innerHTML = 'Enter Valid HD Video URL';743 document.getElementById("filepath3").focus();744 return false;745 }746 }747 if (document.getElementById('filepath4').value === '') {748 document.getElementById('thumburlmessage').innerHTML = 'Enter Thumb Image URL';749 document.getElementById('thumburlmessage').style.display = 'block';750 document.getElementById('filepath4').focus();751 return false;752 } else {753 var thethumburl = document.getElementById("filepath4").value;754 var tothumbmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;755 if (!tothumbmatch.test(thethumburl))756 {757 document.getElementById('thumburlmessage').innerHTML = 'Enter Valid Thmub Image URL';758 document.getElementById('thumburlmessage').style.display = 'block';759 document.getElementById("filepath4").focus();760 return false;761 }762 }763 if (document.getElementById('filepath5').value !== '') {764 var thepreviewurl = document.getElementById("filepath5").value;765 var topreviewmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;766 if (!topreviewmatch.test(thepreviewurl))767 {768 document.getElementById('previewurlmessage').innerHTML = 'Enter Valid Preview Image URL';769 document.getElementById("filepath5").focus();770 return false;771 }772 }773 } else if (document.getElementById('btn4').checked === true)774 {775 var streamer_name = document.getElementById('streamname').value;776 document.getElementById('streamerpath-value').value = streamer_name;777 var islivevalue2 = (document.getElementById('islive2').checked);778 var tomatch1 = /(rtmp:\/\/|rtmpe:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(rtmp:\/\/|rtmpe:\/\/)/;779 if (streamer_name === '') {780 document.getElementById('streamermessage').innerHTML = 'You must provide a streamer path!';781 document.getElementById('streamermessage').style.display = "block";782 document.getElementById('streamname').focus();783 return false;784 } else if (!tomatch1.test(streamer_name))785 {786 document.getElementById('streamermessage').innerHTML = 'Please enter a valid streamer path';787 document.getElementById('streamermessage').style.display = "block";788 document.getElementById('streamname').focus();789 return false;790 } else if (document.getElementById('filepath2').value === '') {791 document.getElementById('videourlmessage').innerHTML = 'Enter Video URL';792 document.getElementById('videourlmessage').style.display = "block";793 document.getElementById('filepath2').focus();794 return false;795 } else if (islivevalue2 === true) {796 document.getElementById('islive-value').value = 1;797 } else {798 document.getElementById('islive-value').value = 0;799 }800 }801 else if (document.getElementById('btn5') && document.getElementById('btn5').checked === true)802 {803 var embed_code = document.getElementById('embedcode').value;804 embed_code = (embed_code + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');805 document.getElementById('embed_code').value = embed_code;806 if (embed_code === '') {807 document.getElementById('embedmessage').innerHTML = 'Enter Embed Code';808 return false;809 } else {810 document.getElementById('embedmessage').innerHTML = '';811 }812 }813 var title = document.getElementById('name').value;814 title = title.trim();815 if (title == '') {816 document.getElementById('titlemessage').innerHTML = 'Enter Title';817 document.getElementById('titlemessage').style.display = "block";818 document.getElementById('name').focus();819 return false;820 }821 822// validation for Video subtitle823 if (document.getElementById('subtitle1form-value').value !== "")824 {825 if (document.getElementById('subtile_lang1').value === "")826 {827 document.getElementById('uploadsrt1message').innerHTML = 'You must provide Subtitle1';828 document.getElementById('subtile_lang1').focus();829 return false;830 } else {831 document.getElementById('subtitle_lang1').value = document.getElementById('subtile_lang1').value;832 }833 }834 if (document.getElementById('subtitle2form-value').value !== "")835 {836 if (document.getElementById('subtile_lang2').value === "")837 {838 document.getElementById('uploadsrt2message').innerHTML = 'You must provide Subtitle2';839 document.getElementById('subtile_lang2').focus();840 return false;841 } else {842 document.getElementById('subtitle_lang2').value = document.getElementById('subtile_lang2').value;843 }844 }845 var check_box = document.getElementsByTagName('input');846 for (var i = 0; i < check_box.length; i++)847 {848 if (check_box[i].type == 'checkbox')849 {850 if (check_box[i].checked) {851 return true;852 }853 }854 }855 document.getElementById('jaxcat').innerHTML = 'Select any category for your Video';856 check_box[0].focus();857 return false;858}859function validateplyalistInput() {860 var playlistname = document.getElementById('playlistname').value; 861 playlistname = playlistname.trim();862 if ( playlistname === '') {863 document.getElementById('playlistnameerrormessage').innerHTML = 'Enter Category Name';864 document.getElementById('playlistname').focus();865 return false;866 }867}868function playlistdisplay()869{870 document.getElementById('playlistcreate1').style.display = "block";871}872function playlistclose()873{874 document.getElementById('playlistcreate1').style.display = "none";875 document.getElementById('jaxcat').innerHTML = "";876 document.getElementById('message').style.display = "none";877}878function generate12(str1)879{880 var theurl = document.getElementById("filepath1").value;881 if (theurl.indexOf("youtu.be") !== -1 || theurl.indexOf("youtube.com") !== -1) {882 document.getElementById('generate').style.visibility = "visible";883 document.getElementById('Youtubeurlmessage').style.display = "none";884 } else {885 document.getElementById('generate').style.visibility = "hidden";886 }887 if (theurl.indexOf("viddler") !== -1 || theurl.indexOf("dailymotion") !== -1) {888 document.getElementById('Youtubeurlmessage').style.display = "none";889 }890}891function validatevideourl() {892 var thevideourl = document.getElementById("filepath2").value;893 if (document.getElementById('btn4').checked === true && thevideourl !== '') {894 document.getElementById('videourlmessage').style.display = "none";895 } else {896 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;897 if (tomatch.test(thevideourl))898 {899 document.getElementById('videourlmessage').style.display = "none";900 }901 }902}903function validatethumburl() {904 var thevideourl = document.getElementById("filepath4").value;905 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;906 if (tomatch.test(thevideourl))907 {908 document.getElementById('thumburlmessage').style.display = "none";909 }910}911function validatestreamurl() {912 var tomatch1 = /(rtmp:\/\/|rtmpe:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(rtmp:\/\/|rtmpe:\/\/)/;913 var streamer_name = document.getElementById('streamname').value;914 if (tomatch1.test(streamer_name))915 {916 document.getElementById('streamermessage').style.display = "none";917 }918}919function validatevideotitle() {920 if (document.getElementById('name').value !== '') {921 document.getElementById('titlemessage').style.display = "none";922 }923}924function validateerrormsg() {925 if (document.getElementById('videoadfilepath').value !== '') {926 document.getElementById('filepatherrormessage').style.display = "none";927 }928 if (document.getElementById('name').value !== '') {929 document.getElementById('nameerrormessage').style.display = "none";930 }931 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('publisherId').value !== '')932 {933 document.getElementById('imapublisherIderrormessage').innerHTML = '';934 }935 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('contentId').value !== '')936 {937 document.getElementById('imacontentIderrormessage').innerHTML = '';938 }939 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('channels').value !== '')940 {941 document.getElementById('imachannelserrormessage').innerHTML = '';942 }943 if (document.getElementById('imaadTypevideo').checked === true)944 {945 if (document.getElementById('imaadpath').value !== '') {946 document.getElementById('imaadpatherrormessage').innerHTML = '';947 } else {948 var thevideoadurl = document.getElementById("imaadpath").value;949 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;950 if (tomatch.test(thevideoadurl))951 {952 document.getElementById('imaadpatherrormessage').innerHTML = '';953 }954 }955 }956}957function removeLogo()958{959 if (document.getElementById('logopathvalue').value !== ''){960 document.getElementById('logoname').innerHTML = '';961 document.getElementById('logopathvalue').innerHTML = '';962 document.getElementById('logopathvalue').value = '';963 document.getElementById('removepng').style.display = "none";964 }965}966function enablefbapi( val ) { 967 if ( val == 0 || val == 1 ) { 968 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 969 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 970 document.getElementById( 'disqus_api' ).style.display = 'none'; 971 } else if ( val == 2 ) { 972 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 973 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 974 document.getElementById( 'disqus_api' ).style.display = 'none'; 975 } else if ( val == 3 ) { 976 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 977 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 978 document.getElementById( 'disqus_api' ).style.display = 'table-row'; 979 } 980}981function enablerelateditems( val ) { 982 if ( val == 'side' ) { 983 document.getElementById( 'related_scroll_barColor' ).style.display = ''; 984 document.getElementById( 'related_scroll_barbgColor' ).style.display = ''; 985 document.getElementById( 'related_bgColor' ).style.display = ''; 986 document.getElementById( 'related_playlist_open' ).style.display = ''; 987 } else { 988 document.getElementById( 'related_scroll_barColor' ).style.display = 'none'; 989 document.getElementById( 'related_scroll_barbgColor' ).style.display = 'none'; 990 document.getElementById( 'related_bgColor' ).style.display = 'none'; 991 document.getElementById( 'related_playlist_open' ).style.display = 'none'; 992 } 993} 994var sortdr = jQuery.noConflict(); 995sortdr( function() { 996 sortdr( ".column" ).sortable( { 997 connectWith: ".column" 998 }); 999 sortdr( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) 1000 .find( ".portlet-header" ) 1001 .addClass( "ui-widget-header ui-corner-all" ) 1002 .prepend( "<span class='ui-icon ui-icon-minusthick'></span>" ) 1003 .end() 1004 .find( ".portlet-content" );1005 sortdr( ".portlet-header .ui-icon" ).click( function() { 1006 sortdr( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" ); 1007 sortdr( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle(); 1008 } ); 1009 sortdr('#videogallery_setting').click(function(){ 1010 var trackcode = sortdr('#trackcode').val(); 1011 var trackcodepattern = /^ua-\d{4,9}-\d{1,4}$/i; 1012 if( ( !trackcodepattern.test(trackcode) ) && trackcode!='' ) { 1013 sortdr('#trackcodeerror').html('Enter valid Google Analytics Tracking Code'); 1014 sortdr('#trackcodeerror').addClass('updated below-h2'); 1015 return false; 1016 }1017 return true; 1018 } ); ...
admin.min.js
Source:admin.min.js
1/** 2 * Video admin js file.3 *4 * @category Apptha5 * @package Contus video Gallery6 * @version 3.07 * @author Apptha Team <developers@contus.in>8 * @copyright Copyright (C) 2015 Apptha. All rights reserved.9 * @license GNU General Public License http://www.gnu.org/copyleft/gpl.html 10 */11/** 12 * Video admin js file.13 *14 * @category Apptha15 * @package Contus video Gallery16 * @version 3.017 * @author Apptha Team <developers@contus.in>18 * @copyright Copyright (C) 2015 Apptha. All rights reserved.19 * @license GNU General Public License http://www.gnu.org/copyleft/gpl.html 20 */21function checkingarray(checkname) //for giving the coma seprerated selcted checkbox id's22{23 checkarr = document.getElementsByName(checkname);24 checkarray = "";25 if (checkarr.length > 0)26 {27 for (i = 0; i < checkarr.length; i++)28 {29 if (checkarr[i].checked)30 {31 checkarray += checkarr[i].value + ",";32 }33 }34 checkarray = checkarray.substring(0, checkarray.length - 1);35 return checkarray;36 }37 else38 {39 return false;40 }41}42function t1( t2 ) 43{ 44 if ( t2.value == "y" || t2 == "y" )45 {46 document.getElementById( 'upload2' ).style.display = "block";47 document.getElementById( 'supportformats' ).style.display = "";48 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "";49 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "";50 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "";51 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "";52 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";53 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";54 document.getElementById( 'filetypevalue' ).value = 2;55 document.getElementById( 'youtube' ).style.display = "none";56 document.getElementById( 'embedvideo' ).style.display = "none";57 if(document.getElementById( 'adstypebox' )){58 document.getElementById( 'adstypebox' ).style.display = "block";59 }60 document.getElementById( 'customurl' ).style.display = "none";61 } else if ( t2.value == "c" || t2 == "c" ) {62 if(document.getElementById( 'youtube' ))63 document.getElementById( 'youtube' ).style.display = "block";64 if(document.getElementById( 'upload2' ))65 document.getElementById( 'upload2' ).style.display = "block";66 if(document.getElementById( 'supportformats' ))67 document.getElementById( 'supportformats' ).style.display = "none";68 if(document.getElementById( 'supportformats' ))69 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";70 if(document.getElementById( 'supportformats' ))71 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";72 if(document.getElementById( 'supportformats' ))73 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";74 if(document.getElementById( 'supportformats' ))75 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";76 if(document.getElementById( 'supportformats' ))77 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";78 if(document.getElementById( 'supportformats' ))79 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";80 if(document.getElementById( 'supportformats' ))81 document.getElementById( 'embedvideo' ).style.display = "none";82 document.getElementById( 'customurl' ).style.display = "none";83 if(document.getElementById( 'adstypebox' )){84 document.getElementById( 'adstypebox' ).style.display = "block";85 }86 document.getElementById( 'filetypevalue' ).value = 1;87 } else if ( t2.value == "url" || t2 == "url" ) {88 document.getElementById( 'customurl' ).style.display = "block";89 document.getElementById( 'embedvideo' ).style.display = "none";90 document.getElementById( 'islive_visible' ).style.display = "none";91 document.getElementById( 'upload2' ).style.display = "block";92 document.getElementById( 'supportformats' ).style.display = "none";93 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";94 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";95 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";96 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";97 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";98 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";99 document.getElementById( 'stream1' ).style.display = "none";100 document.getElementById( 'hdvideourl' ).style.display = "";101 if(document.getElementById( 'adstypebox' )){102 document.getElementById( 'adstypebox' ).style.display = "block";103 }104 document.getElementById( 'youtube' ).style.display = "none";105 document.getElementById( 'filetypevalue' ).value = 3;106 } else if ( t2.value == "rtmp" || t2 == "rtmp" ) {107 document.getElementById( 'customurl' ).style.display = "block";108 document.getElementById( 'islive_visible' ).style.display = "";109 document.getElementById( 'stream1' ).style.display = "";110 document.getElementById( 'upload2' ).style.display = "block";111 document.getElementById( 'supportformats' ).style.display = "none";112 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";113 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";114 document.getElementById( 'ffmpeg_disable_new3' ).style.display = "none";115 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";116 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "";117 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "";118 document.getElementById( 'embedvideo' ).style.display = "none";119 document.getElementById( 'hdvideourl' ).style.display = "none";120 document.getElementById( 'youtube' ).style.display = "none";121 if(document.getElementById( 'adstypebox' )){122 document.getElementById( 'adstypebox' ).style.display = "block";123 }124 document.getElementById( 'filetypevalue' ).value = 4;125 } else if ( t2.value == "embed" || t2 == "embed" ) {126 document.getElementById( 'embedvideo' ).style.display = "block";127 document.getElementById( 'islive_visible' ).style.display = "";128 document.getElementById( 'stream1' ).style.display = "";129 document.getElementById( 'customurl' ).style.display = "none";130 document.getElementById( 'hdvideourl' ).style.display = "none";131 document.getElementById( 'youtube' ).style.display = "none";132 if(document.getElementById( 'adstypebox' )){133 document.getElementById( 'adstypebox' ).style.display = "none";134 }135 document.getElementById( 'upload2' ).style.display = "block"136 document.getElementById( 'ffmpeg_disable_new3' ).style.display = ""137 document.getElementById( 'supportformats' ).style.display = "none";138 document.getElementById( 'ffmpeg_disable_new4' ).style.display = "none";139 document.getElementById( 'ffmpeg_disable_new2' ).style.display = "none";140 document.getElementById( 'ffmpeg_disable_new1' ).style.display = "none";141 document.getElementById( 'ffmpeg_disable_new5' ).style.display = "none";142 document.getElementById( 'ffmpeg_disable_new6' ).style.display = "none";143 document.getElementById( 'filetypevalue' ).value = 5;144 }145}146function VideogoogleaddeleteIds(){147 var googleadactiondown = document.getElementById("videogoogleadactiondown").value;148 var googleadactionup = document.getElementById("videogoogleadactionup").value;149 var googleaddeleteID = checkingarray('videogooglead_id[]');150 if (googleadactiondown === "videogoogleaddelete" || googleadactionup === "videogoogleaddelete")151 {152 if (googleaddeleteID)153 {154 alert("You want to delete Google Adsense? ");155 return true;156 }157 else158 {159 alert("Please select a Google Adsense to delete");160 return false;161 }162 }else if(googleadactiondown ==="videogoogleadpublish" || googleadactionup ==="videogoogleadpublish" || googleadactiondown === "videogoogleadunpublish" || googleadactionup === "videogoogleadunpublish"){163 if(googleaddeleteID){164 return true;165 }166 if(googleadactiondown ==="videogoogleadpublish" || googleadactionup ==="videogoogleadpublish"){167 alert("Please select a googlead to publish");168 return false;169 }170 else{171 alert("Please select a googlead to unpublish");172 return false;173 }174 }else {175 alert("Please select an action");176 }177 return false;178}179function PlaylistdeleteIds()180{181 playlistactiondown = document.getElementById("playlistactiondown").value;182 playlistactionup = document.getElementById("playlistactionup").value;183 playlistID = checkingarray('pid[]');184 if (playlistactiondown === "playlistdelete" || playlistactionup === "playlistdelete")185 {186 if (playlistID)187 {188 if (confirm("You want to delete Category?") == true) {189 return true;190 } else {191 return false;192 }193 }194 else195 {196 alert("Please select a Category to delete");197 return false;198 }199 }else if(playlistactiondown ==="playlistpublish" || playlistactionup ==="playlistpublish" || playlistactiondown === "playlistunpublish" || playlistactionup === "playlistunpublish"){200 if(playlistID){201 return true;202 }else{203 alert("Please select a Category to publish");204 return false;205 }206 }else {207 alert("Please select an action");208 }209 return false;210}211function clear_upload() {212 document.getElementById("normalvideoform-value").value = '';213}214function Videoadtype(adtype)215{216 if (adtype === "prepostroll")217 {218 document.getElementById('admethod').value = "prepost";219 document.getElementById('videoadmethod').style.display = "block";220 document.getElementById('videoaddetails').style.display = "block";221 document.getElementById('adtargeturl').style.display = "block";222 document.getElementById('addescription').style.display = "block";223 document.getElementById('adtitle').style.display = "block";224 document.getElementById('videoimaaddetails').style.display = "none";225 }226 if (adtype === "midroll")227 {228 document.getElementById('upload2').style.display = "none";229 document.getElementById('videoadmethod').style.display = "none";230 document.getElementById('admethod').value = "midroll";231 document.getElementById('videoadurl').style.display = "none";232 document.getElementById('videoaddetails').style.display = "block";233 document.getElementById('adtargeturl').style.display = "block";234 document.getElementById('addescription').style.display = "block";235 document.getElementById('adtitle').style.display = "block";236 document.getElementById('videoimaaddetails').style.display = "none";237 }238 else if (adtype === "imaad")239 {240 document.getElementById('upload2').style.display = "none";241 document.getElementById('videoadmethod').style.display = "none";242 document.getElementById('admethod').value = "imaad";243 document.getElementById('videoadurl').style.display = "none";244 document.getElementById('videoaddetails').style.display = "block";245 document.getElementById('videoimaaddetails').style.display = "block";246 document.getElementById('adtargeturl').style.display = "none";247 document.getElementById('addescription').style.display = "none";248 document.getElementById('adtitle').style.display = "";249 document.getElementById('imaadTypevideo').checked = true;250 changeimaadtype('videoad');251 }252}253function Videoadtypemethod(adtype)254{255 if (adtype === "fileuplo")256 {257 document.getElementById('upload2').style.display = "block";258 document.getElementById('videoadurl').style.display = "none";259 document.getElementById('adtype').value = "file";260 }261 else if (adtype === "urlad")262 {263 document.getElementById('upload2').style.display = "none";264 document.getElementById('videoadurl').style.display = "block";265 document.getElementById('adtype').value = "url";266 }267}268function changeimaadtype(adtype)269{270 if (adtype === "textad")271 {272 document.getElementById('adimapath').style.display = "none";273 document.getElementById('adimawidth').style.display = "";274 document.getElementById('adimaheight').style.display = "";275 document.getElementById('adimapublisher').style.display = "";276 document.getElementById('adimacontentid').style.display = "";277 document.getElementById('adimachannels').style.display = "";278 document.getElementById('imaadTypetext').checked = true;279 }280 else if (adtype === "videoad")281 {282 document.getElementById('adimapath').style.display = "";283 document.getElementById('adimawidth').style.display = "none";284 document.getElementById('adimaheight').style.display = "none";285 document.getElementById('adimapublisher').style.display = "none";286 document.getElementById('adimacontentid').style.display = "none";287 document.getElementById('adimachannels').style.display = "none";288 document.getElementById('imaadTypevideo').checked = true;289 }290}291function validateadInput() { 292 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;293 294 if (document.getElementById('targeturl') && document.getElementById('targeturl').value !== '') {295 var thevideoadurl = document.getElementById("targeturl").value;296 if (!tomatch.test(thevideoadurl))297 {298 document.getElementById('targeterrormessage').innerHTML = 'Enter Valid Target URL';299 document.getElementById("targeturl").focus();300 return false;301 }302 } 303 if (document.getElementById('clickurl') && document.getElementById('clickurl').value !== '') {304 var thevideoadurl = document.getElementById("clickurl").value;305 if (!tomatch.test(thevideoadurl))306 {307 document.getElementById('clickerrormessage').innerHTML = 'Enter Valid Target URL';308 document.getElementById("clickurl").focus();309 return false;310 }311 } 312 if (document.getElementById('impressionurl') && document.getElementById('impressionurl').value !== '') {313 var thevideoadurl = document.getElementById("impressionurl").value;314 if (!tomatch.test(thevideoadurl))315 {316 document.getElementById('impressionerrormessage').innerHTML = 'Enter Valid Target URL';317 document.getElementById("impressionurl").focus();318 return false;319 }320 }321 if (document.getElementById('prepostroll') && document.getElementById('prepostroll').checked == true)322 {323 if (document.getElementById('filebtn') && document.getElementById('filebtn').checked === true && document.getElementById('normalvideoform-value').value === '')324 {325 document.getElementById('filepathuploaderrormessage').innerHTML = 'Upload file for Ad';326 return false;327 } 328 else if (document.getElementById('urlbtn') && document.getElementById('urlbtn').checked === true) 329 {330 if (document.getElementById('videoadfilepath').value === '') {331 document.getElementById('filepatherrormessage').innerHTML = 'Enter Ad URL';332 document.getElementById('videoadfilepath').focus();333 return false;334 } else {335 var thevideoadurl = document.getElementById("videoadfilepath").value;336 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;337 if (!tomatch.test(thevideoadurl))338 {339 document.getElementById('filepatherrormessage').style.display = 'block';340 document.getElementById('filepatherrormessage').innerHTML = 'Enter Valid Ad URL';341 document.getElementById("videoadfilepath").focus();342 return false;343 }344 }345 }346 var adstitle = document.getElementById('name').value;347 adstitle = adstitle.trim();348 if ( adstitle == '') {349 document.getElementById('nameerrormessage').style.display = "block";350 document.getElementById('nameerrormessage').innerHTML = 'Enter Ad Name';351 document.getElementById('name').focus();352 return false;353 }354 }355 if (document.getElementById('imaad') && document.getElementById('imaad').checked === true) {356 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('publisherId').value === '')357 {358 document.getElementById('imapublisherIderrormessage').innerHTML = 'Enter IMA Ad Publisher ID';359 document.getElementById('publisherId').focus();360 return false;361 } else if (document.getElementById('imaadTypetext').checked === true && document.getElementById('contentId').value === '')362 {363 document.getElementById('imacontentIderrormessage').innerHTML = 'Enter IMA Ad Content ID';364 document.getElementById('contentId').focus();365 return false;366 } else if (document.getElementById('imaadTypetext').checked === true && document.getElementById('channels').value === '')367 {368 document.getElementById('imachannelserrormessage').innerHTML = 'Enter IMA Ad Channel';369 document.getElementById('channels').focus();370 return false;371 } else {372 if (document.getElementById('imaadTypevideo').checked === true)373 {374 if (document.getElementById('imaadpath').value === '') {375 document.getElementById('imaadpatherrormessage').innerHTML = 'Enter IMA Ad Path';376 document.getElementById('imaadpath').focus();377 return false;378 } else {379 var thevideoadurl = document.getElementById("imaadpath").value;380 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;381 if (!tomatch.test(thevideoadurl))382 {383 document.getElementById('imaadpatherrormessage').innerHTML = 'Enter Valid IMA Ad URL';384 document.getElementById("imaadpath").focus();385 return false;386 }387 }388 }389 }390 }391 if (document.getElementById('name') && document.getElementById('name').value === '') {392 document.getElementById('nameerrormessage').style.display = "block";393 document.getElementById('nameerrormessage').innerHTML = 'Enter Ad Name';394 document.getElementById('name').focus();395 return false;396 }397}398function VideoaddeleteIds()399{400 videoadactiondown = document.getElementById("videoadactiondown").value;401 videoadactionup = document.getElementById("videoadactionup").value;402 videoadID = checkingarray('videoad_id[]');403 if (videoadactiondown === "videoaddelete" || videoadactionup === "videoaddelete")404 {405 if (videoadID)406 {407 alert("Do you want to delete Video ad? ");408 return true;409 }410 else411 {412 alert("Please select a Video ad to delete");413 return false;414 }415 }else if(videoadactiondown ==="videoadpublish" || videoadactionup ==="videoadpublish" || videoadactiondown === "videoadunpublish" || videoadactionup === "videoadunpublish"){416 if(videoadID){417 return true;418 }else{419 alert("Please select a Video ad to publish");420 return false;421 }422 }423 else424 {425 alert("Please select an action");426 }427 return false;428}429function getsubtitle1name() {430 document.getElementById('subtilelang1').style.display = "";431}432function getsubtitle2name() {433 document.getElementById('subtilelang2').style.display = "";434}435function VideodeleteIds()436{437 videoactiondown = document.getElementById("videoactiondown").value;438 videoactionup = document.getElementById("videoactionup").value;439 videoID = checkingarray('video_id[]');440 if (videoactiondown === "videodelete" || videoactionup === "videodelete")441 {442 if (videoID)443 {444 return true;445 }446 else447 {448 alert("Please select a Video to delete ");449 return false;450 }451 }else if(videoactiondown ==="videopublish" || videoactionup ==="videopublish" || videoactiondown === "videounpublish" || videoactionup === "videounpublish"){452 if(videoID){453 return true;454 }else{455 alert("Please select a video to publish");456 return false;457 }458 }else if(videoactiondown ==='videofeatured' || videoactionup ==="videofeatured" || videoactiondown === "videounfeatured" || videoactionup === "videounfeatured"){459 if(videoID){460 return true;461 }else{462 alert("Please select a video to featured");463 return false;464 }465 }466 else467 {468 alert("Please select an action");469 }470 return false;471}472function Videotype()473{474 if (document.getElementById('uploadbtn').checked === true)475 {476 document.getElementById('videoupload').style.display = "block";477 document.getElementById('videoyoutube').style.display = "none";478 document.getElementById('videourl').style.display = "none";479 document.getElementById('videoffmpeg').style.display = "none";480 }481 if (document.getElementById('youtubebtn').checked === true)482 {483 document.getElementById('videoupload').style.display = "none";484 document.getElementById('videoyoutube').style.display = "block";485 document.getElementById('videourl').style.display = "none";486 document.getElementById('videoffmpeg').style.display = "none";487 }488 if (document.getElementById('ffmpegbtn').checked === true)489 {490 document.getElementById('videoupload').style.display = "none";491 document.getElementById('videoyoutube').style.display = "none";492 document.getElementById('videourl').style.display = "none";493 document.getElementById('videoffmpeg').style.display = "block";494 }495 if (document.getElementById('urlbtn').checked === true)496 {497 document.getElementById('videoupload').style.display = "none";498 document.getElementById('videoyoutube').style.display = "none";499 document.getElementById('videourl').style.display = "block";500 document.getElementById('videoffmpeg').style.display = "none";501 }502}503var uploadqueue = [];504var uploadmessage = '';505function addQueue(whichForm, myfile)506{507 var extn = extension(myfile);508 if (whichForm === 'normalvideoform' || whichForm === 'hdvideoform')509 {510 if (extn !== 'mp3' && extn !== 'MP3' && extn !== 'flv' && extn !== 'FLV' && extn !== 'mp4' && extn !== 'MP4' && extn !== 'm4v' && extn !== 'M4V' && extn !== 'mp4v' && extn !== 'Mp4v' && extn !== 'm4a' && extn !== 'M4A' && extn !== 'mov' && extn !== 'MOV' && extn !== 'f4v' && extn != 'F4V') {511 alert(extn + " is not a valid Video Extension");512 return false;513 }514 } else if (whichForm === 'subtitle1form' || whichForm === 'subtitle2form')515 {516 if (extn !== 'srt' && extn !== 'SRT')517 {518 alert(extn + " is not a valid Video Extension");519 return false;520 }521 }522 else523 {524 if (extn !== 'jpg' && extn !== 'png' && extn !== 'jpeg')525 {526 alert(extn + " is not a valid Image Extension");527 return false;528 }529 }530 uploadqueue.push(whichForm);531 if (uploadqueue.length === 1)532 {533 processQueue();534 }535 else536 {537 holdQueue();538 }539}540function processQueue()541{542 if (uploadqueue.length > 0)543 {544 form_handler = uploadqueue[0];545 setStatus(form_handler, 'Uploading');546 submitUploadForm(form_handler);547 }548}549function holdQueue()550{551 form_handler = uploadqueue[uploadqueue.length - 1];552 setStatus(form_handler, 'Queued');553}554function updateQueue(statuscode, statusmessage, outfile)555{ 556 uploadmessage = statusmessage;557 form_handler = uploadqueue[0];558 if (statuscode === 0) {559 document.getElementById(form_handler + "-value").value = outfile;560 if (form_handler === 'subtitle1form') {561 getsubtitle1name();562 }563 if (form_handler === 'subtitle2form') {564 getsubtitle2name();565 }566 }567 568 setStatus(form_handler, statuscode);569 uploadqueue.shift();570 processQueue();571}572function submitUploadForm(form_handle)573{574 document.forms[form_handle].target = "uploadvideo_target";575 document.forms[form_handle].action = "admin-ajax.php?action=uploadvideo&_wpnonce=" + upload_nonce;576 document.forms[form_handle].submit();577}578function setStatus(form_handle, status)579{580 switch (form_handle)581 {582 case "normalvideoform":583 divprefix = 'f1';584 divmsg = 'uploadmessage';585 divmsg1 = 'filepathuploaderrormessage';586 break;587 case "hdvideoform":588 divprefix = 'f2';589 divmsg = divmsg1 = '';590 break;591 case "thumbimageform":592 divprefix = 'f3';593 divmsg = 'uploadthumbmessage';594 divmsg1 = '';595 break;596 case "previewimageform":597 divprefix = 'f4';598 divmsg = divmsg1 = '';599 break;600 case "subtitle1form":601 divprefix = 'f5';602 divmsg = divmsg1 = '';603 break;604 case "subtitle2form":605 divprefix = 'f6';606 divmsg = divmsg1 = '';607 break;608 }609 switch (status)610 {611 case "Queued":612 document.getElementById(divprefix + "-upload-form").style.display = "none";613 document.getElementById(divprefix + "-upload-progress").style.display = "";614 document.getElementById(divprefix + "-upload-status").innerHTML = "Queued";615 document.getElementById(divprefix + "-upload-message").style.display = "none";616 document.getElementById(divprefix + "-upload-filename").innerHTML = document.forms[form_handle].myfile.value;617 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'empty.gif';618 document.getElementById(divprefix + "-upload-cancel").innerHTML = '<a style="padding-right:10px;" href=javascript:cancelUpload("' + form_handle + '") name="submitcancel">Cancel</a>';619 break;620 case "Uploading":621 document.getElementById(divprefix + "-upload-form").style.display = "none";622 document.getElementById(divprefix + "-upload-progress").style.display = "";623 document.getElementById(divprefix + "-upload-status").innerHTML = "Uploading";624 document.getElementById(divprefix + "-upload-message").style.display = "none";625 document.getElementById(divprefix + "-upload-filename").innerHTML = document.forms[form_handle].myfile.value;626 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'loader.gif';627 document.getElementById(divprefix + "-upload-cancel").innerHTML = '<a style="padding-right:10px;" href=javascript:cancelUpload("' + form_handle + '") name="submitcancel">Cancel</a>';628 break;629 case "Retry":630 case "Cancelled":631 document.getElementById(divprefix + "-upload-form").style.display = "";632 document.getElementById(divprefix + "-upload-progress").style.display = "none";633 document.forms[form_handle].myfile.value = '';634 enableUpload(form_handle);635 break;636 case 0:637 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'success.gif';638 document.getElementById(divprefix + "-upload-status").innerHTML = "";639 document.getElementById(divprefix + "-upload-message").style.display = "";640 document.getElementById(divprefix + "-upload-message").style.backgroundColor = "#CEEEB2";641 document.getElementById(divprefix + "-upload-message").innerHTML = uploadmessage;642 if (divmsg !== '') {643 document.getElementById(divmsg).innerHTML = '';644 }645 document.getElementById(divprefix + "-upload-cancel").innerHTML = '';646 break;647 default:648 document.getElementById(divprefix + "-upload-image").src = videogallery_plugin_folder + 'error.gif';649 document.getElementById(divprefix + "-upload-status").innerHTML = " ";650 document.getElementById(divprefix + "-upload-message").style.display = "";651 document.getElementById(divprefix + "-upload-message").innerHTML = uploadmessage + " <a href=javascript:setStatus('" + form_handle + "','Retry')>Retry</a>";652 document.getElementById(divprefix + "-upload-cancel").innerHTML = '';653 break;654 }655}656function enableUpload(whichForm, myfile)657{658 if (document.forms[whichForm].myfile.value != '')659 document.forms[whichForm].uploadBtn.disabled = "";660 else661 document.forms[whichForm].uploadBtn.disabled = "disabled";662}663function cancelUpload(whichForm)664{665 document.getElementById('uploadvideo_target').src = '';666 setStatus(whichForm, 'Cancelled');667 pos = uploadqueue.lastIndexOf(whichForm);668 if (pos === 0)669 {670 if (uploadqueue.length >= 1)671 {672 uploadqueue.shift();673 processQueue();674 }675 }676 else677 {678 uploadqueue.splice(pos, 1);679 }680}681function chkbut()682{683 if (uploadqueue.length <= 0)684 {685 if (document.getElementById('btn2').checked)686 {687 document.getElementById('youtube-value').value = document.getElementById('filepath1').value;688 return true;689 }690 if (document.getElementById('btn3').checked || document.getElementById('btn4').checked)691 {692 document.getElementById('customurl1').value = document.getElementById('filepath2').value;693 document.getElementById('customhd1').value = document.getElementById('filepath3').value;694 document.getElementById('customimage').value = document.getElementById('filepath4').value;695 document.getElementById('custompreimage').value = document.getElementById('filepath5').value;696 return true;697 }698 } else {699 alert("Wait for Uploading to Finish");700 return false;701 }702}703function extension(fname)704{705 var pos = fname.lastIndexOf(".");706 var strlen = fname.length;707 if (pos !== -1 && strlen !== pos + 1)708 {709 var ext = fname.split(".");710 var len = ext.length;711 var extension = ext[len - 1].toLowerCase();712 }713 else714 {715 extension = "No extension found";716 }717 return extension;718}719function validateInput() {720 document.getElementById('Youtubeurlmessage').innerHTML = '';721 if (document.getElementById('btn2').checked === true) {722 if (document.getElementById('filepath1').value === '') {723 document.getElementById('Youtubeurlmessage').innerHTML = 'Enter Youtube URL';724 document.getElementById('Youtubeurlmessage').style.display = "block";725 document.getElementById('filepath1').focus();726 return false;727 } else {728 var theurl = document.getElementById("filepath1").value;729 var regExp = /^.*(youtu.be\/|v\/|embed\/|watch\?|youtube.com\/user\/[^#]*#([^\/]*?\/)*)\??v?=?([^#\&\?]*).*/;730 var match = theurl.match(regExp);731 if (!match && theurl.indexOf("dailymotion.com") === -1 && theurl.indexOf("viddler.com") === -1) {732 document.getElementById('Youtubeurlmessage').innerHTML = 'Enter Valid Youtube URL';733 document.getElementById('filepath1').focus();734 return false;735 } else {736 document.getElementById("youtube-value").value = theurl;737 }738 }739 } else if (document.getElementById('btn1').checked === true && document.getElementById('f1-upload-form').style.display !== 'none' && document.getElementById('lbl_normal').innerHTML === '') {740 document.getElementById('uploadmessage').innerHTML = 'Upload Video';741 return false;742 } else if (document.getElementById('btn1').checked === true && document.getElementById('f3-upload-form').style.display !== 'none' && document.getElementById('thumbimageform-value').value === '') {743 document.getElementById('uploadthumbmessage').innerHTML = 'Upload Thumb Image';744 return false;745 } else if (document.getElementById('btn3').checked === true) {746 if (document.getElementById('filepath2').value === '') {747 document.getElementById('videourlmessage').innerHTML = 'Enter Video URL';748 document.getElementById('videourlmessage').style.display = "block";749 document.getElementById('filepath2').focus();750 return false;751 } else {752 var thevideourl = document.getElementById("filepath2").value;753 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;754 var allowedfileformat = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp4|.M4V|.M4A|.MOV|.mp4v|.M4V)$/;//Allowed fileformat755 if (!tomatch.test(thevideourl))756 {757 document.getElementById('videourlmessage').innerHTML = 'Enter Valid Video URL';758 document.getElementById('videourlmessage').style.display = "block";759 document.getElementById("filepath2").focus();760 return false;761 }762 763 }764 var thehdvideourl = document.getElementById("filepath3").value;765 if (thehdvideourl !== '') {766 var tohdmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;767 if (!tohdmatch.test(thehdvideourl))768 {769 document.getElementById('videohdurlmessage').innerHTML = 'Enter Valid HD Video URL';770 document.getElementById("filepath3").focus();771 return false;772 }773 }774 if (document.getElementById('filepath4').value === '') {775 document.getElementById('thumburlmessage').innerHTML = 'Enter Thumb Image URL';776 document.getElementById('thumburlmessage').style.display = 'block';777 document.getElementById('filepath4').focus();778 return false;779 } else {780 var thethumburl = document.getElementById("filepath4").value;781 var tothumbmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;782 if (!tothumbmatch.test(thethumburl))783 {784 document.getElementById('thumburlmessage').innerHTML = 'Enter Valid Thmub Image URL';785 document.getElementById('thumburlmessage').style.display = 'block';786 document.getElementById("filepath4").focus();787 return false;788 }789 }790 if (document.getElementById('filepath5').value !== '') {791 var thepreviewurl = document.getElementById("filepath5").value;792 var topreviewmatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;793 if (!topreviewmatch.test(thepreviewurl))794 {795 document.getElementById('previewurlmessage').innerHTML = 'Enter Valid Preview Image URL';796 document.getElementById("filepath5").focus();797 return false;798 }799 }800 } else if (document.getElementById('btn4').checked === true)801 {802 var streamer_name = document.getElementById('streamname').value;803 document.getElementById('streamerpath-value').value = streamer_name;804 var islivevalue2 = (document.getElementById('islive2').checked);805 var tomatch1 = /(rtmp:\/\/|rtmpe:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(rtmp:\/\/|rtmpe:\/\/)/;806 if (streamer_name === '') {807 document.getElementById('streamermessage').innerHTML = 'You must provide a streamer path!';808 document.getElementById('streamermessage').style.display = "block";809 document.getElementById('streamname').focus();810 return false;811 } else if (!tomatch1.test(streamer_name))812 {813 document.getElementById('streamermessage').innerHTML = 'Please enter a valid streamer path';814 document.getElementById('streamermessage').style.display = "block";815 document.getElementById('streamname').focus();816 return false;817 } else if (document.getElementById('filepath2').value === '') {818 document.getElementById('videourlmessage').innerHTML = 'Enter Video URL';819 document.getElementById('videourlmessage').style.display = "block";820 document.getElementById('filepath2').focus();821 return false;822 } else if (islivevalue2 === true) {823 document.getElementById('islive-value').value = 1;824 } else {825 document.getElementById('islive-value').value = 0;826 }827 }828 else if (document.getElementById('btn5') && document.getElementById('btn5').checked === true)829 {830 var embed_code = document.getElementById('embedcode').value;831 embed_code = (embed_code + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');832 document.getElementById('embed_code').value = embed_code;833 if (embed_code === '') {834 document.getElementById('embedmessage').innerHTML = 'Enter Embed Code';835 return false;836 } else {837 document.getElementById('embedmessage').innerHTML = '';838 }839 }840 var title = document.getElementById('name').value;841 title = title.trim();842 if (title == '') {843 document.getElementById('titlemessage').innerHTML = 'Enter Title';844 document.getElementById('titlemessage').style.display = "block";845 document.getElementById('name').focus();846 return false;847 }848 849// validation for Video subtitle850 if (document.getElementById('subtitle1form-value').value !== "")851 {852 if (document.getElementById('subtile_lang1').value === "")853 {854 document.getElementById('uploadsrt1message').innerHTML = 'You must provide Subtitle1';855 document.getElementById('subtile_lang1').focus();856 return false;857 } else {858 document.getElementById('subtitle_lang1').value = document.getElementById('subtile_lang1').value;859 }860 }861 if (document.getElementById('subtitle2form-value').value !== "")862 {863 if (document.getElementById('subtile_lang2').value === "")864 {865 document.getElementById('uploadsrt2message').innerHTML = 'You must provide Subtitle2';866 document.getElementById('subtile_lang2').focus();867 return false;868 } else {869 document.getElementById('subtitle_lang2').value = document.getElementById('subtile_lang2').value;870 }871 }872 var check_box = document.getElementsByTagName('input');873 for (var i = 0; i < check_box.length; i++)874 {875 if (check_box[i].type == 'checkbox')876 {877 if (check_box[i].checked) {878 return true;879 }880 }881 }882 document.getElementById('jaxcat').innerHTML = 'Select any category for your Video';883 check_box[0].focus();884 return false;885}886function validateplyalistInput() {887 var playlistname = document.getElementById('playlistname').value; 888 playlistname = playlistname.trim();889 if ( playlistname === '') {890 document.getElementById('playlistnameerrormessage').innerHTML = 'Enter Category Name';891 document.getElementById('playlistname').focus();892 return false;893 }894}895function playlistdisplay()896{897 document.getElementById('playlistcreate1').style.display = "block";898}899function playlistclose()900{901 document.getElementById('playlistcreate1').style.display = "none";902 document.getElementById('jaxcat').innerHTML = "";903 document.getElementById('message').style.display = "none";904}905function generate12(str1)906{907 var theurl = document.getElementById("filepath1").value;908 if (theurl.indexOf("youtu.be") !== -1 || theurl.indexOf("youtube.com") !== -1) {909 document.getElementById('generate').style.visibility = "visible";910 document.getElementById('Youtubeurlmessage').style.display = "none";911 } else {912 document.getElementById('generate').style.visibility = "hidden";913 }914 if (theurl.indexOf("viddler") !== -1 || theurl.indexOf("dailymotion") !== -1) {915 document.getElementById('Youtubeurlmessage').style.display = "none";916 }917}918function validatevideourl() {919 var thevideourl = document.getElementById("filepath2").value;920 if (document.getElementById('btn4').checked === true && thevideourl !== '') {921 document.getElementById('videourlmessage').style.display = "none";922 } else {923 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;924 if (tomatch.test(thevideourl))925 {926 document.getElementById('videourlmessage').style.display = "none";927 }928 }929}930function validatethumburl() {931 var thevideourl = document.getElementById("filepath4").value;932 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;933 if (tomatch.test(thevideourl))934 {935 document.getElementById('thumburlmessage').style.display = "none";936 }937}938function validatestreamurl() {939 var tomatch1 = /(rtmp:\/\/|rtmpe:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(rtmp:\/\/|rtmpe:\/\/)/;940 var streamer_name = document.getElementById('streamname').value;941 if (tomatch1.test(streamer_name))942 {943 document.getElementById('streamermessage').style.display = "none";944 }945}946function validatevideotitle() {947 if (document.getElementById('name').value !== '') {948 document.getElementById('titlemessage').style.display = "none";949 }950}951function validateerrormsg() {952 if (document.getElementById('videoadfilepath').value !== '') {953 document.getElementById('filepatherrormessage').style.display = "none";954 }955 if (document.getElementById('name').value !== '') {956 document.getElementById('nameerrormessage').style.display = "none";957 }958 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('publisherId').value !== '')959 {960 document.getElementById('imapublisherIderrormessage').innerHTML = '';961 }962 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('contentId').value !== '')963 {964 document.getElementById('imacontentIderrormessage').innerHTML = '';965 }966 if (document.getElementById('imaadTypetext').checked === true && document.getElementById('channels').value !== '')967 {968 document.getElementById('imachannelserrormessage').innerHTML = '';969 }970 if (document.getElementById('imaadTypevideo').checked === true)971 {972 if (document.getElementById('imaadpath').value !== '') {973 document.getElementById('imaadpatherrormessage').innerHTML = '';974 } else {975 var thevideoadurl = document.getElementById("imaadpath").value;976 var tomatch = /(http:\/\/|https:\/\/)[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}|(http:\/\/|https:\/\/)/;977 if (tomatch.test(thevideoadurl))978 {979 document.getElementById('imaadpatherrormessage').innerHTML = '';980 }981 }982 }983}984function removeLogo()985{986 if (document.getElementById('logopathvalue').value !== ''){987 document.getElementById('logoname').innerHTML = '';988 document.getElementById('logopathvalue').innerHTML = '';989 document.getElementById('logopathvalue').value = '';990 document.getElementById('removepng').style.display = "none";991 }992}993function enablefbapi( val ) { 994 if ( val == 0 || val == 1 ) { 995 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 996 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 997 document.getElementById( 'disqus_api' ).style.display = 'none'; 998 } else if ( val == 2 ) { 999 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 1000 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 1001 document.getElementById( 'disqus_api' ).style.display = 'none'; 1002 } else if ( val == 3 ) { 1003 document.getElementById( 'facebook_api' ).style.display = 'table-row'; 1004 document.getElementById( 'facebook_api_link' ).style.display = 'table-row'; 1005 document.getElementById( 'disqus_api' ).style.display = 'table-row'; 1006 } 1007}1008function enablerelateditems( val ) { 1009 if ( val == 'side' ) { 1010 document.getElementById( 'related_scroll_barColor' ).style.display = ''; 1011 document.getElementById( 'related_scroll_barbgColor' ).style.display = ''; 1012 document.getElementById( 'related_bgColor' ).style.display = ''; 1013 document.getElementById( 'related_playlist_open' ).style.display = ''; 1014 } else { 1015 document.getElementById( 'related_scroll_barColor' ).style.display = 'none'; 1016 document.getElementById( 'related_scroll_barbgColor' ).style.display = 'none'; 1017 document.getElementById( 'related_bgColor' ).style.display = 'none'; 1018 document.getElementById( 'related_playlist_open' ).style.display = 'none'; 1019 } ...
html5.js
Source:html5.js
1/*!2 * HTML5.js v1.0.0-rc3 * Copyright 2012 John-David Dalton <http://allyoucanleet.com/>4 * Based on HTML5 Shiv vpre3.3 | @afarkas @jon_neal @rem | MIT/GPL2 Licensed5 * Available under MIT/GPL2 license6 */7;(function(window, document) {8 'use strict';9 /** Preset for the install/uninstall methods */10 var allOptions = { 'methods': true, 'print': true, 'styles': true };11 /** Cache of created elements, document methods, and install state */12 var html5Cache = {};13 /** Previous `html5` object */14 var old = window.html5;15 /** List of HTML5 node names to install support for */16 var nodeNames = [17 'abbr', 'article', 'aside', 'audio', 'bdi', 'canvas', 'data', 'datalist',18 'details', 'figcaption', 'figure', 'footer', 'header', 'main',19 'mark', 'meter', 'nav', 'output', 'progress', 'section', 'summary', 'time',20 'video'21 ];22 /** Used to namespace printable elements and define `expando` */23 var namespace = 'html5js';24 /** Used to store an elements `uid` if `element.uniqueNumber` is not supported */25 var expando = namespace + /\d+$/.exec(Math.random());26 /** Used to filter media types */27 var reMedia = /^$|\b(?:all|print)\b/;28 /**29 * Used to skip elements with type attributes because in IE they cannot be30 * set/changed once an element is inserted into a document/fragment.31 * http://msdn.microsoft.com/en-us/library/ie/ms534700(v=vs.85).aspx32 */33 var reSkip = /^(?:button|select)$/i;34 /** Used to detect elements that cannot be cloned correctly */35 var reUnclonable = /^<\?/;36 /** Used as a fallback for `element.uniqueNumber` */37 var uid = 1;38 /** Cache of unclonable element node names */39 var unclonables = {};40 /**41 * An object used to flag features.42 *43 * @static44 * @memberOf html545 * @type Object46 */47 var support = {};48 (function() {49 var p,50 parent,51 sandbox;52 // create a new document used to get untainted styles53 try {54 // avoid https: protocol issues with IE55 sandbox = new ActiveXObject(location.protocol == 'https:' && 'htmlfile');56 } catch(e) {57 // http://xkr.us/articles/dom/iframe-document/58 (sandbox = document.createElement('iframe')).name = expando;59 sandbox.frameBorder = sandbox.height = sandbox.width = 0;60 parent = document.body || document.documentElement;61 parent.insertBefore(sandbox, parent.firstChild);62 sandbox = (sandbox = sandbox.contentWindow || sandbox.contentDocument || frames[expando]).document || sandbox;63 }64 sandbox.write('<!doctype html><title></title><body><script>document.w = this<\/script>');65 sandbox.close();66 p = sandbox.body.appendChild(sandbox.createElement('p'));67 p.innerHTML = '<nav/>';68 /**69 * Detect whether the browser supports default HTML5 styles.70 * @memberOf html5.support71 * @type Boolean72 */73 support.html5Styles = !!p.firstChild &&74 (p.firstChild.currentStyle || sandbox.w.getComputedStyle(p.firstChild, null)).display == 'block';75 /**76 * Detect whether the browser supports unknown elements.77 *78 * @memberOf html5.support79 * @type Boolean80 */81 support.unknownElements = p.childNodes.length == 1 || (function() {82 // assign a false positive if unable to install83 try {84 (document.createElement)('p');85 } catch(e) {86 return true;87 }88 var frag = document.createDocumentFragment();89 return (90 typeof frag.createElement == 'undefined' ||91 typeof p.uniqueNumber == 'undefined'92 );93 }());94 /**95 * Detect whether the browser supports printing html5 elements.96 *97 * @memberOf html5.support98 * @type Boolean99 */100 support.html5Printing = support.unknownElements || (101 // assign a false positive if unable to install102 typeof document.namespaces == 'undefined' ||103 typeof document.parentWindow == 'undefined' ||104 typeof p.applyElement == 'undefined' ||105 typeof p.removeNode == 'undefined' ||106 typeof window.attachEvent == 'undefined'107 );108 parent && destroyElement(sandbox.w.frameElement);109 }());110 /*--------------------------------------------------------------------------*/111 /**112 * Creates a style sheet of modified CSS rules to style the print wrappers.113 * (e.g. the CSS rule "header{}" becomes "html5js\:header{}")114 *115 * @private116 * @param {Document} ownerDocument The document.117 * @param {String} cssText The CSS text.118 * @returns {StyleSheet} The style element.119 */120 function addPrintSheet(ownerDocument, cssText) {121 var pair,122 parts = cssText.split('{'),123 index = parts.length,124 reElements = RegExp('(^|[\\s,>+~])(' + nodeNames.join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'),125 replacement = '$1' + namespace + '\\:$2';126 while (index--) {127 pair = parts[index] = parts[index].split('}');128 pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement);129 parts[index] = pair.join('}');130 }131 return addStyleSheet(ownerDocument, parts.join('{'));132 }133 /**134 * Wraps all HTML5 elements in the given document with printable elements.135 * (e.g. the "header" element is wrapped with the "html5js:header" element)136 *137 * @private138 * @param {Document} ownerDocument The document.139 * @returns {Array} An array of added wrappers.140 */141 function addPrintWrappers(ownerDocument) {142 var node,143 nodes = ownerDocument.getElementsByTagName('*'),144 index = nodes.length,145 reElements = RegExp('^(?:' + nodeNames.join('|') + ')$', 'i'),146 result = [];147 while (index--) {148 node = nodes[index];149 if (reElements.test(node.nodeName)) {150 result.push(node.applyElement(createPrintWrapper(node)));151 }152 }153 return result;154 }155 /**156 * Creates a style sheet with the given CSS text and adds it to the document.157 *158 * @private159 * @param {Document} ownerDocument The document.160 * @param {String} cssText The CSS text.161 * @returns {StyleSheet} The style sheet.162 */163 function addStyleSheet(ownerDocument, cssText) {164 // IE8 only respects namespace prefixs when created with `innerHTML`165 var p = ownerDocument.createElement('p'),166 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;167 p.innerHTML = 'x<style>' + cssText + '</style>';168 return parent.insertBefore(p.lastChild, parent.firstChild);169 }170 /**171 * Creates HTML5 elements using the given document enabling the document to172 * parse them correctly.173 *174 * @private175 * @param {Document|Fragment} ownerDocument The document.176 * @returns {Document|Fragment} The document.177 */178 function createElements(ownerDocument) {179 var index = nodeNames.length,180 create = ownerDocument.createElement;181 while (index--) {182 create(nodeNames[index]);183 }184 return ownerDocument;185 }186 /**187 * Creates a printable wrapper for the given element.188 *189 * @private190 * @param {Element} element The element.191 * @returns {Element} The wrapper.192 */193 function createPrintWrapper(element) {194 var node,195 nodes = element.attributes,196 index = nodes.length,197 wrapper = element.ownerDocument.createElement(namespace + ':' + element.nodeName);198 // copy element attributes to the wrapper199 while (index--) {200 node = nodes[index];201 node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);202 }203 // copy element styles to the wrapper204 wrapper.style.cssText = element.style.cssText;205 return wrapper;206 }207 /**208 * Destroys the given element.209 *210 * @private211 * @param {Element} element The element to destroy.212 * @param {Object} [cache] The cache object.213 */214 function destroyElement(element, cache) {215 var trash = (cache || getCache(element.ownerDocument)).trash;216 trash.appendChild(element);217 trash.innerHTML = '';218 }219 /**220 * Gets the cache object for the given document.221 *222 * @private223 * @param {Document} ownerDocument The document.224 * @returns {Object} The cache object.225 */226 function getCache(ownerDocument) {227 var docEl = ownerDocument.documentElement,228 id = docEl.uniqueNumber || docEl[expando] || (docEl[expando] = uid++),229 skip = support.unknownElements;230 return html5Cache[id] || (html5Cache[id] = {231 'frag': !skip && createElements(ownerDocument.createDocumentFragment()),232 'nativeCreateElement': !skip && createElements(ownerDocument).createElement,233 'nativeCreateFragment': !skip && ownerDocument.createDocumentFragment,234 'nodes': {},235 'trash': ownerDocument.createElement('div')236 });237 }238 /**239 * Removes the given print wrappers, leaving the original elements.240 *241 * @private242 * @param {Document} ownerDocument The document.243 * @params {Array} wrappers An array of wrappers.244 */245 function removePrintWrappers(ownerDocument, wrappers) {246 var cache = getCache(ownerDocument),247 index = wrappers.length;248 while (index--) {249 destroyElement(wrappers[index].removeNode(), cache);250 }251 }252 /**253 * Resolves an options object from the given value.254 *255 * @private256 * @param {Mixed} value The value to convert to an options object.257 * @returns {Object} The options object.258 */259 function resolveOptions(value) {260 var key;261 value = value ? (value === 'all' || value.all ? allOptions : value) : {};262 if (typeof value == 'string') {263 var object = {};264 value = value.split(/[, ]+/);265 while ((key = value.pop())) {266 object[key] = true;267 }268 value = object;269 }270 return value;271 }272 /**273 * Overwrites the document's `createElement` and `createDocumentFragment` methods274 * with `html5.createElement` and `html5.createDocumentFragment` equivalents.275 *276 * @private277 * @param {Document} ownerDocument The document.278 */279 function setMethods(ownerDocument) {280 var cache = getCache(ownerDocument),281 create = cache.nativeCreateElement,282 frag = cache.frag,283 nodes = cache.nodes;284 // allow a small amount of repeated code for better performance285 ownerDocument.createElement = function(nodeName) {286 var cached = nodes[nodeName],287 node = cached ? cached.cloneNode() : create(nodeName);288 if (!cached && !unclonables[nodeName] &&289 !(unclonables[nodeName] = reUnclonable.test(node.outerHTML))) {290 node = (nodes[nodeName] = node).cloneNode();291 }292 return node.canHaveChildren && !reSkip.test(nodeName) ? frag.appendChild(node) : node;293 };294 // compile unrolled `createElement` calls for better performance295 ownerDocument.createDocumentFragment = Function('frag',296 'return function() {\n' +297 ' var node = frag.cloneNode(), create = node.createElement;\n' +298 (nodeNames + '').replace(/\w+/g, 'create("$&")\n') + ';\n' +299 ' return node\n' +300 '}'301 )(frag);302 }303 /**304 * Adds support for printing HTML5 elements.305 *306 * @private307 * @param {Document} ownerDocument The document.308 */309 function setPrintSupport(ownerDocument) {310 var printSheet,311 wrappers,312 cache = getCache(ownerDocument),313 namespaces = ownerDocument.namespaces,314 ownerWindow = ownerDocument.parentWindow;315 ownerWindow.attachEvent('onbeforeprint', cache.onbeforeprint = function() {316 var imports,317 length,318 sheet,319 collection = ownerDocument.styleSheets,320 cssText = [],321 index = collection.length,322 sheets = [];323 // convert styleSheets collection to an array324 while (index--) {325 sheets[index] = collection[index];326 }327 // concat all style sheet CSS text328 while ((sheet = sheets.pop())) {329 // IE does not enforce a same origin policy for external style sheets...330 if (!sheet.disabled && reMedia.test(sheet.media)) {331 // ...but will throw an "access denied" error when attempting to read332 // the CSS text of a style sheet added by a script from a different origin.333 try {334 cssText.push(sheet.cssText);335 for (imports = sheet.imports, index = 0, length = imports.length; index < length; index++) {336 sheets.push(imports[index]);337 }338 } catch(e) { }339 }340 }341 // wrap all HTML5 elements with printable elements and add print style sheet342 wrappers = addPrintWrappers(ownerDocument);343 printSheet = addPrintSheet(ownerDocument, cssText.reverse().join(''));344 });345 ownerWindow.attachEvent('onafterprint', cache.onafterprint = function() {346 // remove wrappers, leaving the original elements, and remove print style sheet347 removePrintWrappers(ownerDocument, wrappers);348 destroyElement(printSheet, cache);349 });350 if (typeof namespaces[namespace] == 'undefined') {351 namespaces.add(namespace);352 }353 }354 /**355 * Adds minimal default HTML5 element styles to the given document.356 *357 * @private358 * @param {Document} ownerDocument The document.359 * @param {Object} options Options object.360 */361 function setStyles(ownerDocument, options) {362 // for additional default and normalized HTML5 element styles checkout363 // https://github.com/necolas/normalize.css364 getCache(ownerDocument).sheet = addStyleSheet(ownerDocument,365 // corrects block display not defined in IE6/7/8/9 and Firefox 3366 'article, aside, figcaption, figure, footer, header, main, nav, section {' +367 ' display: block' +368 '}' +369 // adds styling not present in IE6/7/8/9370 'mark {' +371 ' background: #ff0;' +372 ' color: #000' +373 '}'374 );375 }376 /**377 * Restores the document's original `createElement` and `createDocumentFragment` methods.378 *379 * @private380 * @param {Document} ownerDocument The document.381 */382 function unsetMethods(ownerDocument) {383 var cache = getCache(ownerDocument),384 fn = cache.nativeCreateElement;385 if (ownerDocument.createElement != fn) {386 ownerDocument.createElement = fn;387 }388 if (ownerDocument.createDocumentFragment != (fn = cache.nativeCreateFragment)) {389 ownerDocument.createDocumentFragment = fn;390 }391 }392 /**393 * Removes support for printing HTML5 elements.394 *395 * @private396 * @param {Document} ownerDocument The document.397 */398 function unsetPrintSupport(ownerDocument) {399 var cache = getCache(ownerDocument),400 ownerWindow = ownerDocument.parentWindow;401 ownerWindow.detachEvent('onbeforeprint', cache.onbeforeprint || unsetPrintSupport);402 ownerWindow.detachEvent('onafterprint', cache.onafterprint || unsetPrintSupport);403 }404 /**405 * Removes default HTML5 element styles.406 *407 * @private408 * @param {Document} ownerDocument The document.409 * @param {Object} options Options object.410 */411 function unsetStyles(ownerDocument, options) {412 var cache = getCache(ownerDocument),413 sheet = cache.sheet;414 if (sheet) {415 cache.sheet = null;416 destroyElement(sheet, cache);417 }418 }419 /*--------------------------------------------------------------------------*/420 /**421 * Creates a shimmed element of the given node name.422 *423 * @memberOf html5424 * @param {Document} [ownerDocument=document] The context document.425 * @param {String} nodeName The node name of the element to create.426 * @returns {Element} The created element.427 * @example428 *429 * // basic usage430 * html5.createElement('div');431 *432 * // from a child iframe433 * parent.html5.createElement(document, 'div');434 */435 function createElement(ownerDocument, nodeName) {436 // juggle arguments437 ownerDocument || (ownerDocument = document);438 if (ownerDocument && !ownerDocument.nodeType) {439 nodeName = ownerDocument;440 ownerDocument = document;441 }442 if (support.unknownElements) {443 return ownerDocument.createElement(nodeName);444 }445 // Avoid adding some elements to fragments in IE because446 // * attributes like `type` cannot be set/changed once an element is inserted447 // into a document/fragment448 // * link elements with `src` attributes that are inaccessible, as with449 // a 403 response, will cause the tab/window to crash450 // * script elements appended to fragments will execute when their `src`451 // or `text` property is set452 var cache = getCache(ownerDocument),453 nodes = cache.nodes,454 cached = nodes[nodeName],455 node = cached ? cached.cloneNode() : cache.nativeCreateElement(nodeName);456 // IE < 9 doesn't clone unknown elements correctly457 if (!cached && !unclonables[nodeName] &&458 !(unclonables[nodeName] = reUnclonable.test(node.outerHTML))) {459 node = (nodes[nodeName] = node).cloneNode();460 }461 return node.canHaveChildren && !reSkip.test(nodeName) ? cache.frag.appendChild(node) : node;462 }463 /**464 * Creates a shimmed document fragment.465 *466 * @memberOf html5467 * @param {Document} [ownerDocument=document] The context document.468 * @returns {Fragment} The created document fragment.469 * @example470 *471 * // basic usage472 * html5.createDocumentFragment();473 *474 * // from a child iframe475 * parent.html5.createDocumentFragment(document);476 */477 function createDocumentFragment(ownerDocument) {478 ownerDocument || (ownerDocument = document);479 return support.unknownElements480 ? ownerDocument.createDocumentFragment()481 : createElements(getCache(ownerDocument).frag.cloneNode());482 }483 /**484 * Installs shims according to the specified options.485 *486 * @memberOf html5487 * @param {Document} [ownerDocument=document] The document.488 * @param {Object} [options={}] Options object.489 * @returns {Document} The document.490 * @example491 *492 * // basic usage493 * // autmatically called on the primary document to allow IE < 9 to494 * // parse HTML5 elements correctly495 * html5.install();496 *497 * // from a child iframe498 * parent.html5.install(document);499 *500 * // with an options object501 * html5.install({502 *503 * // overwrite the document's `createElement` and `createDocumentFragment`504 * // methods with `html5.createElement` and `html5.createDocumentFragment` equivalents.505 * 'methods': true,506 *507 * // add support for printing HTML5 elements508 * 'print': true,509 *510 * // add minimal default HTML5 element styles511 * 'styles': true512 * });513 *514 * // with an options string515 * html5.install('print styles');516 *517 * // from a child iframe with options518 * parent.html5.install(document, options);519 *520 * // using a shortcut to install all support extensions521 * html5.install('all');522 */523 function install(ownerDocument, options) {524 ownerDocument || (ownerDocument = document);525 if (ownerDocument && !ownerDocument.nodeType) {526 options = ownerDocument;527 ownerDocument = document;528 }529 options = resolveOptions(options);530 uninstall(ownerDocument, {531 'methods': options.methods,532 'print': options.print,533 'styles': options.styles534 });535 if (!support.html5Styles && options.styles) {536 setStyles(ownerDocument, options);537 }538 if (!support.html5Printing && options.print) {539 setPrintSupport(ownerDocument);540 }541 if (!support.unknownElements) {542 // if not installing methods then init cache and install support543 // for basic HTML5 element parsing544 options.methods ? setMethods(ownerDocument) : getCache(ownerDocument);545 }546 return ownerDocument;547 }548 /**549 * Restores a previously overwritten `html5` object.550 * @memberOf html5551 * @returns {Object} The current `html5` object.552 */553 function noConflict() {554 window.html5 = old;555 return this;556 }557 /**558 * Uninstalls shims according to the specified options.559 *560 * @memberOf html5561 * @param {Document} [ownerDocument=document] The document.562 * @param {Object} [options={}] Options object.563 * @returns {Document} The document.564 * @example565 *566 * // basic usage with an options object567 * html5.uninstall({568 *569 * // restore the document's original `createElement`570 * // and `createDocumentFragment` methods.571 * 'methods': true,572 *573 * // remove support for printing HTML5 elements574 * 'print': true,575 *576 * // remove minimal default HTML5 element styles577 * 'styles': true578 * });579 *580 * // with an options string581 * html5.uninstall('print styles');582 *583 * // from a child iframe with options584 * parent.html5.uninstall(document, options);585 *586 * // using a shortcut to uninstall all support extensions587 * html5.uninstall('all');588 */589 function uninstall(ownerDocument, options) {590 ownerDocument || (ownerDocument = document);591 if (ownerDocument && !ownerDocument.nodeType) {592 options = ownerDocument;593 ownerDocument = document;594 }595 options = resolveOptions(options);596 if (!support.unknownElements && options.methods) {597 unsetMethods(ownerDocument);598 }599 if (!support.html5Printing && options.print) {600 unsetPrintSupport(ownerDocument);601 }602 if (!support.html5Styles && options.styles) {603 unsetStyles(ownerDocument, options);604 }605 return ownerDocument;606 }607 /*--------------------------------------------------------------------------*/608 /**609 * The `html5` object.610 * @type Object611 */612 var html5 = {613 /**614 * The semantic version number.615 * @static616 * @memberOf html5617 * @type String618 */619 'version': '1.0.0-rc',620 // an object of feature detection flags621 'support': support,622 // creates shimmed document fragments623 'createDocumentFragment': createDocumentFragment,624 // creates shimmed elements625 'createElement': createElement,626 // installs support extensions627 'install': install,628 // avoid `html5` object conflicts629 'noConflict': noConflict,630 // uninstalls support extensions631 'uninstall': uninstall632 };633 /*--------------------------------------------------------------------------*/634 // Expose the `html5` object to the global object even when an AMD loader is635 // present in case html5.js was injected by a third-party script and not636 // intended to be loaded as a module. The global assignment can be reverted in637 // the `html5` module via its `noConflict()` method.638 window.html5 = html5;639 // some AMD build optimizers, like r.js, check for specific condition patterns like the following:640 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {641 // define as an anonymous module so, through path mapping, it can be aliased642 define(function() {643 return html5;644 });645 }...
Header.js
Source:Header.js
1document.writeln(' <header> ');2document.writeln(' <div class="center-wrap"> ');3document.writeln(' <div class="companyIdentity"> ');4document.writeln(' <a href="index.html"><img src="content-images/yulu-logo.png" alt="" /></a> ');5document.writeln(' </div> ');6document.writeln(' <!-- END companyIdentity --> ');7document.writeln(' <!-- START Main Navigation --> ');8document.writeln(' <nav> ');9document.writeln(' <ul> ');10document.writeln(' <li class="current-menu-item"><a href="index.html">Home</a></li> ');11document.writeln(' <li> ');12document.writeln(' <a href="sol_solution.html">Solution</a> ');13document.writeln(' <ul class="sub-menu" > ');14document.writeln(' <li><span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');15document.writeln(' <a href="sol_hyper_converged.html">Super Fusion Platform</a> ');16document.writeln(' <ul class="sub-menu"> ');17document.writeln(' <li><a href="sol_bigdata.html">Big Data</a></li> ');18document.writeln(' <li><a href="sol_blockchain.html">Block Chain</a></li> ');19document.writeln(' <li><a href="sol_ai.html">Artificial Intelligence</a></li> ');20document.writeln(' <li><a href="sol_cloud_storage.html">Cloud Storage</a></li> ');21document.writeln(' <li><a href="sol_cloud_computation.html">Cloud Computing</a></li> ');22document.writeln(' <li><a href="sol_diaster_recovery.html">Disaster Recovery System</a></li>');23document.writeln(' <li><a href="sol_mppdatabase.html">MPP Database</a></li> ');24document.writeln(' <li><a href="sol_cloud_search.html">Cloud Search Platform</a></li> ');25document.writeln(' <li><a href="sol_bigdataui.html">Big Data Application Platform</a></li> ');26document.writeln(' <li><a href="sol_dew_automation.html">DEW Testing Platform</a></li> ');27document.writeln(' </ul> ');28document.writeln(' </li> ');29document.writeln(' <li> ');30document.writeln(' <span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');31document.writeln(' <a href="sol_iot_platform3.html">Internet of things platform</a> ');32document.writeln(' <ul class="sub-menu"> ');33document.writeln(' <li><a href="sol_carnet.html">Internet of intelligent vehicles</a></li> ');34document.writeln(' <li><a href="sol_smartcity.html">Smart city platform</a></li> ');35document.writeln(' </ul> ');36document.writeln(' </li> ');37document.writeln(' <li> ');38document.writeln(' <span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');39document.writeln(' <a href="sol_soa_introduce.html">Microservices</a> ');40document.writeln(' <ul class="sub-menu"> ');41document.writeln(' <li><a href="sol_soa_api.html">Bank API gateway</a></li> ');42document.writeln(' <li><a href="sol_soa_devops.html">devops</a></li> ');43document.writeln(' </ul> ');44document.writeln(' </li> ');45document.writeln(' <li> ');46document.writeln(' <span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');47document.writeln(' <a href="sol_cloud_5gsecure.html">5g and security</a> ');48document.writeln(' <ul class="sub-menu"> ');49document.writeln(' <li><a href="sol_cloud_5g.html">5g</a></li> ');50document.writeln(' <li><a href="sol_cloud_secure.html">cloud security</a></li> ');51document.writeln(' </ul> ');52document.writeln(' </li> ');53document.writeln(' <li> ');54document.writeln(' <span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');55document.writeln(' <a href="sol_sase.html">Cloud Security</a> ');56document.writeln(' <ul class="sub-menu"> ');57document.writeln(' <li><a href="sol_sase_solution.html">SASE</a></li> ');58document.writeln(' <li><a href="sol_sase_scpm.html">CSPM</a></li> ');59document.writeln(' <li><a href="sol_sase_sdn.html">SDN</a></li> ');60document.writeln(' <li><a href="sol_sase_sdwan.html">SD-WAN</a></li> ');61document.writeln(' </ul> ');62document.writeln(' </li> ');63document.writeln(' <li> ');64document.writeln(' <span style="position:absolute;right:0px;top:8px">â¦â¦more </span> ');65document.writeln(' <a href="sol_web3.html">WEB3.0</a> ');66document.writeln(' <ul class="sub-menu"> ');67document.writeln(' <li><a href="sol_web3_app.html">WEB3.0 Application</a></li> ');68document.writeln(' <li><a href="sol_web3_blockchain.html">Security of Blockchain</a></li> ');69document.writeln(' </ul> ');70document.writeln(' </li> ');71document.writeln(' </ul> ');72document.writeln(' </li> ');73document.writeln(' <li> ');74document.writeln(' <a href="service.html">Service Support</a> ');75document.writeln(' <ul class="sub-menu"> ');76document.writeln(' <li><a href="service.html">Business Consulting</a></li> ');77document.writeln(' <li><a href="service.html">Application Development</a></li> ');78document.writeln(' <li><a href="service.html">Data Migration</a></li> ');79document.writeln(' <li><a href="service.html">Field Deployment</a></li> ');80document.writeln(' <li><a href="service.html">Technical Support</a></li> ');81document.writeln(' <li><a href="service.html">Recovery</a></li> ');82document.writeln(' <li><a href="certificationtraining.html">Certification and Training</a></li> ');83document.writeln(' </ul> ');84document.writeln(' </li> ');85document.writeln(' <li> ');86document.writeln(' <a href="customercase.html">Case</a> ');87document.writeln(' <ul class="sub-menu"> ');88document.writeln(' <li><a href="customercase.html?index=1">Financial</a></li> ');89document.writeln(' <li><a href="customercase.html?index=2">Agriculture</a></li> ');90document.writeln(' <li><a href="customercase.html?index=3">Public Security</a></li> ');91document.writeln(' <li><a href="customercase.html?index=4">Civil Aviation</a></li> ');92document.writeln(' <li><a href="customercase.html?index=5">Environmental Protection</a></li> ');93document.writeln(' <li><a href="customercase.html?index=6">Industry</a></li> ');94document.writeln(' <li><a href="customercase.html?index=7">Government</a></li> ');95document.writeln(' <li><a href="customercase.html?index=8">School</a></li> ');96document.writeln(' </ul> ');97document.writeln(' </li> ');98document.writeln(' <li> ');99document.writeln(' <a>Tech Center</a> ');100document.writeln(' <ul class="sub-menu"> ');101document.writeln(' <li><a href="filedownload.html">File Download</a></li> ');102document.writeln(' <li><a href="filedownload.html">Software Download</a></li> ');103document.writeln(' <li><a href="DEWcollege.html">DEW College</a></li> ');104document.writeln(' <li><a href="KnowHow.html">Exchange of know-how</a></li> ');105document.writeln(' <li><a href="LeaveMsg.html">DEW Leave Message</a></li> ');106document.writeln(' </ul> ');107document.writeln(' </li> ');108document.writeln(' <li><a href="news.html">News</a></li> ');109document.writeln(' <li> ');110document.writeln(' <a>More</a> ');111document.writeln(' <ul class="sub-menu"> ');112document.writeln(' <li><a href="companyintroduction.html">Company Introduction</a></li> ');113document.writeln(' <li><a href="founder.html">Introduction of Founder</a></li> ');114document.writeln(' <li><a href="investment.html">Investment</a></li> ');115document.writeln(' <li><a href="contact.html">Contact Us</a></li> ');116document.writeln(' <li><a href="joinus.html">Join Us</a></li> ');117document.writeln(' </ul> ');118document.writeln(' </li> ');119document.writeln(' </ul> ');120document.writeln(' </nav> ');121document.writeln(' <!-- END Main Navigation --> ');122document.writeln(' </div> ');123document.writeln(' <!-- END center-wrap --> ');124document.writeln(' </header> ');125document.writeln(' <section> ');126document.writeln(' <img src="content-images/banner1.jpg" style="height:100%;width:100%" > ');...
calculator.js
Source:calculator.js
1var endNumber=true2var mem=03var carry=104var hexnum="0123456789abcdef"5var angle="d"6var stack=""7var level="0"8var layer=09//æ°åé®10function inputkey(key)11{12 var index=key.charCodeAt(0);13 if ((carry==2 && (index==48 || index==49))14 || (carry==8 && index>=48 && index<=55)15 || (carry==10 && (index>=48 && index<=57 || index==46))16 || (carry==16 && ((index>=48 && index<=57) || (index>=97 && index<=102))))17 if(endNumber)18 {19 endNumber=false20 document.calc.display.value = key21 }22 else if(document.calc.display.value == null || document.calc.display.value == "0")23 document.calc.display.value = key24 else25 document.calc.display.value += key26}27function changeSign()28{29 if (document.calc.display.value!="0")30 if(document.calc.display.value.substr(0,1) == "-")31 document.calc.display.value = document.calc.display.value.substr(1)32 else33 document.calc.display.value = "-" + document.calc.display.value34}35//å½æ°é®36function inputfunction(fun,shiftfun)37{38 endNumber=true39 if (document.calc.shiftf.checked)40 document.calc.display.value=decto(funcalc(shiftfun,(todec(document.calc.display.value,carry))),carry)41 else42 document.calc.display.value=decto(funcalc(fun,(todec(document.calc.display.value,carry))),carry)43 document.calc.shiftf.checked=false44 document.calc.hypf.checked=false45 inputshift()46}47function inputtrig(trig,arctrig,hyp,archyp)48{49 if (document.calc.hypf.checked)50 inputfunction(hyp,archyp)51 else52 inputfunction(trig,arctrig)53}54//è¿ç®ç¬¦55function operation(join,newlevel)56{57 endNumber=true58 var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value59 while (newlevel!=0 && (newlevel<=(level.charAt(level.length-1))))60 {61 temp=parse(temp)62 level=level.slice(0,-1)63 }64 if (temp.match(/^(.*\d[\+\-\*\/\%\^\&\|x])?([+-]?[0-9a-f\.]+)$/))65 document.calc.display.value=RegExp.$266 stack=stack.substr(0,stack.lastIndexOf("(")+1)+temp+join67 document.calc.operator.value=" "+join+" "68 level=level+newlevel69}70//æ¬å·71function addbracket()72{73 endNumber=true74 document.calc.display.value=075 stack=stack+"("76 document.calc.operator.value=" "77 level=level+078 layer+=179 document.calc.bracket.value="(="+layer80}81function disbracket()82{83 endNumber=true84 var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value85 while ((level.charAt(level.length-1))>0)86 {87 temp=parse(temp)88 level=level.slice(0,-1)89 }90 document.calc.display.value=temp91 stack=stack.substr(0,stack.lastIndexOf("("))92 document.calc.operator.value=" "93 level=level.slice(0,-1)94 layer-=195 if (layer>0)96 document.calc.bracket.value="(="+layer97 else98 document.calc.bracket.value=""99}100//çå·101function result()102{103 endNumber=true104 while (layer>0)105 disbracket()106 var temp=stack+document.calc.display.value107 while ((level.charAt(level.length-1))>0)108 {109 temp=parse(temp)110 level=level.slice(0,-1)111 }112 document.calc.display.value=temp113 document.calc.bracket.value=""114 document.calc.operator.value=""115 stack=""116 level="0"117}118//ä¿®æ¹é®119function backspace()120{121 if (!endNumber)122 {123 if(document.calc.display.value.length>1)124 document.calc.display.value=document.calc.display.value.substring(0,document.calc.display.value.length - 1)125 else126 document.calc.display.value=0127 }128}129function clearall()130{131 document.calc.display.value=0132 endNumber=true133 stack=""134 level="0"135 layer=""136 document.calc.operator.value=""137 document.calc.bracket.value=""138}139//转æ¢é®140function inputChangCarry(newcarry)141{142 endNumber=true143 document.calc.display.value=(decto(todec(document.calc.display.value,carry),newcarry))144 carry=newcarry145 document.calc.sin.disabled=(carry!=10)146 document.calc.cos.disabled=(carry!=10)147 document.calc.tan.disabled=(carry!=10)148 document.calc.bt.disabled=(carry!=10)149 document.calc.pi.disabled=(carry!=10)150 document.calc.e.disabled=(carry!=10)151 document.calc.kp.disabled=(carry!=10)152 document.calc.k2.disabled=(carry<=2)153 document.calc.k3.disabled=(carry<=2)154 document.calc.k4.disabled=(carry<=2)155 document.calc.k5.disabled=(carry<=2)156 document.calc.k6.disabled=(carry<=2)157 document.calc.k7.disabled=(carry<=2)158 document.calc.k8.disabled=(carry<=8)159 document.calc.k9.disabled=(carry<=8)160 document.calc.ka.disabled=(carry<=10)161 document.calc.kb.disabled=(carry<=10)162 document.calc.kc.disabled=(carry<=10)163 document.calc.kd.disabled=(carry<=10)164 document.calc.ke.disabled=(carry<=10)165 document.calc.kf.disabled=(carry<=10)166}167function inputChangAngle(angletype)168{169 endNumber=true170 angle=angletype171 if (angle=="d")172 document.calc.display.value=radiansToDegress(document.calc.display.value)173 else174 document.calc.display.value=degressToRadians(document.calc.display.value)175 endNumber=true176}177function inputshift()178{179 if (document.calc.shiftf.checked)180 {181 document.calc.bt.value="deg"182 document.calc.ln.value="exp"183 document.calc.log.value="expd"184 if (document.calc.hypf.checked)185 {186 document.calc.sin.value="ahs"187 document.calc.cos.value="ahc"188 document.calc.tan.value="aht"189 }190 else191 {192 document.calc.sin.value="asin"193 document.calc.cos.value="acos"194 document.calc.tan.value="atan"195 }196 document.calc.sqr.value="x^.5"197 document.calc.cube.value="x^.3"198 document.calc.floor.value="å°æ°"199 }200 else201 {202 document.calc.bt.value="d.ms"203 document.calc.ln.value="ln"204 document.calc.log.value="log"205 if (document.calc.hypf.checked)206 {207 document.calc.sin.value="hsin"208 document.calc.cos.value="hcos"209 document.calc.tan.value="htan"210 }211 else212 {213 document.calc.sin.value="sin"214 document.calc.cos.value="cos"215 document.calc.tan.value="tan"216 }217 document.calc.sqr.value="x^2"218 document.calc.cube.value="x^3"219 document.calc.floor.value="åæ´"220 }221}222//åå¨å¨é¨å223function clearmemory()224{225 mem=0226 document.calc.memory.value=" "227}228function getmemory()229{230 endNumber=true231 document.calc.display.value=decto(mem,carry)232}233function putmemory()234{235 endNumber=true236 if (document.calc.display.value!=0)237 {238 mem=todec(document.calc.display.value,carry)239 document.calc.memory.value=" M "240 }241 else242 document.calc.memory.value=" "243}244function addmemory()245{246 endNumber=true247 mem=parseFloat(mem)+parseFloat(todec(document.calc.display.value,carry))248 if (mem==0)249 document.calc.memory.value=" "250 else251 document.calc.memory.value=" M "252}253function multimemory()254{255 endNumber=true256 mem=parseFloat(mem)*parseFloat(todec(document.calc.display.value,carry))257 if (mem==0)258 document.calc.memory.value=" "259 else260 document.calc.memory.value=" M "261}262//åè¿å¶è½¬æ¢263function todec(num,oldcarry)264{265 if (oldcarry==10 || num==0) return(num)266 var neg=(num.charAt(0)=="-")267 if (neg) num=num.substr(1)268 var newnum=0269 for (var index=1;index<=num.length;index++)270 newnum=newnum*oldcarry+hexnum.indexOf(num.charAt(index-1))271 if (neg)272 newnum=-newnum273 return(newnum)274}275function decto(num,newcarry)276{277 var neg=(num<0)278 if (newcarry==10 || num==0) return(num)279 num=""+Math.abs(num)280 var newnum=""281 while (num!=0)282 {283 newnum=hexnum.charAt(num%newcarry)+newnum284 num=Math.floor(num/newcarry)285 }286 if (neg)287 newnum="-"+newnum288 return(newnum)289}290//表达å¼è§£æ291function parse(string)292{293 if (string.match(/^(.*\d[\+\-\*\/\%\^\&\|x\<])?([+-]?[0-9a-f\.]+)([\+\-\*\/\%\^\&\|x\<])([+-]?[0-9a-f\.]+)$/))294 return(RegExp.$1+cypher(RegExp.$2,RegExp.$3,RegExp.$4))295 else296 return(string)297}298//æ°å¦è¿ç®åä½è¿ç®299function cypher(left,join,right)300{301 left=todec(left,carry)302 right=todec(right,carry)303 if (join=="+")304 return(decto(parseFloat(left)+parseFloat(right),carry))305 if (join=="-")306 return(decto(left-right,carry))307 if (join=="*")308 return(decto(left*right,carry))309 if (join=="/" && right!=0)310 return(decto(left/right,carry))311 if (join=="%")312 return(decto(left%right,carry))313 if (join=="&")314 return(decto(left&right,carry))315 if (join=="|")316 return(decto(left|right,carry))317 if (join=="^")318 return(decto(Math.pow(left,right),carry))319 if (join=="x")320 return(decto(left^right,carry))321 if (join=="<")322 return(decto(left<<right,carry))323 alert("é¤æ°ä¸è½ä¸ºé¶")324 return(left)325}326//å½æ°è®¡ç®327function funcalc(fun,num)328{329 with(Math)330 {331 if (fun=="pi")332 return(PI)333 if (fun=="e")334 return(E)335 if (fun=="abs")336 return(abs(num))337 if (fun=="ceil")338 return(ceil(num))339 if (fun=="round")340 return(round(num))341 if (fun=="floor")342 return(floor(num))343 if (fun=="deci")344 return(num-floor(num))345 if (fun=="ln" && num>0)346 return(log(num))347 if (fun=="exp")348 return(exp(num))349 if (fun=="log" && num>0)350 return(log(num)*LOG10E)351 if (fun=="expdec")352 return(pow(10,num))353 if (fun=="cube")354 return(num*num*num)355 if (fun=="cubt")356 return(pow(num,1/3))357 if (fun=="sqr")358 return(num*num)359 if (fun=="sqrt" && num>=0)360 return(sqrt(num))361 if (fun=="!")362 return(factorial(num))363 if (fun=="recip" && num!=0)364 return(1/num)365 if (fun=="dms")366 return(dms(num))367 if (fun=="deg")368 return(deg(num))369 if (fun=="~")370 return(~num)371 if (angle=="d")372 {373 if (fun=="sin")374 return(sin(degressToRadians(num)))375 if (fun=="cos")376 return(cos(degressToRadians(num)))377 if (fun=="tan")378 return(tan(degressToRadians(num)))379 if (fun=="arcsin" && abs(num)<=1)380 return(radiansToDegress(asin(num)))381 if (fun=="arccos" && abs(num)<=1)382 return(radiansToDegress(acos(num)))383 if (fun=="arctan")384 return(radiansToDegress(atan(num)))385 }386 else387 {388 if (fun=="sin")389 return(sin(num))390 if (fun=="cos")391 return(cos(num))392 if (fun=="tan")393 return(tan(num))394 if (fun=="arcsin" && abs(num)<=1)395 return(asin(num))396 if (fun=="arccos" && abs(num)<=1)397 return(acos(num))398 if (fun=="arctan")399 return(atan(num))400 }401 if (fun=="hypsin")402 return((exp(num)-exp(0-num))*0.5)403 if (fun=="hypcos")404 return((exp(num)+exp(-num))*0.5)405 if (fun=="hyptan")406 return((exp(num)-exp(-num))/(exp(num)+exp(-num)))407 if (fun=="ahypsin" | fun=="hypcos" | fun=="hyptan")408 {409 alert("对ä¸èµ·,å
¬å¼è¿æ²¡ææ¥å°!")410 return(num)411 }412 alert("è¶
åºå½æ°å®ä¹èå´")413 return(num)414 }415}416function factorial(n)417{418 n=Math.abs(parseInt(n))419 var fac=1420 for (;n>0;n-=1)421 fac*=n422 return(fac)423}424function dms(n)425{426 var neg=(n<0)427 with(Math)428 {429 n=abs(n)430 var d=floor(n)431 var m=floor(60*(n-d))432 var s=(n-d)*60-m433 }434 var dms=d+m/100+s*0.006435 if (neg)436 dms=-dms437 return(dms)438}439function deg(n)440{441 var neg=(n<0)442 with(Math)443 {444 n=abs(n)445 var d=floor(n)446 var m=floor((n-d)*100)447 var s=(n-d)*100-m448 }449 var deg=d+m/60+s/36450 if (neg)451 deg=-deg452 return(deg)453}454function degressToRadians(degress)455{456 return(degress*Math.PI/180)457}458function radiansToDegress(radians)459{460 return(radians*180/Math.PI)...
html5shiv.js
Source:html5shiv.js
1/**2* @preserve HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed3*/4;(function(window, document) {5/*jshint evil:true */6 /** version */7 var version = '3.6.2';8 /** Preset options */9 var options = window.html5 || {};10 /** Used to skip problem elements */11 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;12 /** Not all elements can be cloned in IE **/13 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;14 /** Detect whether the browser supports default html5 styles */15 var supportsHtml5Styles;16 /** Name of the expando, to work with multiple documents or to re-shiv one document */17 var expando = '_html5shiv';18 /** The id for the the documents expando */19 var expanID = 0;20 /** Cached data for each document */21 var expandoData = {};22 /** Detect whether the browser supports unknown elements */23 var supportsUnknownElements;24 (function() {25 try {26 var a = document.createElement('a');27 a.innerHTML = '<xyz></xyz>';28 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles29 supportsHtml5Styles = ('hidden' in a);30 supportsUnknownElements = a.childNodes.length == 1 || (function() {31 // assign a false positive if unable to shiv32 (document.createElement)('a');33 var frag = document.createDocumentFragment();34 return (35 typeof frag.cloneNode == 'undefined' ||36 typeof frag.createDocumentFragment == 'undefined' ||37 typeof frag.createElement == 'undefined'38 );39 }());40 } catch(e) {41 // assign a false positive if detection fails => unable to shiv42 supportsHtml5Styles = true;43 supportsUnknownElements = true;44 }45 }());46 /*--------------------------------------------------------------------------*/47 /**48 * Creates a style sheet with the given CSS text and adds it to the document.49 * @private50 * @param {Document} ownerDocument The document.51 * @param {String} cssText The CSS text.52 * @returns {StyleSheet} The style element.53 */54 function addStyleSheet(ownerDocument, cssText) {55 var p = ownerDocument.createElement('p'),56 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;57 p.innerHTML = 'x<style>' + cssText + '</style>';58 return parent.insertBefore(p.lastChild, parent.firstChild);59 }60 /**61 * Returns the value of `html5.elements` as an array.62 * @private63 * @returns {Array} An array of shived element node names.64 */65 function getElements() {66 var elements = html5.elements;67 return typeof elements == 'string' ? elements.split(' ') : elements;68 }69 /**70 * Returns the data associated to the given document71 * @private72 * @param {Document} ownerDocument The document.73 * @returns {Object} An object of data.74 */75 function getExpandoData(ownerDocument) {76 var data = expandoData[ownerDocument[expando]];77 if (!data) {78 data = {};79 expanID++;80 ownerDocument[expando] = expanID;81 expandoData[expanID] = data;82 }83 return data;84 }85 /**86 * returns a shived element for the given nodeName and document87 * @memberOf html588 * @param {String} nodeName name of the element89 * @param {Document} ownerDocument The context document.90 * @returns {Object} The shived element.91 */92 function createElement(nodeName, ownerDocument, data){93 if (!ownerDocument) {94 ownerDocument = document;95 }96 if(supportsUnknownElements){97 return ownerDocument.createElement(nodeName);98 }99 if (!data) {100 data = getExpandoData(ownerDocument);101 }102 var node;103 if (data.cache[nodeName]) {104 node = data.cache[nodeName].cloneNode();105 } else if (saveClones.test(nodeName)) {106 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();107 } else {108 node = data.createElem(nodeName);109 }110 // Avoid adding some elements to fragments in IE < 9 because111 // * Attributes like `name` or `type` cannot be set/changed once an element112 // is inserted into a document/fragment113 // * Link elements with `src` attributes that are inaccessible, as with114 // a 403 response, will cause the tab/window to crash115 // * Script elements appended to fragments will execute when their `src`116 // or `text` property is set117 return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;118 }119 /**120 * returns a shived DocumentFragment for the given document121 * @memberOf html5122 * @param {Document} ownerDocument The context document.123 * @returns {Object} The shived DocumentFragment.124 */125 function createDocumentFragment(ownerDocument, data){126 if (!ownerDocument) {127 ownerDocument = document;128 }129 if(supportsUnknownElements){130 return ownerDocument.createDocumentFragment();131 }132 data = data || getExpandoData(ownerDocument);133 var clone = data.frag.cloneNode(),134 i = 0,135 elems = getElements(),136 l = elems.length;137 for(;i<l;i++){138 clone.createElement(elems[i]);139 }140 return clone;141 }142 /**143 * Shivs the `createElement` and `createDocumentFragment` methods of the document.144 * @private145 * @param {Document|DocumentFragment} ownerDocument The document.146 * @param {Object} data of the document.147 */148 function shivMethods(ownerDocument, data) {149 if (!data.cache) {150 data.cache = {};151 data.createElem = ownerDocument.createElement;152 data.createFrag = ownerDocument.createDocumentFragment;153 data.frag = data.createFrag();154 }155 ownerDocument.createElement = function(nodeName) {156 //abort shiv157 if (!html5.shivMethods) {158 return data.createElem(nodeName);159 }160 return createElement(nodeName, ownerDocument, data);161 };162 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +163 'var n=f.cloneNode(),c=n.createElement;' +164 'h.shivMethods&&(' +165 // unroll the `createElement` calls166 getElements().join().replace(/[\w\-]+/g, function(nodeName) {167 data.createElem(nodeName);168 data.frag.createElement(nodeName);169 return 'c("' + nodeName + '")';170 }) +171 ');return n}'172 )(html5, data.frag);173 }174 /*--------------------------------------------------------------------------*/175 /**176 * Shivs the given document.177 * @memberOf html5178 * @param {Document} ownerDocument The document to shiv.179 * @returns {Document} The shived document.180 */181 function shivDocument(ownerDocument) {182 if (!ownerDocument) {183 ownerDocument = document;184 }185 var data = getExpandoData(ownerDocument);186 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {187 data.hasCSS = !!addStyleSheet(ownerDocument,188 // corrects block display not defined in IE6/7/8/9189 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +190 // adds styling not present in IE6/7/8/9191 'mark{background:#FF0;color:#000}' +192 // hides non-rendered elements193 'template{display:none}'194 );195 }196 if (!supportsUnknownElements) {197 shivMethods(ownerDocument, data);198 }199 return ownerDocument;200 }201 /*--------------------------------------------------------------------------*/202 /**203 * The `html5` object is exposed so that more elements can be shived and204 * existing shiving can be detected on iframes.205 * @type Object206 * @example207 *208 * // options can be changed before the script is included209 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };210 */211 var html5 = {212 /**213 * An array or space separated string of node names of the elements to shiv.214 * @memberOf html5215 * @type Array|String216 */217 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',218 /**219 * current version of html5shiv220 */221 'version': version,222 /**223 * A flag to indicate that the HTML5 style sheet should be inserted.224 * @memberOf html5225 * @type Boolean226 */227 'shivCSS': (options.shivCSS !== false),228 /**229 * Is equal to true if a browser supports creating unknown/HTML5 elements230 * @memberOf html5231 * @type boolean232 */233 'supportsUnknownElements': supportsUnknownElements,234 /**235 * A flag to indicate that the document's `createElement` and `createDocumentFragment`236 * methods should be overwritten.237 * @memberOf html5238 * @type Boolean239 */240 'shivMethods': (options.shivMethods !== false),241 /**242 * A string to describe the type of `html5` object ("default" or "default print").243 * @memberOf html5244 * @type String245 */246 'type': 'default',247 // shivs the document according to the specified `html5` object options248 'shivDocument': shivDocument,249 //creates a shived element250 createElement: createElement,251 //creates a shived documentFragment252 createDocumentFragment: createDocumentFragment253 };254 /*--------------------------------------------------------------------------*/255 // expose html5256 window.html5 = html5;257 // shiv the document258 shivDocument(document);...
app.js
Source:app.js
1// *******************Chapter 05 ****************************2// ******************Question # 01 ****************************3// Addtion4var a = 5;5var b = 4;6var c = a + b;7document.write("Sum of "+a+" and "+b+" is \n "+c);8document.write("<hr>");9document.write("<br>");10// ******************Question # 02 ****************************11// Subtraction12var a = 5;13var b = 4;14var c = a - b;15document.write("\nSubtraction of "+a+" and "+b+" is "+c);16document.write("<hr>");17document.write("<br>");18// ******************Question # 02 ****************************19// Multiply20var a = 5;21var b = 4;22var c = a * b;23document.write("\nMultiplication of "+a+" and "+b+" is "+c);24document.write("<hr>");25document.write("<br>");26// ******************Question # 02 ****************************27// Divide28var a = 5;29var b = 4;30var c = a / b;31document.write("\nDivision of "+a+" and "+b+" is "+c);32document.write("<hr>");33document.write("<br>");34// ******************Question # 02 ****************************35// Modulus36var a = 5;37var b = 4;38var c = a % b;39document.write("\nModulus of "+a+" and "+b+" is "+c);40document.write("<hr>");41document.write("<br>");42// ******************Question # 03 ****************************43// ************ a ***************44var sherry;45// ************ b ***************46document.write("Value after variable declaration is:" + sherry);47document.write("<br>");48document.write("<br>");49// ************ c ***************50sherry = 05;51//d52document.write("Initial value: " + sherry);53document.write("<br>");54document.write("<br>");55// e56sherry++57//f58document.write("value after increment is: " + sherry);59document.write("<br>");60document.write("<br>");61//g62// ************** 6 + 7 ****************63var result = sherry + 7;64//h65alert("Value after addition is " + result);66//i67result--68//j69document.write("value after decrement is: " + result);70document.write("<br>");71document.write("<br>");72//k 73var reminder = result % 3;74// L75document.write("The reminder is: " + reminder);76document.write("<hr>");77document.write("<br>");78// ******************Question # 04 ****************************79var tic = 600, buy = 5;80var cost = tic * buy;81document.write("Total cost to buy" + buy + "tickets to a movie is " + cost+"PKR");82document.write("<hr>");83document.write("<br>");84// ******************Question # 05 ****************************85var number = +prompt("Enter a Number to print a Table:");86document.write(number + " * " + 1 + " = " + number*1);87document.write("<br>");88document.write(number + " * " + 2 + " = " + number*2);89document.write("<br>");90document.write(number + " * " + 3 + " = " + number*3);91document.write("<br>");92document.write(number + " * " + 4 + " = " + number*4);93document.write("<br>");94document.write(number + " * " + 5 + " = " + number*5);95document.write("<br>");96document.write(number + " * " + 6 + " = " + number*6);97document.write("<br>");98document.write(number + " * " + 7 + " = " + number*7);99document.write("<br>");100document.write(number + " * " + 8 + " = " + number*8);101document.write("<br>");102document.write(number + " * " + 9 + " = " + number*9);103document.write("<br>");104document.write(number + " * " + 10 + " = " + number*10);105document.write("<hr>");106document.write("<br>");107// ******************Question # 06 ****************************108//a & c109var C = 25, F = 77;110//b111C = (F - 32) * 5 / 9;112document.write("Celcius = " + F + "Fo <br>" );113//d114F = (C * 9/5) +32;115document.write("Faranheit = " + C + "Co");116document.write("<hr>");117// ******************Question # 07 ****************************118//a Price of item 1119var item1 = 650;120//b Price of item 2121var item2 = 100;122//c Ordered Quantity of item 1123var quantity1 = 3;124//d Ordered Quantity of item 1125var quantity2 = 7;126//e Shipping charges127var shippingcharges = 100;128document.write("<h1> Shopping Cart </h1>");129document.write("Price of item 1 is " + item1);130document.write("<br> Quantity of item 1 is " + quantity1);131document.write("<br> Price of item 2 is " + item2);132document.write("<br> Quantity of item 2 is " + quantity2);133document.write("<br> Shipping Charges is " + shippingcharges);134var resultant = (item1 * quantity1) + (item2 * quantity2) + shippingcharges;135document.write("<br> The Cost of your order is " + resultant);136document.write("<hr>");137// ******************Question # 08 ****************************138var om = 804 , tm = 980 , per;139per = om/tm;140document.write("<h1> Mark Sheet </h1> <br> <br>");141document.write("<br>Total Marks : " + tm);142document.write("<br>Obtained Marks : " + om);143document.write("<br>Percentage : " + per + "%");144document.write("<hr>");145// ******************Question # 09 ****************************146var dollars = 10, riyals = 25 , pk = 104.8, pks = 28;147document.write("<h1> Currency in PKR </h1> <br> <br>");148var conversion = (dollars*pk)+(riyals*pks);149document.write(conversion);150document.write("<br>");151document.write("<hr>");152// ******************Question # 10 ****************************153var num = 2;154var equation = (((num + 5)*10)/2);155document.write("Question No: 10<br>");156document.write(equation);157document.write("<br>");158document.write("<hr>");159// ******************Question # 11 ****************************160document.write("<h1> Age Calculator </h1> <br> <br>");161var crryear = 2021;162var birthyear = 2000;163var age = crryear - birthyear;164document.write("Current Year: " + crryear + "<br> Birth Year: " + birthyear + "<br>Your Age is: " + age); 165document.write("<hr>");166// ******************Question # 12 ****************************167document.write("<h1> The Geometrizer </h1> <br> <br>");168var radius = 20, pie = 3.142, circum, area;169circum = 2 * pie * radius;170area = (pie * (radius * radius));171document.write("<br>Radius of a Circle: " + radius);172document.write("<br>The Circumference is: " + circum);173document.write("<br>The area is: " + area);174document.write("<hr>");175// ******************Question # 13 ****************************176document.write("<h1> The Lifetime Supply Calculator </h1> <br> <br>");177var favSnack = "Chocolate Chip", currAge = 15, maxAge = 65, esstAmount = 3, ripOld ;178ripOld = (maxAge - currAge) * esstAmount;179document.write("<br>Favourite Snack: " + favSnack);180document.write("<br>Current Age: " + currAge);181document.write("<br>Estimated maximum Age: " + maxAge);182document.write("<br>Amount of snacks per day: " + esstAmount);183document.write("<br>You will need " + ripOld +" " + favSnack +" to last you until the rip old age of " + maxAge);...
document-upload.js
Source:document-upload.js
1$(function($){2 // Manage document upload3 $.documentUploadManager = {};4 Dropzone.autoDiscover = false;5 // Remove document on click6 $.documentUploadManager.initDocumentDropZone = function() {7 $.documentUploadManager.onClickDeleteDocument();8 $.documentUploadManager.sortDocument();9 $.documentUploadManager.onClickToggleVisibilityDocument();10 var documentDropzone = new Dropzone("#documents-dropzone", {11 dictDefaultMessage : $('.btn-browse').html(),12 uploadMultiple: false,13 maxFilesize: 814 });15 var totalFiles = 0,16 completedFiles = 0;17 documentDropzone.on("addedfile", function(file){18 totalFiles += 1;19 if(totalFiles == 1){20 $('.dz-message').hide();21 }22 });23 documentDropzone.on("complete", function(file){24 completedFiles += 1;25 if (completedFiles === totalFiles){26 $('.dz-message').slideDown();27 }28 });29 documentDropzone.on("success", function(file) {30 documentDropzone.removeFile(file);31 $.documentUploadManager.updateDocumentListAjax();32 $.documentUploadManager.onClickDeleteDocument();33 $.documentUploadManager.onClickToggleVisibilityDocument();34 });35 };36 // Update picture list via AJAX call37 $.documentUploadManager.updateDocumentListAjax = function() {38 var $documentListArea = $(".document-manager .existing-document");39 $documentListArea.html('<div class="loading" ></div>');40 $.ajax({41 type: "POST",42 url: documentListUrl,43 statusCode: {44 404: function() {45 $documentListArea.html(46 documentListErrorMessage47 );48 }49 }50 }).done(function(data) {51 $documentListArea.html(52 data53 );54 $.documentUploadManager.onClickDeleteDocument();55 $.documentUploadManager.sortDocument();56 $.documentUploadManager.onClickToggleVisibilityDocument();57 });58 };59 // Remove document on click60 $.documentUploadManager.onClickDeleteDocument = function() {61 $('.document-manager .document-delete-btn').on('click', function (e) {62 e.preventDefault();63 var $this = $(this);64 var $parent = $this.parent();65 $parent.find('a').remove();66 $parent.append('<div class="loading" ></div>');67 var $url = $this.attr("href");68 var errorMessage = $this.attr("data-error-message");69 $.ajax({70 type: "POST",71 url: $url,72 statusCode: {73 404: function() {74 $(".document-manager .message").html(75 errorMessage76 );77 }78 }79 }).done(function(data) {80 $parent.parents('li').remove();81 $(".document-manager .message").html(82 data83 );84 /* refresh position */85 $( "#js-sort-document").children('li').each(function(position, element) {86 $(element).find('.js-sorted-position').html(position + 1);87 });88 });89 return false;90 });91 };92 // toggle document on click93 $.documentUploadManager.onClickToggleVisibilityDocument = function() {94 $('.document-manager').on('click', '.document-toggle-btn', function (e) {95 e.preventDefault();96 var $this = $(this);97 //$parent.append('<div class="loading" ></div>');98 var $url = $this.attr("href");99 var errorMessage = $this.attr("data-error-message");100 $.ajax({101 type: "GET",102 url: $url,103 statusCode: {104 404: function() {105 $(".document-manager .message").html(106 errorMessage107 );108 }109 }110 }).done(function(data) {111 $(".document-manager .message").html(112 data113 );114 $this.toggleClass("visibility-visible");115 });116 return false;117 });118 };119 $.documentUploadManager.sortDocument = function() {120 $( "#js-sort-document" ).sortable({121 placeholder: "ui-sortable-placeholder col-sm-6 col-md-3",122 change: function( event, ui ) {123 /* refresh position */124 var pickedElement = ui.item;125 var position = 0;126 $( "#js-sort-document").children('li').each(function(k, element) {127 if($(element).data('sort-id') == pickedElement.data('sort-id')) {128 return true;129 }130 position++;131 if($(element).is('.ui-sortable-placeholder'))Â {132 pickedElement.find('.js-sorted-position').html(position);133 } else {134 $(element).find('.js-sorted-position').html(position);135 }136 });137 },138 stop: function( event, ui ) {139 /* update */140 var newPosition = ui.item.find('.js-sorted-position').html();141 var documentId = ui.item.data('sort-id');142 $.ajax({143 type: "POST",144 url: documentReorder,145 data: {146 document_id: documentId,147 position: newPosition148 },149 statusCode: {150 404: function() {151 $(".document-manager .message").html(152 documentReorderErrorMessage153 );154 }155 }156 }).done(function(data) {157 $(".document-manager .message").html(158 data159 );160 });161 }162 });163 $( "#js-sort-document" ).disableSelection();164 };...
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('
Using AI Code Generation
1describe('My First Test', () => {2 it('Does not do much!', () => {3 expect(true).to.equal(true)4 })5 it('Visits the Kitchen Sink', () => {6 cy.contains('type').click()7 cy.url().should('include', '/commands/actions')8 cy.get('.action-email')9 .type('
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .type('
Using AI Code Generation
1describe('Test', () => {2 it('go to google', () => {3 cy.title().should('eq', 'Google')4 })5})6{7 "env": {8 },9}10describe('Test', () => {11 it('go to google', () => {12 cy.title().should('eq', 'Google')13 })14})15{16 "env": {17 },18}19describe('Test', () => {20 it('go to google', () => {21 cy.title().should('eq', 'Google')22 })23})24{25 "env": {26 },27}28describe('Test', () => {29 it('go to google', () => {30 cy.title().should('eq', 'Google')31 })32})
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!