Best JavaScript code snippet using playwright-internal
option.js
Source:option.js
...437 g_setting[name]=parseInt(v);438 _addRecent(document[docName]);439 }440}441function _setChecked(name,docName){442 if(!docName)docName=name;443 var v=document[docName].v.checked;444 if(v!=g_setting[name]){445 g_setting[name]=v;446 _addRecent(document[docName]);447 }448}449function _setInt(name,docName){450 if(!docName)docName=name;451 var v=parseInt(document[docName].v.value);452 if(v!=g_setting[name]){453 g_setting[name]=v;454 _addRecent(document[docName]);455 }456}457function _setValue(name,docName){458 if(!docName)docName=name;459 var v=document[docName].v.value;460 if(v!=g_setting[name]){461 g_setting[name]=v;462 _addRecent(document[docName]);463 }464}465function _setSelectedValue(name,docName){466 if(!docName)docName=name;467 var v=getSelectedValue(document[docName].v.options);468 if(v!=g_setting[name]){469 g_setting[name]=v;470 _addRecent(document[docName]);471 }472}473function _setSelectedIntValue(name,docName){474 if(!docName)docName=name;475 var v=parseInt(getSelectedValue(document[docName].v.options));476 if(v!=g_setting[name]){477 g_setting[name]=v;478 _addRecent(document[docName]);479 }480}481/////////////////////////////////////////////////////////////////////////////////////482// legacy menu483function getLegacyMenuPath(){484 return getFSO().BuildPath(getSettingDirPath(),"LegacyMenu");485}486function isLegacyMenu(){487 var path=getLegacyMenuPath();488 return getFSO().FileExists(path);489}490function setLegacyMenu(isSet){491 var path=getLegacyMenuPath();492 var fso=getFSO();493 var fileexist=fso.FileExists(path);494 var changed=isSet!=fileexist;495 if (changed){496 try{497 if (isSet){498 if(!fileexist){499 fso.CreateTextFile(path,false).Close();500 }501 }else{502 if(fileexist){503 fso.DeleteFile(path);504 }505 }506 changed=isSet!=fileexist;507 }catch(e){}508 }509 return changed;510}511/////////////////////////////////////////////////////////////////////////////////////512// init, apply, view513function goAddSearchPage(){514 g_app.ExecScript("reserved\\goAddSearchPage.js");515 optionClose();516}517function doFind(ev){518 if(13===ev.keyCode){519 view("find");520 }521}522function view(category){523 var isFind=("find"===category);524 if(!isFind&&g_view===category){525 return;526 }527 g_ext.hilite("");528 var elemNotFound=$("#notFound")529 ,elemNeedKw=$("#needKw");530 document.getElementById("view").scrollTop=0;531 elemNotFound.hide();532 elemNeedKw.hide(); 533534 $.each(g_cats,function(){535 this.toggleClass(C_SELECTED,this.get(0).id===category);536 });537538 var g_settingsCnt=g_settings.length539 ,kw=document.findKeyword.v.value;540 if(isFind&&kw.length){541 kw=kw.toUpperCase();542 var notFound=true;543 for(var j=0;j<g_settingsCnt;++j){544 var setting=$("#"+g_settings[j][1]);545 if(setting){546 var show=false;547 // call init548 if(null!==g_settings[j][2]){549 g_settings[j][2]();550 g_settings[j][2]=null;551 }552 var txt=setting.text().toUpperCase();553 if(txt.indexOf(kw)!=-1){554 show=true;555 notFound=false;556 }557 show ? setting.show() : setting.hide();558 }559 }560 if(notFound){561 elemNotFound.slideDown(300);562 } else {563 g_ext.hilite(kw);564 }565 }else{566 for(var j=0;j<g_settingsCnt;++j){567 var setting=$("#"+g_settings[j][1]);568 if(setting){569 if(isFind||(-1!=g_settings[j][0].indexOf(category))){570 // call init571 if(null!==g_settings[j][2]){572 g_settings[j][2]();573 }574 setting.show();575 }else{576 setting.hide();577 }578 }579 }580 if(isFind){581 elemNeedKw.slideDown(300);582 }583 }584 g_view=category;585}586function init(){587 // category588 g_cats=[589 $(document.getElementById("recent"))590 , $(document.getElementById("main"))591 , $(document.getElementById("reg"))592 , $(document.getElementById("style"))593 , $(document.getElementById("bookmark"))594 , $(document.getElementById("tool"))595 , $(document.getElementById("trident"))596 , $(document.getElementById("tab"))597 , $(document.getElementById("urlaction"))598 , $(document.getElementById("stylesheet"))599 , $(document.getElementById("toolbar"))600 , $(document.getElementById("mouse"))601 , $(document.getElementById("accel"))602 , $(document.getElementById("search"))603 , $(document.getElementById("script"))604 , $(document.getElementById("cache"))605 , $(document.getElementById("sidebar"))606 , $(document.getElementById("find"))607 ];608609 var option=loadOptionSetting();610 showOption(option);611 var firstSelect=1;612 if(applyRecent(option)){613 g_cats[0].show();614 firstSelect=0;615 }616 $.each(g_cats,function(){this.mouseout(617 function(ev){618 var target=$(ev.target);619 if((ev.target.className.indexOf(C_SELECTED)===-1)&&ev.target.tagName==="A"){620 target.addClass(C_UNHOVER[0]);621 setTimeout(function(){622 if(!target.hasClass(C_SELECTED)){623 target.addClass(C_UNHOVER[1]);624 }625 target.removeClass(C_UNHOVER[0]);626 setTimeout(function(){627 target.removeClass(C_UNHOVER[1]);628 },50);629 },30);630 }631 })632 });633634 //////////////////////////////////////////////////////635 // reg636 if(g_setting.sysVer<6000){637 document.getElementById("idSelectBrowserUI").style.display="none";638 document.getElementById("idAssocNew").style.display="none";639 document.getElementById("idAssocOld").style.display="block";640 document.getElementById("idNewSystem").style.display="none";641 }642643 //////////////////////////////////////////////////////644645 // start646 setCheckedByValue(document.start, g_setting.start);647 // app style648 setCheckedByValue(document.appStyle, g_setting.style);649 document.getElementById("idCurrentStyle").innerText=getAppStyleText(g_setting.currentStyle);650 // tab group651 document.tabGroup.v.checked=g_setting.tabGroup;652 // loading style653 document.loadingStyle[g_setting.loadingStyle].checked=true;654 document.getElementById("idCurrentLoadingStyle").innerText=getLoadingStyleText(g_setting.currentLoadingStyle);655 // tab width656 document.loadDelay.v.value=g_setting.loadDelay;657 // tab group color658 document.tabGroupColor.v.checked=g_setting.tabGroupColor;659 // menu style660 document.legacyMenu.v.checked=isLegacyMenu();661 // view style662 document.viewStyle[g_setting.viewStyle].checked=true;663 document.getElementById("currentViewStyle").innerText=getViewStyleText(g_setting.currentViewStyle);664 // single instance665 document.singleInstance.v.checked=g_setting.singleInstance;666 // single instance start enable667 document.singleInstanceStartEnable.v.checked=g_setting.singleInstanceStartEnable;668 // max closed669 document.maxClosed.v.value=g_setting.maxClosed;670 // max travellog671 document.maxTravelLog.v.value=g_setting.maxTravelLog;672 // max tab673 document.maxTab.v.value=g_setting.maxTab;674 // max tab load675 document.maxTabLoad.v.value=g_setting.maxTabLoad;676 // tab snapshot677 document.tabSnapshot.v.checked=g_setting.tabSnapshot;678 // tab snapshot interval679 document.tabSnapshotInterval.v.value=g_setting.tabSnapshotInterval;680 // tab width681 document.tabWidth.v.value=g_setting.tabWidth;682 // tab auto min width683 document.tabAutoMinWidth.v.value=g_setting.tabAutoMinWidth;684 // tab auto maxwidth685 document.tabAutoMaxWidth.v.value=g_setting.tabAutoMaxWidth;686 // tab font687 if(g_setting.tabFont){688 document.getElementById("currentTabFont").innerText=g_setting.tabFont;689 g_defaultTabFont=false;690 }691 // auto text link692 document.autoTextLink.v.checked=g_setting.autoTextLink;693 // auto text link dialog694 document.autoTextLinkDialog.v.checked=g_setting.autoTextLinkDialog;695 // auto image resize696 document.autoImageResize.v.checked=g_setting.autoImageResize;697 // security698 var security = g_setting.security;699 document.securityImage.v.checked=(security&0x10);700 document.securityVideo.v.checked=(security&0x20);701 document.securitySound.v.checked=(security&0x40);702 document.securityScript.v.checked=(0===(security&0x80));703 document.securityJava.v.checked=(0===(security&0x100));704 document.securityRunActiveX.v.checked=(0===(security&0x200));705 document.securityDownloadActiveX.v.checked=(0===(security&0x400));706 document.metaRefresh.v.checked=g_setting.metaRefresh;707 // inherit security708 document.inheritSecurity.v.checked=g_setting.inheritSecurity;709 // feature710 selectOption(document.featureBrowserEmulation.v.options,g_setting.featureBrowserEmulation);711 document.featureGpuRendering.v.checked=g_setting.featureGpuRendering;712 document.featureObjectCaching.v.checked=g_setting.featureObjectCaching;713 document.featureZoneElevation.v.checked=g_setting.featureZoneElevation;714 document.featureMimeHandling.v.checked=g_setting.featureMimeHandling;715 document.featureMimeSniffing.v.checked=g_setting.featureMimeSniffing;716 document.featureWindowRestrictions.v.checked=g_setting.featureWindowRestrictions;717 document.featureWebocPopupmanagement.v.checked=g_setting.featureWebocPopupmanagement;718 document.featureBehaviors.v.checked=g_setting.featureBehaviors;719 document.featureDisableMkProtocol.v.checked=g_setting.featureDisableMkProtocol;720 document.featureLocalmachineLockdown.v.checked=g_setting.featureLocalmachineLockdown;721 document.featureSecurityband.v.checked=g_setting.featureSecurityband;722 document.featureRestrictActivexinstall.v.checked=g_setting.featureRestrictActivexinstall;723 document.featureValidateNavigateUrl.v.checked=g_setting.featureValidateNavigateUrl;724 document.featureRestrictFiledownload.v.checked=g_setting.featureRestrictFiledownload;725 document.featureProtocolLockdown.v.checked=g_setting.featureProtocolLockdown;726 document.featureHttpUsernamePasswordDisable.v.checked=g_setting.featureHttpUsernamePasswordDisable;727 document.featureSafeBindtoobject.v.checked=g_setting.featureSafeBindtoobject;728 document.featureUncSavedfilecheck.v.checked=g_setting.featureUncSavedfilecheck;729 document.featureGetUrlDomFilepathUnencoded.v.checked=g_setting.featureGetUrlDomFilepathUnencoded;730 document.featureTabbedBrowsing.v.checked=g_setting.featureTabbedBrowsing;731 document.featureSslux.v.checked=g_setting.featureSslux;732 document.featureDisableNavigationSounds.v.checked=g_setting.featureDisableNavigationSounds;733 document.featureDisableLegacyCompression.v.checked=g_setting.featureDisableLegacyCompression;734 document.featureXmlHttp.v.checked=g_setting.featureXmlHttp;735 document.featureDisableTelnetProtocol.v.checked=g_setting.featureDisableTelnetProtocol;736 document.featureFeeds.v.checked=g_setting.featureFeeds;737 document.featureBlockInputPrompts.v.checked=g_setting.featureBlockInputPrompts;738 document.featureEnableScriptPasteUrlActionIfPrompt.v.checked=!g_setting.featureEnableScriptPasteUrlActionIfPrompt;739 document.FEATURE_AJAX_CONNECTIONEVENTS.v.checked=g_setting.FEATURE_AJAX_CONNECTIONEVENTS;740 document.FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG.v.checked=g_setting.FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG;741 document.FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION.v.checked=g_setting.FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION;742 document.FEATURE_VIEWLINKEDWEBOC_IS_UNSAFE.v.checked=g_setting.FEATURE_VIEWLINKEDWEBOC_IS_UNSAFE;743 document.FEATURE_IFRAME_MAILTO_THRESHOLD.v.checked=g_setting.FEATURE_IFRAME_MAILTO_THRESHOLD;744 document.FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI.v.checked=g_setting.FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI;745 document.FEATURE_BLOCK_LMZ_IMG.v.checked=g_setting.FEATURE_BLOCK_LMZ_IMG;746 document.FEATURE_BLOCK_LMZ_OBJECT.v.checked=g_setting.FEATURE_BLOCK_LMZ_OBJECT;747 document.FEATURE_ADDITIONAL_IE8_MEMORY_CLEANUP.v.checked=g_setting.FEATURE_ADDITIONAL_IE8_MEMORY_CLEANUP;748 document.FEATURE_SCRIPTURL_MITIGATION.v.checked=g_setting.FEATURE_SCRIPTURL_MITIGATION;749 document.FEATURE_DOMSTORAGE.v.checked=g_setting.FEATURE_DOMSTORAGE;750 document.FEATURE_RESTRICT_RES_TO_LMZ.v.checked=g_setting.FEATURE_RESTRICT_RES_TO_LMZ;751 document.FEATURE_WARN_ON_SEC_CERT_REV_FAILED.v.checked=g_setting.FEATURE_WARN_ON_SEC_CERT_REV_FAILED;752 document.FEATURE_STATUS_BAR_THROTTLING.v.checked=g_setting.FEATURE_STATUS_BAR_THROTTLING;753 document.FEATURE_SHIM_MSHELP_COMBINE.v.checked=g_setting.FEATURE_SHIM_MSHELP_COMBINE;754 document.FEATURE_NINPUT_LEGACYMODE.v.checked=g_setting.FEATURE_NINPUT_LEGACYMODE;755 document.FEATURE_WEBOC_DOCUMENT_ZOOM.v.checked=g_setting.FEATURE_WEBOC_DOCUMENT_ZOOM;756 document.FEATURE_DISABLE_HSTS.v.checked=g_setting.FEATURE_DISABLE_HSTS;757 document.FEATURE_ACTIVEX_REPURPOSEDETECTION.v.checked=g_setting.FEATURE_ACTIVEX_REPURPOSEDETECTION;758 document.freezeCheck.v.checked=g_setting.freezeCheck;759 document.freezeCheckElapse.v.value=g_setting.freezeCheckElapse;760 document.featureMaxConnectionsPer1_0Server.v.value=g_setting.featureMaxConnectionsPer1_0Server;761 document.featureMaxConnectionsPerServer.v.value=g_setting.featureMaxConnectionsPerServer;762 document.featureAlignedTimers.v.checked=g_setting.featureAlignedTimers;763 document.featureAllowHighfreqTimers.v.checked=g_setting.featureAllowHighfreqTimers;764765 // target name resolve766 document.targetNameResolve.v.checked=g_setting.targetNameResolve;767 // trident theme768 document.tridentTheme.v.checked=g_setting.tridentTheme;769 // auto complete770 document.autoComplete.v.checked=g_setting.autoComplete;771 // dpi aware772 document.dpiAware.v.checked=g_setting.dpiAware;773 // drop action774 document.dropAction.v.checked=g_setting.dropAction;775 // super drag drop776 document.superDragDrop.v.checked=g_setting.superDragDrop;777 // super drag drop form778 document.superDragDropForm.v.checked=g_setting.superDragDropForm;779 // mouse gesture780 document.mouseGesture.v[g_setting.mouseGesture].checked=true;781 // mouse gesture limit782 document.mouseGestureLimit.v.value=g_setting.mouseGestureLimit;783 // wheel redirect784 document.wheelRedirect.v.checked=g_setting.wheelRedirect;785 // hwheel redirect786 document.hwheelRedirect.v.checked=g_setting.hwheelRedirect;787 // new url788 document.newUrl.v.value=g_setting.newUrl;789 // search new tab790 document.searchNewTab.v.checked=g_setting.searchNewTab;791 // search tab group792 document.searchTabGroup.v.checked=g_setting.searchTabGroup;793 // tab style794 document.tabStyle.v[g_setting.tabStyle].checked=true;795 // tab icon796 document.tabIcon.v.checked=g_setting.tabIcon;797 // new tab position798 document.newTabPosition.v[g_setting.newTabPosition].checked=true;799 // new tab position tab list800 selectOption(document.newTabPositionTabList.v.options,g_setting.newTabPositionTabList);801 // new tab position window802 selectOption(document.newTabPositionWindow.v.options,g_setting.newTabPositionWindow);803 // new tab activate804 document.newTabActivate.v.checked=g_setting.newTabActivate;805 // new tab activate from page806 selectOption(document.newTabActivateFromPage.v.options,g_setting.newTabActivateFromPage);807 // open popup808 document.openPopup.v.checked=g_setting.openPopup;809 // new process activate810 selectOption(document.newProcessActivate.v.options,g_setting.newProcessActivate);811 // close active tab812 document.closeActiveTab.v[g_setting.closeActiveTab].checked=true;813 // last tab cmd814 document.lastTabCmd.v[g_setting.lastTabCmd].checked=true;815 // last union cmd816 document.lastUnionCmd.v[g_setting.lastUnionCmd].checked=true;817 // wheel tab818 document.wheelTab.v.checked=g_setting.wheelTab;819 // wheel tab loop820 document.wheelTabLoop.v.checked=g_setting.wheelTabLoop;821 // wheel tab scroll822 document.wheelTabScroll.v.checked=g_setting.wheelTabScroll;823 // select tab MDI824 document.selectTabMDI.v.checked=g_setting.selectTabMDI;825 // tab close button826 document.tabCloseButton.v.checked=g_setting.tabCloseButton;827 // tab control bar828 document.tabControlBar.v.checked=g_setting.tabControlBar;829 // nav close lock830 document.navCloseLock.v.checked=g_setting.navCloseLock;831 // show tab state832 document.showTabState.v.checked=g_setting.showTabState;833 // active no auto refresh834 document.activeNoAutoRefresh.v.checked=g_setting.activeNoAutoRefresh;835 // taskbar thumbnail836 document.taskbarThumbnail.v.checked=g_setting.taskbarThumbnail;837 // taskbar progress838 document.taskbarProgress.v.checked=g_setting.taskbarProgress;839 // confirm exit840 document.confirmExit.v.checked=g_setting.confirmExit;841 // confirm close any tab842 document.confirmCloseAnyTab.v.checked=g_setting.confirmCloseAnyTab;843 // sync ime state844 document.syncImeState.v.checked=g_setting.syncImeState;845 // check downloading846 document.checkDownloading.v.checked=g_setting.checkDownloading;847 // task tray848 document.tasktray.v.checked=g_setting.tasktray;849 // minimize task tray850 document.minimizeTasktray.v.checked=g_setting.minimizeTasktray;851 // delete history on close852 document.deleteHistoryOnClose.v.checked=g_setting.deleteHistoryOnClose;853 // delete cache on close854 document.deleteCacheOnClose.v.checked=g_setting.deleteCacheOnClose;855 // delete cookie on close856 document.deleteCookieOnClose.v.checked=g_setting.deleteCookieOnClose;857 // delete form data on close858 document.deleteFormDataOnClose.v.checked=g_setting.deleteFormDataOnClose;859 // delete passwords on close860 document.deletePasswordsOnClose.v.checked=g_setting.deletePasswordsOnClose;861 // delete search history on close862 document.deleteSearchHistoryOnClose.v.checked=g_setting.deleteSearchHistoryOnClose;863 // delete address history on close864 document.deleteAddressHistoryOnClose.v.checked=g_setting.deleteAddressHistoryOnClose;865 // delete lasttab on close866 document.deleteLastTabOnClose.v.checked=g_setting.deleteLastTabOnClose;867 // jump list868 document.jumpList.v.checked=g_setting.jumpList;869 toggleEnable(document.jumpList.v,'jumpListButton');870 // show active script error871 document.showActiveScriptError.v.checked=g_fsetting["showActiveScriptError"].isEnable();872 // show page script error873 document.showPageScriptError.v.checked=g_fsetting["showPageScriptError"].isEnable();874 // favicon875 document.favicon.v.checked=g_setting.favicon;876 // thumbnail877 document.thumbnail.v.checked=g_setting.thumbnail;878 // feed879 document.feed.v.checked=g_setting.feed;880 // auto hilite881 document.autoHilite.v.checked=g_setting.autoHilite;882 // inherit hilite883 document.inheritHilite.v.checked=g_setting.inheritHilite;884 // tab pos885 document.tabPos.v[g_setting.tabPos].checked=true;886 // hilite pos887 document.hilitePos.v[g_setting.hilitePos].checked=true;888 // frame additional button889 document.frameAdditionalButton.v.checked=g_setting.frameAdditionalButton;890 // script invoker version891 setCheckedByValue(document.scriptInvokerVersion, g_setting.scriptInvokerVersion);892 // isearch pos893 document.isearchPos.v[g_setting.isearchPos].checked=true;894 // max search histroy895 document.maxSearchHistory.v.value=g_setting.maxSearchHistory;896 // max inc history897 document.maxIncHistory.v.value=g_setting.maxIncHistory;898 // lock toolbar899 document.lockToolbar.v.checked=g_setting.lockToolbar;900 // favicon limit count901 document.faviconLimitCount.v.value=g_setting.faviconLimitCount;902 // favicon delete percent903 document.faviconDeletePercent.v.value=g_setting.faviconDeletePercent;904 // thumbnail limit count905 document.thumbnailLimitCount.v.value=g_setting.thumbnailLimitCount;906 // thumbnail delete percent907 document.thumbnailDeletePercent.v.value=g_setting.thumbnailDeletePercent;908 // DEP909 document.DEP.v.checked=g_setting.DEP;910 // empty working set911 document.emptyWorkingSet.v.checked=g_setting.emptyWorkingSet;912 // crash file913 document.crashFile.v.checked=g_setting.crashFile;914 // delete old crash file915 document.deleteOldCrashFile.v.checked=g_setting.deleteOldCrashFile;916 // save closed917 document.saveClosed.v.checked=g_setting.saveClosed;918 // save scroll pos919 document.saveScrollPos.v.checked=g_setting.saveScrollPos;920 // sidebar edge size921 document.sidebarEdgeSize.v.value=g_setting.sidebarEdgeSize;922 // test feature923 document.testFeature.v.checked=g_setting.testFeature;924 // EBPlus tab mode925 document.EBPlusTabMode.v.checked=g_setting.EBPlusTabMode;926 // url action927 document.urlAction.v.checked=g_setting.urlAction;928 // sub frame url action929 document.subFrameUrlAction.v.checked=g_setting.subFrameUrlAction;930 // fix active x931 document.fixActiveX.v.checked=g_setting.fixActiveX;932 // single key shortcut933 document.singlekeyShortcut.v.checked=g_setting.singlekeyShortcut;934 935 // select main936 g_cats[firstSelect].click();937 938 // focus939 document.findKeyword.v.focus();940}941// from html dialog942function onCloseHtmlDialog(){943 _addRecentSp();944 saveOptionSetting();945 if(g_toolbarChanged){946 g_ext.settingSave=true;947 }948}949function optionClose(){950 g_ext.optionClose();951}952function optionApply(){953 if(!apply_check()){954 return;955 }956 957 var reloads=[];958 clearRecent();959 960 if(g_initUrlAction||g_initStyleSheet){961 if(saveUrlAction()){962 g_ext.reloadUrlAction();963 if(g_initUrlAction){964 addRecent("urlActionSetting");965 }966 if(g_initStyleSheet){967 addRecent("styleSheetSetting");968 }969 }970 }971 if(g_initProxy){972 saveProxy();973 var indexProxy=getCheckedIdx(document.proxy.v,0);974 var proxy="";975 if(1===indexProxy){976 proxy=":direct:";977 }else if(2===indexProxy){978 proxy=getSelectedValue(document.proxyList.v.options);979 if(proxy===":ng:"){980 alert("ãããã·æ
å ±ãé¸æãã¦ãã ãã");981 document.proxyList.v.focus();982 return;983 }984 if(!getFSO().FileExists(getProxySettingPathFromName(proxy))){985 alert("ãããã·æ
å ±ã®ãã¡ã¤ã«ãèªã¿åãã¾ããã");986 document.proxyList.v.focus();987 return;988 }989 }990 if(g_setting.proxy!=proxy){991 g_setting.proxy=proxy;992 addRecent("proxySetting");993 }994 }995996 // start997 _setCheckedValue("start");998 // app style999 _setCheckedValue("style","appStyle");1000 // tab group1001 _setChecked("tabGroup");1002 // loading style1003 _setCheckedIndex("loadingStyle");1004 // load delay1005 _setInt("loadDelay");1006 // tab group color1007 _setChecked("tabGroupColor");1008 // legacy menu1009 if (setLegacyMenu(document.legacyMenu.v.checked)){1010 addRecent("menuSetting");1011 }1012 // view style1013 _setCheckedIndex("viewStyle");1014 // single instance1015 _setChecked("singleInstance");1016 // single instance start enable1017 _setChecked("singleInstanceStartEnable");1018 // home1019 if(g_initHome){1020 _setSelectedValue("home");1021 }1022 // max closed1023 _setInt("maxClosed");1024 // max travellog1025 _setInt("maxTravelLog");1026 // max tab1027 _setInt("maxTab");1028 // max tab load1029 _setInt("maxTabLoad");1030 if(g_setting["maxTabLoad"]===0){1031 g_setting["maxTabLoad"]=1;1032 }1033 // tab snapshot1034 _setChecked("tabSnapshot");1035 // tab snapshot interval1036 _setInt("tabSnapshotInterval");1037 if(! g_setting.tabSnapshotInterval){1038 g_setting.tabSnapshotInterval=30;1039 }1040 if(g_initTabSnapshot){1041 if(snapshot_save()){1042 addRecent("tabSnapshotSetting");1043 }1044 }1045 // tab width1046 var tabWidth=parseInt(document.tabWidth.v.value);1047 if(tabWidth<48){1048 document.tabWidth.v.value="48";1049 }1050 _setInt("tabWidth");1051 // tab auto min width1052 var tabAutoMinWidth=parseInt(document.tabAutoMinWidth.v.value);1053 if(tabAutoMinWidth<48){1054 document.tabAutoMinWidth.v.value="48";1055 }1056 _setInt("tabAutoMinWidth");1057 // tab auto max width1058 var tabAutoMaxWidth=parseInt(document.tabAutoMaxWidth.v.value);1059 if(tabAutoMaxWidth<48){1060 document.tabAutoMaxWidth.v.value="48";1061 }1062 _setInt("tabAutoMaxWidth");1063 // tab font1064 var tabFont="";1065 if(!g_defaultTabFont){1066 tabFont=document.getElementById("currentTabFont").innerText;1067 }1068 if(g_setting.tabFont!=tabFont){1069 g_setting.tabFont=tabFont;1070 addRecent("tabFontSetting");1071 }1072 // auto text link1073 _setChecked("autoTextLink");1074 // auto text link dialog1075 _setChecked("autoTextLinkDialog");1076 // auto image resize1077 _setChecked("autoImageResize");1078 // image panning1079 if(g_initImagePanning){1080 if(imagePanning_save()){1081 addRecent("imagePanningSetting");1082 }1083 }1084 // security1085 var security = 0;1086 security|=(document.securityImage.v.checked?0x10:0);1087 security|=(document.securityVideo.v.checked?0x20:0);1088 security|=(document.securitySound.v.checked?0x40:0);1089 security|=(document.securityScript.v.checked?0:0x80);1090 security|=(document.securityJava.v.checked?0:0x100);1091 security|=(document.securityRunActiveX.v.checked?0:0x200);1092 security|=(document.securityDownloadActiveX.v.checked?0:0x400);1093 if(g_setting.security!=security){1094 g_setting.security=security;1095 addRecent("securitySetting");1096 }1097 _setChecked("metaRefresh");1098 // inherit security1099 _setChecked("inheritSecurity");1100 // BHO1101 if(g_initBHO){1102 if(g_bhoList&&g_bhoList.length){1103 var bhoList=[],bhoChanged;1104 for(var i=0;i<g_bhoList.length;++i){1105 var bho=g_bhoList[i];1106 if(bho.enable!=bho.enableOld){1107 bhoChanged=true;1108 }1109 if(bho.enable){1110 bhoList.push(bho.clsid);1111 }1112 }1113 if(bhoChanged){1114 addRecent("BHOSetting");1115 g_ext.bhoList=bhoList;1116 }1117 }1118 }1119 // user agent1120 if(g_initUserAgent) {1121 var idx=document.userAgentList.v.selectedIndex;1122 var userAgent="";1123 if(0!=idx){1124 userAgent=document.userAgent.v.value;1125 }1126 if(g_setting.userAgent!=userAgent){1127 g_setting.userAgent=userAgent;1128 addRecent("userAgentSetting");1129 }1130 }1131 // feature1132 _setSelectedValue("featureBrowserEmulation");1133 _setChecked("featureGpuRendering");1134 _setChecked("featureObjectCaching");1135 _setChecked("featureZoneElevation");1136 _setChecked("featureMimeHandling");1137 _setChecked("featureMimeSniffing");1138 _setChecked("featureWindowRestrictions");1139 _setChecked("featureWebocPopupmanagement");1140 _setChecked("featureBehaviors");1141 _setChecked("featureDisableMkProtocol");1142 _setChecked("featureLocalmachineLockdown");1143 _setChecked("featureSecurityband");1144 _setChecked("featureRestrictActivexinstall");1145 _setChecked("featureValidateNavigateUrl");1146 _setChecked("featureRestrictFiledownload");1147 _setChecked("featureProtocolLockdown");1148 _setChecked("featureHttpUsernamePasswordDisable");1149 _setChecked("featureSafeBindtoobject");1150 _setChecked("featureUncSavedfilecheck");1151 _setChecked("featureGetUrlDomFilepathUnencoded");1152 _setChecked("featureTabbedBrowsing");1153 _setChecked("featureSslux");1154 _setChecked("featureDisableNavigationSounds");1155 _setChecked("featureDisableLegacyCompression");1156 _setChecked("featureXmlHttp");1157 _setChecked("featureDisableTelnetProtocol");1158 _setChecked("featureFeeds");1159 _setChecked("featureBlockInputPrompts");1160 {1161 var tmp=featureEnableScriptPasteUrlActionIfPrompt;1162 tmp.v.checked=!tmp.v.checked;1163 }1164 _setChecked("featureEnableScriptPasteUrlActionIfPrompt");1165 _setChecked("featureAlignedTimers");1166 _setChecked("featureAllowHighfreqTimers");1167 _setChecked("FEATURE_AJAX_CONNECTIONEVENTS");1168 _setChecked("FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG");1169 _setChecked("FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION");1170 _setChecked("FEATURE_VIEWLINKEDWEBOC_IS_UNSAFE");1171 _setChecked("FEATURE_IFRAME_MAILTO_THRESHOLD");1172 _setChecked("FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI");1173 _setChecked("FEATURE_BLOCK_LMZ_IMG");1174 _setChecked("FEATURE_BLOCK_LMZ_OBJECT");1175 _setChecked("FEATURE_ADDITIONAL_IE8_MEMORY_CLEANUP");1176 _setChecked("FEATURE_SCRIPTURL_MITIGATION");1177 _setChecked("FEATURE_DOMSTORAGE");1178 _setChecked("FEATURE_RESTRICT_RES_TO_LMZ");1179 _setChecked("FEATURE_WARN_ON_SEC_CERT_REV_FAILED");1180 _setChecked("FEATURE_STATUS_BAR_THROTTLING");1181 _setChecked("FEATURE_SHIM_MSHELP_COMBINE");1182 _setChecked("FEATURE_NINPUT_LEGACYMODE");1183 _setChecked("FEATURE_WEBOC_DOCUMENT_ZOOM");1184 _setChecked("FEATURE_DISABLE_HSTS");1185 _setChecked("FEATURE_ACTIVEX_REPURPOSEDETECTION");1186 _setChecked("freezeCheck");1187 _setInt("freezeCheckElapse");1188 if(g_setting["freezeCheckElapse"]===0){1189 g_setting["freezeCheckElapse"]=10;1190 }11911192 // max http10 connections1193 {1194 var _frm=document.featureMaxConnectionsPer1_0Server;1195 var _v=common_fixRange(_frm.v.value,0,128);1196 if(_v!=undefined){1197 if(1===_v){1198 _v=2;1199 }1200 _frm.v.value=_v;1201 _setInt("featureMaxConnectionsPer1_0Server");1202 }1203 }12041205 // max http11 connections1206 {1207 var _frm=document.featureMaxConnectionsPerServer;1208 var _v=common_fixRange(_frm.v.value,0,128);1209 if(_v!=undefined){1210 if(1===_v){1211 _v=2;1212 }1213 _frm.v.value=_v;1214 _setInt("featureMaxConnectionsPerServer");1215 }1216 }12171218 // target name resolve1219 _setChecked("targetNameResolve");1220 // trident theme1221 _setChecked("tridentTheme");1222 // auto complete1223 _setChecked("autoComplete");1224 // dpi aware1225 _setChecked("dpiAware");1226 // drop action1227 _setChecked("dropAction");1228 // super drag drop1229 _setChecked("superDragDrop");1230 // super drag drop form1231 _setChecked("superDragDropForm");1232 // super drag drop cmd1233 if (g_initSuperdd){1234 if(superdd.saveAll()){1235 addRecent("superDragDropSetting");1236 }1237 }1238 // mouse gesture1239 _setCheckedIndex("mouseGesture");1240 // mouse gesture limit1241 var mouseGestureLimit=parseInt(document.mouseGestureLimit.v.value);1242 if(mouseGestureLimit < 1) {1243 document.mouseGestureLimit.v.value="4";1244 }1245 _setInt("mouseGestureLimit");1246 // wheel redirect1247 _setChecked("wheelRedirect");1248 // hwheel redirect1249 _setChecked("hwheelRedirect");1250 // new url1251 _setValue("newUrl");1252 // search new tab1253 _setChecked("searchNewTab");1254 // search tab group1255 _setChecked("searchTabGroup");1256 // tab style1257 _setCheckedIndex("tabStyle");1258 // tab icon1259 _setChecked("tabIcon");1260 // new tab position1261 _setCheckedIndex("newTabPosition");1262 // new tab position tab list1263 _setSelectedIntValue("newTabPositionTabList");1264 // new tab position window1265 _setSelectedIntValue("newTabPositionWindow");1266 // new tab activate1267 _setChecked("newTabActivate");1268 // new tab activate from page1269 _setSelectedIntValue("newTabActivateFromPage");1270 // open popup1271 _setChecked("openPopup");1272 // new process activate1273 _setSelectedIntValue("newProcessActivate");1274 // close active tab1275 _setCheckedIndex("closeActiveTab");1276 // last tab cmd1277 _setCheckedIndex("lastTabCmd");1278 // last tab cmd1279 _setCheckedIndex("lastUnionCmd");1280 // wheel tab1281 _setChecked("wheelTab");1282 // wheel tab loop1283 _setChecked("wheelTabLoop");1284 // wheel tab scroll1285 _setChecked("wheelTabScroll");1286 // select tab MDI1287 _setChecked("selectTabMDI");1288 // tab close button1289 _setChecked("tabCloseButton");1290 // tab control bar1291 _setChecked("tabControlBar");1292 // nav close lock1293 _setChecked("navCloseLock");1294 // show tab state1295 _setChecked("showTabState");1296 // active no auto refresh1297 _setChecked("activeNoAutoRefresh");1298 // show active script error1299 _setCheckedFSetting("showActiveScriptError");1300 // show page script error1301 _setCheckedFSetting("showPageScriptError");1302 // taskbar thumbnail1303 _setChecked("taskbarThumbnail");1304 // taskbar progress1305 _setChecked("taskbarProgress");1306 // confirm exit1307 _setChecked("confirmExit");1308 // confirm close any tab1309 _setChecked("confirmCloseAnyTab");1310 // sync ime state1311 _setChecked("syncImeState");1312 // check downloading1313 _setChecked("checkDownloading");1314 // task tray1315 _setChecked("tasktray");1316 // minimize task tray1317 _setChecked("minimizeTasktray");1318 // delete history on close1319 _setChecked("deleteHistoryOnClose");1320 // delete cache on close1321 _setChecked("deleteCacheOnClose");1322 // delete cookie on close1323 _setChecked("deleteCookieOnClose");1324 // delete form data on close1325 _setChecked("deleteFormDataOnClose");1326 // delete passwords on close1327 _setChecked("deletePasswordsOnClose");1328 // delete search history on close1329 _setChecked("deleteSearchHistoryOnClose");1330 // delete address history on close1331 _setChecked("deleteAddressHistoryOnClose");1332 // delete lasttab on close1333 _setChecked("deleteLastTabOnClose");1334 // jump list1335 _setChecked("jumpList");1336 // favicon1337 _setChecked("favicon");1338 // thumbnail1339 _setChecked("thumbnail");1340 // feed1341 _setChecked("feed");1342 // auto hilite1343 _setChecked("autoHilite");1344 // inherit hilite1345 _setChecked("inheritHilite");1346 // tab pos1347 _setCheckedIndex("tabPos");1348 // hilite pos1349 _setCheckedIndex("hilitePos");1350 // frame additional button1351 _setChecked("frameAdditionalButton");1352 // script invoker version1353 _setCheckedValue("scriptInvokerVersion");1354 // isearch pos1355 _setCheckedIndex("isearchPos");1356 // max search history1357 _setInt("maxSearchHistory");1358 // max inc history1359 _setInt("maxIncHistory");1360 // mouse1361 if(g_initMouseAction){1362 var changed=mouse_saveAction();1363 for(var idx in changed.settings){1364 _addRecent(document.getElementById(changed.settings[idx]));1365 }1366 if(changed.reloads.length){1367 reloads=reloads.concat(changed.reloads);1368 }1369 }1370 // accel1371 if(g_initAccel){1372 // del add accel item1373 var accel=$(document.getElementById("idAppAccel")).data("accel");1374 var list=accel.list;1375 list.del(list.count-1);1376 // apply del1377 var count=list.count;1378 1379 while(count){1380 --count;1381 if(list.markDel(count)){1382 list.del(count);1383 }1384 }1385 // check default accel list1386 list.sort();1387 g_setting.defaultAccelList=false;1388 if(compareAccelList(list,g_setting.defaultAccelList)){1389 g_setting.defaultAccelList=true;1390 }1391 // check custom accel list1392 else if(! compareAccelList(list,g_setting.accelList)){1393 g_setting.accelList=list;1394 addRecent("accelSetting");1395 }1396 }1397 // favicon limit count1398 _setInt("faviconLimitCount");1399 // favicon delete percent1400 {1401 var _frm=document.faviconDeletePercent;1402 _frm.v.value=common_fixRange(_frm.v.value,0,100);1403 }1404 _setInt("faviconDeletePercent");1405 // thumbnail limit count1406 _setInt("thumbnailLimitCount");1407 // thumbnail delete percent1408 {1409 var _frm=document.thumbnailDeletePercent;1410 _frm.v.value=common_fixRange(_frm.v.value,0,100);1411 }1412 _setInt("thumbnailDeletePercent");1413 // DEP1414 _setChecked("DEP");1415 // empty working set1416 _setChecked("emptyWorkingSet");1417 // check file1418 _setChecked("crashFile");1419 // delete old crash file1420 _setChecked("deleteOldCrashFile");1421 // save closed1422 _setChecked("saveClosed");1423 // save scroll pos1424 _setChecked("saveScrollPos");1425 // sidebar edge size1426 {1427 var _frm=document.sidebarEdgeSize;1428 var _v=common_fixRange(_frm.v.value,0,20);1429 if(_v!=undefined){1430 _frm.v.value=_v;1431 _setInt("sidebarEdgeSize");1432 }1433 }1434 // test feature1435 _setChecked("testFeature");1436 // EBPlus tab mode1437 _setChecked("EBPlusTabMode");1438 // url action1439 _setChecked("urlAction");1440 // sub frame url action1441 _setChecked("subFrameUrlAction");1442 // fix active x1443 _setChecked("fixActiveX");1444 // wheel paste1445 updateTridentEtcSetting();1446 // single key shortcut1447 _setChecked("singlekeyShortcut");1448 // jumplist1449 if (g_jumplistChanged){1450 addRecent("jumpListSetting");1451 }1452 1453 // apply1454 var reloadSetting=reloads.join(',');1455 if(1===reloads.length){1456 reloadSetting+=',';1457 }1458 g_ext.optionApply(reloadSetting);1459 g_ext.settingSave=true;1460 optionClose();1461}
...
AbstractRadioGroup.js
Source:AbstractRadioGroup.js
...49 */50 _onClick(e) {51 e.preventDefault()52 if (e.target.getAttribute('role') === 'radio') {53 this._setChecked(e.target)54 }55 }56 /**57 * Any user action (a keypress or mouse click) eventually funnels down to58 * this method which ensures that only the passed in element is checked.59 * Uncheck _all_ `GmailRadioGroup` children. Then set the60 * `RadioButton` that was passed in to `aria-checked=true`. Also make61 * it focusable with `tabIndex=0` and call its `focus()` method.62 */63 _setChecked(node) {64 this._uncheckAll()65 this._checkNode(node)66 this._focusNode(node)67 }68 /**69 * If the user pressed an arrow key, call preventDefault to prevent the70 * page from scrolling. If the up or left arrow keys were pressed, select71 * the previous `RadioButton`. If the down or right keys were pressed,72 * select the next `RadioButton`.73 */74 _onKeyDown(e) {75 switch (e.keyCode) {76 case KEYCODE.UP:77 case KEYCODE.LEFT:78 e.preventDefault()79 this._setCheckedToPrevButton()80 break81 case KEYCODE.DOWN:82 case KEYCODE.RIGHT:83 e.preventDefault()84 this._setCheckedToNextButton()85 break86 87 case KEYCODE.HOME:88 e.preventDefault()89 this._setChecked(this.firstRadioButton)90 break91 92 case KEYCODE.END:93 e.preventDefault()94 this._setChecked(this.lastRadioButton)95 break96 case KEYCODE.SPACE:97 e.preventDefault()98 if (e.target.getAttribute('role') === 'radio')99 this._setChecked(e.target)100 break101 102 default:103 break104 }105 }106 /**107 * A helper for when the user tries to moves backwards through the108 * `AbstractRadioGroup` using their keyboard. Return the `RadioButton`109 * coming before the one passed as an argument. If no previous110 * `RadioButton` is found, return null.111 */112 _prevRadioButton(node) {113 let prev = node.previousElementSibling114 while (prev) {115 if (prev.getAttribute('role') === 'radio') {116 return prev117 }118 prev = prev.previousElementSibling119 }120 return null121 }122 /**123 * A helper for when the user tries to moves forwards through the124 * `HowtoRadioGroup` using their keyboard. Return the `HowtoRadioButton`125 * coming after the one passed as an argument. If no next126 * `HowtoRadioButton` is found, return null.127 */128 _nextRadioButton(node) {129 let next = node.nextElementSibling130 while (next) {131 if (next.getAttribute('role') === 'radio') {132 return next133 }134 next = next.nextElementSibling135 }136 return null137 }138 /**139 * This method is called in response to a user pressing a key to move140 * backwards through the `RadioGroup`. Check to see if the currently141 * checked `RadioButton` is the first child. If so, loop around and142 * focus the last child. Otherwise, find the previous sibling of the143 * currently checked `RadioButton`, and make it the new checked144 * button.145 */146 _setCheckedToPrevButton() {147 let checkedButton = this.checkedRadioButton || this.firstRadioButton148 if (checkedButton === this.firstRadioButton) {149 this._setChecked(this.lastRadioButton)150 } else {151 this._setChecked(this._prevRadioButton(checkedButton))152 }153 }154 /**155 * This method is called in response to a user pressing a key to move156 * forwards through the `RadioGroup`. Check to see if the currently157 * checked `RadioButton` is the last child. If so, loop around and158 * focus the first child. Otherwise, find the next sibling of the currently159 * checked `RadioButton`, and make it the new checked button.160 */161 _setCheckedToNextButton() {162 let checkedButton = this.checkedRadioButton || this.firstRadioButton163 if (checkedButton === this.lastRadioButton) {164 this._setChecked(this.firstRadioButton)165 } else {166 this._setChecked(this._nextRadioButton(checkedButton))167 }168 }169 /**170 * Call `focus()` on the passed in node to direct keyboard focus to it.171 */172 _focusNode(node) {173 node.focus()174 }...
side-menu.js
Source:side-menu.js
...127 if (flag) mi.classList.remove('disabled');128 else mi.classList.add('disabled');129 return mi;130 }131 _setChecked(cmd, flag) {132 const mi = this._elm.querySelector('[data-cmd=' + cmd + ']');133 if (flag) mi.classList.add('checked');134 else mi.classList.remove('checked');135 return mi;136 }137 // -------------------------------------------------------------------------138 open() {139 this._elm.style.display = 'block';140 this._pseudoFocus.focus();141 }142 close() {143 this._elm.style.display = 'none';144 this._study._editor._comp.focus();145 }146 // -------------------------------------------------------------------------147 reflectClipboard(text) {148 this._setEnabled('paste', text.length > 0);149 }150 reflectState(state) {151 this._setEnabled('undo', state.canUndo);152 this._setEnabled('redo', state.canRedo);153 this._setEnabled('exportAsLibrary', state.isFileOpened);154 this._setEnabled('exportAsWebPage', state.isFileOpened);155 }156 reflectConfig(conf) {157 this._setChecked('toggleSoftWrap', conf.softWrap);158 this._setChecked('toggleFnLineNum', conf.functionLineNumber);159 this._setChecked('toggleAutoIndent', conf.autoIndent);160 if (conf.language === 'ja') {161 this._setChecked('setLanguageJa', true);162 this._setChecked('setLanguageEn', false);163 } else {164 this._setChecked('setLanguageJa', false);165 this._setChecked('setLanguageEn', true);166 }167 }...
position-sanity-checker.js
Source:position-sanity-checker.js
...14 controller.set('management_onplaya_role', this.managers(model.management_onplaya_role))15 controller.set('deactivated_positions', this.deactivated_positions(model.deactivated_positions))16 }17 shinyPennies(shiny_pennies) {18 this._setChecked(shiny_pennies);19 this._setYesNo(shiny_pennies, 'has_shiny_penny')20 shiny_pennies.columns = [21 {label: 'Mentor Year', property: 'year'},22 {label: 'Has Posotion?', property: 'has_shiny_penny', class:'text-center' }23 ]24 return shiny_pennies25 }26 greenDots(green_dots) {27 this._setChecked(green_dots);28 this._setYesNo(green_dots, 'has_dirt_green_dot', 'has_sanctuary', 'has_gp_gd')29 green_dots.columns = [30 {label: 'Has Dirt - Green Dot?', property: 'has_dirt_green_dot', class:'text-center'},31 {label: 'Has Sanctuary?', property: 'has_sanctuary', class:'text-center'},32 {label: 'Has Gerlach Patrol - Green Dot?', property: 'has_gp_gd', class:'text-center'}33 ]34 return green_dots35 }36 managers(managers) {37 this._setChecked(managers);38 this._setYesNo(managers, 'is_shiny_penny')39 managers.forEach((mr) => mr.positions = mr.positions.map(p => p.title).join())40 managers.columns = [41 {label: 'Postion(s)', property: 'positions'},42 {label: 'Is Shiny Penny?', property: 'is_shiny_penny', class: 'text-center'}43 ]44 return managers;45 }46 deactivated_positions(positions) {47 positions.forEach((p) => this._setChecked(p.people));48 return positions;49 }50 _setChecked(rows) {51 rows.forEach((row) => row.checked = 1);52 }53 _setYesNo(rows, ...properties) {54 rows.forEach((r) => {55 properties.forEach( (prop) => r[prop] = yesno([r[prop]]))56 })57 }...
role.js
Source:role.js
...37 }38 if(len>0){39 for(var i=0;i<len;i++){40 if(chkd){41 accchek._setChecked($('#'+slibid[i]), true);42 }else{43 if($("input[id^='" + slibid[i] + "-']").length<=1){44 accchek._setChecked($('#'+slibid[i]), false);45 }46 }47 }48 }49 var chkes = $("input[id^='" + _id + "']");50 //éä¸51 if (chkd) {52 accchek._setChecked(chkes, true);53 }54 //åæ¶éä¸55 else {56 accchek._setChecked(chkes, false);57 }58 });59 },60 _setChecked: function (obj, chked) {61 if (obj.length <= 0) {62 return;63 }64 obj.each(function (i) {65 this.checked = chked;66 /*if (chked) {67 $(this).closest('span').addClass('checked');68 } else {69 $(this).closest('span').removeClass('checked');70 }*/...
syspower_role.js
Source:syspower_role.js
...37 }38 if(len>0){39 for(var i=0;i<len;i++){40 if(chkd){41 accchek._setChecked($('#'+slibid[i]), true);42 }else{43 if($("input[id^='" + slibid[i] + "-']").length<=1){44 accchek._setChecked($('#'+slibid[i]), false);45 }46 }47 }48 }49 var chkes = $("input[id^='" + _id + "']");50 //éä¸51 if (chkd) {52 accchek._setChecked(chkes, true);53 }54 //åæ¶éä¸55 else {56 accchek._setChecked(chkes, false);57 }58 });59 },60 _setChecked: function (obj, chked) {61 if (obj.length <= 0) {62 return;63 }64 obj.each(function (i) {65 this.checked = chked;66 /*if (chked) {67 $(this).closest('span').addClass('checked');68 } else {69 $(this).closest('span').removeClass('checked');70 }*/...
Radio.js
Source:Radio.js
...41 this.observe('value', this._onChangeValueAttr);42 this._onChangeValueAttr();43 }44 init() {45 this._setChecked();46 }47 _setHandlers() {48 this.input.on('change', () => {49 this.radioWrap.setValue(this.value);50 $scope.$apply();51 });52 }53 _onChangeValueAttr() {54 this._setChecked();55 }56 _setChecked() {57 this.input.prop('checked', this.checked);58 }59 }60 return new Radio();61 };62 controller.$inject = ['$element', '$scope', 'Base'];63 angular.module('app.ui')64 .component('wRadio', {65 bindings: {66 value: '<'67 },68 transclude: true,69 templateUrl: 'modules/ui/directives/radio/radio.html',70 require: {...
Switch.js
Source:Switch.js
...6 const { checked, onChange } = props;7 const [_checked, _setChecked] = useState();8 const handleSwitch = () => {9 if (onChange) onChange(!_checked);10 _setChecked((checkedState) => !checkedState);11 };12 useEffect(() => {13 _setChecked(checked);14 }, [checked]);15 return (16 <span className={styles.switchContainer} onClick={handleSwitch}>17 <span18 className={`${styles.switchTrack} ${19 _checked && styles.switchTrackChecked20 }`}21 ></span>22 <span23 className={`${styles.switchButton} ${24 _checked && styles.switchButtonChecked25 }`}26 ></span>27 </span>...
Using AI Code Generation
1const { _setChecked } = require('playwright/lib/server/dom.js');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('input[type="checkbox"]');8 const checkbox = await page.$('input[type="checkbox"]');9 await _setChecked(checkbox, false);10})();
Using AI Code Generation
1const { _setChecked } = require('playwright/lib/server/dom.js');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const handle = await page.$('#L2AGLb');8 await _setChecked(handle, true);9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const context = await browser.newContext();15 const page = await context.newPage();16 await page.check('#L2AGLb');17 await browser.close();18})();
Using AI Code Generation
1const { _setChecked } = require('playwright/lib/server/dom');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.waitForSelector('iframe');8 await page.waitForTimeout(2000);9 const frame = page.frames().find(frame => frame.name() === 'iframeResult');10 const checkbox = await frame.waitForSelector('#vehicle1');11 await _setChecked(checkbox, true);12 await browser.close();13})();
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.click('text=Checkbox');6 await page.click('text=Get Started');7 await page.click('text=AP
Using AI Code Generation
1const { _setChecked } = require('playwright/lib/client/selectorEngine');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.waitForSelector('#main > iframe');7 const frame = page.frame({ name: 'iframeResult' });8 await frame.waitForSelector('#myCheck');9 await _setChecked(frame, '#myCheck', true);10 await page.screenshot({ path: `example.png` });11 await browser.close();12})();
Using AI Code Generation
1const checkbox = await page.$('input[type="checkbox"]');2await checkbox._setChecked(true);3const checkbox = await page.$('input[type="checkbox"]');4await checkbox._setChecked(true);5const input = await page.$('input[type="file"]');6await input._setInputFiles('/path/to/file');7const input = await page.$('input[type="file"]');8await input._setInputFiles('/path/to/file');9const input = await page.$('input[type="file"]');10await input._setInputFiles('/path/to/file');11const input = await page.$('input[type="file"]');12await input._setInputFiles('/path/to/file');13const input = await page.$('input[type="file"]');14await input._setInputFiles('/path/to/file');15const input = await page.$('input[type="file"]');16await input._setInputFiles('/path/to/file');17const input = await page.$('input[type="file"]');18await input._setInputFiles('/path/to/file');19const input = await page.$('input[type="file"]');20await input._setInputFiles('/path/to/file');21const input = await page.$('input[type="file"]');22await input._setInputFiles('/path/to/file');23const input = await page.$('input[type="file"]');24await input._setInputFiles('/path/to/file');25const input = await page.$('input[type="file"]');26await input._setInputFiles('/path/to/file');
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const checkbox = await page.$('#onetrust-accept-btn-handler');7 await checkbox._setChecked(true);8 await browser.close();9})();10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 const checkbox = await page.$('#onetrust-accept-btn-handler');16 await checkbox._setChecked(false);17 await browser.close();18})();
Using AI Code Generation
1const { test, expect } = require('@playwright/test');2const { Checkbox } = require('@playwright/test/lib/server/checkbox');3test('test', async ({ page }) => {4 const checkbox = await page.$('input[type="checkbox"]');5 await checkbox.evaluate(c => c._setChecked(true));6 expect(await checkbox.isChecked()).toBe(true);7});8const { test, expect } = require('@playwright/test');9const { Checkbox } = require('@playwright/test/lib/server/checkbox');10test('test', async ({ page }) => {11 const checkbox = await page.$('input[type="checkbox"]');12 checkbox._setChecked(true);13 expect(await checkbox.isChecked()).toBe(true);14});15import { test, expect } from '@playwright/test';16import { Checkbox } from '@playwright/test/lib/server/checkbox';17test('test', async ({ page }) => {18 const checkbox = await page.$('input[type="checkbox"]');19 checkbox._setChecked(true);20 expect(await checkbox.isChecked()).toBe(true);21});
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const page = await browser.newPage();5 await page.waitForSelector('iframe');6 const frame = page.frames().find(f => f.name() === 'iframeResult');7 await frame.waitForSelector('input');8 const input = await frame.$('input');9 await input._setChecked(true);10 await page.screenshot({path: `screenshot.png`});11 await browser.close();12})();13const {chromium} = require('playwright');14(async () => {15 const browser = await chromium.launch({headless: false});16 const page = await browser.newPage();17 await page.waitForSelector('iframe');18 const frame = page.frames().find(f => f.name() === 'iframeResult');19 await frame.waitForSelector('input');20 const input = await frame.$('input');21 await input._setChecked(false);22 await page.screenshot({path: `screenshot.png`});23 await browser.close();24})();25const {chromium} = require('playwright');26(async () => {27 const browser = await chromium.launch({headless: false});28 const page = await browser.newPage();29 await page.waitForSelector('iframe');30 const frame = page.frames().find(f => f.name() === 'iframeResult');31 await frame.waitForSelector('input');32 const input = await frame.$('input');33 await input._setChecked(true);34 await page.screenshot({path: `screenshot.png`});35 await browser.close();36})();
Using AI Code Generation
1const { _setChecked } = require('playwright/lib/server/dom.js');2await _setChecked(page, '#checkbox', true);3await _setChecked(page, '#checkbox', false);4const { _setChecked } = require('playwright/lib/server/dom.js');5await _setChecked(page, '#checkbox', true);6await _setChecked(page, '#checkbox', false);7const { _setChecked } = require('playwright/lib/server/dom.js');8await _setChecked(page, '#checkbox', true);9await _setChecked(page, '#checkbox', false);10const { _setChecked } = require('playwright/lib/server/dom.js');11await _setChecked(page, '#checkbox', true);12await _setChecked(page, '#checkbox', false);13const { _setChecked } = require('playwright/lib/server/dom.js');14await _setChecked(page, '#checkbox', true);15await _setChecked(page, '#checkbox', false);16const { _setChecked } = require('playwright/lib/server/dom.js');17await _setChecked(page, '#checkbox', true);18await _setChecked(page, '#checkbox', false);19const { _setChecked } = require('playwright/lib/server/dom.js');20await _setChecked(page, '#checkbox', true);21await _setChecked(page, '#checkbox', false);22const { _setChecked } = require('playwright/lib/server/dom.js');23await _setChecked(page, '#checkbox', true);24await _setChecked(page, '#checkbox', false);25const { _setChecked } = require('playwright/lib/server/dom.js');26await _setChecked(page, '#checkbox', true);27await _setChecked(page, '#checkbox', false);28const { _setChecked } = require('playwright/lib
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!