1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338 |
- var palette = [
- ["rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)", "rgb(153, 153, 153)", "rgb(183, 183, 183)",
- "rgb(204, 204, 204)", "rgb(217, 217, 217)", "rgb(239, 239, 239)", "rgb(243, 243, 243)", "rgb(255, 255, 255)"],
- ["rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
- "rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)"],
- ["rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
- "rgb(208, 224, 227)", "rgb(201, 218, 248)", "rgb(207, 226, 243)", "rgb(217, 210, 233)", "rgb(234, 209, 220)",
- "rgb(221, 126, 107)", "rgb(234, 153, 153)", "rgb(249, 203, 156)", "rgb(255, 229, 153)", "rgb(182, 215, 168)",
- "rgb(162, 196, 201)", "rgb(164, 194, 244)", "rgb(159, 197, 232)", "rgb(180, 167, 214)", "rgb(213, 166, 189)",
- "rgb(204, 65, 37)", "rgb(224, 102, 102)", "rgb(246, 178, 107)", "rgb(255, 217, 102)", "rgb(147, 196, 125)",
- "rgb(118, 165, 175)", "rgb(109, 158, 235)", "rgb(111, 168, 220)", "rgb(142, 124, 195)", "rgb(194, 123, 160)",
- "rgb(166, 28, 0)", "rgb(204, 0, 0)", "rgb(230, 145, 56)", "rgb(241, 194, 50)", "rgb(106, 168, 79)",
- "rgb(69, 129, 142)", "rgb(60, 120, 216)", "rgb(61, 133, 198)", "rgb(103, 78, 167)", "rgb(166, 77, 121)",
- "rgb(133, 32, 12)", "rgb(153, 0, 0)", "rgb(180, 95, 6)", "rgb(191, 144, 0)", "rgb(56, 118, 29)",
- "rgb(19, 79, 92)", "rgb(17, 85, 204)", "rgb(11, 83, 148)", "rgb(53, 28, 117)", "rgb(116, 27, 71)",
- "rgb(91, 15, 0)", "rgb(102, 0, 0)", "rgb(120, 63, 4)", "rgb(127, 96, 0)", "rgb(39, 78, 19)",
- "rgb(12, 52, 61)", "rgb(28, 69, 135)", "rgb(7, 55, 99)", "rgb(32, 18, 77)", "rgb(76, 17, 48)"]
- ];
- // RGB转16进制(rgb2hex)
- function colorRGB2Hex(color) {
- var rgb = color.split(',');
- var r = parseInt(rgb[0].split('(')[1]);
- var g = parseInt(rgb[1]);
- var b = parseInt(rgb[2].split(')')[0]);
- var hex = "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
- return hex;
- }
- // 基于颜色插件 获取颜色值
- function getFontColor(obj) {
- var fontColor = $(obj).spectrum("get");
- fontColor = 'rgb(' + fontColor._r + ',' + fontColor._g + ',' + fontColor._b + ')';
- return colorRGB2Hex(fontColor);
- }
- // 基于颜色插件 获取颜色值的透明度
- function getAlpha(obj) {
- return $(obj).spectrum("get")._a;
- }
- // 汉字 字符
- function getByteLen(val) {
- var len = 0;
- for (var i = 0; i < val.length; i++) {
- var a = val.charAt(i);
- if (a.match(/[^\x00-\xff]/ig) != null) {
- len += 2;
- } else {
- len += 1;
- }
- }
- return len;
- }
- // 第三方分享
- // 分享位置
- /*
- $(".plugin-share .con").click(function () {
- $(".plugin-share .con").removeClass("active");
- $(this).addClass("active");
- });
- */
- // 分享方式
- $(".plugin-share .s-way .s-ul li").click(function () {
- var $elShow = $(".plugin-share .app-share");
- var i = $(this).data("way");
- $(this).addClass("active").siblings().removeClass("active");
- if (i == 1) {
- $elShow.show();
- } else {
- $elShow.hide();
- }
- });
- // 第三方分享 点击保存,验证
- var wechatId = '';
- var wechatSecret = '';
- var shareText = '';
- var shareUrl = '';
- var shareWay = 1;
- $("#shareModal .plugin-save").click(function () {
- var $wxId = $("#shareModal input[name=wxId]");
- var $wxSecret = $("#shareModal input[name=wxSecret]");
- var $text = $("#shareModal input[name=text]");
- var $link1 = $("#shareModal input[name=link1]");
- var way = $("#shareModal .s-ul li.active").attr("data-way");
- if (way == 1) {
- if ($wxId.val().length > 0 && $wxSecret.val().length > 0) {
- $wxSecret.next(".error").hide();
- } else {
- $wxSecret.next(".error").show();
- }
- wechatId = $wxId.val();
- wechatSecret = $wxSecret.val();
- } else {
- $wxSecret.next(".error").hide();
- wechatId = '';
- wechatSecret = '';
- }
- if (verifyUrl($link1.val())) {
- $link1.parents(".form-group").removeClass("form-error");
- } else {
- $link1.parents(".form-group").addClass("form-error");
- }
- var errorLEength = $(".plugin-share .error:visible").length;
- if (errorLEength == 0) {
- $("#shareModal").modal("hide");
- } else {
- $("#shareModal").modal("show");
- }
- shareText = $text.val();
- shareUrl = $link1.val();
- shareWay = way;
- share = {"way": way, "wxId": wechatId, "wxSecret": wechatSecret, "shareText": shareText, "shareUrl": shareUrl};
- });
- $("#keystoreModal .plugin-save").click(function () {
- var storeFileContent = $("input[name=store_file_content]").val();
- var storeStorepass = $("input[name=store_storepass]").val();
- var storeAlias = $("input[name=store_alias]").val();
- var storeKeypass = $("input[name=store_keypass]").val();
- if (!(storeStorepass && storeAlias && storeKeypass)) {
- alert('请填写必填项');
- return false;
- }
- androidKey = {
- 'save': '1',
- 'type': '2',
- 'file_url': storeFileContent,
- 'storepass': storeStorepass,
- 'alias': storeAlias,
- 'keypass': storeKeypass
- }
- console.log(androidKey);
- $("#keystoreModal").modal("hide");
- })
- // 左侧栏 显示方式
- // 左侧栏背景颜色
- $("#colorPicker5").spectrum({
- color: "#f3f3f3",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateAsideBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- function updateAsideBackground(color) {
- $("#asideModal .aside-modal .a-left .phone .bg").css("background-color", color);
- }
- // 左侧栏字体颜色
- $("#asideFontColor").spectrum({
- color: "#333",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateAsideFontColor(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- function updateAsideFontColor(color) {
- $("#asideModal .a-left .aside-nav li .iconfont").css("color", color);
- $("#asideModal .a-left .aside-nav li .text").css("color", color);
- }
- tab.radioRound({
- el: "#displayMode li",
- checkedClass: "icon-radio-checked"
- });
- // 左侧栏 顶部显示APP图标
- tab.radioTick({
- el: ".plugin-aside .top-show ul li"
- });
- // 左侧栏 图标显示隐藏
- $(".plugin-aside .top-show ul li").click(function () {
- var i = $(this).index();
- var $icon = $("#asideModal .a-left .phone .aside-icon");
- if (i == 0) {
- $icon.show();
- } else {
- $icon.hide();
- }
- });
- // 左侧栏 显示方式
- /*
- $("#displayMode li").click(function () {
- var index = $(this).index();
- $("#asideModal .phone .b-right img").eq(index).show().siblings().hide();
- });
- */
- // 左侧栏 下拉框change字体颜色设置、显示链接输入框
- $(".plugin-aside .n-list select").change(function () {
- $(this).css("color", "#333");
- var selectedVal = $(this).find(":selected").val();
- // console.log(selectedVal);
- if (selectedVal == "link_app" || selectedVal == "link_url") {
- $(this).parents("dd").find(".n-link").css("visibility", "visible").addClass("link-show");
- } else {
- $(this).parents("dd").find(".n-link").css("visibility", "hidden").removeClass("link-show");
- }
- });
- // 左侧栏 点击图标
- var asideIconIndex = -1;
- $(".plugin-aside .n-list .add-icon").click(function () {
- asideIconIndex = $(this).parents("dd").index();
- $("#iconsModal").modal("show");
- });
- // 左侧栏 设置图标
- $(".plugin-modal .icons li").click(function () {
- var i = $(this).index();
- // console.log(i);
- $("#iconsModal").modal("hide");
- $('#asideModal').css({'overflow-y': 'scroll'});
- $("body").css("overflow", "hidden");
- $(".aside-modal .aside-nav li").eq(asideIconIndex).find(".iconfont").attr("class", "fl iconfont icon-" + i);
- $(".plugin-aside .n-list dd").eq(asideIconIndex).find(".add-icon").find(".iconfont").attr({
- "class": "iconfont icon-" + i,
- "data-index": i
- }).css("color", "#333");
- });
- //左侧栏 增加导航 默认显示1个
- $(".plugin-aside .n-list .add-config").click(function () {
- var $dd = $(".plugin-aside .n-list dd:not(.active)");
- $dd.eq(0).addClass('active');
- if ($(".plugin-aside .n-list dd.active").length > 9) {
- $(this).addClass("disabled");
- } else {
- $(this).removeClass("disabled");
- }
- });
- // 左侧栏 实时文字
- $(".plugin-aside .n-list .n-text").bind("input propertychange", function () {
- var i = $(this).parents("dd").index();
- // console.log(i);
- var thisVal = $(this).val();
- if (thisVal.length == 0) {
- $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text("");
- } else {
- // $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text(thisVal);
- $("#asideModal .a-left .aside-nav li").eq(i).show().find(".text").text(thisVal);
- }
- });
- // 左侧栏 恢复默认
- $(".plugin-aside .set-nav .reset").click(function () {
- // $("#colorPicker4").spectrum("set", "rgb(249, 249, 249)");
- // li恢复到隐藏
- $("#asideModal .a-left .aside-nav li").hide();
- // 去除错误状态
- $(".plugin-aside .n-list").find(".error").remove();
- // 恢复左侧导航文字为空
- $("#asideModal .a-left .aside-nav li .text").text("");
- // 恢复 配置导航显示1个
- $(".plugin-aside .set-nav .n-list dd:nth-of-type(n+2)").removeClass('active');
- // 导航名称默认恢复为空
- $(".plugin-aside .n-list .n-text").val('');
- // 恢复图标
- $("#asideModal .a-left .aside-nav li .iconfont").attr("class", "iconfont fl");
- $(".plugin-aside .n-list .add-icon .iconfont").attr({
- "class": "iconfont icon-jia",
- "data-index": ""
- }).css("color", "#eee");
- // select恢复到默认
- $(".plugin-aside .n-list select").each(function () {
- $(this).css("color", "#999");
- $(this).find("option").eq(0).attr("selected", "selected");
- });
- // 链接输入框恢复到默认
- $(".plugin-aside .n-list .n-link").css("visibility", "hidden").val("").removeClass("link-show");
- $(".plugin-aside .n-list .add-config").removeClass("disabled");
- });
- // 左侧栏 删除
- $(".plugin-aside .n-list .n-delete").click(function () {
- var $this = $(this).parents("dd");
- var i = $this.index();
- $this.removeClass('active');
- $this.find(".n-link").removeClass("link-show").show();
- $this.find("select").eq(0).attr("selected", "selected");
- $("#asideModal .a-left .aside-nav li").eq(i).find(".text").text("");
- $("#asideModal .a-left .aside-nav li").eq(i).find(".iconfont").attr("class", "iconfont fl");
- $(".plugin-aside .n-list .add-config").removeClass("disabled");
- });
- // 升级提示 select选择自定义,自定义输入框显示
- $(".plugin-upgrade-prompt select").change(function () {
- var selectedVal = $(this).find(":selected").val();
- if (selectedVal == 2) {
- $(this).next("input").show();
- } else {
- $(this).next("input").hide();
- $(this).next("input").val("");
- }
- });
- // 升级提示 选项卡
- tab.radioRound({
- el: ".plugin-upgrade-prompt .version li",
- checkedClass: "icon-radio-checked"
- });
- tab.radioRound({
- el: ".plugin-upgrade-prompt .time li",
- checkedClass: "icon-radio-checked"
- });
- tab.radioTick({
- el: ".plugin-upgrade-prompt .style li"
- });
- // URL 拉起APP
- $("#urlAppModal .plugin-url-app ul li").click(function () {
- var i = $(this).index();
- if (i == 0) {
- $(this).parents(".plugin-url-app").find(".color-warning").show();
- } else {
- $(this).parents(".plugin-url-app").find(".color-warning").hide();
- }
- });
- // 下拉刷新
- $("#refreshModal .plugin-refresh ul li").click(function () {
- var i = $(this).index();
- if (i == 0) {
- $(this).parents(".plugin-refresh").find(".color-warning").show();
- } else {
- $(this).parents(".plugin-refresh").find(".color-warning").hide();
- }
- });
- // 加载进度条颜色
- $("#colorPicker1").spectrum({
- color: "#157df1",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateLoadingBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- function updateLoadingBackground(color) {
- $(".plugin-loading .con-1 .tit2 .progress1").css("background-color", color);
- return color;
- };
- function updateStateBackground(color) {
- $(".plugin-state .state-bgcolor").css("background-color", color);
- };
- function updateTitleBackground(color) {
- $(".plugin-title .state-bgcolor").css("background-color", color);
- };
- function updateTitleFontColor(color) {
- $(".plugin-title .title-top .text").css("color", color);
- $(".plugin-title .title-top .iconfont").css("color", color);
- }
- // 配置插件 index
- var activeIndex;
- $(".encapsulation3 .col-sm-2").click(function () {
- activeIndex = $(this);
- });
- /*
- $(".config-plugin .choose-cancel").click(function () {
- $(this).parents(".plugin-modal").find(".plugin-save").addClass("plugin-cancel");
- });
- */
- // 保存按钮 操作
- $(".plugin-save").click(function () {
- if (activeIndex && $(this).is(':visible')) {
- var has = $(this).hasClass("plugin-cancel");
- if (has) {
- activeIndex.find(".con").removeClass("active");
- $(this).removeClass("plugin-cancel");
- } else {
- activeIndex.find(".con").addClass("active").find(".icon-checkbox1").addClass("icon-checkbox-checked1 add-checked");
- }
- }
- activeIndex = null;
- });
- $(document).on("click", ".add-checked", function (e) {
- // console.log(123);
- $(".plugin-modal").modal("hide");
- $(this).removeClass("add-checked icon-checkbox-checked1");
- $(this).parents(".con").removeClass("active");
- e.stopPropagation();
- });
- // 加载动画
- $(".plugin-loading .con").click(function () {
- $(this).parents(".plugin-loading").find(".con").removeClass("active");
- $(this).addClass("active");
- var i = $(this).parent(".col-sm-5").index();
- // console.log(i);
- var that = $(this).parents(".plugin-loading").find(".color-picker-wrap");
- if (i == 1) {
- that.hide();
- } else {
- that.show();
- }
- });
- // 清除缓存
- $(".config-plugin .plugin-common .common-ul li").click(function () {
- $(this).addClass("active").siblings().removeClass("active");
- var index = $(this).index();
- if (index == 0) {
- $(this).parents(".plugin-common").find(".bg-text-color").show();
- $(this).parents(".plugin-common").find(".be-hidden").hide();
- } else {
- $(this).parents(".plugin-common").find(".bg-text-color").hide();
- $(this).parents(".plugin-common").find(".be-hidden").show();
- }
- });
- // 极光推送
- $('.plugin-modal .app-key').bind('input propertychange', function () {
- var valLength = $(this).val().length;
- // console.log(valLength);
- if (valLength > 0) {
- $(this).parents(".plugin-modal").find(".plugin-save").prop("disabled", false);
- } else {
- $(this).parents(".plugin-modal").find(".plugin-save").prop("disabled", true);
- }
- });
- // 退出提示
- $(".plugin-exit .mode dd").click(function () {
- $(this).addClass("active").siblings().removeClass("active");
- $(this).parents(".mode").find(".icon-radio").removeClass("icon-radio-checked");
- $(this).find(".icon-radio").addClass("icon-radio-checked");
- });
- // 引导页
- $(".thumbnail").change(function () {
- $("#guideModal .plugin-save").prop("disabled", false);
- });
- $(".plugin-guide .radio-tick li").click(function () {
- var type = $(this).data("type");
- var $parents = $(this).parents("#guideModal");
- if (type == -1) {
- $(".experience-color", $parents).hide();
- $(".experience-btn", $parents).hide();
- } else {
- $(".experience-color", $parents).show();
- $(".experience-btn", $parents).show();
- }
- });
- // 引导页 立即体验文字颜色
- $("#experienceTextColor").spectrum({
- color: "#fff",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateGuideFontColor(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- // console.log(getFontColor("#experienceTextColor"));
- function updateGuideFontColor(color) {
- $("#guideModal .experience-btn").css({"color": color, "border-color": color});
- };
- // 引导页 上传图片预览
- $("#guideModal .thumbnail").change(function () {
- var index = $(this).parents(".col-sm-3").index();
- var file = this.files[0];
- var name = $(this).val();
- // console.log(name);
- // 判断文件类型
- var type = (name.substr(name.lastIndexOf("."))).toLowerCase();
- // console.log(type);
- var typeModal = '<div class="modal fade" id="typeModal" tabindex="-1" role="dialog">\
- <div class="modal-dialog modal-sm" role="document">\
- <div class="modal-content">\
- <div class="modal-body">\
- <div class="text-center">\
- <div><span class="icon icon-modal-error2"></span></div>\
- <p class="color-333 mt5">您上传的图片格式不正确,请重新上传!</p>\
- <div class="mt15">\
- <button type="button" class="ms-btn ms-btn-default w90" data-dismiss="modal">确定</button>\
- </div>\
- </div>\
- </div>\
- </div>\
- </div>\
- </div>';
- if (type != ".jpg" && type != ".gif" && type != ".jpeg" && type != ".png") {
- $("#typeModal").remove();
- $("body").append(typeModal);
- $("#typeModal").modal("show");
- return false;
- }
- ;
- if (file.size / (1024 * 1024) > 1) {
- Modal.generalModal({
- backdrop: false, // 点击阴影是否关闭弹窗, // true 开启; false 关闭
- p: '图片过大,请上传1M以内的图片', // 弹窗内容
- align: 'center', // 弹窗内容排列顺序 left center right
- successBtnText: '确定', // 确定按钮文字
- successBtnModal: true, // 点击确定按钮是否关闭弹窗 true 关闭 false 不关闭
- });
- $(this).val("");
- return false;
- }
- ;
- var reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = function () {
- $("#guideModal .modal-aside-left .bg img").eq(index).attr("src", this.result);
- };
- });
- // 引导页删除上传图片
- $(".plugin-guide .upload-img .icon-delete2").click(function () {
- var index = $(this).parents(".col-sm-3").index();
- $("#guideModal .modal-aside-left .bg img").eq(index).attr("src", "");
- });
- /*
- // 状态栏背景颜色
- $("#colorPicker22").spectrum({
- color: "#157df1",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateStateBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- // 标题栏背景颜色 字体颜色
- $("#colorPicker3").spectrum({
- color: "#157df1",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateTitleBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- $("#titFontColor").spectrum({
- color: "#fff",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateTitleFontColor(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- // 状态栏 文字颜色
- $(".plugin-modal .bg-text-color .writing li").click(function () {
- var index = $(this).index();
- $(this).addClass("active").siblings().removeClass("active");
- if (index == 0) {
- $(this).parents(".plugin-state").find(".common-top").removeClass("black").addClass("white");
- // $(this).parents("#asideModal").find(".a-left").find(".aside-nav").removeClass("black").addClass("white")
- } else {
- $(this).parents(".plugin-state").find(".common-top").removeClass("white").addClass("black");
- // $(this).parents("#asideModal").find(".a-left").find(".aside-nav").removeClass("white").addClass("black");
- }
- });
- // 标题栏 标题文字实时展现
- $(".plugin-title .input-title").bind("input propertychange", function () {
- var thisVal = $(this).val();
- $(this).parents(".plugin-title").find(".title-top").find(".text").text(thisVal);
- });
- // 标题栏 选择左功能键图标
- $(".plugin-title .function-keys.f-left li").click(function () {
- var i = $(this).index();
- var no = $(this).hasClass("rule-out");
- var checked = $(this).hasClass("active");
- var disabled = $(this).hasClass("disabled");
- if (disabled) return;
- var $parent = $(this).parents(".function-keys");
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-left span").eq(i).hide();
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- var dis1 = $(this).hasClass("disabled");
- // 不是disabled的状态,点击li,头部预览图标显示
- if (!dis1) {
- $(".plugin-title .title-top .t-left span").eq(i).show();
- }
- }
- var checkedLength = $parent.find(".active").length;
- // 超过2个
- if (checkedLength > 1) {
- $("li", $parent).not(".active").addClass("disabled");
- } else {
- $("li", $parent).not(".active").removeClass("disabled");
- }
- // 点击无
- var dis = $(this).hasClass("disabled");
- if (no && !dis) {
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $("li", $parent).removeClass("disabled");
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-left span").hide();
- }
- } else {
- }
- var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
- var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
- var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
- // 点击侧边栏出提示
- if (aside == 1 && $asideChecked && !asideDis) {
- $parent.next(".plugin-remind").show();
- } else {
- $parent.next(".plugin-remind").hide();
- }
- // 左侧是否选中了侧边栏
- if ($(".plugin-title .function-keys.f-right li[data-right-key='aside']").hasClass("active")) {
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
- }
- if ($(".plugin-title .function-keys.f-left li[data-left-key='aside']").hasClass("active")) {
- $(".plugin-title .function-keys.f-right li[data-right-key='aside']").addClass("disabled");
- } else {
- if ($(".plugin-title .function-keys.f-right li.disabled").length <= 1) {
- $(".plugin-title .function-keys.f-right li[data-right-key='aside']").removeClass("disabled");
- }
- }
- });
- // 标题栏 选择右功能键图标
- $(".plugin-title .function-keys.f-right li").click(function () {
- var i = $(this).index();
- var no = $(this).hasClass("rule-out");
- var checked = $(this).hasClass("active");
- var $parent = $(this).parents(".function-keys");
- var disabled = $(this).hasClass("disabled");
- if (disabled) return;
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-right span").eq(i).hide();
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- var dis1 = $(this).hasClass("disabled");
- if (!dis1) {
- $(".plugin-title .title-top .t-right span").eq(i).show();
- }
- }
- var checkedLength = $parent.find(".active").length;
- // 超过2个
- if (checkedLength > 1) {
- $("li", $parent).not(".active").addClass("disabled");
- } else {
- $("li", $parent).not(".active").removeClass("disabled");
- }
- // 点击无
- var dis = $(this).hasClass("disabled");
- if (no && !dis) {
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $("li", $parent).removeClass("disabled");
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-right span").hide();
- }
- } else {
- }
- var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
- var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
- var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
- // 点击侧边栏出提示
- if (aside == 1 && $asideChecked && !asideDis) {
- $parent.next(".plugin-remind").show();
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
- } else {
- $parent.next(".plugin-remind").hide();
- // 获取右侧置灰个数,超过一个不在开启
- if ($(".plugin-title .function-keys.f-left li.disabled").length <= 1) {
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").removeClass("disabled");
- }
- }
- // 左侧是否选中了侧边栏
- if ($(".plugin-title .function-keys.f-left li[data-left-key='aside']").hasClass("active")) {
- $(".plugin-title .function-keys.f-right li[data-right-key='aside']").addClass("disabled");
- }
- if ($(".plugin-title .function-keys.f-right li[data-right-key='aside']").hasClass("active")) {
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
- } else {
- if ($(".plugin-title .function-keys.f-left li.disabled").length <= 1) {
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").removeClass("disabled");
- }
- }
- });
- $(".plugin-title .function-keys").on("click", ".disabled", function () {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- })
- // 标题栏 显示 隐藏
- $("#titleShow li").click(function () {
- var i = $(this).index();
- if (i == 1) {
- $(".plugin-title .title-top .t-left span").hide();
- $(".plugin-title .title-top .t-right span").hide();
- $(".plugin-title .function-keys li").removeClass("active disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .function-keys.f-left li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- $(".plugin-title .function-keys.f-right li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- $(".plugin-title .bg-text-color").hide();
- $(".plugin-title .function-keys-wrap").hide();
- } else {
- $(".plugin-title .title-top .t-left span").eq(0).show();
- $(".plugin-title .title-top .t-right span").eq(0).show();
- $(".plugin-title .bg-text-color").show();
- $(".plugin-title .function-keys-wrap").show();
- }
- });
- // 标题栏点击保存
- $("#titleModal .plugin-save").click(function () {
- var leftKeys = []; // 标题栏左侧功能键
- var rightKeys = []; // 标题栏右侧功能键
- function getKeys(obj, data, arr) {
- $(obj).each(function () {
- var has = $(this).hasClass("active");
- var val = $(this).attr(data);
- if (has) {
- arr.push(val);
- }
- });
- }
- getKeys(".function-keys.f-left li", "data-left-key", leftKeys);
- getKeys(".function-keys.f-right li", "data-right-key", rightKeys);
- var titleBg = getFontColor("#colorPicker3"); // 背景色
- var fontColor = getFontColor("#titFontColor"); // 文字色
- var showTitle = $("#titleShow .active").attr("data-show"); // 显示Or隐藏
- var titleVal = $('#titleModal input[name=title]').val(); // 标题栏文字
- if (showTitle == 1) {
- titleBar = {show: showTitle};
- } else {
- titleBar = {
- show: showTitle,
- bgColor: titleBg,
- titleColor: fontColor,
- title: titleVal,
- leftKey: leftKeys,
- rightKey: rightKeys
- };
- }
- console.log(titleBar);
- });
- */
- // 状态标题栏 状态栏背景颜色
- $("#colorPicker2").spectrum({
- color: "#157df1", //初始化颜色
- showInput: true, //显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateStateBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- // 状态标题栏 标题栏背景颜色 字体颜色
- $("#colorPicker3").spectrum({
- color: "#157df1",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateTitleBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- $("#titFontColor").spectrum({
- color: "#fff",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateTitleFontColor(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- function updateStateBackground(color) {
- $("#titleModal .state-bgcolor").css("background-color", color);
- };
- function updateTitleBackground(color) {
- $(".plugin-title .title-top").css("background-color", color);
- };
- function updateTitleFontColor(color) {
- $(".plugin-title .title-top .text").css("color", color);
- $(".plugin-title .title-top .iconfont").css("color", color);
- }
- // 状态标题栏 状态栏显示、隐藏
- $("#titleModal .state-show-toggle li").click(function () {
- var state = $(this).data("state");
- var titleShow = $("#titleShow .active").attr("data-show");
- var $parents = $(this).parents(".config-plugin");
- if (state == 2) {
- $(".state-way ", $parents).hide();
- $(".state-way [data-state-way=1]", $parents).addClass("active").siblings().removeClass("active");
- $(".be-hidden1", $parents).show();
- $("#titleModal .state-top").removeClass("state-top-extension").hide();
- if (titleShow == 1) {
- $(".title-wrap1").show();
- $(".title-wrap1 .title-way").hide();
- $("#titleModal .state-bg-extension").hide();
- $("#titleModal .title-top").hide();
- } else {
- $(".title-wrap1").show();
- $(".title-wrap1 .title-way").show();
- $("#titleModal .state-bg-extension").hide();
- $("#titleModal .title-top").show();
- }
- } else {
- $(".state-way", $parents).show();
- $(".be-hidden1", $parents).hide();
- $("#titleModal .state-top").show();
- $("#titleModal .state-bg-color1").show();
- }
- });
- // 状态栏标题栏 选择背景图延伸
- $("#titleModal .state-way-ul li").click(function () {
- var state = $(this).attr("data-state-way");
- var $parents = $(this).parents("#titleModal");
- if (state == 2) {
- $(".state-bg-color1", $parents).hide();
- $(".title-wrap1", $parents).hide();
- $(".state-bg-extension", $parents).show();
- $(".state-top", $parents).addClass("state-top-extension");
- $(".title-top", $parents).hide();
- } else {
- $(".state-bg-color1", $parents).show();
- $(".title-wrap1", $parents).show();
- $(".state-bg-extension", $parents).hide();
- $(".state-top", $parents).removeClass("state-top-extension");
- $(".title-top", $parents).show();
- }
- });
- // 状态标题栏 状态栏 字体颜色设置黑白
- $("#titleModal .bg-text-color1 .writing li").click(function () {
- var state = $(this).attr("data-state-font-color");
- var $parents = $(this).parents("#titleModal");
- $(this).addClass("active").siblings().removeClass("active");
- if (state == 1) {
- $(".state-top", $parents).removeClass("black").addClass("white");
- } else {
- $(".state-top", $parents).removeClass("white").addClass("black");
- }
- });
- // 状态标题栏 标题栏显示、隐藏
- $("#titleShow li").click(function () {
- var i = $(this).data("show");
- if (i == 1) {
- $("#titleModal .title-way").hide();
- $("#titleModal .title-top").hide();
- $("#titleModal .be-hidden2").show();
- // $(".plugin-title .title-top .t-left span").hide();
- // $(".plugin-title .title-top .t-right span").hide();
- // $(".plugin-title .function-keys li").removeClass("active disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- // $(".plugin-title .function-keys.f-left li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- // $(".plugin-title .function-keys.f-right li:eq(0)").addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- // $(".plugin-title .bg-text-color").hide();
- // $(".plugin-title .function-keys-wrap").hide();
- } else {
- $("#titleModal .title-way").show();
- $("#titleModal .title-top").show();
- $("#titleModal .be-hidden2").hide();
- // $(".plugin-title .title-top .t-left span").eq(0).show();
- // $(".plugin-title .title-top .t-right span").eq(0).show();
- // $(".plugin-title .bg-text-color").show();
- // $(".plugin-title .function-keys-wrap").show();
- }
- });
- // 状态标题栏 标题栏 标题文字实时展现
- $(".plugin-title .input-title").bind("input propertychange", function () {
- var thisVal = $(this).val();
- $(this).parents(".plugin-title").find(".title-top").find(".text").text(thisVal);
- });
- // 状态标题栏 标题栏 选择左功能键图标
- $(".plugin-title .function-keys.f-left li").click(function () {
- var i = $(this).index();
- var no = $(this).hasClass("rule-out");
- var checked = $(this).hasClass("active");
- var $parent = $(this).parents(".function-keys");
- var disabled = $(this).hasClass("disabled");
- if (disabled) return;
- var $right = $(".plugin-title .function-keys.f-right");
- var $leftAside = $(".plugin-title .function-keys.f-left li[data-left-key='aside']");
- var $rightAside = $(".plugin-title .function-keys.f-right li[data-right-key='aside']");
- var $leftShare = $(".plugin-title .function-keys.f-left li[data-left-key='share']");
- var $rightShare = $(".plugin-title .function-keys.f-right li[data-right-key='share']");
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-left span").eq(i).hide();
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- var dis1 = $(this).hasClass("disabled");
- // 不是disabled的状态,点击li,头部预览图标显示
- if (!dis1) {
- $(".plugin-title .title-top .t-left span").eq(i).show();
- }
- }
- // 点击左侧侧边栏,右侧侧边栏增加disabled
- if ($leftAside.hasClass("active")) {
- $rightAside.addClass("disabled disabled1");
- } else {
- $rightAside.removeClass("disabled disabled1");
- }
- // 点击左侧分享,右侧分享增加disabled
- if ($leftShare.hasClass("active")) {
- $rightShare.addClass("disabled disabled1");
- } else {
- $rightShare.removeClass("disabled disabled1");
- }
- var checkedLength = $parent.find(".active").length;
- // console.log("left:" + checkedLength);
- // 超过2个
- if (checkedLength > 1) {
- $("li", $parent).not(".active").addClass("disabled");
- } else {
- $("li", $parent).not(".active,.disabled1").removeClass("disabled");
- }
- // console.log($right.find(".active").length);
- if ($right.find(".active").length == 2) {
- if ($rightAside.hasClass("active")) {
- $rightAside.removeClass("disabled");
- } else {
- $rightAside.addClass("disabled");
- }
- if ($rightShare.hasClass("active")) {
- $rightShare.removeClass("disabled");
- } else {
- $rightShare.addClass("disabled");
- }
- }
- /*
- // 点击无
- var dis = $(this).hasClass("disabled");
- if (no && !dis) {
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $("li", $parent).not(".disabled1").removeClass("disabled");
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-left span").hide();
- }
- }
- */
- var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
- var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
- var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
- // 点击侧边栏出提示
- if (aside == 1 && $asideChecked && !asideDis) {
- $parent.next(".plugin-remind").show();
- } else {
- $parent.next(".plugin-remind").hide();
- }
- var share = $("li[data-share=1]", $parent).attr("data-share");
- var $shareChecked = $("li[data-share=1]", $parent).hasClass("active");
- var shareDis = $("li[data-share=1]", $parent).hasClass("disabled");
- // 点击分享出提示
- if (share == 1 && $shareChecked && !shareDis) {
- $parent.next(".plugin-remind").next(".plugin-remind1").show();
- } else {
- $parent.next(".plugin-remind").next(".plugin-remind1").hide();
- }
- });
- // 状态标题栏 标题栏 选择右功能键图标
- $(".plugin-title .function-keys.f-right li").click(function () {
- var i = $(this).index();
- var no = $(this).hasClass("rule-out");
- var checked = $(this).hasClass("active");
- var $parent = $(this).parents(".function-keys");
- var disabled = $(this).hasClass("disabled");
- var $left = $(".plugin-title .function-keys.f-left");
- var $leftAside = $(".plugin-title .function-keys.f-left li[data-left-key='aside']");
- var $rightAside = $(".plugin-title .function-keys.f-right li[data-right-key='aside']");
- var $leftShare = $(".plugin-title .function-keys.f-left li[data-left-key='share']");
- var $rightShare = $(".plugin-title .function-keys.f-right li[data-right-key='share']");
- if (disabled) return;
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-right span").eq(i).hide();
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1");
- var dis1 = $(this).hasClass("disabled");
- if (!dis1) {
- $(".plugin-title .title-top .t-right span").eq(i).show();
- }
- }
- // 点击右侧侧边栏,给左侧侧边栏增加disabled
- if ($rightAside.hasClass("active")) {
- $leftAside.addClass("disabled disabled1");
- } else {
- $leftAside.removeClass("disabled disabled1");
- }
- // 点击右侧分享,给左侧分享增加disabled
- if ($rightShare.hasClass("active")) {
- $leftShare.addClass("disabled disabled1");
- } else {
- $leftShare.removeClass("disabled disabled1");
- }
- var checkedLength = $parent.find(".active").length;
- // console.log("right:" + checkedLength);
- // 超过2个
- if (checkedLength > 1) {
- $("li", $parent).not(".active").addClass("disabled");
- } else {
- $("li", $parent).not(".active,.disabled1").removeClass("disabled");
- // console.log("left:" + $left.find(".active").length);
- }
- // console.log($left.find(".active").length);
- if ($left.find(".active").length == 2) {
- if ($leftAside.hasClass("active")) {
- $leftAside.removeClass("disabled");
- } else {
- $leftAside.addClass("disabled");
- }
- if ($leftShare.hasClass("active")) {
- $leftShare.removeClass("disabled");
- } else {
- $leftShare.addClass("disabled");
- }
- }
- /*
- // 点击无
- var dis = $(this).hasClass("disabled");
- if (no && !dis) {
- if (checked) {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- $("li", $parent).not(".disabled1").removeClass("disabled");
- } else {
- $(this).addClass("active").find(".iconfont").addClass("icon-checkbox-checked1").parents(".active").siblings().removeClass("active").addClass("disabled").find(".iconfont").removeClass("icon-checkbox-checked1");
- $(".plugin-title .title-top .t-right span").hide();
- }
- } else {
- }
- */
- var aside = $("li[data-sideBar=1]", $parent).attr("data-sideBar");
- var $asideChecked = $("li[data-sideBar=1]", $parent).hasClass("active");
- var asideDis = $("li[data-sideBar=1]", $parent).hasClass("disabled");
- // 点击侧边栏出提示
- if (aside == 1 && $asideChecked && !asideDis) {
- $parent.next(".plugin-remind").show();
- $(".plugin-title .function-keys.f-left li[data-left-key='aside']").addClass("disabled");
- } else {
- $parent.next(".plugin-remind").hide();
- }
- var share = $("li[data-share=1]", $parent).attr("data-share");
- var $shareChecked = $("li[data-share=1]", $parent).hasClass("active");
- var shareDis = $("li[data-share=1]", $parent).hasClass("disabled");
- // 点击分享出提示
- if (share == 1 && $shareChecked && !shareDis) {
- $parent.next(".plugin-remind").next(".plugin-remind1").show();
- } else {
- $parent.next(".plugin-remind").next(".plugin-remind1").hide();
- }
- });
- /*
- $(".plugin-title .function-keys").on("click", ".disabled", function () {
- $(this).removeClass("active").find(".iconfont").removeClass("icon-checkbox-checked1");
- });
- */
- // 状态标题栏点击保存取值
- $("#titleModal .plugin-save").click(function () {
- stateBar = {}; // 清空状态栏
- titleBar = {}; // 清空标题栏
- // 状态标题栏 状态栏取值
- // 状态栏显示、隐藏
- var showState = $("#titleModal .state-show-toggle .active").attr("data-state"); // 1 显示 2 隐藏
- // 状态栏显示方式
- var stateWay = $("#titleModal .state-way-ul .active").attr("data-state-way"); // 1 自定义 2 背景图延伸
- // 状态栏背景颜色
- var stateBgColor = getFontColor("#colorPicker2");
- // 状态栏背景透明度
- var stateBgColorAlpha = getAlpha("#colorPicker2");
- // 状态栏文字颜色
- var stateFontColor = $("#titleModal .writing .active").attr("data-state-font-color"); // 1 白色 2 黑色
- // 状态标题栏 标题栏取值
- // 标题栏 显示、隐藏
- var showTitle = $("#titleShow .active").attr("data-show"); // // 0 显示 1 隐藏
- // 标题栏 输入文字
- var titleVal = $('#titleModal input[name=title]').val();
- // 标题栏 背景颜色
- var titleBg = getFontColor("#colorPicker3");
- // 标题栏 背景颜色透明度
- var titleBgAlpha = getAlpha("#colorPicker3");
- // 标题栏 字体颜色
- var titleFontColor = getFontColor("#titFontColor");
- // 标题栏 字体透明度
- var titleFontColorAlpha = getAlpha("#titFontColor");
- // 左侧功能键 取值
- var leftKeys = [];
- // 右侧功能键 取值
- var rightKeys = [];
- function getKeys(obj, data, arr) {
- $(obj).each(function () {
- var has = $(this).hasClass("active");
- var val = $(this).attr(data);
- if (has) {
- arr.push(val);
- }
- });
- }
- getKeys(".function-keys.f-left li", "data-left-key", leftKeys);
- getKeys(".function-keys.f-right li", "data-right-key", rightKeys);
- if (showState != 2 && stateWay == 2) showTitle = 1; // 显示状态栏且延伸则标题栏不显示
- titleBar.show = showTitle;
- if (showTitle != 1) {
- titleBar.title = titleVal;
- titleBar.bgColor = titleBg;
- titleBar.bgAlpha = titleBgAlpha;
- titleBar.titleColor = titleFontColor;
- titleBar.titleAlpha = titleFontColorAlpha;
- titleBar.leftKey = leftKeys;
- titleBar.rightKey = rightKeys;
- }
- stateBar.state = showState;
- if (showState != 2) {
- stateBar.way = stateWay;
- if (stateWay == 2) { // 延伸
- stateBar.fontColor = stateFontColor;
- } else { // 自定义颜色
- stateBar.bgColor = stateBgColor;
- stateBar.bgAlpha = stateBgColorAlpha;
- stateBar.fontColor = stateFontColor;
- }
- }
- });
- // 导航栏背景颜色 字体图标颜色
- $("#colorPicker4").spectrum({
- color: "#157df1",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateNavBackground(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- $("#navFontColor1").spectrum({
- color: "#ddd",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateNavFontColor1(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- $("#navFontColor2").spectrum({
- color: "#fff",//初始化颜色
- showInput: true,//显示输入
- showAlpha: true, // 透明度
- containerClassName: "full-spectrum",
- showInitial: true,//显示初始颜色,提供现在选择的颜色和初始颜色对比
- showPalette: true,//显示选择器面板
- showSelectionPalette: true,//记住选择过的颜色
- maxPaletteSize: 7,//记住选择过的颜色的最大数量
- preferredFormat: "hex",//输入框颜色格式,(hex十六进制,hex3十六进制可以的话只显示3位,hsl,rgb三原色,name英文名显示)
- hideAfterPaletteSelect: true,// 点击左侧选择颜色,面板关闭
- chooseText: "确定",
- cancelText: "取消",
- move: function (color) {//选择器右边面板移动时触发
- },
- show: function () {//选择器面板显示时触发
- },
- beforeShow: function () {//选择器面板显示之前触发,返回false时不显示
- },
- hide: function (color) {//选择器面板隐藏时触发
- updateNavFontColor2(color);
- },
- //选择器面板颜色设置
- palette: palette
- });
- function updateNavBackground(color) {
- $(".plugin-nav .state-bgcolor").css("background-color", color);
- }
- function updateNavFontColor1(color) {
- $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".n-icon").css("color", color);
- $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".icon-null").css("border-color", color);
- $(".plugin-nav .nav-top ul li").not(":eq(0)").find(".n-text").css("color", color);
- }
- function updateNavFontColor2(color) {
- $(".plugin-nav .nav-top ul li").eq(0).find(".n-icon").css("color", color);
- $(".plugin-nav .nav-top ul li").eq(0).find(".icon-null").css("border-color", color);
- $(".plugin-nav .nav-top ul li").eq(0).find(".n-text").css("color", color);
- }
- // console.log(getFontColor("#navFontColor1"));
- // 导航栏 下拉框change字体颜色设置、显示链接输入框
- $(".plugin-nav .n-list select").change(function () {
- $(this).css("color", "#333");
- var selectedVal = $(this).find(":selected").val();
- // console.log(selectedVal);
- if (selectedVal == 'link_app' || selectedVal == 'link_url') {
- $(this).parents("dd").find(".n-link").css("visibility", "visible").addClass("link-show");
- } else {
- $(this).parents("dd").find(".n-link").css("visibility", "hidden").removeClass("link-show");
- }
- });
- // 导航栏 图标、文字3种不同 显示方式
- $(".plugin-nav .set-nav .set-bottom ul li").click(function () {
- var i = $(this).index();
- $(".plugin-nav .set-nav .set-bottom ul li").removeClass("active").find(".icon-radio").removeClass("icon-radio-checked");
- $(this).addClass("active").find(".icon-radio").addClass("icon-radio-checked");
- if (i == 0) {
- $(".plugin-nav .n-list .n-text").show();
- $(".plugin-nav .n-list .add-icon").show();
- $(".plugin-nav .nav-top .n-icon").show();
- $(".plugin-nav .nav-top .n-text").show();
- $(".plugin-nav .n-nav .nav-name").show();
- $(".plugin-nav .n-nav .nav-icon").show();
- } else if (i == 1) {
- $(".plugin-nav .n-list .n-text").hide();
- $(".plugin-nav .n-list .add-icon").show();
- $(".plugin-nav .nav-top .n-text").hide();
- $(".plugin-nav .nav-top .n-icon").show();
- $(".plugin-nav .n-nav .nav-name").hide();
- $(".plugin-nav .n-nav .nav-icon").show();
- } else {
- $(".plugin-nav .n-list .n-text").show();
- $(".plugin-nav .n-list .add-icon").hide();
- $(".plugin-nav .nav-top .n-text").show();
- $(".plugin-nav .nav-top .n-icon").hide();
- $(".plugin-nav .n-nav .nav-name").show();
- $(".plugin-nav .n-nav .nav-icon").hide();
- }
- });
- // 导航栏点击图标
- var clickIconIndex = -1;
- $(".plugin-nav .n-list .add-icon").click(function () {
- clickIconIndex = $(this).parents("dd").index();
- $("#iconsModal").modal("show");
- });
- // 导航栏 设置图标
- $(".plugin-modal .icons li").click(function () {
- var i = $(this).index();
- // console.log(i);
- $("#iconsModal").modal("hide");
- $('#navModal').css({'overflow-y': 'scroll'});
- $("body").css("overflow", "hidden");
- $(".plugin-nav .nav-top ul li").eq(clickIconIndex).find(".n-icon").attr("class", "n-icon iconfont icon-" + i + "");
- $(".plugin-nav .n-list dd").eq(clickIconIndex).find(".add-icon").find(".iconfont").attr({
- "class": "iconfont icon-" + i,
- "data-index": i
- }).css("color", "#333");
- });
- /*
- $('#iconsModal').on('hidden.bs.modal', function() {
- $('#navModal').css({'overflow-y':'scroll'});
- });
- */
- // 导航栏 增加配置导航 默认显示2个
- $(".plugin-nav .n-list .add-config").click(function () {
- $dd = $(".plugin-nav .n-list dd");
- var showLength = $(".plugin-nav .n-list dd.active").length;
- $(".plugin-nav .nav-top ul li").eq(showLength).css("display", "table-cell");
- $(".plugin-nav .n-list dd:not(.active)").eq(0).addClass('active');
- if (showLength >= 4) {
- $(this).addClass("disabled");
- } else {
- $(this).removeClass("disabled");
- }
- });
- // 导航栏 实时文字
- $(".plugin-nav .n-list .n-text").bind("input propertychange", function () {
- var i = $(this).parents("dd").index();
- // console.log(i);
- var thisVal = $(this).val();
- if (thisVal.length == 0) {
- $(".plugin-nav .nav-top ul li").eq(i).find(".n-text").text('空白');
- } else {
- $(".plugin-nav .nav-top ul li").eq(i).find(".n-text").text(thisVal);
- }
- });
- // 导航栏 恢复默认
- $(".plugin-nav .set-nav .reset").click(function () {
- // $("#colorPicker4").spectrum("set", "rgb(249, 249, 249)");
- // 去除错误状态
- $(".plugin-nav .n-list").find(".error").remove();
- // 恢复文字
- $(".plugin-nav .nav-top ul li .n-text").text('空白');
- // 恢复 配置导航显示2个
- $(".plugin-nav .set-nav .n-list dd").addClass('active');
- $(".plugin-nav .set-nav .n-list dd:nth-of-type(n+3)").removeClass('active');
- // 预览导航 恢复到2个
- $(".plugin-nav .nav-top ul li:nth-of-type(n+3)").hide();
- // 导航名称默认恢复为空
- $(".plugin-nav .n-list .n-text").val('');
- // 恢复图标
- $(".plugin-nav .nav-top .n-icon").attr("class", "n-icon icon-null").css("display", "inline-block");
- $(".plugin-nav .n-list .add-icon .iconfont").attr({
- "class": "iconfont icon-jia",
- "data-index": ""
- }).css("color", "#eee");
- // select恢复到默认
- $(".plugin-nav .n-list select").each(function () {
- $(this).css("color", "#999");
- $(this).find("option").eq(0).attr("selected", "selected");
- });
- // 链接输入框恢复到默认
- $(".plugin-nav .n-list .n-link").css("visibility", "hidden").val("").removeClass("link-show");
- // 新增导航按钮去除disabled
- $(".plugin-nav .n-list .add-config").removeClass("disabled");
- });
- // 导航栏 删除
- $(".plugin-nav .n-list .n-delete").click(function () {
- var $This = $(this).parents("dd");
- var i = $This.index();
- $This.hide();
- $This.find(".n-link").removeClass("link-show").show();
- $This.find("select").eq(0).attr("selected", "selected");
- $(".plugin-nav .nav-top ul li").eq(i).hide();
- var showLength = $(".plugin-nav .n-list dd.active").length;
- if (showLength < 5) {
- $(".plugin-nav .n-list .add-config").removeClass("disabled");
- } else {
- $(".plugin-nav .n-list .add-config").addClass("disabled");
- }
- });
- // 导航栏 保存
- $("#navModal .plugin-save").click(function () {
- var $dd = $(".plugin-nav .n-list dd.active");
- var navBgColor = getFontColor("#colorPicker4");
- var navBgColorAlpha = getAlpha("#colorPicker4");
- var navDefaultFontColor = getFontColor("#navFontColor1");
- var navDefaultFontColorAlpha = getAlpha("#navFontColor1");
- var navCheckedFontColor = getFontColor("#navFontColor2");
- var navCheckedFontColorAlpha = getAlpha("#navFontColor2");
- var iconNameShow = $("#iconNameShow .active").attr("data-show");
- var error = false;
- var nameErrorText = "请输入导航名称,四个字以内";
- var selectErrorText = "请选择导航功能";
- var iconErrorText = "请选择图标";
- var linkErrorText = "请输入http://或https://的链接地址";
- var match = /^((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*\/)*[\w\-]+(\.[\w\-]+)*\/?(\?([\w\-\.,@?^=%&:\/~\+#]*)+)?/;
- var menu = [];
- $dd.find('.error').remove();
- $dd.each(function () {
- var This1 = $(this);
- var text = $.trim(This1.find(".n-text").val());
- var action = This1.find(":selected").val();
- var icon = This1.find(".iconfont").attr("data-index");
- var url = This1.find(".link-show").val();
- var textLength = getByteLen(text);
- var noIcon = This1.find(".add-icon").find(".iconfont").hasClass("icon-jia");
- var hasUrl = This1.find(".n-link").hasClass("link-show");
- // 导航功能
- if (action == 0) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + selectErrorText + '</div>');
- error = true;
- return false;
- }
- // 名称
- if (iconNameShow != 1 && (textLength < 1 || textLength > 8)) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + nameErrorText + '</div>');
- error = true;
- return false;
- }
- // 图标
- if (iconNameShow != 2 && noIcon) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + iconErrorText + '</div>');
- error = true;
- return false;
- }
- // 链接
- if (hasUrl && !match.test(url)) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + linkErrorText + '</div>');
- error = true;
- return false;
- }
- menu.push({text, action, icon, url});
- });
- if (!error && menu.length > 0) {
- navData = {
- menuBackgroundColor: navBgColor,
- menuBackgroundColorAlpha: navBgColorAlpha,
- menuTextColor: navDefaultFontColor,
- menuTextColorAlpha: navDefaultFontColorAlpha,
- menuPressedTextColor: navCheckedFontColor,
- menuPressedTextColorAlpha: navCheckedFontColorAlpha,
- show: iconNameShow, menu
- };
- console.log(navData);
- $("#navModal").modal("hide");
- $("#config8").parent().addClass("active");
- $("#config8").find(".iconfont").addClass("icon-checkbox-checked1");
- }
- });
- // 左侧栏 取值
- $("#asideModal .plugin-save").click(function () {
- var $dd = $(".plugin-aside .n-list dd.active");
- // 背景色
- var asideBgColor = getFontColor("#colorPicker5");
- // 背景色透明度
- var asideBgColorAlpha = getAlpha("#colorPicker5");
- // 文字和图标颜色
- var asideFontColor = getFontColor("#asideFontColor");
- // 文字和图标颜色透明度
- var asideFontColorAlpha = getAlpha("#asideFontColor");
- // 显示方式
- // var asideDisplay = $(".plugin-aside .set-nav .set-bottom ul .active").attr("data-display");
- // 显示APP
- var asideShowApp = $(".plugin-aside .top-show ul li.active").attr("data-app-show");
- var nameErrorText = "请输入导航名称,十个字以内";
- var selectErrorText = "请选择导航功能";
- var iconErrorText = "请选择图标";
- var linkErrorText = "请输入http://或https://的链接地址";
- var match = /^((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*\/)*[\w\-]+(\.[\w\-]+)*\/?(\?([\w\-\.,@?^=%&:\/~\+#]*)+)?/;
- var error = false;
- var menu = [];
- $dd.find('.error').remove();
- $dd.each(function () {
- var This1 = $(this);
- var text = $.trim(This1.find(".n-text").val());
- var action = This1.find(":selected").val();
- var icon = This1.find(".iconfont").attr("data-index");
- var url = This1.find(".link-show").val();
- var textLength = getByteLen(text);
- var noIcon = This1.find(".add-icon").find(".iconfont").hasClass("icon-jia");
- var hasUrl = This1.find(".n-link").hasClass("link-show");
- This1.removeClass("form-error");
- This1.find(".error").remove();
- // 导航功能
- if (action == 0) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + selectErrorText + '</div>');
- error = true;
- return false;
- }
- // 名称
- if (textLength < 1 || textLength > 19) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + nameErrorText + '</div>');
- error = true;
- return false;
- }
- // 图标
- if (noIcon) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + iconErrorText + '</div>');
- error = true;
- return false;
- }
- // 链接
- if (hasUrl && !match.test(url)) {
- This1.addClass("form-error");
- This1.append('<div class="error">' + linkErrorText + '</div>');
- error = true;
- return false;
- }
- menu.push({text, action, icon, url});
- });
- if (!error && menu.length > 0) {
- asideData = {asideBgColor, asideBgColorAlpha, asideFontColor, asideFontColorAlpha, asideShowApp, menu};
- console.log(asideData);
- $("#asideModal").modal("hide");
- $("#configAside").parent().addClass("active");
- $("#configAside").find(".iconfont").addClass("icon-checkbox-checked1");
- }
- });
- // 长按图片保存点击保存
- $("#photoSaveModal .plugin-save").click(function () {
- supportLongPressSavePicture = $("#photoSaveModal").find("ul>li.active").data('photo-save');
- console.log(supportLongPressSavePicture);
- });
- // 支持二维码扫码点击保存
- $("#identifyCodeModal .plugin-save").click(function () {
- supportQrcodeScan = $("#identifyCodeModal").find("ul>li.active").data('identify-code');
- console.log(supportQrcodeScan);
- });
- // 支持侧滑返回
- $("#skidBackModal .plugin-save").click(function () {
- skidBack = $("#skidBackModal").find("ul>li.active").data('skid-back');
- console.log(skidBack);
- });
- // 支持无网提示
- $("#noNetModal .plugin-save").click(function () {
- noNet = $("#noNetModal").find("ul>li.active").data('no-net');
- console.log(noNet);
- });
- // 支持APK安装器
- $("#installTipModal .plugin-save").click(function () {
- installTip = $("#installTipModal").find("ul>li.active").data('install-tip');
- console.log(installTip);
- });
- // 支持屏幕常亮
- $("#keepScreenModal .plugin-save").click(function () {
- keepScreen = $("#keepScreenModal").find("ul>li.active").data('keep-screen');
- console.log(keepScreen);
- });
- // 支持隐藏虚拟按键
- $("#hideBottomModal .plugin-save").click(function () {
- hideBottom = $("#hideBottomModal").find("ul>li.active").data('hide-bottom');
- console.log(hideBottom);
- });
- // 网页缩放
- // 开启 关闭
- $(".plugin-web-zoom .fun li").click(function () {
- var attr = $(this).attr("data-web-zoom");
- if (attr == -1) {
- $(this).parents(".plugin-web-zoom").find(".zoom-in").hide();
- } else {
- $(this).parents(".plugin-web-zoom").find(".zoom-in").show();
- }
- });
- // 支持网页缩放
- $("#webZoomModal .plugin-save").click(function () {
- supportZoom = $("#webZoomModal").find("ul>li.active").data('web-zoom');
- console.log(supportZoom);
- });
- // 引导页保存
- $("#guideModal .plugin-save").click(function () {
- // 是否显示“立即体验”,以及按钮颜色
- supportGuideEnterMainPageButton = $('#guideModal .experience').find("li.active").data('type');
- guideEnterMainPageButtonColor = getFontColor("#experienceTextColor");
- guide = {};
- $('#guideModal').find(".plugin-guide img").each(function (index, element) {
- guide[index] = $(element).attr('src');
- });
- });
- // UA设置
- $("#uaModal .plugin-save").click(function () {
- userAgent = {};
- userAgent.appendUa = $.trim($('#uaModal').find("input[name='appendUa']").val());
- userAgent.completeUa = $.trim($('#uaModal').find("input[name='completeUa']").val());
- if (!userAgent.appendUa && !userAgent.completeUa) {
- $('#uaModal').find("input[name='completeUa']").parents(".form-group").addClass("form-error");
- } else {
- $('#uaModal').find("input[name='completeUa']").parents(".form-group").removeClass("form-error");
- }
- var errorLength = $(".plugin-ua .form-error").length;
- if (errorLength > 0) {
- $("#uaModal").modal("show");
- $("[data-target=#uaModal]").removeClass("active").find(".icon-checkbox1").removeClass("icon-checkbox-checked1 add-checked");
- } else {
- $("#uaModal").modal("hide");
- $("[data-target=#uaModal]").addClass("active").find(".icon-checkbox1").addClass("icon-checkbox-checked1 add-checked");
- }
- });
- $(".toStore").on('click', function () {
- $('#msModal8').modal('show');
- appName = $("input[name=app]").val();
- url = $("input[name=url]").val();
- device = $("#device").find(".active").attr("data-device");
- screen = $("#screen").find(".active").attr("data-screen");
- version = $("input[name=version]").val();
- bundle = $("input[name=bundle]").val();
- appIcon = $(".pack-step2 #appIcon").find("img").attr('src');// ICON图标
- startPage = $("input[name='startPage']").parent().find("img").attr("src"); // 启动图
- splashShowTime = $(".pack-step2 .start-time ").find("ul>li.active").data("start-time"); // 启动图显示时长
- isSupportShowSplashSkipButton = $(".pack-step2 .show-skip").find("ul>li.active").data("show"); // 是否显示跳过按钮
- // 获取插件
- plugin = {};
- var hasChecked1 = $("#config1").find(".iconfont").hasClass("icon-checkbox-checked1"); // 加载动画
- var hasChecked2 = $("#config2").find(".iconfont").hasClass("icon-checkbox-checked1"); // 清理缓存
- var hasChecked3 = $("#config3").find(".iconfont").hasClass("icon-checkbox-checked1"); // 浏览器
- var hasChecked4 = $("#config4").find(".iconfont").hasClass("icon-checkbox-checked1"); // 退出提示
- var hasChecked5 = $("#config5").find(".iconfont").hasClass("icon-checkbox-checked1"); // 第三方分享
- var hasChecked6 = $("#config6").find(".iconfont").hasClass("icon-checkbox-checked1"); // 极光推送
- var hasChecked7 = $("#config7").find(".iconfont").hasClass("icon-checkbox-checked1"); // 友盟统计
- var hasChecked8 = $("#config8").find(".iconfont").hasClass("icon-checkbox-checked1"); // 导航栏
- var hasChecked9 = $("#config9").find(".iconfont").hasClass("icon-checkbox-checked1"); // 状态栏
- var hasChecked10 = $("#config10").find(".iconfont").hasClass("icon-checkbox-checked1"); // 标题栏
- var hasChecked11 = $("#config11").find(".iconfont").hasClass("icon-checkbox-checked1"); // 引导页
- var configAsideChecked = $("#configAside").find(".iconfont").hasClass("icon-checkbox-checked1"); // 左侧栏
- var longPressSavePictureChecked = $("#configPhotoSave").find(".iconfont").hasClass("icon-checkbox-checked1"); // 长按图片保存
- var qrcodeScanChecked = $("#configIdentifyCode").find(".iconfont").hasClass("icon-checkbox-checked1"); // 扫一扫
- var webZoomChecked = $("#configWebZoom").find(".iconfont").hasClass("icon-checkbox-checked1"); // 网页缩放
- var userAgentChecked = $("#userAgent").find(".iconfont").hasClass("icon-checkbox-checked1");
- var isSkidBack = $("#configSkidBack").find(".iconfont").hasClass("icon-checkbox-checked1"); // 侧滑返回
- var isNoNet = $("#configNoNet").find(".iconfont").hasClass("icon-checkbox-checked1"); // 无网提示
- var isInstallTip = $("#configInstallTip").find(".iconfont").hasClass("icon-checkbox-checked1"); // APK安装器
- var isKeepScreen = $("#configKeepScreen").find(".iconfont").hasClass("icon-checkbox-checked1"); // 屏幕常亮
- var isHideBottom = $("#configHideBottom").find(".iconfont").hasClass("icon-checkbox-checked1"); // 屏幕常亮
- var hasKeystore = $('#configKeystore').find(".iconfont").hasClass("icon-checkbox-checked1"); // 安卓证书
- plugin.supportLongPressSavePicture = 0;
- plugin.supportQrcodeScan = 0;
- plugin.supportZoom = 0;
- plugin.userAgent = {};
- plugin.skidBack = 0;
- plugin.noNet = 0;
- plugin.installTip = 0;
- plugin.keepScreen = 0;
- plugin.hideBottom = 0;
- if (longPressSavePictureChecked) plugin.supportLongPressSavePicture = supportLongPressSavePicture;
- if (qrcodeScanChecked) plugin.supportQrcodeScan = supportQrcodeScan;
- if (webZoomChecked) plugin.supportZoom = supportZoom;
- if (userAgentChecked) plugin.userAgent = userAgent;
- if (isSkidBack) plugin.skidBack = skidBack;
- if (isNoNet) plugin.noNet = noNet;
- if (isInstallTip) plugin.installTip = installTip;
- if (isKeepScreen) plugin.keepScreen = keepScreen;
- if (isHideBottom) plugin.hideBottom = hideBottom;
- // 下拉刷新
- var hasCheckedRefresh = $("#configRefresh").find(".iconfont").hasClass("icon-checkbox-checked1");
- if (hasCheckedRefresh) {
- refreshVal = $("#refreshModal").find(".plugin-refresh").find(".active").attr("data-refresh");
- plugin.refresh = refreshVal;
- } else {
- plugin.refresh = 0;
- }
- // URL 拉起APP
- var hasCheckedUrlApp = $("#configUrlApp").find(".iconfont").hasClass("icon-checkbox-checked1");
- plugin.urlApp = 0;
- if (hasCheckedUrlApp) {
- urlAppVal = $("#urlAppModal").find(".plugin-url-app").find(".active").attr("data-url-app");
- plugin.urlApp = urlAppVal;
- }
- // 加载配置
- if (hasChecked1) {
- way = $("#loadingModal").find(".plugin-loading").find(".active").attr("data-way");
- color = $("#loadingModal").find(".plugin-loading").find(".sp-preview-inner").css("background-color");
- color = colorRGB2Hex(color);
- plugin.loading = {way: way, color: color};
- } else {
- plugin.loading = {};
- }
- // 清理缓存
- if (hasChecked2) {
- plugin.cache = $("#cacheModal").find(".plugin-cache").find(".active").attr("data-cache");
- } else {
- plugin.cache = 0;
- }
- // 浏览器内核
- if (hasChecked3) {
- android = $("#browserModal").find("#androidKernel").find(".active").attr("data-android-kernel");
- ios = $("#browserModal").find("#iosKernel").find(".active").attr("data-ios-kernel");
- plugin.browser = {android: android, ios: ios}
- } else {
- plugin.browser = {};
- }
- // 退出提示
- if (hasChecked4) {
- exit = $("#exitModal").find(".plugin-exit").find(".active").attr("data-exit");
- plugin.exit = exit;
- } else {
- plugin.exit = 0;
- }
- // 第三方分享
- if (hasChecked5) {
- plugin.share = share;
- }
- // 极光推送
- plugin.jPushId = '';
- if (hasChecked6) {
- jPushId = $.trim($('#auroraModal input[name="jPushId"]').val());
- if (jPushId) plugin.jPushId = jPushId;
- }
- // 友盟统计
- plugin.umengKey = '';
- if (hasChecked7) {
- umengIosKey = $.trim($('#alliesModal input[name="umeng_ios_key"]').val());
- umengAndroidKey = $.trim($('#alliesModal input[name="umeng_android_key"]').val());
- plugin.umengKey = {
- ios: umengIosKey,
- android: umengAndroidKey
- };
- }
- // 导航栏
- plugin.nav = '';
- if (hasChecked8 && navData) plugin.nav = navData;
- // 状态标题栏
- plugin.titleBar = '';
- plugin.stateBar = '';
- if (hasChecked10) {
- plugin.titleBar = titleBar;
- plugin.stateBar = stateBar;
- }
- // 侧边栏
- plugin.asideData = '';
- if (configAsideChecked && asideData) plugin.asideData = asideData;
- console.info(plugin);
- // 引导页
- plugin.guide = {};
- if (hasChecked11) {
- plugin.guide = guide;
- plugin.support_guide_enter_main_page_button = supportGuideEnterMainPageButton;
- plugin.guide_enter_main_page_button_color = guideEnterMainPageButtonColor;
- }
- if (hasKeystore) {
- delete androidKey.save;
- plugin.androidKey = androidKey;
- }
- // 是否点击跳过
- //var isSkip = $(this).hasClass('skip');
- formData = new FormData();
- formData.append('id', id);
- formData.append('appName', appName);
- formData.append('url', url);
- formData.append('device', device);
- formData.append('appVersion', version);
- formData.append('bundleId', bundle);
- formData.append('splashMode', screen);
- formData.append('icon', appIcon);
- formData.append('splash', startPage);
- formData.append('isSupportShowSplashSkipButton', isSupportShowSplashSkipButton);
- formData.append('splashShowTime', splashShowTime);
- formData.append('plugin', JSON.stringify(plugin));
- $.ajax({
- url: '/pack/store',
- type: 'POST',
- cache: false,
- data: formData,
- processData: false,
- contentType: false,
- success: function (result) {
- $('#msModal8').modal('hide');
- if (result.code != 200) {
- if (result.code == -10001) {
- alert(result.msg, function () {
- window.location.href = '/user/login';
- });
- } else {
- alert(result.msg);
- }
- return;
- }
- window.location.href = result.data.url
- }
- });
- });
- $(function () {
- $(document).on('click', "div[data-target='#navModal']", function () {
- console.info(navData);
- // 设置导航背景色
- if (navData.menuBackgroundColor) {
- $("#colorPicker4").spectrum("set", navData.menuBackgroundColor);
- updateNavBackground(navData.menuBackgroundColor);
- }
- // 字体色
- if (navData.menuTextColor) {
- $("#navFontColor1").spectrum("set", navData.menuTextColor);
- updateNavFontColor1(navData.menuTextColor);
- }
- // 选中色
- if (navData.menuPressedTextColor) {
- $("#navFontColor2").spectrum("set", navData.menuPressedTextColor);
- updateNavFontColor2(navData.menuPressedTextColor);
- }
- //显示类型
- $("#navModal").find("#iconNameShow li[data-show='" + navData.show + "']").trigger('click');
- //设置导航值
- var jsonLength = 0;
- if (navData.menu) {
- $.each(navData.menu, function () {
- jsonLength++;
- });
- }
- // 需要补充的导航个数
- var addLength = jsonLength - 2;
- if (addLength > 0) {
- for (var i = 0; i < addLength; i++) {
- $(".plugin-nav .nav-top ul li").eq(i + 2).css("display", "table-cell");
- $(".plugin-nav .n-list dd").eq(i + 2).addClass('active');
- }
- }
- if (navData.menu) {
- // 填充数据
- $.each(navData.menu, function (key, item) {
- var dd = $(".plugin-nav .n-list dd");
- if (item.text) {
- dd.eq(key).find("input[name='navText']").val(item.text);
- $(".plugin-nav .nav-top ul li").eq(key).find(".n-text").text(item.text);
- }
- dd.eq(key).find("select").val(item.action);
- dd.eq(key).find("select").trigger('change');
- if (item.icon) {
- dd.eq(key).find(".add-icon span").attr('class', 'iconfont icon-' + item.icon);
- dd.eq(key).find(".add-icon span").css('color', 'rgb(51, 51, 51)');
- dd.eq(key).find(".add-icon span").attr('data-index', item.icon);
- $(".plugin-nav .nav-top ul li").eq(key).find(".n-icon").attr("class", "n-icon iconfont icon-" + item.icon + "");
- }
- dd.eq(key).find("input[name='navLink']").val(item.url);
- });
- }
- });
- // 状态标题栏设置默认值
- $(document).on('click', "div[data-target='#titleModal']", function () {
- // 状态栏设置
- if (stateBar.state == 2) { // 隐藏
- $(".plugin-title").find(".state-show-toggle li[data-state='2']").trigger('click');
- } else {
- if (stateBar.way == 2) { // 延伸
- $(".plugin-title .state-way-ul").find("li[data-state-way='2']").trigger('click');
- } else { // 自定义
- $(".plugin-title .state-way-ul").find("li[data-state-way='1']").trigger('click');
- if (stateBar.bgColor) {
- // 设置背景色
- $("#colorPicker2").spectrum("set", stateBar.bgColor);
- updateStateBackground(stateBar.bgColor);
- //$("$colorPicker2").css('opacity', stateBar.bgAlpha);
- //$("#titleModal .state-bgcolor").css("opacity", '0.5');
- }
- }
- // 设置文字色
- if (stateBar.fontColor) {
- $(".plugin-title .bg-text-color1").find("li[data-state-font-color=" + stateBar.fontColor + "]").trigger('click');
- }
- }
- // 显示或隐藏
- if (titleBar.show == 1) {
- $(".plugin-title").find("#titleShow li[data-show='1']").trigger('click');
- return;
- }
- if (!titleBar.title) titleBar.title = $("input[name=app]").val();
- $(".plugin-title .input-title").val(titleBar.title);
- $(".plugin-title .input-title").parents(".plugin-title").find(".title-top").find(".text").text(titleBar.title);
- // 设置颜色
- if (titleBar.bgColor) {
- $("#colorPicker3").spectrum("set", titleBar.bgColor);
- updateTitleBackground(titleBar.bgColor);
- }
- if (titleBar.titleColor) {
- $("#titFontColor").spectrum("set", titleBar.titleColor);
- updateTitleFontColor(titleBar.titleColor);
- }
- if (titleBar.leftKey) {
- $.each(titleBar.leftKey, function (key, val) {
- if (!$("#leftKey").find("li[data-left-key='" + val + "']").hasClass('active')) {
- // 设置功能键
- $("#leftKey").find("li[data-left-key='" + val + "']").trigger('click');
- console.log(val);
- }
- });
- }
- if (titleBar.rightKey) {
- $.each(titleBar.rightKey, function (key, v) {
- // 设置功能键,是否选中,选中后不再触发点击
- if (!$("#rightKey").find("li[data-right-key='" + v + "']").hasClass('active')) {
- $("#rightKey").find("li[data-right-key='" + v + "']").trigger('click');
- console.log(v);
- }
- });
- }
- });
- // 第三方分享设置默认值
- $(document).on('click', "div[data-target='#shareModal']", function () {
- if (share.way == 1) {
- $(".plugin-share .s-ul").find("li[data-way='1']").trigger('click');
- } else {
- $(".plugin-share .s-ul").find("li[data-way='0']").trigger('click');
- }
- $("#shareModal input[name=wxId]").val(share.wxId);
- $("#shareModal input[name=wxSecret]").val(share.wxSecret);
- $("#shareModal input[name=text]").val(share.shareText);
- $("#shareModal input[name=link1]").val(share.shareUrl);
- });
- // 第三方分享设置默认值
- // $(document).on('click', "div[data-target='#keystoreModal']", function () {
- //
- // $('#keystoreModal .keystore-wrap').find("input[name='store_file_content']").val(androidKey.file_url);
- // $('#keystoreModal .keystore-wrap').find("input[name='store_storepass']").val(androidKey.store_pass);
- // $('#keystoreModal .keystore-wrap').find("input[name='store_alias']").val(androidKey.alias);
- // $('#keystoreModal .keystore-wrap').find("input[name='store_keypass']").val(androidKey.key_pass);
- // });
- // 侧边栏设置默认值
- $(document).on('click', "div[data-target='#asideModal']", function () {
- var iconImg = $(".step2").find("#appIcon img").attr('src');
- $("#asideModal").find(".aside-icon img").attr('src', iconImg);
- // 背景色
- if (asideData.asideBgColor) {
- $("#colorPicker5").spectrum("set", asideData.asideBgColor);
- updateAsideBackground(asideData.asideBgColor);
- }
- // 字体色
- if (asideData.asideFontColor) {
- $("#asideFontColor").spectrum("set", asideData.asideFontColor);
- updateAsideFontColor(asideData.asideFontColor);
- }
- // 显示方式
- $("#asideModal").find("#displayMode li[data-display='" + asideData.asideDisplay + "']").trigger('click');
- // 是否显示APP
- $("#asideModal").find(".top-show li[data-app-show='" + asideData.asideShowApp + "']").trigger('click');
- //设置导航值
- var jsonLength = 0;
- if (asideData.menu) {
- $.each(asideData.menu, function () {
- jsonLength++;
- });
- }
- // 需要补充的导航个数
- var addLength = jsonLength - 1;
- if (addLength > 0) {
- for (var i = 0; i < addLength; i++) {
- $(".plugin-aside .nav-top ul li").eq(i + 1).css("display", "table-cell");
- $(".plugin-aside .n-list dd").eq(i + 1).removeClass('active');
- }
- }
- if (asideData.menu) {
- // 填充数据
- $.each(asideData.menu, function (key, item) {
- var dd = $(".plugin-aside .n-list dd");
- if (item.text) {
- dd.eq(key).find("input[name='navText']").val(item.text);
- dd.eq(key).find("input[name='navText']").bind('input propertychange', function () {
- //$(this).val(item.text);
- }).trigger('propertychange');
- $(".plugin-aside .nav-top ul li").eq(key).find(".n-text").text(item.text);
- }
- dd.eq(key).find("select").val(item.action);
- dd.eq(key).find("select").trigger('change');
- if (item.icon) {
- dd.eq(key).find(".add-icon span").attr('class', 'iconfont icon-' + item.icon);
- dd.eq(key).find(".add-icon span").css('color', 'rgb(51, 51, 51)');
- dd.eq(key).find(".add-icon span").attr('data-index', item.icon);
- item.icon.split('menu');
- $(".aside-modal .aside-nav li").eq(key).find(".iconfont").attr("class", "fl iconfont icon-" + item.icon);
- $(".plugin-aside .nav-top ul li").eq(key).find(".n-icon").attr("class", "n-icon iconfont icon-" + item.icon + "");
- }
- dd.eq(key).find("input[name='navLink']").val(item.url);
- });
- }
- });
- // // 状态栏设置默认值
- // $(document).on('click', "div[data-target='#stateModal']", function () {
- // // 设置颜色
- // $("#colorPicker22").spectrum("set", stateBar.bgColor);
- // });
- //------------------ 长按图片保存 -------------------//
- $(document).on('click', "div[data-target='#photoSaveModal']", function () {
- $("#photoSaveModal").find("ul>li[data-photo-save='" + supportLongPressSavePicture + "']").trigger('click');
- });
- //------------------ 支持二维码扫码 -------------------//
- $(document).on('click', "div[data-target='#identifyCodeModal']", function () {
- $("#identifyCodeModal").find("ul>li[data-identify-code='" + supportQrcodeScan + "']").trigger('click');
- });
- //------------------ 支持侧滑返回 -------------------//
- $(document).on('click', "div[data-target='#skidBackModal']", function () {
- $("#skidBackModal").find("ul>li[data-skid-back='" + skidBack + "']").trigger('click');
- });
- //------------------ 支持无网提示 -------------------//
- $(document).on('click', "div[data-target='#noNetModal']", function () {
- $("#noNetModal").find("ul>li[data-no-net='" + noNet + "']").trigger('click');
- });
- //------------------ 支持APk安装器 -------------------//
- $(document).on('click', "div[data-target='#installTipModal']", function () {
- $("#installTipModal").find("ul>li[data-install-tip='" + installTip + "']").trigger('click');
- });
- //------------------ 支持屏幕常亮 -------------------//
- $(document).on('click', "div[data-target='#keepScreenModal']", function () {
- $("#keepScreenModal").find("ul>li[data-keep-screen='" + keepScreen + "']").trigger('click');
- });
- //------------------ 支持网页缩放 -------------------//
- $(document).on('click', "div[data-target='#webZoomModal']", function () {
- $("#webZoomModal").find("ul>li[data-web-zoom='" + supportZoom + "']").trigger('click');
- });
- //------------------ 设置引导页的“立即体验”按钮及其颜色 -------------------//
- $(document).on('click', "div[data-target='#guideModal']", function () {
- $("#guideModal").find(".experience ul>li[data-type='" + supportGuideEnterMainPageButton + "']").trigger('click');
- if (supportGuideEnterMainPageButton == -1) {
- $("#experienceTextColor").spectrum("set", '#ffffff');
- } else {
- $("#experienceTextColor").spectrum("set", guideEnterMainPageButtonColor);
- }
- });
- //------------------ UA设置 -------------------//
- $(document).on('click', "div[data-target='#uaModal']", function () {
- $("#uaModal input[name='appendUa']").val(plugin.userAgent.appendUa);
- $("#uaModal input[name='completeUa']").val(plugin.userAgent.completeUa);
- });
- // 提示滚动条
- $(".plugin-modal .modal-body").scroll(function () {
- var sclollTop = $(this).scrollTop();
- // console.log(sclollTop);
- if (sclollTop > 0) {
- $(this).find(".more-gif").hide();
- } else {
- $(this).find(".more-gif").show();
- }
- });
- // 手势配置
- tab.radioRound({
- el: ".gestures-list1 li",
- checkedClass: "icon-radio-checked"
- });
- });
|