sound={
LinearLayout,
orientation="vertical",
layout_height="fill",
layout_width="fill",
{
LinearLayout,
orientation="horizontal",--横排列
layout_height="fill",
layout_width="fill",
layout_gravity="center",
{TextView,
layout_height="wrap_content",
text="音量:",
id="seekText",
layout_width="wrap_content"},
{SeekBar,
layout_height="wrap_content",
layout_width="wrap_content",
id="mainProgressBar1",
id="seekbar",
layout_weight="1.0"
},
},
{
LinearLayout,
orientation="horizontal",--横排列
layout_height="fill",
layout_width="fill",
layout_gravity="center",
{Button,
text="低",
gravity="center",
onClick=function()
window = activity.getWindow();
lp = window.getAttributes();
lp.screenBrightness = 25 / 255.0;
window.setAttributes(lp)
end
},
{Button,
text="中",
gravity="center",
onClick=function()
window = activity.getWindow();
lp = window.getAttributes();
lp.screenBrightness = 127 / 255.0;
window.setAttributes(lp)
end
},
{Button,
text="高",
gravity="center",
onClick=function()
window = activity.getWindow();
lp = window.getAttributes();
lp.screenBrightness = 150 / 255.0;
window.setAttributes(lp)
end
},
{Button,
text="常亮",
gravity="center",
onClick=function()
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
end
},
},
};
AlertDialog.Builder(this)
.setView(loadlayout(sound))
.setMessage("网页浏览工具")
.setPositiveButton("屏蔽广告",function()
items={}
table.insert(items,"方案①(通用)")
table.insert(items,"方案②(专杀浮动)")
table.insert(items,"方案③(暴力拦截)")
table.insert(items,"方案④(动态专杀)")
table.insert(items,"注:当可能导致您无法正常浏览网页,如有异常重启应用即可")
table.insert(items,"广告屏蔽由孤灯广告屏蔽助手提供支持")
AlertDialog.Builder(this)
.setTitle("去广告选项")
.setItems(items,{onClick=function(l,v)
if items[v+1]=="方案①(通用)" then
加载Js([[(function(){var host=location.href;if(host.indexOf('baidu.com')>0||host.indexOf('360doc.cn')>0||host.indexOf('sm.cn')>0||host.indexOf('uc.cn')>0||host.indexOf('info.3g.qq.com')>0||host.indexOf('melogin.cn')>0||host.indexOf('192.168.')>0||host.indexOf('m.weibo.cn')>0||host.indexOf('taobao.com')>0){return}var myArray=new Array('div','img','span','p','a','li');for(var i=0;i<6;i++){var ifr=document.getElementsByTagName(myArray[i]);if(ifr&&ifr.length>0){for(var j=0;j<ifr.length;j++){var obj=ifr[j];var ids=obj.getAttribute('id');var cls=obj.getAttribute('class');if(cls){if(obj.tagName=='A'&&cls.indexOf(' ')!=-1&&obj.getAttribute('onclick')&&obj.getAttribute('target')&&obj.href){obj.style.display='none'}}if(ids&&cls){if(ids==cls&&cls.length>10&&obj.tagName=='LI')obj.style.display='none'}if(ids){if(ids.length>30&&ids.indexOf('-')==-1){obj.style.display='none'}if((/^[0-9]*$/.test(ids))&&ids.length>1){obj.style.display='none'}if(ids.length>7&&/[0-9]/.test(ids)&&/[a-z]/i.test(ids)&&obj.getAttribute('style')){obj.style.display='none'}}if(ids&&cls){if(cls.indexOf(' ')!=-1&&cls.indexOf(ids)!=-1&&obj.getAttribute('style')){obj.style.display='none'}if(ids==cls){if(/[0-9]/.test(ids)&&/[a-z]/i.test(ids)){obj.style.display='none'}}}}}}})();]])
对话框()
.设置标题("温馨提示")
.设置消息([[您已经启用广告拦截模式①,本功能主要用于DNS被挟持或者host被挟持所带来的广告,如有浏览问题请重启应用!技术由孤灯广告屏蔽助手提供]])
.设置积极按钮("我知道了")
.显示()
elseif items[v+1]=="方案②(专杀浮动)" then
加载Js([[var d=document;var s=d.createElement('script');s.setAttribute('src', 'https://greasyfork.org/scripts/7410-jskillad/code/jsKillAD.user.js');d.head.appendChild(s);]])
对话框()
.设置标题("温馨提示")
.设置消息([[您已经启用广告拦截模式②,本功能主要用于DNS被挟持或者host被挟持所带来的广告,如有浏览问题请重启应用!技术由孤灯广告屏蔽助手提供]])
.设置积极按钮("我知道了")
.显示()
elseif items[v+1]=="方案③(强制拦截)" then
加载Js([[var d=document;var s=d.createElement('script');s.setAttribute('src', 'https://greasyfork.org/scripts/368754-%E9%80%9A%E7%94%A8%E5%8E%BB%E5%B9%BF%E5%91%8A-%E6%AF%94%E8%BE%83%E6%9A%B4%E5%8A%9B-%E6%85%8E%E7%94%A8-v0-1/code/%E9%80%9A%E7%94%A8%E5%8E%BB%E5%B9%BF%E5%91%8A(%E6%AF%94%E8%BE%83%E6%9A%B4%E5%8A%9B%EF%BC%8C%E6%85%8E%E7%94%A8)V01.user.js');d.head.appendChild(s);]])
对话框()
.设置标题("温馨提示")
.设置消息("您已经启用广告拦截模式③,本功能主要用于DNS被挟持或者host被挟持所带来的广告,如有浏览问题请重启应用!技术由孤灯广告屏蔽助手提供")
.设置积极按钮("我知道了")
.显示()
elseif items[v+1]=="广告屏蔽由孤灯广告屏蔽助手提供支持" then
弹出消息("喜欢二次元的小朋友可以到QQ群159155783来玩哦")
加QQ群(159155783)--作者辛苦整合,请勿删除小小无商业性质的广
elseif items[v+1]=="方案④(动态专杀)" then
加载Js([[(function(valid, rule) { if(typeof Element === 'undefined') console.log('IE8以下浏览器无效'); var origin = new RegExp('^' + location.origin),Ele = Element; each(['appendChild', 'insertBefore', 'insertAfter'], proxy); function proxy(prop) { var proxy_obj = Ele.prototype[prop]; Ele.prototype[prop] = function(elem) { if (!elem.children.length) { var tag = elem.tagName.toLowerCase(); if (tag == 'script' && isBanScript(elem)) { console.log('禁用脚本:' + elem.src); var substitute = document.createElement('script'); substitute.innerHTML = '// 禁用脚本:' + elem.src; elem = substitute; } } return proxy_obj.apply(this, arguments); }; } function isBanScript(script) { if (origin.test(script.src)) return false; return valid === each(rule, match); function match(val) { var type = typeof val; if (type === 'string') { if (script.src == val) return true; } else if (type === 'function') { if (val(script)) return true; } else { if (val.test(script.src)) return true; } return false; } } function each(arr, fn) { if (arr) { for (var i = 0, n = arr.length; i < n; i++) { if (fn.call(arr[i], arr[i], i) === true) return false; } } return true; }})(true, []);]])
对话框()
.设置标题("温馨提示")
.设置消息("您已经启动广告拦截④模式,本模式主要用于动态广告拦截,技术由孤灯广告屏蔽助手提供")
.设置积极按钮("我知道了")
.显示()
elseif items[v+1]=="方案⑤(专杀浮动)" then
加载JS([[(function () { var bc = Array.prototype.forEach;//Callback function getStyle(o, s) { if(o.style[s])//内联样式 return o.style[s]; else if(document.defaultView && document.defaultView.getComputedStyle){//DOM //s = s.replace(/([A-Z])/g,'-$1').toLowerCase(); var x = document.defaultView.getComputedStyle(o,''); return x.getPropertyValue(s); } } function testStyle(o) { var s = getStyle(o, "position"); return s === "fixed" || s === "absolute"; }/* function sameDomain(o) { try { return o.document.body; } catch (e) { return 0; } }*/ function isFloatLay(o) { var x = o.offsetParent; return !x || x.tagName === "BODY" || x.tagName === "HTML"; } function delNode(x) { x.parentNode.removeChild(x); } function scan(el) { ["iframe", "img", "object", "embed", "video"].forEach(function(s) { bc.call(el.getElementsByTagName(s), function(x) { while (x) { if (isFloatLay(x)) { //要删除的层得同时满足二个条件 if (testStyle(x)) delNode(x); break; } x = x.offsetParent; } }); }); } /* //扫描广告脚本 bc.call(document.getElementsByTagName("script"), function(o) { if (o.src && o.readyState !== "complete") delNode(o); }); //没用哦,因为DIV中可能已经生成了元素 bc.call(document.querySelectorAll ? document.querySelectorAll("div>script") : document.getElementsByTagName("script"), function(x) { x = x.parentNode; if (x.childNodes.length === 1) delNode(x); }); */ document.addEventListener("DOMContentLoaded", function(){scan(document);}, false); bc.call(frames, function(x) { try { scan(x.contentDocument); } catch (e) {} });})();]])
对话框()
.设置标题("温馨提示")
.设置消息([[您已经启用广告拦截模式⑤,本功能主要用于DNS被挟持或者host被挟持所带来的广告,如有浏览问题请重启应用!技术由孤灯广告屏蔽助手提供]])
.设置积极按钮("我知道了")
.显示()
end
end})
.show()
end)
.setNeutralButton("物理浏览",function()
function 物理效果(id,灵敏度)
if not (__IIll00oo==nil)then
弹出消息("此代码仅允许运行一次!")
end
if not (type(id)=="table")then
__IIll00oo={}
table.insert(__IIll00oo,id)
else
__IIll00oo=id
end
local l = 灵敏度 or 1
require "import"
import "android.content.Context"
import "android.hardware.Sensor"
import "android.hardware.SensorEvent"
import "android.hardware.SensorEventListener"
import "android.hardware.SensorManager"
local x轴,y轴,z轴
传感器 = activity.getSystemService(Context.SENSOR_SERVICE)
local 加速度传感器 = 传感器.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
传感器.registerListener(SensorEventListener({
onSensorChanged=function(event)
local x轴 = event.values[0]
local y轴 = event.values[1]
local z轴 = event.values[2]
for v,k in pairs(__IIll00oo) do
k.setRotationX(y轴*l)
k.setRotationY(x轴*l)
end
end,nil}), 加速度传感器, SensorManager.SENSOR_DELAY_NORMAL)
end
物理效果({webView,titleTvw},3)
弹出消息("由孤灯广告屏蔽助手整合源码")
end)
.setNegativeButton("退出",nil)--退出按钮
.show()
import "android.graphics.Paint"
--导入AudioManager类
import "android.media.AudioManager"
--注意是改变媒体音量
--得到音频管理对象
mAudioManager = activity.getSystemService(Context.AUDIO_SERVICE);
--获取当前音乐音量
mVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
--设置为seekbar音量的最大阶数
seekbar.setMax(mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
--设置seekbar为当前音量进度
seekbar.setProgress(mVolume);
--绑定监听
seekbar.setOnSeekBarChangeListener{
onProgressChanged=function(a,i)
--拖动seekbar时改变音量
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, i, 1);--设置1显示音量调节窗口0为隐藏
px=math.floor(i/mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC)*100)
seekText.Text="音量:"..px.."%"
end}
包名=this.getPackageManager().getPackageInfo(this.getPackageName(),((32552732/2/2-8183)/10000-6-231)/9)
版本=tostring(包名.versionName)
版本号=tonumber(包名.versionCode)
更新链接="https://sharechain.qq.com/1e264b2cdda0279f0dffe13133c99b35"--用了@小狼狗QQ收藏检查更新代码
Http.get(更新链接,nil,"UTF-8",nil,function(code,content,cookie,header)
if(code==200 and content)then
content=content:match("\"html_content\":(.-),"):gsub("\\u003C/?.-%>",""):gsub("\\n","\n"):gsub(" "," "):gsub("<","<"):gsub(">",">"):gsub("&","&"):gsub(""","\""):gsub("'","'")
新版本=content:match("【版本】(.-)【版本】")
新版本号=content:match("【版本号】(.-)【版本号】")
更新日志=content:match("【更新日志】(.-)【更新日志】")
gxurl=content:match("【下载链接】(.-)【下载链接】")
else
print("连接服务器失败("..code..")")
end
if 新版本号>tostring(this.getPackageManager().getPackageInfo(this.getPackageName(),((32552732/2/2-8183)/10000-6-231)/9).versionCode) then
弹出消息("孤灯广告屏蔽助手模块有更新,请联系开发者更新")
else
弹出消息("已连接云广告拦截服务")
end
end)