How to use getLocale method in Appium Android Driver

Best JavaScript code snippet using appium-android-driver

options.js

Source:options.js Github

copy

Full Screen

...35 $("#hideimport").click(hidebulk);36 $("#importsettings").click(settingsImport);37 $("#settingsall").click(settingsall);38 $("#syncenable").change(function() {39 if ($(this).prop('checked') && confirm(bkg.getLocale("forcesyncimport"))) {40 bkg.importSyncHandle(1);41 }42 });43 $(".savechange").change(saveOptions);44 $(".closepage").click(closeOptions);45 $("#syncimport").click(forceSyncImport);46 $("#syncexport").click(forceSyncExport);47 $("#savetxt").click(downloadtxt);48 $("#viewtoggle").click(function() {49 viewToggle(1);50 });51 $("#hotkeyspage").click(function() {52 chrome.tabs.create({url: 'chrome://extensions/?id=footer-section'});53 });54 $("#restoredefault").click(function() {55 if (confirm(bkg.getLocale("restoredefaultconfirm"))) {56 bkg.setDefaultOptions(1);57 notification(bkg.getLocale("settingssave"));58 }59 });60 $("#restoredefault2").click(function() {61 if (confirm(bkg.getLocale("restoredefaultconfirm2"))) {62 bkg.setDefaultOptions(2);63 notification(bkg.getLocale("settingssave"));64 }65 });66 $("#useragent").keyup(function() {67 if ($(this).val().indexOf("\n") != -1) $(".useragentrandom").show();68 else $(".useragentrandom").hide();69 });70 syncstatus = localStorage['syncenable'];71 $(".row-offcanvas").show();72 if (localStorage['optionslist'] == 'true') viewToggle(0);73 $('#sidebar').stickyScroll({ container: '#sectionname' });74 bkg.setUpdated();75 setInterval(function() { if (bkg.getUpdated()) { bkg.setUpdated(); window.location.reload(1); } }, 5000);76});77function i18load() {78 $(".i18_support").html(bkg.getLocale("support"));79 $("#restoredefault").val(bkg.getLocale("restoredefault"));80 $("#restoredefault2").val(bkg.getLocale("restoredefault2"));81 $(".i18_listallsettings").html(bkg.getLocale("listallsettings"));82 $(".i18_groupallsettings").html(bkg.getLocale("groupallsettings"));83 $(".i18_sections").html(bkg.getLocale("sections"));84 $(".i18_save").val(bkg.getLocale("save"));85 $(".i18_close").val(bkg.getLocale("close"));86 $(".i18_enable").html(bkg.getLocale("enable"));87 $(".i18_mode").html(bkg.getLocale("mode"));88 $(".i18_default").html(bkg.getLocale("default"));89 $(".i18_enabled").html(bkg.getLocale("enabled"));90 $(".i18_disabled").html(bkg.getLocale("disabled"));91 $(".i18_enablesyncing").html(bkg.getLocale("enablesyncing"));92 $("#syncimport").val(bkg.getLocale("syncimport"));93 $("#syncexport").val(bkg.getLocale("syncexport"));94 $(".i18_blockrec").html(bkg.getLocale("blockrec"));95 $(".i18_block").html(bkg.getLocale("block"));96 $(".i18_allow").html(bkg.getLocale("allow"));97 $(".i18_disableremove").html(bkg.getLocale("disableremove"));98 $(".i18_xml").html(bkg.getLocale("xml"));99 $(".i18_disabledcap").html(bkg.getLocale("disabledcap"));100 $(".i18_xmlcross").html(bkg.getLocale("xmlcross"));101 $(".i18_xmlall").html(bkg.getLocale("xmlall"));102 $(".i18_xmldesc").html(bkg.getLocale("xmldesc"));103 $(".i18_syncnotify").html(bkg.getLocale("syncnotify"));104 $(".i18_syncnotifydesc").html(bkg.getLocale("syncnotifydesc"));105 $(".i18_syncfromnotify").html(bkg.getLocale("syncfromnotify"));106 $(".i18_syncfromnotifydesc").html(bkg.getLocale("syncfromnotifydesc"));107 $(".i18_updatenotify").html(bkg.getLocale("updatenotify"));108 $(".i18_updatenotifydesc").html(bkg.getLocale("updatenotifydesc"));109 $(".i18_hotkeys").html(bkg.getLocale("hotkeys"));110 $(".i18_availablehotkeys").html(bkg.getLocale("availablehotkeys"));111 $(".i18_hotkeystoggle").html(bkg.getLocale("hotkeystoggle"));112 $(".i18_hotkeysremove").html(bkg.getLocale("hotkeysremove"));113 $(".i18_hotkeysremoveall").html(bkg.getLocale("hotkeysremoveall"));114 $("#hotkeyspage").html(bkg.getLocale("hotkeyspage"));115 $(".i18_showcontext").html(bkg.getLocale("showcontext"));116 $(".i18_hotkeysinst").html(bkg.getLocale("hotkeysinst"));117 $(".i18_canvas").html(bkg.getLocale("canvas"));118 $(".i18_canvasblank").html(bkg.getLocale("canvasblank"));119 $(".i18_canvasrandom").html(bkg.getLocale("canvasrandom"));120 $(".i18_canvasblock").html(bkg.getLocale("canvasblock"));121 $(".i18_canvasdesc").html(bkg.getLocale("canvasdesc"));122 $(".i18_audioblock").html(bkg.getLocale("audioblock"));123 $(".i18_audioblockdesc").html(bkg.getLocale("audioblockdesc"));124 $(".i18_webgl").html(bkg.getLocale("webgl"));125 $(".i18_webgldesc").html(bkg.getLocale("webgldesc"));126 $(".i18_battery").html(bkg.getLocale("battery"));127 $(".i18_batterydesc").html(bkg.getLocale("batterydesc"));128 $(".i18_webrtcdevice").html(bkg.getLocale("webrtcdevice"));129 $(".i18_webrtcdevicedesc").html(bkg.getLocale("webrtcdevicedesc"));130 $(".i18_gamepad").html(bkg.getLocale("gamepad"));131 $(".i18_gamepaddesc").html(bkg.getLocale("gamepaddesc"));132 $(".i18_webvr").html(bkg.getLocale("webvr"));133 $(".i18_webvrdesc").html(bkg.getLocale("webvrdesc"));134 $(".i18_bluetooth").html(bkg.getLocale("bluetooth"));135 $(".i18_bluetoothdesc").html(bkg.getLocale("bluetoothdesc"));136 $(".i18_canvasfont").html(bkg.getLocale("canvasfont"));137 $(".i18_canvasfontdesc").html(bkg.getLocale("canvasfontdesc"));138 $(".i18_clientrects").html(bkg.getLocale("clientrects"));139 $(".i18_clientrectsdesc").html(bkg.getLocale("clientrectsdesc"));140 $(".i18_keyboard").html(bkg.getLocale("keyboard"));141 $(".i18_keyboarddesc").html(bkg.getLocale("keyboarddesc"));142 $(".i18_browserplugins").html(bkg.getLocale("browserplugins"));143 $(".i18_browserpluginsdesc").html(bkg.getLocale("browserpluginsdesc"));144 $(".i18_paranoia").html(bkg.getLocale("paranoia"));145 $(".i18_paranoiadesc").html(bkg.getLocale("paranoiadesc"));146 $(".i18_annoyances").html(bkg.getLocale("annoyances"));147 $(".i18_annoyancesdesc").html(bkg.getLocale("annoyancesdesc"));148 $(".i18_cookies").html(bkg.getLocale("cookies"));149 $(".i18_cookiesdesc").html(bkg.getLocale("cookiesdesc"));150 $(".i18_annoyancesmode").html(bkg.getLocale("annoyancesmode"));151 $(".i18_annoyancesmodedesc").html(bkg.getLocale("annoyancesmodedesc"));152 $(".i18_antisocial").html(bkg.getLocale("antisocial"));153 $(".i18_antisocialdesc").html(bkg.getLocale("antisocialdesc"));154 $(".i18_antisocialdesc2").html(bkg.getLocale("antisocialdesc2"));155 $(".i18_webbugs").html(bkg.getLocale("webbugs"));156 $(".i18_webbugsdesc").html(bkg.getLocale("webbugsdesc"));157 $(".i18_utm").html(bkg.getLocale("utm"));158 $(".i18_utmdesc").html(bkg.getLocale("utmdesc"));159 $(".i18_hashchecking").html(bkg.getLocale("hashchecking"));160 $(".i18_hashcheckingdesc").html(bkg.getLocale("hashcheckingdesc"));161 $(".i18_webrtc").html(bkg.getLocale("webrtc"));162 $(".i18_webrtcdesc").html(bkg.getLocale("webrtcdesc"));163 $(".i18_referrer").html(bkg.getLocale("referrer"));164 $(".i18_referrerdesc").html(bkg.getLocale("referrerdesc"));165 $(".i18_timezone").html(bkg.getLocale("timezone"));166 $(".i18_timezonedesc").html(bkg.getLocale("timezonedesc"));167 $(".i18_useragentspoof").html(bkg.getLocale("useragentspoof"));168 $(".i18_useragentspoofdesc").html(bkg.getLocale("useragentspoofdesc"));169 $(".i18_uaspoofallow").html(bkg.getLocale("uaspoofallow"));170 $(".i18_request").html(bkg.getLocale("request"));171 $(".i18_interval").html(bkg.getLocale("interval"));172 $(".i18_minutes").html(bkg.getLocale("minutes"));173 $(".i18_referrerspoof").html(bkg.getLocale("referrerspoof"));174 $(".i18_referrerspoofdesc").html(bkg.getLocale("referrerspoofdesc"));175 $("#userref").attr('placeholder', bkg.getLocale("userref"));176 $(".i18_linktarget").html(bkg.getLocale("linktarget"));177 $(".i18_linktargetdesc").html(bkg.getLocale("linktargetdesc"));178 $(".i18_preservesamedomain").html(bkg.getLocale("preservesamedomain"));179 $(".i18_preservesamedomaindesc").html(bkg.getLocale("preservesamedomaindesc"));180 $(".i18_refresh").html(bkg.getLocale("refresh"));181 $(".i18_refreshdesc").html(bkg.getLocale("refreshdesc"));182 $(".i18_rating").html(bkg.getLocale("rating"));183 $(".i18_ratingdesc").html(bkg.getLocale("ratingdesc"));184 $(".i18_classicoptions").html(bkg.getLocale("classicoptions"));185 $(".i18_classicoptionsdesc").html(bkg.getLocale("classicoptionsdesc"));186 $(".i18_clipboard").html(bkg.getLocale("clipboard"));187 $(".i18_clipboarddesc").html(bkg.getLocale("clipboarddesc"));188 $(".i18_domainsort").html(bkg.getLocale("domainsort"));189 $(".i18_domainsortdesc").html(bkg.getLocale("domainsortdesc"));190 $(".i18_url").html(bkg.getLocale("url"));191 $("#url").attr('placeholder', bkg.getLocale("urldesc"));192 $("#whitebind").val(bkg.getLocale("whitebind"));193 $("#blackbind").val(bkg.getLocale("blackbind"));194 $("#domaininfo").val(bkg.getLocale("domaininfo"));195 $(".i18_whitelist").html(bkg.getLocale("whitelist"));196 $(".i18_blacklist").html(bkg.getLocale("blacklist"));197 $("#blackclear, #whiteclear").html(bkg.getLocale("clearlow"));198 $("#importwhite, #importblack").html(bkg.getLocale("bulkimport"));199 $(".i18_bulkimportcap").html(bkg.getLocale("bulkimportcap"));200 $(".i18_bulkimportcapdesc").html(bkg.getLocale("bulkimportcapdesc"));201 $("#bulkbtn").html(bkg.getLocale("bulkbtn"));202 $("#hideimport").val(bkg.getLocale("hide"));203 $(".i18_import").html(bkg.getLocale("import"));204 $("#importsettings").val(bkg.getLocale("import"));205 $(".i18_export").html(bkg.getLocale("export"));206 $("#settingsall").html(bkg.getLocale("settingsall"));207 $("#settingsimport").attr('placeholder', bkg.getLocale("settingsimport"));208 $("#savetxt").val(bkg.getLocale("savetxt"));209 $(".i18_relaxed").html(bkg.getLocale("relaxed"));210 $(".i18_strict").html(bkg.getLocale("strict"));211 $(".i18_default_public_interface_only").html(bkg.getLocale("default_public_interface_only"));212 $(".i18_disable_non_proxied_udp").html(bkg.getLocale("disable_non_proxied_udp"));213 $(".i18_onlyunwhitelisted").html(bkg.getLocale("onlyunwhitelisted"));214 $(".i18_alldomains").html(bkg.getLocale("alldomains"));215 $(".i18_random").html(bkg.getLocale("random"));216 $(".i18_off").html(bkg.getLocale("off"));217 $(".i18_same").html(bkg.getLocale("same"));218 $(".i18_domain").html(bkg.getLocale("domain"));219 $(".i18_custom").html(bkg.getLocale("custom"));220 $(".i18_sametab").html(bkg.getLocale("sametab"));221 $(".i18_newtab").html(bkg.getLocale("newtab"));222 $(".i18_strictsamedomain").html(bkg.getLocale("strictsamedomain"));223 $(".i18_loosesamedomain").html(bkg.getLocale("loosesamedomain"));224 $(".i18_whitelistmove").attr('title', bkg.getLocale("whitelistmove"));225 $(".i18_blacklistmove").attr('title', bkg.getLocale("blacklistmove"));226 $(".i18_domaintip").html(bkg.getLocale("domaintip"));227 $(".topDomainAdd[data-mode='0']").html(bkg.getLocale("trust"));228 $(".topDomainAdd[data-mode='1']").html(bkg.getLocale("distrust"));229 $("#menu_generalsettings").attr('rel', bkg.getLocale("generalsettings")).html(bkg.getLocale("generalsettings"));230 $("#menu_fingerprint").attr('rel', bkg.getLocale("fingerprintdesc")).html(bkg.getLocale("fingerprint"));231 $("#menu_privacy").attr('rel', bkg.getLocale("privacy")).html(bkg.getLocale("privacy"));232 $("#menu_behavior").attr('rel', bkg.getLocale("behavior")).html(bkg.getLocale("behavior"));233 $("#menu_whitelistblacklist").attr('rel', bkg.getLocale("whitelistblacklist")).html(bkg.getLocale("whitelistblacklist"));234 $("#menu_importexport").attr('rel', bkg.getLocale("importexport")).html(bkg.getLocale("importexport"));235 $("#sectionname").html($('.list-group a.active').attr('rel'));236}237function initTabs() {238 $('.list-group a').on('click', function(e) {239 var currentAttrValue = $(this).attr('href');240 $("#sectionname").text($(this).attr('rel'));241 $('.tab-content ' + currentAttrValue).show().siblings().hide();242 $(this).addClass('active').siblings().removeClass('active');243 $('.tab-content ' + currentAttrValue).addClass('active').siblings().removeClass('active');244 e.preventDefault();245 });246}247function viewToggle(commit) {248 $("#sidebar, #sectionname").toggle();249 if ($(".tab-content").hasClass('col-sm-9')) {250 $("#viewtoggle").text(bkg.getLocale("groupallsettings")).removeClass('btn-info').addClass('btn-success');251 if (commit) localStorage['optionslist'] = 'true';252 $(".tab-content").removeClass('col-sm-9').addClass('col-sm-12');253 $(".tab").each(function() {254 $(this).prepend('<div class="sectionheading alert alert-success"><h4>'+$("a[href='#"+$(this).attr('id')+"']").attr('rel')+'</h4></div>').show();255 });256 $(".sectionheading:first").css('margin-top', '0px');257 $('#generalsettings .sectionheading').stickyScroll({ topBoundary: $("#generalsettings").offset().top, bottomBoundary: $("#fingerprintprotection").offset().top });258 $('#fingerprintprotection .sectionheading').stickyScroll({ topBoundary: $("#fingerprintprotection").offset().top, bottomBoundary: $("#privacysettings").offset().top });259 $('#privacysettings .sectionheading').stickyScroll({ topBoundary: $("#privacysettings").offset().top, bottomBoundary: $("#behaviorsettings").offset().top });260 $('#behaviorsettings .sectionheading').stickyScroll({ topBoundary: $("#behaviorsettings").offset().top, bottomBoundary: $("#whitelistblacklist").offset().top });261 $('#whitelistblacklist .sectionheading').stickyScroll({ topBoundary: $("#whitelistblacklist").offset().top, bottomBoundary: $("#whitelistblacklist").offset().top });262 } else {263 $("#viewtoggle").text(bkg.getLocale("listallsettings")).removeClass('btn-success').addClass('btn-info');264 if (commit) localStorage['optionslist'] = 'false';265 $(".tab-content").removeClass('col-sm-12').addClass('col-sm-9');266 $(".tab").hide();267 $(".tab.active").show();268 $('.sectionheading').stickyScroll('reset');269 $(".sectionheading").remove();270 $('#sidebar').stickyScroll('reset');271 $('#sidebar').stickyScroll({ container: '#sectionname' });272 }273}274function forceSyncExport() {275 if (confirm(bkg.getLocale("forcesyncexport"))) {276 if (bkg.freshSync(true) == 'true') {277 notification(bkg.getLocale("exportsuccess"));278 }279 }280}281function forceSyncImport() {282 if (confirm(bkg.getLocale("forcesyncimport"))) {283 bkg.importSyncHandle(1);284 }285}286function importbulkwhite() {287 importbulk(0);288}289function importbulkblack() {290 importbulk(1);291}292function settingsall() {293 selectAll('settingsexport');294}295function importwhite() {296 bulk(0);297}298function importblack() {299 bulk(1);300}301function whiteclear() {302 listclear(0);303}304function blackclear() {305 listclear(1);306}307function closeOptions() {308 window.open('', '_self', '');window.close();309}310function whitelistlisten() {311 addList(0);312}313function blacklistlisten() {314 addList(1);315}316function domainsort() {317 saveOptions();listUpdate();fpListUpdate();318}319function loadCheckbox(id) {320 document.getElementById(id).checked = typeof localStorage[id] == "undefined" ? false : localStorage[id] == "true";321}322function loadElement(id) {323 $("#"+id).val(localStorage[id]);324}325function loadList(id) {326 $("#"+id).val(JSON.parse(localStorage[id]).join("\n"));327}328function saveCheckbox(id) {329 localStorage[id] = document.getElementById(id).checked;330}331function saveElement(id) {332 localStorage[id] = $("#"+id).val().replace(/[~|]/g, '');333}334function saveList(id) {335 localStorage[id] = JSON.stringify($("#"+id).val().split("\n"));336}337function loadOptions() {338 $("#title").html("ScriptSafe v"+version);339 loadCheckbox("enable");340 loadCheckbox("syncenable");341 if (!$("#syncenable").prop('checked')) $("#syncbuttons").hide();342 else $("#syncbuttons").show();343 loadCheckbox("syncfromnotify");344 loadCheckbox("updatenotify");345 loadCheckbox("syncnotify");346 loadElement("mode");347 loadCheckbox("refresh");348 loadCheckbox("script");349 loadCheckbox("noscript");350 loadCheckbox("object");351 loadCheckbox("applet");352 loadCheckbox("embed");353 loadCheckbox("iframe");354 loadCheckbox("frame");355 loadCheckbox("audio");356 loadCheckbox("video");357 loadCheckbox("image");358 loadCheckbox("dataurl");359 loadCheckbox("showcontext");360 loadElement("xml");361 loadCheckbox("annoyances");362 loadElement("annoyancesmode");363 loadCheckbox("antisocial");364 loadElement("canvas");365 loadCheckbox("canvasfont");366 loadCheckbox("clientrects");367 loadCheckbox("audioblock");368 loadCheckbox("webgl");369 loadCheckbox("battery");370 loadCheckbox("webrtcdevice");371 loadCheckbox("gamepad");372 loadCheckbox("webvr");373 loadCheckbox("bluetooth");374 loadElement("timezone");375 loadCheckbox("keyboard");376 loadCheckbox("browserplugins");377 if (!$("#keyboard").prop('checked')) $(".keydeltarow").hide();378 else $(".keydeltarow").show();379 loadElement("keydelta");380 if ($("#keydelta").val() < 0 || isNaN(parseInt($("#keydelta").val()))) {381 $("#keydelta").val(40);382 saveElement("keydelta");383 }384 loadCheckbox("webbugs");385 loadCheckbox("utm");386 loadCheckbox("hashchecking");387 loadCheckbox("hashallow");388 loadElement("webrtc");389 if (!bkg.getWebRTC()) $("#webrtccell").html('<strong style="color: red;">'+bkg.getLocale("nowebrtc")+'</strong>');390 loadElement("preservesamedomain");391 loadCheckbox("paranoia");392 loadCheckbox("clipboard");393 loadCheckbox("classicoptions");394 loadElement("referrer");395 loadCheckbox("rating");396 loadCheckbox("domainsort");397 loadElement("linktarget");398 loadCheckbox("cookies");399 loadElement("useragentspoof");400 loadElement("useragentspoof_os");401 loadList("useragent");402 loadElement("useragentinterval");403 loadElement("useragentintervalmins");404 loadCheckbox("uaspoofallow");405 if (localStorage['annoyances'] == 'true' || localStorage['cookies'] == 'true') $("#annoyancesmode").removeAttr('disabled');406 else $("#annoyancesmode").attr('disabled', 'true');407 if ($("#useragentspoof").val() == 'off') $("#useragentspoof_os, #useragentbox, #applytoallow").hide();408 else if ($("#useragentspoof").val() == 'custom') {409 $("#useragentspoof_os").hide();410 $("#useragentbox, #applytoallow").show();411 } else {412 $("#useragentbox").hide();413 $("#useragentspoof_os, #applytoallow").show();414 }415 if ($("#hashchecking").val() == 'off') $("#applytoallowhash").hide();416 else $("#applytoallowhash").show();417 loadCheckbox("referrerspoofdenywhitelisted");418 if (localStorage['referrerspoof'] != 'same' && localStorage['referrerspoof'] != 'domain' && localStorage['referrerspoof'] != 'off') {419 $("#referrerspoof").val('custom');420 $("#customreferrer").show();421 $("#userref").val(localStorage['referrerspoof']);422 } else {423 loadElement("referrerspoof");424 $("#customreferrer").hide();425 }426 if ($("#useragent").val().indexOf("\n") == -1) $(".useragentrandom").hide();427 else $(".useragentrandom").show();428 if (localStorage['useragentinterval'] == 'interval') $("#useragentintervaloption").show();429 else $("#useragentintervaloption").hide();430 if ($("#referrerspoof").val() == 'off') $("#applyreferrerspoofdenywhitelisted").hide();431 else $("#applyreferrerspoofdenywhitelisted").show();432 listUpdate();433 fpListUpdate();434}435function saveOptions() {436 saveCheckbox("enable");437 saveCheckbox("syncenable");438 if (!$("#syncenable").prop('checked')) $("#syncbuttons").hide();439 else $("#syncbuttons").show();440 saveCheckbox("syncnotify");441 saveCheckbox("syncfromnotify");442 saveCheckbox("updatenotify");443 saveElement("mode");444 saveCheckbox("refresh");445 saveCheckbox("script");446 saveCheckbox("noscript");447 saveCheckbox("object");448 saveCheckbox("applet");449 saveCheckbox("embed");450 saveCheckbox("iframe");451 saveCheckbox("frame");452 saveCheckbox("audio");453 saveCheckbox("video");454 saveCheckbox("image");455 saveCheckbox("dataurl");456 saveCheckbox("showcontext");457 saveElement("xml");458 saveCheckbox("annoyances");459 saveElement("annoyancesmode");460 saveCheckbox("antisocial");461 saveElement("canvas");462 saveCheckbox("canvasfont");463 saveCheckbox("clientrects");464 saveCheckbox("audioblock");465 saveCheckbox("webgl");466 saveCheckbox("battery");467 saveCheckbox("webrtcdevice");468 saveCheckbox("gamepad");469 saveCheckbox("webvr");470 saveCheckbox("bluetooth");471 saveElement("timezone");472 saveCheckbox("keyboard");473 saveCheckbox("browserplugins");474 if (!$("#keyboard").prop('checked')) $(".keydeltarow").hide();475 else $(".keydeltarow").show();476 saveElement("keydelta");477 saveCheckbox("webbugs");478 saveCheckbox("utm");479 saveCheckbox("hashchecking");480 saveCheckbox("hashallow");481 saveElement("webrtc");482 saveElement("preservesamedomain");483 saveCheckbox("paranoia");484 saveCheckbox("clipboard");485 saveCheckbox("classicoptions");486 saveElement("referrer");487 saveCheckbox("rating");488 saveCheckbox("cookies");489 saveElement("useragentspoof");490 saveElement("useragentspoof_os");491 var userAgents = $("#useragent").val();492 if (userAgents) {493 var validUserAgents = [];494 userAgents = userAgents.split("\n");495 var sanitizedAgent;496 for (var i=0, userAgentNum=userAgents.length; i<userAgentNum; i++) {497 sanitizedAgent = $.trim(userAgents[i].replace(/[~|]/g, ''));498 if (sanitizedAgent) validUserAgents.push(sanitizedAgent);499 }500 $("#useragent").val(validUserAgents.join("\n"));501 }502 saveList("useragent");503 saveElement("useragentinterval");504 saveElement("useragentintervalmins");505 saveCheckbox("uaspoofallow");506 saveCheckbox("referrerspoofdenywhitelisted");507 if ($("#referrerspoof").val() != 'custom') {508 saveElement("referrerspoof");509 $("#customreferrer").hide();510 } else {511 if ($("#userref").val() != '') localStorage['referrerspoof'] = $("#userref").val();512 else {513 $("#customreferrer").show();514 $("#userref").focus;515 }516 }517 saveElement("linktarget");518 saveCheckbox("domainsort");519 if (localStorage['annoyances'] == 'true' || localStorage['cookies'] == 'true') $("#annoyancesmode").removeAttr('disabled');520 else $("#annoyancesmode").attr('disabled', 'true');521 if (localStorage['useragentspoof'] == 'off') $("#useragentspoof_os, #useragentbox, #applytoallow").hide();522 else if (localStorage['useragentspoof'] == 'custom') {523 $("#useragentspoof_os").hide();524 $("#useragentbox, #applytoallow").show();525 } else {526 $("#useragentbox").hide();527 $("#useragentspoof_os, #applytoallow").show();528 }529 if (localStorage['hashchecking'] != 'off') $("#applytoallowhash").show();530 else $("#applytoallowhash").hide();531 if ($("#useragent").val().indexOf("\n") == -1) $(".useragentrandom").hide();532 else $(".useragentrandom").show();533 if (localStorage['useragentinterval'] == 'interval') $("#useragentintervaloption").show();534 else $("#useragentintervaloption").hide();535 if (localStorage['referrerspoof'] != 'off') $("#applyreferrerspoofdenywhitelisted").show();536 else $("#applyreferrerspoofdenywhitelisted").hide();537 updateExport();538 bkg.refreshRequestTypes();539 bkg.initWebRTC();540 bkg.reinitContext();541 syncstatus = bkg.freshSync();542 if (syncstatus) {543 notification(bkg.getLocale("settingssavesync"));544 } else {545 notification(bkg.getLocale("settingssave"));546 }547}548function saveLang() {549 saveElement("locale");550 updateExport();551 bkg.initLang(localStorage['locale'], 0);552 setTimeout(function() {553 i18load();554 syncstatus = bkg.freshSync();555 if (syncstatus) {556 notification(bkg.getLocale("settingssavesync"));557 } else {558 notification(bkg.getLocale("settingssave"));559 }560 }, 1000);561}562function selectAll(id) {563 $("#"+id).select();564}565function settingsImport() {566 var error = "";567 var settings = $("#settingsimport").val().split("\n");568 if ($.trim($("#settingsimport").val()) == "") {569 notification(bkg.getLocale("pastesettings"));570 return false;571 }572 if (settings.length > 0) {573 $.each(settings, function(i, v) {574 if ($.trim(v) != "") {575 var settingentry = $.trim(v).split("|");576 if (settingnames.indexOf($.trim(settingentry[0])) != -1 && ($.trim(settingentry[1]) != '' || $.trim(settingentry[0]) == 'useragent')) {577 if ($.trim(settingentry[0]) == 'whiteList' || $.trim(settingentry[0]) == 'blackList' || $.trim(settingentry[0]) == 'useragent') {578 var listarray = $.trim(settingentry[1]).replace(/(\[|\]|")/g,"").split(",");579 if ($.trim(settingentry[0]) == 'whiteList' && listarray.toString() != '') localStorage['whiteList'] = JSON.stringify(listarray);580 else if ($.trim(settingentry[0]) == 'blackList' && listarray.toString() != '') localStorage['blackList'] = JSON.stringify(listarray);581 else if ($.trim(settingentry[0]) == 'useragent' && listarray.toString() != '') localStorage['useragent'] = JSON.stringify(listarray);582 } else 583 localStorage[$.trim(settingentry[0])] = $.trim(settingentry[1]);584 } else {585 error += $.trim(settingentry[0])+", ";586 }587 }588 });589 }590 loadOptions();591 listUpdate();592 fpListUpdate();593 bkg.refreshRequestTypes();594 bkg.initWebRTC();595 bkg.cacheLists();596 bkg.cacheFpLists();597 bkg.initLang(localStorage['locale'], 0);598 setTimeout(function() {599 i18load();600 $("#locale").val(localStorage['locale'])601 syncstatus = bkg.freshSync();602 if (!error) {603 if (syncstatus) notification(bkg.getLocale("importsuccesssync"));604 else notification(bkg.getLocale("importsuccessoptions"));605 } else {606 if (syncstatus) notification(bkg.getLocale("importsuccesscond")+' '+error.slice(0, -2)+'<br /><br />'+bkg.getLocale("settingssavesync"));607 else notification(bkg.getLocale("importsuccesscond")+' '+error.slice(0, -2));608 }609 $("#settingsimport").val("");610 }, 1000);611}612function downloadtxt() {613 var textToWrite = $("#settingsexport").val();614 var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});615 var fileNameToSaveAs = "scriptsafe-settings-"+new Date().toJSON()+".txt";616 var downloadLink = document.createElement("a");617 downloadLink.download = fileNameToSaveAs;618 downloadLink.innerHTML = "Download File";619 downloadLink.href = window.URL.createObjectURL(textFileAsBlob);620 downloadLink.onclick = function(e) { document.body.removeChild(e.target); };621 downloadLink.style.display = "none";622 document.body.appendChild(downloadLink);623 downloadLink.click();624}625function updateExport() {626 settingnames = [];627 $("#settingsexport").val("");628 for (var i in localStorage) {629 if (localStorage.hasOwnProperty(i)) {630 if (i != "version" && i != "tempregexflag" && i != "whiteListCount" && i != "blackListCount" && i != "whiteListCount2" && i != "blackListCount2" && i.substr(0, 2) != "zb" && i.substr(0, 2) != "zw" && i.substr(0, 2) != "sb" && i.substr(0, 2) != "sw" && i.substr(0, 2) != "sf") {631 settingnames.push(i);632 $("#settingsexport").val($("#settingsexport").val()+i+"|"+localStorage[i]+"\n");633 }634 }635 }636 $("#settingsexport").val($("#settingsexport").val().slice(0,-1));637}638function is_int(value){ 639 if ((parseFloat(value) == parseInt(value)) && !isNaN(value)) return true;640 return false;641}642function notification(msg) {643 $('#message').html(msg).stop().fadeIn("slow").delay(2000).fadeOut("slow")644}645function addList(type) {646 var domain = $('#url').val().toLowerCase().replace("http://", "").replace("https://", "");647 if (!domain.match(/^(?:[\-\w\*\?]+(\.[\-\w\*\?]+)*|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})|\[[A-Fa-f0-9:.]+\])?$/g)) {648 notification(bkg.getLocale("domaininvalid"));649 } else if (!domain.match(/[a-z0-9]/g)) {650 notification(bkg.getLocale("domaininvalid2"));651 } else {652 if ((localStorage['annoyances'] == 'true' && (localStorage['annoyancesmode'] == 'strict' || (localStorage['annoyancesmode'] == 'relaxed' && bkg.domainCheck(domain, 1) != '0')) && bkg.baddies(bkg.getDomain(domain), localStorage['annoyancesmode'], localStorage['antisocial']) == 1) || (localStorage['antisocial'] == 'true' && bkg.baddies(bkg.getDomain(domain), localStorage['annoyancesmode'], localStorage['antisocial']) == '2')) {653 notification(bkg.getLocale("domaininvalid3"));654 } else {655 var responseflag = bkg.domainHandler(domain, type);656 if (responseflag) {657 $('#url').val('');658 syncstatus = bkg.freshSync();659 if (syncstatus) {660 notification([bkg.getLocale("whitelisted"),bkg.getLocale("blacklisted")][type]+' '+domain+' and syncing in 10 seconds.');661 } else {662 notification([bkg.getLocale("whitelisted"),bkg.getLocale("blacklisted")][type]+' '+domain+'.');663 }664 listUpdate();665 } else {666 notification(domain+' not added as it already exists in the list or the entire domain has been '+[bkg.getLocale("whitelisted"),bkg.getLocale("blacklisted")][type]);667 }668 $('#url').focus();669 }670 }671 return false;672}673function addFPList() {674 var elid = $(this).attr('id').substr(0, $(this).attr('id').indexOf('whitebind'));675 var domain = $('#'+elid+'url').val().toLowerCase().replace("http://", "").replace("https://", "");676 if (!domain.match(/^(?:[\-\w\*\?]+(\.[\-\w\*\?]+)*|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})|\[[A-Fa-f0-9:.]+\])?$/g)) {677 notification(bkg.getLocale("domaininvalid"));678 } else if (!domain.match(/[a-z0-9]/g)) {679 notification(bkg.getLocale("domaininvalid2"));680 } else {681 var responseflag = bkg.fpDomainHandler(domain, elid, 1);682 if (responseflag) {683 $('#'+elid+'url').val('');684 syncstatus = bkg.freshSync();685 if (syncstatus) {686 notification(bkg.getLocale("whitelisted")+' '+domain+' and syncing in 10 seconds.');687 } else {688 notification(bkg.getLocale("whitelisted")+' '+domain+'.');689 }690 fpListUpdate();691 } else {692 notification(domain+' not added as it already exists in the list or the entire domain has been '+bkg.getLocale("whitelisted"));693 }694 $('#'+elid+'url').focus();695 }696 return false;697}698function domainRemover(domain, type) {699 if (confirm("Are you sure you want to remove "+domain+" from this list?")) {700 if (type === undefined) type = false;701 if (!type) {702 bkg.domainHandler(domain,2);703 listUpdate();704 } else {705 bkg.fpDomainHandler(domain,type,-1);706 fpListUpdate();707 }708 syncstatus = bkg.freshSync();709 if (syncstatus) {710 notification('Successfully removed: '+domain+' and syncing in 10 seconds.');711 } else {712 notification('Successfully removed: '+domain);713 }714 }715 return false;716}717function domainMove(domain, mode) {718 var lingo;719 if (mode == '0') lingo = bkg.getLocale("whitelistlow");720 else if (mode == '1') lingo = bkg.getLocale("blacklistlow");721 if (confirm("Are you sure you want to move "+domain+" to the "+lingo+"?")) {722 bkg.domainHandler(domain, mode);723 listUpdate();724 syncstatus = bkg.freshSync();725 if (syncstatus) {726 notification([bkg.getLocale("whitelisted"),bkg.getLocale("blacklisted")][mode]+' '+domain+' and syncing in 10 seconds.');727 } else {728 notification([bkg.getLocale("whitelisted"),bkg.getLocale("blacklisted")][mode]+' '+domain);729 }730 }731 return false;732}733function topDomainAdd(domain, mode) {734 var lingo;735 var fpmode = false;736 if (mode == '0') lingo = bkg.getLocale("trustlow");737 else if (mode == '1') lingo = bkg.getLocale("distrustlow");738 else {739 lingo = bkg.getLocale("trustlow");740 fpmode = true;741 }742 if (domain && !domain.match(/^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) && !domain.match(/^(?:\[[A-Fa-f0-9:.]+\])$/g) && domain.indexOf('**.') != 0 && confirm("Are you sure you want to "+lingo+" "+bkg.getDomain(domain)+"?\r\n\r\Click OK will mean all subdomains on "+bkg.getDomain(domain)+" will be "+lingo+"ed, such as _."+bkg.getDomain(domain)+" and even _._._."+bkg.getDomain(domain)+".")) {743 bkg.topHandler(domain, mode);744 if (!fpmode) listUpdate();745 else fpListUpdate();746 bkg.freshSync();747 notification('Successfully '+lingo+'ed: '+domain);748 }749}750function hidebulk() {751 $("#bulk").slideUp("fast");752}753function bulk(type) {754 var error = false;755 if (!$("#bulk").is(":visible")) {756 $("#bulk").slideDown("fast");757 $('html, body').animate({758 scrollTop: ($("#bulk").offset().top-55)759 }, 'slow');760 } else {761 if ((type == '0' && $("#bulk strong").html() == bkg.getLocale("whitelist")+" "+bkg.getLocale("bulkimportcap")) || (type == '1' && $("#bulk strong").html() == bkg.getLocale("blacklist")+" "+bkg.getLocale("bulkimportcap"))) hidebulk();762 }763 $("#bulk textarea").focus();764 if (type == '0') {765 $("#bulk strong").html(bkg.getLocale("whitelist")+" "+bkg.getLocale("bulkimportcap"));766 $("#bulkbtn").val(bkg.getLocale("whitebind")).click(importbulkwhite);767 } else if (type == '1') {768 $("#bulk strong").html(bkg.getLocale("blacklist")+" "+bkg.getLocale("bulkimportcap"));769 $("#bulkbtn").val(bkg.getLocale("blackbind")).click(importbulkblack);770 }771}772function importbulk(type) {773 var error = '';774 var domains = $("#bulk textarea").val().split("\n");775 if ($.trim($("#bulk textarea").val()) == "") {776 hidebulk();777 return false;778 }779 if (domains.length > 0) {780 $.each(domains, function(i, v) {781 if ($.trim(v) != "") {782 var domain = $.trim(v).toLowerCase().replace("http://", "").replace("https://", "");783 if ((localStorage['annoyances'] == 'true' && (localStorage['annoyancesmode'] == 'strict' || (localStorage['annoyancesmode'] == 'relaxed' && bkg.domainCheck(domain.replace("http://", "").replace("https://", ""), 1) != '0')) && bkg.baddies(bkg.getDomain(domain.replace("http://", "").replace("https://", "")), localStorage['annoyancesmode'], localStorage['antisocial']) == 1) || (localStorage['antisocial'] == 'true' && bkg.baddies(bkg.getDomain(domain.replace("http://", "").replace("https://", "")), localStorage['annoyancesmode'], localStorage['antisocial']) == '2')) {784 error += '<li>'+domain.replace("http://", "").replace("https://", "")+' <b>(provider of unwanted content (see "Block Unwanted Content" and/or "Antisocial Mode")</b></li>';785 } else {786 if (domain.match(/^(?:[\-\w\*\?]+(\.[\-\w\*\?]+)*|((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})|\[[A-Fa-f0-9:.]+\])?$/g)) {787 bkg.domainHandler(domain, type);788 } else {789 error += '<li>'+domain+'</li>';790 }791 }792 }793 });794 }795 listUpdate();796 if (!error) {797 syncstatus = bkg.freshSync();798 if (syncstatus) {799 notification('Domains imported successfully and syncing in 10 seconds');800 } else {801 notification('Domains imported successfully');802 }803 if ($("#bulk").is(":visible")) hidebulk();804 $("#bulk textarea").val("");805 $('#importerror').hide();806 } else {807 bkg.freshSync();808 notification('Error importing some domains');809 $('#importerror').html('<strong>Some Domains Not Imported</strong><br />The following domains were not imported as they are invalid (the others were successfully imported): <ul>'+error+'</ul>').stop().fadeIn("slow");810 }811}812function listUpdate() {813 var whiteList = JSON.parse(localStorage['whiteList']);814 var blackList = JSON.parse(localStorage['blackList']);815 var whitelistCompiled = '';816 var whitelistLength = whiteList.length;817 if (whitelistLength==0) whitelistCompiled = '[currently empty]';818 else {819 if (localStorage['domainsort'] == 'true') whiteList = bkg.domainSort(whiteList);820 else whiteList.sort();821 for (var i in whiteList) {822 if ((whiteList[i][0] == '*' && whiteList[i][1] == '*') || whiteList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || whiteList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) whitelistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" class="domainMove i18_blacklistmove" title=\''+bkg.getLocale("blacklistmove")+'\' data-domain=\''+whiteList[i]+'\' data-mode="1"><span class="glyphicon glyphicon-retweet" aria-hidden="true"></span></a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+whiteList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+whiteList[i]+'</div>';823 else whitelistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:green;" class="topDomainAdd" title=\''+bkg.getLocale("trust")+' '+whiteList[i]+'\' data-domain=\''+whiteList[i]+'\' data-mode="0">'+bkg.getLocale("trust")+'</a> | <a href="javascript:;" class="domainMove i18_blacklistmove" title=\''+bkg.getLocale("blacklistmove")+'\' data-domain=\''+whiteList[i]+'\' data-mode="1"><span class="glyphicon glyphicon-retweet" aria-hidden="true"></span></a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+whiteList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+whiteList[i]+'</div>';824 }825 }826 var blacklistCompiled = '';827 var blacklistLength = blackList.length;828 if (blacklistLength==0) blacklistCompiled = '[currently empty]';829 else {830 if (localStorage['domainsort'] == 'true') blackList = bkg.domainSort(blackList);831 else blackList.sort();832 for (var i in blackList) {833 if ((blackList[i][0] == '*' && blackList[i][1] == '*') || blackList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || blackList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) blacklistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" class="domainMove i18_whitelistmove" title=\''+bkg.getLocale("whitelistmove")+'\' data-domain=\''+blackList[i]+'\' data-mode="0"><span class="glyphicon glyphicon-retweet" aria-hidden="true"></span></a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+blackList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+blackList[i]+'</div>';834 else blacklistCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:green;" class="topDomainAdd" title=\''+bkg.getLocale("distrust")+' '+blackList[i]+'\' data-domain=\''+blackList[i]+'\' data-mode="1">'+bkg.getLocale("distrust")+'</a> | <a href="javascript:;" class="domainMove i18_whitelistmove" title=\''+bkg.getLocale("whitelistmove")+'\' data-domain=\''+blackList[i]+'\' data-mode="0"><span class="glyphicon glyphicon-retweet" aria-hidden="true"></span></a> | <a href="javascript:;" style="color:#f00;" class="domainRemover" rel=\''+blackList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+blackList[i]+'</div>';835 }836 }837 $('#whitelist').html(whitelistCompiled);838 $('#blacklist').html(blacklistCompiled);839 $('#whitelistcount').html(whitelistLength);840 $('#blacklistcount').html(blacklistLength);841 $(".domainRemover, .topDomainAdd, .domainMove").unbind('click');842 $(".domainRemover").click(function() { domainRemover($(this).attr('rel'));});843 $(".topDomainAdd").click(function() { topDomainAdd($(this).attr('data-domain'), $(this).attr('data-mode'));});844 $(".domainMove").click(function() { domainMove($(this).attr('data-domain'), $(this).attr('data-mode'));});845 updateExport();846}847function fpListUpdate() {848 var fpTypes = ['fpCanvas', 'fpCanvasFont', 'fpAudio', 'fpWebGL', 'fpBattery', 'fpDevice', 'fpGamepad', 'fpWebVR', 'fpBluetooth', 'fpClientRectangles', 'fpClipboard', 'fpBrowserPlugins'];849 for (var i in fpTypes) {850 fpListProcess(fpTypes[i]);851 }852 $(".fpDomainRemover, .fpTopDomainAdd").unbind('click');853 $(".fpDomainRemover").click(function() { domainRemover($(this).attr('rel'), $(this).parent().parent().parent().attr('id')); });854 $(".fpTopDomainAdd").click(function() { topDomainAdd($(this).attr('data-domain'), $(this).parent().parent().parent().attr('id'));});855 updateExport();856}857function fpListProcess(fpType) {858 var fpList = JSON.parse(localStorage[fpType]);859 var fpListCompiled = '';860 var fpListLength = fpList.length;861 if (fpListLength==0) fpListCompiled = '[currently empty]';862 else {863 if (localStorage['domainsort'] == 'true') fpList = bkg.domainSort(fpList);864 else fpList.sort();865 for (var i in fpList) {866 if (fpList[i][0] == '*' || fpList[i].match(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/g) || fpList[i].match(/^(?:\[[A-Fa-f0-9:.]+\])(:[0-9]+)?$/g)) fpListCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="fpDomainRemover" rel=\''+fpList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+fpList[i]+'</div>';867 else fpListCompiled += '<div class="listentry"><div class="entryoptions"><a href="javascript:;" style="color:#f00;" class="fpDomainRemover" rel=\''+fpList[i]+'\'><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></div>'+fpList[i]+'</div>';868 }869 }870 $('#'+fpType).html(fpListCompiled);871 $('#'+fpType+'count').html(fpListLength);872}873function listclear(type) {874 if (confirm(['Clear whitelist?','Clear blacklist?'][type])) {875 localStorage[['whiteList','blackList'][type]] = JSON.stringify([]);876 listUpdate();877 bkg.cacheLists();878 if (bkg.freshSync(2)) {879 notification(bkg.getLocale("settingssavesync"));880 } else {881 notification(bkg.getLocale("settingssave"));882 }883 }884 return false;885}...

Full Screen

Full Screen

vfs.js

Source:vfs.js Github

copy

Full Screen

...105 if(req.dir){106 req.vfserrors = req.vfserrors || [];107 var path = req.vfspath ? req.vfspath.join("/") : "/";108 if(req.vfserrors.length > 0){109 var handler = new ResponseHandler({errors: req.vfserrors}, req.session.getLocale());110 handler.send(res);111 }112 else {113 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())114 .then(function(handler, folder){115 if(folder){116 folder.getContents()117 .then(function(handler, folderList, fileList){118 if(folderList && fileList){119 var folders = [];120 while(folderList.hasNext()){121 folders.push(folderList.next().toJSON());122 }123 var files = [];124 while(fileList.hasNext()){125 files.push(fileList.next().toJSON());126 }127 handler = new ResponseHandler({}, req.session.getLocale());128 handler.addBodyPart('folders', folders);129 handler.addBodyPart('files', files);130 handler.send(res);131 }132 else if(handler){133 handler.send(res);134 }135 else {136 new ResponseHandler({errors: ['generic.errors.undefined']}, req.session.getLocale)137 .send(res);138 }139 });140 }141 else if(handler){142 handler.send(res);143 }144 else {145 getFile(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())146 .then(function(fileHandler, file){147 if(fileHandler){148 fileHandler.send(res);149 }150 else {151 fileHandler = new ResponseHandler({}, req.session.getLocale());152 if(file){153 fileHandler.addBodyPart('file', file.toJSON());154 }155 else {156 fileHandler.addI18nErrorMessage('files.errors.none', req.vfspath.join("/"));157 fileHandler.setStatus(Status.notfound);158 }159 fileHandler.send(res);160 }161 });162 }163 });164 }165 }166 else {167 VFSFolder.find({parent: null})168 .then(function(err, folderList){169 if(err){170 new ResponseHandler({errors: [err]}, req.session.getLocale()).send(res);171 }172 else {173 VFSFile.find({parent: null})174 .then(function(fileErr, fileList){175 if(fileErr){176 new ResponseHandler({errors: [fileErr]}, req.session.getLocale()).send(res);177 }178 else {179 var folders = [],180 files = [];181 while(folderList.hasNext()){182 folders.push(folderList.next().toJSON());183 }184 while(fileList.hasNext()){185 files.push(fileList.next().toJSON());186 }187 var handler = new ResponseHandler({}, req.session.getLocale());188 handler.addBodyPart('folders', folders);189 handler.addBodyPart('files', files);190 handler.send(res);191 }192 });193 }194 });195 }196 });197 router.put("/", function(req, res){198 if(!req.dir){199 new ResponseHandler({errors: ['folders.errors.update.root']}, req.session.getLocale()).send(res);200 }201 else {202 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())203 .then(function(folderHandler, folder){204 if(folder){205 for(var key in req.body){206 folder.setValue(key, req.body[key]);207 }208 folder.update(req.session.getUserId())209 .then(function(response){210 new ResponseHandler(response, req.session.getLocale())211 .assert(function(response, body){212 return response.errors.length > 0;213 }, {214 message: i18n.getTranslatedText('folders.messages.success', req.session.getLocale()).format(req.vfspath.join("/"), "updated")215 })216 .send(res);217 });218 }219 else if(folderHandler){220 folderHandler.send(res);221 }222 else {223 getFile(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())224 .then(function(fileHandler, file){225 if(file){226 for(var key in req.body){227 file.setValue(key, req.body[key]);228 }229 file.update(req.session.getUserId())230 .then(function(response){231 new ResponseHandler(response, req.session.getLocale())232 .assert(function(response, body){233 return response.errors.length > 0;234 }, {235 message: i18n.getTranslatedText('files.messages.success', req.session.getLocale()).format(req.vfspath.join("/"), "updated")236 })237 .send(res);238 });239 }240 else {241 if(folderHandler){242 fileHandler.send(res);243 }244 else {245 fileHandler = new ResponseHandler({}, req.session.getLocale());246 fileHandler.addI18nErrorMessage('files.errors.none', req.vfspath.join("/"));247 fileHandler.send(res);248 }249 }250 });251 }252 });253 }254 })255 router.put("/move", function(req, res){256 if(!req.dir){257 new ResponseHandler({errors: ['folders.errors.move.root']}, req.session.getLocale()).send(res);258 }259 else {260 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())261 .then(function(handler, folder){262 if(handler){263 handler.send(res);264 }265 else if(folder){266 getFolderFromPath(req.body.newPath, undefined, "", req.session.getLocale())267 .then(function(parentHandler, parent){268 if(parentHandler){269 parentHandler.send(res);270 }271 else if(parent){272 folder.setProtectedValue('parent', parent.getEntryId());273 folder.update(req.session.getUserId())274 .then(function(response){275 new ResponseHandler(response, req.session.getLocale())276 .assert(function(response, body){277 return response.errors.length > 0;278 }, {279 message: i18n.getTranslatedText('folders.messages.success.move', req.session.getLocale()).format(req.dir, "/" + req.vfspath.join("/"), req.body.newPath + "/" + req.dir)280 })281 .send(res);282 });283 }284 else {285 new ResponseHandler({errors: ['generic.errors.undefined']}, req.session.getLocale()).send(res);286 }287 });288 }289 else {290 getFile(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())291 .then(function(fileHandler, file){292 if(fileHandler){293 fileHandler.send(res);294 }295 else if(file){296 getFolderFromPath(req.body.newPath, undefined, "", req.session.getLocale())297 .then(function(parentHandler, parent){298 if(parentHandler){299 parentHandler.send(res);300 }301 else if(parent){302 file.setProtectedValue('parent', parent.getEntryId());303 file.update(req.session.getUserId())304 .then(function(response){305 new ResponseHandler(response, req.session.getLocale())306 .assert(function(response, body){307 return response.errors.length > 0;308 }, {309 message: i18n.getTranslatedText('files.messages.success.move', req.session.getLocale()).format(req.dir, "/" + req.vfspath.join("/"), req.body.newPath + "/" + req.dir)310 })311 .send(res);312 });313 }314 else {315 new ResponseHandler({errors: ['generic.errors.undefined']}, req.session.getLocale()).send(res);316 }317 });318 }319 else {320 var handler = new ResponseHandler({}, req.session.getLocale());321 handler.addI18nErrorMessage('files.errors.none', req.vfspath.join("/"));322 handler.setStatus(Status.notfound);323 handler.send(res);324 }325 });326 }327 });328 }329 });330 router.put("/contents", function(req, res){331 if(!req.dir){332 new ResponseHandler({errors: ['folders.errors.contents']}, req.session.getLocale()).send(res);333 }334 else {335 getFile(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())336 .then(function(handler, file){337 if(handler){338 handler.send(res);339 }340 else if(file){341 }342 else {343 new ResponseHandler()344 }345 })346 }347 });348 router.delete("/", function(req, res){349 if(!req.dir){350 new ResponseHandler({errors: ['folders.errors.delete.root']}, req.session.getLocale()).send(res);351 }352 else {353 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())354 .then(function(folderHandler, folder){355 if(folderHandler){356 folderHandler.send(res);357 }358 else if(folder){359 folder.getContents()360 .then(function(contentsHandler, folders, files){361 if(contentsHandler){362 contentsHandler.send(res);363 }364 else {365 if(folders.hasNext() || files.hasNext()){366 new ResponseHandler({errors: [i18n.getTranslatedText('folders.errors.delete.notempty', req.session.getLocale()).format(req.vfspath.join('/'))]}, req.session.getLocale()).send(res);367 }368 else {369 VFSFolder.delete({_id: folder.getEntryId()})370 .then(function(response){371 new ResponseHandler(response, req.session.getLocale())372 .assert(function(response, body){373 return response.errors.length > 0;374 }, {375 message: i18n.getTranslatedText('folders.messages.success', req.session.getLocale()).format(req.vfspath.join("/"), "deleted")376 })377 .send(res);378 });379 }380 }381 });382 }383 else {384 getFile(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())385 .then(function(fileHandler, file){386 if(fileHandler){387 fileHandler.send(res);388 }389 else if(file){390 VFSFile.delete({_id: file.getEntryId()})391 .then(function(response){392 new ResponseHandler(response, req.session.getLocale())393 .assert(function(response, body){394 return response.errors.length > 0;395 }, {396 message: i18n.getTranslatedText('files.messages.success', req.session.getLocale()).format(req.vfspath.join("/"), "deleted")397 })398 .send(res);399 });400 }401 else {402 var handler = new ResponseHandler({errors: [i18n.getTranslatedText('files.errors.none', req.session.getLocale()).format(req.vfspath.join('/'))]}, req.session.getLocale());403 handler.setStatus(Status.notfound);404 handler.send(res);405 }406 });407 }408 });409 }410 });411 router.post("/dir", function(req, res){412 if(req.dir){413 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())414 .then(function(handler, folder){415 if(handler){416 handler.send(res);417 }418 else if(folder){419 var newDir = new VFSFolder({name: req.body.name, parent: folder.getEntryId()});420 newDir.create(req.session.getUserId())421 .then(function(response){422 new ResponseHandler(response, req.session.getLocale())423 .assert(function(response, body){424 return response.errors.length > 0;425 }, {426 message: i18n.getTranslatedText('folders.messages.success', req.session.getLocale()).format(req.vfspath.join("/") + "/" + req.body.name, "created")427 })428 .send(res);429 });430 }431 else {432 new ResponseHandler({errors: ['generic.errors.undefined']}, req.session.getLocale()).send(res);433 }434 });435 }436 else {437 var newDir = new VFSFolder({name: req.body.name, parent: null});438 newDir.create(req.session.getUserId())439 .then(function(response){440 new ResponseHandler(response, req.session.getLocale())441 .assert(function(response, body){442 return response.errors.length > 0;443 }, {444 message: i18n.getTranslatedText('folders.messages.success', req.session.getLocale()).format("/" + req.body.name, "created")445 })446 .send(res);447 });448 }449 });450 router.post("/file", function(req, res){451 if(req.dir){452 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())453 .then(function(response, folder){454 if(response){455 response.send(res);456 }457 else if(folder){458 var file = new VFSFile({name: req.body.name, parent: folder.getEntryId()});459 file.create(req.session.getUserId())460 .then(function(createResponse){461 new ResponseHandler(createResponse, req.session.getLocale())462 .assert(function(response, body){463 return response.errors.length > 0;464 }, {465 message: i18n.getTranslatedText('files.messages.success', req.session.getLocale()).format(req.vfspath.join("/") + "/" + req.body.name, "created")466 })467 .send(res);468 });469 }470 else {471 var noFolderHandler = new ResponseHandler({}, req.session.getLocale());472 noFolderHandler.addI18nErrorMessage('folders.errors.none', req.vfspath.join("/"));473 noFolderHandler.setStatus(Status.notfound);474 noFolderHandler.send(res);475 }476 });477 }478 else {479 var file = new VFSFile({name: req.body.name, parent: null});480 file.create(req.session.getUserId())481 .then(function(createResponse){482 new ResponseHandler(createResponse, req.session.getLocale())483 .assert(function(response, body){484 return response.errors.length > 0;485 }, {486 message: i18n.getTranslatedText('files.messages.success', req.session.getLocale()).format("/" + req.body.name, "created")487 })488 .send(res);489 });490 }491 });492 router.param("dir", function(req, res, next, dir){493 req.vfspath = req.vfspath || [];494 req.vfserrors = req.vfserrors || [];495 req.vfspath.push(dir);496 if(req.dir){497 getFolder(req.dir, req.parentDir, req.vfspath.join("/"), req.session.getLocale())498 .then(function(handler, folder){499 if(folder){500 req.parentDir = folder;501 }502 else if(handler){503 handler = handler.toJSON();504 req.vfserrors = req.vfserrors.concat(handler.responseDetails.errors);505 }506 else {507 req.vfserrors.push(i18n.getTranslatedText('folders.errors.none', req.session.getLocale()).format(req.vfspath.join("/")));508 }509 req.dir = dir;510 next();511 });512 }513 else {514 req.dir = dir;515 next();516 }517 });518 router.use("/:dir", router);519 return router;520});521module.exports = VFS;

Full Screen

Full Screen

i18n.setLocale.js

Source:i18n.setLocale.js Github

copy

Full Screen

...19 res = {};20 });21 it('getLocale should return same locale for req and res without any setLocale switch', function() {22 i18n.init(req, res);23 i18n.getLocale(req).should.equal('de');24 i18n.getLocale(res).should.equal('de');25 req.getLocale().should.equal('de');26 res.getLocale().should.equal('de');27 });28 it('i18n.setLocale(req) should switch locale for req only', function() {29 i18n.init(req, res);30 i18n.setLocale(req, 'fr');31 i18n.getLocale(req).should.equal('fr');32 i18n.getLocale(res).should.equal('de');33 req.getLocale().should.equal('fr');34 res.getLocale().should.equal('de');35 req.__('Hello').should.equal('Bonjour');36 res.__('Hello').should.equal('Hallo');37 });38 it('req.setLocale() should switch locale for req only (alternative notation)', function() {39 i18n.init(req, res);40 req.setLocale('fr');41 i18n.getLocale(req).should.equal('fr');42 i18n.getLocale(res).should.equal('de');43 req.getLocale().should.equal('fr');44 res.getLocale().should.equal('de');45 req.__('Hello').should.equal('Bonjour');46 res.__('Hello').should.equal('Hallo');47 });48 it('i18n.setLocale(res) should switch locale for res only', function() {49 i18n.init(req, res);50 i18n.setLocale(res, 'fr');51 i18n.getLocale(req).should.equal('de');52 i18n.getLocale(res).should.equal('fr');53 req.getLocale().should.equal('de');54 res.getLocale().should.equal('fr');55 req.__('Hello').should.equal('Hallo');56 res.__('Hello').should.equal('Bonjour');57 });58 it('res.setLocale() should switch locale for res only (alternative notation)', function() {59 i18n.init(req, res);60 res.setLocale('fr');61 i18n.getLocale(req).should.equal('de');62 i18n.getLocale(res).should.equal('fr');63 req.getLocale().should.equal('de');64 res.getLocale().should.equal('fr');65 req.__('Hello').should.equal('Hallo');66 res.__('Hello').should.equal('Bonjour');67 });68 it('setLocale() should switch locale for req and res implicitly', function() {69 // add res to req to simulate express 4.x schema70 req.res = res;71 i18n.init(req, res);72 req.setLocale('fr');73 i18n.getLocale(req).should.equal('fr');74 i18n.getLocale(res).should.equal('fr');75 req.getLocale().should.equal('fr');76 res.getLocale().should.equal('fr');77 req.__('Hello').should.equal('Bonjour');78 res.__('Hello').should.equal('Bonjour');79 });80 it('setLocale() should switch locale for req and res implicitly (alternative notation)', function() {81 // add res to req to simulate express 4.x schema82 req.res = res;83 i18n.init(req, res);84 i18n.setLocale(req, 'fr');85 i18n.getLocale(req).should.equal('fr');86 i18n.getLocale(res).should.equal('fr');87 req.getLocale().should.equal('fr');88 res.getLocale().should.equal('fr');89 req.__('Hello').should.equal('Bonjour');90 res.__('Hello').should.equal('Bonjour');91 });92 it('setLocale() should switch locale for req, res and res.locals implicitly', function() {93 // add locals to res94 res.locals = {};95 // add res to req to simulate express 4.x schema96 req.res = res;97 i18n.init(req, res);98 i18n.setLocale(req, 'fr');99 i18n.getLocale(req).should.equal('fr');100 i18n.getLocale(res).should.equal('fr');101 i18n.getLocale(res.locals).should.equal('fr');102 req.getLocale().should.equal('fr');103 res.getLocale().should.equal('fr');104 res.locals.getLocale().should.equal('fr');105 req.__('Hello').should.equal('Bonjour');106 res.__('Hello').should.equal('Bonjour');107 res.locals.__('Hello').should.equal('Bonjour');108 });109 it('setLocale() should switch locale for req, res and res.locals implicitly when set on req', function() {110 // add locals to res111 res.locals = {};112 // add res to req to simulate express 4.x schema113 req.res = res;114 i18n.init(req, res);115 req.setLocale('fr');116 i18n.getLocale(req).should.equal('fr');117 i18n.getLocale(res).should.equal('fr');118 i18n.getLocale(res.locals).should.equal('fr');119 req.getLocale().should.equal('fr');120 res.getLocale().should.equal('fr');121 res.locals.getLocale().should.equal('fr');122 req.__('Hello').should.equal('Bonjour');123 res.__('Hello').should.equal('Bonjour');124 res.locals.__('Hello').should.equal('Bonjour');125 });126 it('setLocale() should switch locale for req, res and res.locals implicitly when set on res', function() {127 // add locals to res128 res.locals = {};129 // add res to req to simulate express 4.x schema130 req.res = res;131 i18n.init(req, res);132 res.setLocale('fr');133 i18n.getLocale(req).should.equal('de');134 i18n.getLocale(res).should.equal('fr');135 i18n.getLocale(res.locals).should.equal('fr');136 req.getLocale().should.equal('de');137 res.getLocale().should.equal('fr');138 res.locals.getLocale().should.equal('fr');139 req.__('Hello').should.equal('Hallo');140 res.__('Hello').should.equal('Bonjour');141 res.locals.__('Hello').should.equal('Bonjour');142 });143 it('setLocale() should switch locale for req, res and res.locals implicitly when set on res.locals', function() {144 // add locals to res145 res.locals = {};146 // add res to req to simulate express 4.x schema147 req.res = res;148 i18n.init(req, res);149 res.locals.setLocale('fr');150 i18n.getLocale(req).should.equal('de');151 i18n.getLocale(res).should.equal('de');152 i18n.getLocale(res.locals).should.equal('fr');153 req.getLocale().should.equal('de');154 res.getLocale().should.equal('de');155 res.locals.getLocale().should.equal('fr');156 req.__('Hello').should.equal('Hallo');157 res.__('Hello').should.equal('Hallo');158 res.locals.__('Hello').should.equal('Bonjour');159 });160 it('setLocale() should switch locale for req, res and res.locals implicitly when set as array', function() {161 // add locals to res162 res.locals = {};163 // add res to req to simulate express 4.x schema164 req.res = res;165 i18n.init(req, res);166 i18n.setLocale([req, res, res.locals], 'fr');167 i18n.getLocale(req).should.equal('fr');168 i18n.getLocale(res).should.equal('fr');169 i18n.getLocale(res.locals).should.equal('fr');170 req.getLocale().should.equal('fr');171 res.getLocale().should.equal('fr');172 res.locals.getLocale().should.equal('fr');173 req.__('Hello').should.equal('Bonjour');174 res.__('Hello').should.equal('Bonjour');175 res.locals.__('Hello').should.equal('Bonjour');176 });177 it('setLocale(object) should escape res -> locals -> res recursion', function() {178 // add locals to res179 res.locals = { res: res };180 // add res to req to simulate express 4.x schema181 req.res = res;182 i18n.init(req, res);183 i18n.setLocale(req, 'fr');184 res.locale.should.equal('fr');185 res.locals.locale.should.equal('fr');186 });...

Full Screen

Full Screen

i18n.setLocaleDefaultLanguage.js

Source:i18n.setLocaleDefaultLanguage.js Github

copy

Full Screen

...25 });26 it('getLocale should return defaultLocale for req and res without any setLocale switch', function() {27 i18n.init(req, res);28 // as we don't support es i18n defaults to (yet internal en)29 i18n.getLocale(req).should.equal('en');30 i18n.getLocale(res).should.equal('en');31 // as we don't support es i18n defaults to (yet internal en)32 req.getLocale().should.equal('en');33 res.getLocale().should.equal('en');34 // as we don't support es i18n defaults to (yet internal en)35 req.__('Hello').should.equal('Hello');36 res.__('Hello').should.equal('Hello');37 i18n.__('Hello').should.equal('Hello');38 });39 it('getLocale should return defaultLocale for req and res with i18n.setLocale(req) switching to any unsupported locale', function() {40 i18n.init(req, res);41 // explicitly switch locale on req to unsuperted es42 i18n.setLocale(req, 'es');43 // as we don't support es i18n defaults to (yet internal en)44 i18n.getLocale(req).should.equal('en');45 i18n.getLocale(res).should.equal('en');46 // as we don't support es i18n defaults to (yet internal en)47 req.getLocale().should.equal('en');48 res.getLocale().should.equal('en');49 // as we don't support es i18n defaults to (yet internal en)50 req.__('Hello').should.equal('Hello');51 res.__('Hello').should.equal('Hello');52 i18n.__('Hello').should.equal('Hello');53 });54 it('getLocale should return defaultLocale for req and res with req.setLocale() switching to any unsupported locale', function() {55 i18n.init(req, res);56 // explicitly switch locale on req to unsuperted es57 req.setLocale('es');58 // as we don't support es i18n defaults to (yet internal en)59 i18n.getLocale(req).should.equal('en');60 i18n.getLocale(res).should.equal('en');61 // as we don't support es i18n defaults to (yet internal en)62 req.getLocale().should.equal('en');63 res.getLocale().should.equal('en');64 // as we don't support es i18n defaults to (yet internal en)65 req.__('Hello').should.equal('Hello');66 res.__('Hello').should.equal('Hello');67 i18n.__('Hello').should.equal('Hello');68 });69 it('getLocale should return defaultLocale for req and res with i18n.setLocale(res) switching to any unsupported locale', function() {70 i18n.init(req, res);71 // explicitly switch locale on req to unsuperted es72 i18n.setLocale(res, 'es');73 // as we don't support es i18n defaults to (yet internal en)74 i18n.getLocale(req).should.equal('en');75 i18n.getLocale(res).should.equal('en');76 // as we don't support es i18n defaults to (yet internal en)77 req.getLocale().should.equal('en');78 res.getLocale().should.equal('en');79 // as we don't support es i18n defaults to (yet internal en)80 req.__('Hello').should.equal('Hello');81 res.__('Hello').should.equal('Hello');82 i18n.__('Hello').should.equal('Hello');83 });84 it('getLocale should return defaultLocale for req and res with res.setLocale() switching to any unsupported locale', function() {85 i18n.init(req, res);86 // explicitly switch locale on req to unsuperted es87 res.setLocale('es');88 // as we don't support es i18n defaults to (yet internal en)89 i18n.getLocale(req).should.equal('en');90 i18n.getLocale(res).should.equal('en');91 // as we don't support es i18n defaults to (yet internal en)92 req.getLocale().should.equal('en');93 res.getLocale().should.equal('en');94 // as we don't support es i18n defaults to (yet internal en)95 req.__('Hello').should.equal('Hello');96 res.__('Hello').should.equal('Hello');97 i18n.__('Hello').should.equal('Hello');98 });99 it('i18n.setLocale(req) should switch locale for req but not change defaultLocale', function() {100 i18n.init(req, res);101 // switch locale on req102 i18n.setLocale(req, 'de');103 // req get's switched104 i18n.getLocale(req).should.equal('de');105 req.getLocale().should.equal('de');106 req.__('Hello').should.equal('Hallo');107 // res stays default108 i18n.getLocale(res).should.equal('en');109 res.getLocale().should.equal('en');110 res.__('Hello').should.equal('Hello');111 // global stays default112 i18n.getLocale().should.equal('en');113 i18n.__('Hello').should.equal('Hello');114 });115 it('req.setLocale() should switch locale for req but not change defaultLocale', function() {116 i18n.init(req, res);117 // switch locale on req118 req.setLocale('de');119 // req get's switched120 i18n.getLocale(req).should.equal('de');121 req.getLocale().should.equal('de');122 req.__('Hello').should.equal('Hallo');123 // res stays default124 i18n.getLocale(res).should.equal('en');125 res.getLocale().should.equal('en');126 res.__('Hello').should.equal('Hello');127 // global stays default128 i18n.getLocale().should.equal('en');129 i18n.__('Hello').should.equal('Hello');130 });131 it('i18n.setLocale(res) should switch locale for res but not change defaultLocale', function() {132 i18n.init(req, res);133 // switch locale on req134 i18n.setLocale(res, 'de');135 // res get's switched136 i18n.getLocale(res).should.equal('de');137 res.getLocale().should.equal('de');138 res.__('Hello').should.equal('Hallo');139 // req stays default140 i18n.getLocale(req).should.equal('en');141 req.getLocale().should.equal('en');142 req.__('Hello').should.equal('Hello');143 // global stays default144 i18n.getLocale().should.equal('en');145 i18n.__('Hello').should.equal('Hello');146 });147 it('res.setLocale() should switch locale for res but not change defaultLocale', function() {148 i18n.init(req, res);149 // switch locale on req150 res.setLocale('de');151 // res get's switched152 i18n.getLocale(res).should.equal('de');153 res.getLocale().should.equal('de');154 res.__('Hello').should.equal('Hallo');155 // req stays default156 i18n.getLocale(req).should.equal('en');157 req.getLocale().should.equal('en');158 req.__('Hello').should.equal('Hello');159 // global stays default160 i18n.getLocale().should.equal('en');161 i18n.__('Hello').should.equal('Hello');162 });...

Full Screen

Full Screen

locales_list.sjs

Source:locales_list.sjs Github

copy

Full Screen

1let fennecID = "{a23983c0-fd0e-11dc-95ff-0800200c9a66}";2Components.utils.import("resource://gre/modules/Services.jsm");3function getLocale(aLocaleParams, aAppParams) {4 let l = {5 TARGETLOCALE: "test{IDNUMBER}",6 NAME: "Test Locale {IDNUMBER}",7 VERSION: "1.0",8 INSTALL: "http://www.example.com/browser/mobile/chrome/tests/addons/browser_locale{IDNUMBER}.xpi",9 TYPENUMBER: 5,10 TYPENAME: "Language Pack (Application)",11 IDNUMBER: "",12 };13 let a = {14 APPNAME: "Fennec",15 MINVERSION: "4.0", MAXVERSION: "*",16 APPID: fennecID17 };18 if (aLocaleParams) {19 for (var entry in aLocaleParams) {20 l[entry] = aLocaleParams[entry];21 }22 }23 if (aAppParams) {24 for (var entry in aAppParams) {25 a[entry] = aAppParams[entry];26 }27 }28 l.app = a;29 return l;30}31let appTemplate = "<application>" +32"<name>{APPNAME}</name>" +33 "<min_version>{MINVERSION}</min_version>" +34 "<max_version>{MAXVERSION}</max_version>" +35 "<appID>{APPID}</appID>" +36"</application>";37let template = "<addon>"+38 "<target_locale>{TARGETLOCALE}</target_locale>" +39 "<name>{NAME}</name>"+40 "<type id=\"{TYPENUMBER}\">{TYPENAME}</type>"+41 "<guid>langpack-{TARGETLOCALE}@firefox-mobile.mozilla.org</guid>"+42 "<version>{VERSION}</version>"+43 "<status id=\"4\">Public</status>"+44 "<compatible_applications>{APPS}</compatible_applications>"+45 "<all_compatible_os><os>ALL</os></all_compatible_os>"+46 "<install os=\"ALL\">{INSTALL}</install><strings>\n" +47 "title=TITLE\n" +48 "continueIn=CONTINUEIN%S\n" +49 "name=NAME\n" +50 "choose=CHOOSE\n" +51 "chooseLanguage=CHOOSELANGUAGE\n" +52 "cancel=CANCEL\n" +53 "continue=CONTINUE\n" +54 "installing=INSTALLING%S\n" +55 "installerror=INSTALLERROR\n" +56 "loading=LOADING" +57 "</strings>"+58"</addon>";59function handleRequest(request, response) {60 response.setStatusLine(request.httpVersion, 200, "OK");61 response.setHeader("Content-Type", "text/xml", false);62 response.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");63 response.write("<addons>");64 let locales = [];65 let query = decodeURIComponent(request.queryString || "").split("=");66 switch(query[0]) {67 case "numvalid":68 let numValid = parseInt(query[1]);69 for (let i = 0; i < numValid; i++) {70 locales.push( getLocale({IDNUMBER: i}) );71 }72 break;73 case "buildid":74 locales.push( getLocale({IDNUMBER: 1, NAME: query[1]}) );75 break;76 default :77 locales.push( getLocale({IDNUMBER: 1}) );78 /* These locales should fail in the LocaleRepository */79 locales.push( getLocale({IDNUMBER: 1}) ); // no duplicate ids80 locales.push( getLocale({IDNUMBER: 2, INSTALL: "INVALID_URL"}) );81 locales.push( getLocale({IDNUMBER: 3}, {APPID: "INVALID_ID"}) );82 locales.push( getLocale({IDNUMBER: 3}, {MAXVERSION: "0"}) );83 locales.push( getLocale({IDNUMBER: 4, TARGETLOCALE: ""}) );84 locales.push( getLocale({IDNUMBER: 5, NAME: ""}) );85 locales.push( getLocale({IDNUMBER: 6, VERSION: ""}) );86 locales.push( getLocale({IDNUMBER: 7, TYPENUMBER: ""}) );87 break;88 }89 for(var i = 0; i < locales.length; i++) {90 let t = template;91 t = t.replace(/{TARGETLOCALE}/g, locales[i].TARGETLOCALE);92 t = t.replace(/{NAME}/, locales[i].NAME);93 t = t.replace(/{VERSION}/, locales[i].VERSION);94 t = t.replace(/{INSTALL}/, locales[i].INSTALL);95 t = t.replace(/{TYPENUMBER}/, locales[i].TYPENUMBER);96 t = t.replace(/{TYPENAME}/, locales[i].TYPENAME);97 t = t.replace(/{IDNUMBER}/g, locales[i].IDNUMBER)98 let a = appTemplate;99 a = a.replace(/{APPNAME}/, locales[i].app.APPNAME);100 a = a.replace(/{MINVERSION}/, locales[i].app.MINVERSION);...

Full Screen

Full Screen

i18n.js

Source:i18n.js Github

copy

Full Screen

...57 FREDDY: "Freddie, mkay!"58 }59 });60 61 t.equals(glow.i18n.getLocale(), 'en', "Getting first locale (not set on the page)");62 glow.i18n.setLocale("aa");63 t.equals(glow.i18n.getLocale(), 'aa', "Setting a well formed language locale");64 glow.i18n.setLocale("aa-Aaaa");65 t.equals(glow.i18n.getLocale(), 'aa-Aaaa', "Setting a well formed language-script locale");66 glow.i18n.setLocale("aa-AA");67 t.equals(glow.i18n.getLocale(), 'aa-AA', "Setting a well formed language-region locale");68 glow.i18n.setLocale("aa-Aaaa-AA");69 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-AA', "Setting a well formed language-script-region locale");70 glow.i18n.setLocale("aa-aaa");71 t.equals(glow.i18n.getLocale(), 'aa-aaa', "Setting a well formed language-variant locale");72 glow.i18n.setLocale("aa-Aaaa-aaa");73 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-aaa', "Setting a well formed language-script-variant locale");74 glow.i18n.setLocale("aa-AA-aaa");75 t.equals(glow.i18n.getLocale(), 'aa-AA-aaa', "Setting a well formed language-region-variant locale");76 glow.i18n.setLocale("aa-Aaaa-AA-aaa");77 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-AA-aaa', "Setting a well formed language-script-region-variant locale");78 glow.i18n.setLocale("XX-Xxxx-bb-Bbbb-xx-BB-XX-bbb-xxxx");79 t.equals(glow.i18n.getLocale(), 'bb-Bbbb-BB-bbb', "Correctly interpreting a mal-formed locale");80 81 glow.i18n.setLocale("QtTtW");82 t.equals(glow.i18n.getLocale(), 'bb-Bbbb-BB-bbb', "Correctly ignoring an invalid locale");83 84 glow.i18n.revertLocale();85 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-AA-aaa', "Correctly rewinding along the locale stack (1)");86 87 glow.i18n.revertLocale();88 t.equals(glow.i18n.getLocale(), 'aa-AA-aaa', "Correctly rewinding along the locale stack (2)");89 90 glow.i18n.revertLocale();91 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-aaa', "Correctly rewinding along the locale stack (3)");92 93 glow.i18n.revertLocale();94 t.equals(glow.i18n.getLocale(), 'aa-aaa', "Correctly rewinding along the locale stack (4)");95 96 glow.i18n.revertLocale();97 t.equals(glow.i18n.getLocale(), 'aa-Aaaa-AA', "Correctly rewinding along the locale stack (5)");98 99 glow.i18n.setLocale("kd-GB-scouse");100 t.isObj(glow.i18n.getLocaleModule("RAINBOW"), {ROD: "Rod, what!", JANE: "Jane", FREDDY: "Freddie"}, "Get locale module");101 102 var checked = glow.i18n.checkLocale("kd-GB-scouse");103 t.equals(checked.BAGPUSS.YAFFELL, "en", "Correctly checking the negotiation results on an entire locale");104 var checked = glow.i18n.checkLocale("kd-GB-scouse", {module: "BAGPUSS"});105 t.equals(checked.YAFFELL, "en", "Correctly checking the negotiation results on a module");106 var checked = glow.i18n.checkLocale("kd-GB-scouse", {module: "BAGPUSS", label: "YAFFELL"});107 t.equals(checked, "en", "Correctly checking the negotiation results on a label");108});...

Full Screen

Full Screen

locales.spec.js

Source:locales.spec.js Github

copy

Full Screen

...4 */5import { getLocale, register } from '../src/locales';6describe('locales', () => {7 test('getLocale', () => {8 expect(getLocale('zh_CN')).toBeDefined();9 expect(getLocale('en_US')).toBeDefined();10 });11 test('Locales zh', () => {12 expect(getLocale('zh_CN')(1, 0)).toEqual(['刚刚', '片刻后']);13 expect(getLocale('zh_CN')(1, 1)).toEqual(['1 秒前', '1 秒后']);14 expect(getLocale('zh_CN')(1, 2)).toEqual(['1 分钟前', '1 分钟后']);15 expect(getLocale('zh_CN')(1, 3)).toEqual(['1 分钟前', '1 分钟后']);16 expect(getLocale('zh_CN')(1, 4)).toEqual(['1 小时前', '1 小时后']);17 expect(getLocale('zh_CN')(1, 5)).toEqual(['1 小时前', '1 小时后']);18 expect(getLocale('zh_CN')(1, 6)).toEqual(['1 天前', '1 天后']);19 expect(getLocale('zh_CN')(1, 7)).toEqual(['1 天前', '1 天后']);20 expect(getLocale('zh_CN')(1, 8)).toEqual(['1 周前', '1 周后']);21 expect(getLocale('zh_CN')(1, 9)).toEqual(['1 周前', '1 周后']);22 expect(getLocale('zh_CN')(1, 10)).toEqual(['1 个月前', '1 个月后']);23 expect(getLocale('zh_CN')(1, 11)).toEqual(['1 个月前', '1 个月后']);24 expect(getLocale('zh_CN')(1, 12)).toEqual(['1 年前', '1 年后']);25 expect(getLocale('zh_CN')(1, 13)).toEqual(['1 年前', '1 年后']);26 });27 test('Locales en', () => {28 expect(getLocale('en_US')(1, 0)).toEqual(['just now', 'right now']);29 expect(getLocale('en_US')(1, 1)).toEqual(['1 second ago', 'in 1 second']);30 expect(getLocale('en_US')(10, 1)).toEqual(['10 seconds ago', 'in 10 seconds']);31 expect(getLocale('en_US')(1, 2)).toEqual(['1 minute ago', 'in 1 minute']);32 expect(getLocale('en_US')(1, 3)).toEqual(['1 minute ago', 'in 1 minute']);33 expect(getLocale('en_US')(1, 4)).toEqual(['1 hour ago', 'in 1 hour']);34 expect(getLocale('en_US')(1, 5)).toEqual(['1 hour ago', 'in 1 hour']);35 expect(getLocale('en_US')(1, 6)).toEqual(['1 day ago', 'in 1 day']);36 expect(getLocale('en_US')(1, 7)).toEqual(['1 day ago', 'in 1 day']);37 expect(getLocale('en_US')(1, 8)).toEqual(['1 week ago', 'in 1 week']);38 expect(getLocale('en_US')(1, 9)).toEqual(['1 week ago', 'in 1 week']);39 expect(getLocale('en_US')(1, 10)).toEqual(['1 month ago', 'in 1 month']);40 expect(getLocale('en_US')(1, 11)).toEqual(['1 month ago', 'in 1 month']);41 expect(getLocale('en_US')(1, 12)).toEqual(['1 year ago', 'in 1 year']);42 expect(getLocale('en_US')(1, 13)).toEqual(['1 year ago', 'in 1 year']);43 expect(getLocale('en_US')(10, 13)).toEqual(['10 years ago', 'in 10 years']);44 });45 test('register', () => {46 const fr = () => 'test';47 register('fr', fr);48 expect(getLocale('fr')).toBe(fr);49 expect(getLocale('fr')()).toBe('test');50 });...

Full Screen

Full Screen

localeSagas.js

Source:localeSagas.js Github

copy

Full Screen

...3import LocaleApi from 'api/__mocks__/LocaleApi';4import CheckObject from 'testHelpers/CheckObject';5describe('localeSagas', () => {6 it('getLocale first yeald should return TAKE pattern "GET_LOCALE"', () => {7 const generator = localeSagas.getLocale();8 expect(generator.next().value.TAKE.pattern).toEqual('GET_LOCALE');9 });10 it('getLocale second yeald should return CALL to function "LocaleApi.getLocale"', () => {11 const generator = localeSagas.getLocale();12 generator.next();13 expect(generator.next().value.CALL.fn).toEqual(LocaleApi.getLocale);14 });15 it('getLocale third yeald should return PUT action.type "GET_LOCALE_SUCCESS"', () => {16 const generator = localeSagas.getLocale();17 const currentLocale = LocaleApi.getLocale();18 generator.next();19 generator.next();20 expect(generator.next(currentLocale).value.PUT.action.type).toEqual('GET_LOCALE_SUCCESS');21 });22 it('getLocale third yeald should return PUT action.currentLocale that is a Promise', () => {23 const generator = localeSagas.getLocale();24 const currentLocale = LocaleApi.getLocale();25 generator.next();26 generator.next();27 expect(CheckObject.IsPromise(generator.next(currentLocale).value.PUT.action.currentLocale)).toBeTruthy();28 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.getLocale().then(function (locale) {2 console.log(locale);3});4driver.setLocale("en").then(function (locale) {5 console.log(locale);6});7driver.hideKeyboard("Done").then(function (locale) {8 console.log(locale);9});10driver.isKeyboardShown().then(function (locale) {11 console.log(locale);12});13driver.toggleWifi().then(function (locale) {14 console.log(locale);15});16driver.toggleData().then(function (locale) {17 console.log(locale);18});19driver.toggleAirplaneMode().then(function (locale) {20 console.log(locale);21});22driver.toggleLocationServices().then(function (locale) {23 console.log(locale);24});25driver.lock(5).then(function (locale) {26 console.log(locale);27});28driver.isLocked().then(function (locale) {29 console.log(locale);30});31driver.shake().then(function (locale) {32 console.log(locale);33});34driver.openNotifications().then(function (locale) {35 console.log(locale);36});37driver.getDeviceTime().then(function (locale) {38 console.log(locale);39});40driver.installApp("path to app").then(function (locale) {41 console.log(locale);42});43driver.removeApp("app id").then(function (locale) {44 console.log(locale);45});46driver.isAppInstalled("app id").then(function (locale) {47 console.log(locale);48});49driver.runAppInBackground(5).then(function

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .withCapabilities({4 })5 .build();6driver.getLocale().then(function(locale) {7 console.log(locale);8});9driver.quit();10var webdriver = require('selenium-webdriver');11var driver = new webdriver.Builder()12 .withCapabilities({13 })14 .build();15driver.setLocale('en').then(function() {16 console.log('Locale set to en');17});18driver.quit();19var webdriver = require('selenium-webdriver');20var driver = new webdriver.Builder()21 .withCapabilities({22 })23 .build();24driver.getOrientation().then(function(orientation) {25 console.log(orientation);26});27driver.quit();28var webdriver = require('selenium-webdriver');29var driver = new webdriver.Builder()30 .withCapabilities({31 })32 .build();33driver.setOrientation('LANDSCAPE').then(function() {34 console.log('Orientation set to LAND

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var AndroidDriver = require('appium-android-driver');4var driver = wd.promiseChainRemote('localhost', 4723);5var androidDriver = new AndroidDriver();6driver.init({7}).then(function() {8 return driver.getLocale();9}).then(function(locale) {10 console.log("Locale of device is: " + locale);11});12driver.quit();13var wd = require('wd');14var assert = require('assert');15var AndroidDriver = require('appium-android-driver');16var driver = wd.promiseChainRemote('localhost', 4723);17var androidDriver = new AndroidDriver();18driver.init({19}).then(function() {20 return driver.setLocale("en-US");21}).then(function() {22 console.log("Locale of device is set to: en-US");23});24driver.quit();25var wd = require('wd');26var assert = require('assert');27var AndroidDriver = require('appium-android-driver');28var driver = wd.promiseChainRemote('localhost', 4723);29var androidDriver = new AndroidDriver();30driver.init({31}).then(function() {32 return driver.currentActivity();33}).then(function(activity) {34 console.log("Current Activity: " + activity);35});36driver.quit();37var wd = require('wd');38var assert = require('assert');39var AndroidDriver = require('appium-android-driver');40var driver = wd.promiseChainRemote('localhost', 4723);41var androidDriver = new AndroidDriver();42driver.init({

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2 it('should get locale', async() => {3 const driver = await wdio.remote(options);4 const locale = await driver.getLocale();5 console.log(locale);6 await driver.deleteSession();7 });8});9describe('Test', () => {10 it('should get locale', async() => {11 const driver = await wdio.remote(options);12 const locale = await driver.getLocale();13 console.log(locale);14 await driver.deleteSession();15 });16});17describe('Test', () => {18 it('should get locale', async() => {19 const driver = await wdio.remote(options);20 const locale = await driver.getLocale();21 console.log(locale);22 await driver.deleteSession();23 });24});25describe('Test', () => {26 it('should get locale', async() => {27 const driver = await wdio.remote(options);28 const locale = await driver.getLocale();29 console.log(locale);30 await driver.deleteSession();31 });32});33describe('Test', () => {34 it('should get locale', async() => {35 const driver = await wdio.remote(options);36 const locale = await driver.getLocale();37 console.log(locale);38 await driver.deleteSession();39 });40});41describe('Test', () => {42 it('should get locale', async() => {43 const driver = await wdio.remote(options);44 const locale = await driver.getLocale();45 console.log(locale);46 await driver.deleteSession();47 });48});49describe('Test', () => {50 it('should get locale', async() => {51 const driver = await wdio.remote(options);52 const locale = await driver.getLocale();53 console.log(locale);54 await driver.deleteSession();55 });56});57describe('Test', () => {58 it('should get locale', async() => {59 const driver = await wdio.remote(options);60 const locale = await driver.getLocale();61 console.log(locale);

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = new AndroidDriver({2 desiredCapabilities: {3 }4});5driver.getLocale().then(function(locale){6 console.log(locale);7});8driver.getLanguage().then(function(language){9 console.log(language);10});11driver.getPlatformVersion().then(function(platformVersion){12 console.log(platformVersion);13});14driver.getPlatformName().then(function(platformName){15 console.log(platformName);16});17driver.getDeviceName().then(function(deviceName){18 console.log(deviceName);19});20driver.getOrientation().then(function(orientation){21 console.log(orientation);22});23driver.setOrientation('LANDSCAPE').then(function(){24 console.log('Orientation set to Landscape');25});26driver.getOrientation().then(function(orientation){27 console.log(orientation);28});29driver.setOrientation('PORTRAIT').then(function(){30 console.log('Orientation set to Portrait');31});32driver.getOrientation().then(function(orientation){33 console.log(orientation);34});35driver.getDeviceTime().then(function(deviceTime){36 console.log(deviceTime);37});38driver.getDisplayDensity().then(function(displayDensity){39 console.log(displayDensity);40});41driver.getDisplaySize().then(function(displaySize){42 console.log(displaySize);43});44driver.getNetworkConnection().then(function(networkConnection){45 console.log(networkConnection);46});47driver.setNetworkConnection(2).then(function(){48 console.log('Network Connection set to Airplane Mode');49});50driver.getNetworkConnection().then(function(networkConnection){51 console.log(networkConnection);52});53driver.setNetworkConnection(1).then(function(){54 console.log('Network Connection set to WIFI only');55});56driver.getNetworkConnection().then(function(networkConnection){57 console.log(networkConnection);58});59driver.setNetworkConnection(0).then(function(){60 console.log('Network Connection set to All Network On');61});62driver.getNetworkConnection().then(function(networkConnection){63 console.log(networkConnection);64});65driver.getBatteryInfo().then(function(batteryInfo){66 console.log(batteryInfo);67});68driver.getPerformanceDataTypes().then(function(performanceDataTypes){69 console.log(performanceDataTypes);70});71driver.getPerformanceData('cpuinfo', 'com.abc.xxx', 1000).then(function(performanceData){

Full Screen

Using AI Code Generation

copy

Full Screen

1var driver = require('appium-android-driver');2var getLocale = driver.getLocale;3var locale = getLocale();4console.log(locale);5var driver = require('appium-ios-driver');6var getLocale = driver.getLocale;7var locale = getLocale();8console.log(locale);9var driver = require('appium-windows-driver');10var getLocale = driver.getLocale;11var locale = getLocale();12console.log(locale);13var driver = require('appium-mac-driver');14var getLocale = driver.getLocale;15var locale = getLocale();16console.log(locale);17var driver = require('appium-android-driver');18var getLocale = driver.getLocale;19var locale = getLocale();20console.log(locale);21var driver = require('appium-ios-driver');22var getLocale = driver.getLocale;23var locale = getLocale();24console.log(locale);25var driver = require('appium-windows-driver');26var getLocale = driver.getLocale;27var locale = getLocale();28console.log(locale);29var driver = require('appium-mac-driver');30var getLocale = driver.getLocale;31var locale = getLocale();32console.log(locale);33var driver = require('appium-android-driver');34var getLocale = driver.getLocale;35var locale = getLocale();36console.log(locale);37var driver = require('appium-ios-driver');38var getLocale = driver.getLocale;39var locale = getLocale();40console.log(locale);41var driver = require('appium-windows-driver');42var getLocale = driver.getLocale;43var locale = getLocale();44console.log(locale);45var driver = require('appium-mac-driver');46var getLocale = driver.getLocale;47var locale = getLocale();48console.log(locale);

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.getLocale().then(function(locale){2 console.log('Locale is: ', locale);3});4driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });5var driver = new webdriver.Builder().forBrowser('chrome').build();6driver.manage().window().maximize();7driver.manage().timeouts().implicitlyWait(3000);8driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });9driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });10driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });11var driver = new webdriver.Builder().forBrowser('chrome').build();12driver.manage().window().maximize();13driver.manage().timeouts().implicitlyWait(3000);14driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });15driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });16driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });17var driver = new webdriver.Builder().forBrowser('chrome').build();18driver.manage().window().maximize();19driver.manage().timeouts().implicitlyWait(3000);20driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });21driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });22driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });23var driver = new webdriver.Builder().forBrowser('chrome').build();24driver.manage().window().maximize();25driver.manage().timeouts().implicitlyWait(3000);26driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });27driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });28driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });29var driver = new webdriver.Builder().forBrowser('chrome').build();30driver.manage().window().maximize();31driver.manage().timeouts().implicitlyWait(3000);32driver.getLocale().then(function(locale){ console.log('Locale is: ', locale); });33driver.getLocale().then(function(locale){ console.log('Locale

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Android Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful