FusionApp小技巧(网上收集整合)

常用代码

//网页即将加载
if(网页链接:find"url/.")then
  停止加载()
  进入子页面("游览",{链接=网页链接})
end

//加载本地网页
("file:///android_asset/drawable/index.html")

//如何调用浏览器打开当前页面?
import "android.content.Intent"
import "android.net.Uri"
url="https://www.lanzous.com/b251218"
viewIntent = Intent("android.intent.action.VIEW",Uri.parse(url))
activity.startActivity(viewIntent)
--浏览器打开链接

//收到新标题
设置顶栏标题(webView.title)

//项目点击事件
进入子页面("子页面名",{链接="url",标题="标题名"})

//去头部留白
document.body.style.paddingTop=0

//显示或隐藏悬浮按钮
--显示悬浮按钮
fltBtn.setVisibility(View.VISIBLE)
--隐藏悬浮按钮
fltBtn.setVisibility(View.GONE)
注:fltBtn为悬浮按钮的ID,不需要更改。

//悬浮点击事件
加载Js([[document.getElementsByClassName("apk_topbar_btn")[0].parentElement.onclick()]])

//悬浮选择点击事件
pop=PopupMenu(activity,fltBtn)
menu=pop.Menu
menu.add("选项一").onMenuItemClick=function(a)
进入子页面("子页面名",{链接="url1"..webView.getUrl()})
end
menu.add("选项二").onMenuItemClick=function(a)
进入子页面("子页面名",{链接="url2"..webView.getUrl()})
end
pop.show()

//设置屏幕方向
import "android.content.pm.ActivityInfo"
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
//视频解析播放
加载网页("vip解析url"..webView.getUrl());
--横屏
activity.setRequestedOrientation(0); 
--竖屏
activity.setRequestedOrientation(1); 

//各控件ID
searchEdtTxt       搜索栏
toolbar.parent        顶栏
toolbar             标题栏
titleTvw            顶栏标题
webView           浏览器
fltBtn              悬浮按钮
 pager             滑动窗体
popmenu_position     菜单栏
sidebar             侧滑栏显示图标
pgsBar             进度条
sideLvw           侧滑图标
menu_button       菜单图标
menuBtn          侧滑栏图标

//开启和关闭侧滑
--打开侧滑
drawerLayout.openDrawer(3)
--关闭侧滑
drawerLayout.closeDrawer(3) 

--均放在点击事件
--自定义底栏点击事件

index=1--底栏项目序号

bmBarLin.getChildAt(index-1).onClick=function()
--点击事件
end

--自定义标签栏点击事件

local index=1--标签栏项目序号

tabBar.getChildAt(index-1).onClick=function()

 --点击事件

end
-- 多页面搜索 --
-- By: QQ3
local urls={"https://www.google.com/search?q=%s","https://m.baidu.com/s?wd=%s","https://m.so.com/s?q=%s","http://cn.bing.com/search?q=%s","http://m.chinaso.com/page/search.htm?keys=%s","https://m.sogou.com/web/searchList.jsp?keyword=%s","https://m.sm.cn/s?q=%s"}
searchEdtTxt.setOnEditorActionListener{
  onEditorAction=function(view,action,event)
    local text=tostring(view.text)
    if text~=nil and text~="" then
      searchEdtTxt.setHint(text)
      local URLEncodeer=import"java.net.URLEncoder"
      for index in pairs(urls) do
        if allWebView[index] and urls[index]~=nil and urls[index]~="" then
          local url=tostring(urls[index]):format(URLEncoder.encode(text))
          if pager.getCurrentItem()+1==index then
            task(100,function()allWebView[index].loadUrl(url)end)--解决当前页面无法加载(与默认搜索事件冲突被覆盖)的问题
          else
            allWebView[index].loadUrl(url)
          end
        end
      end
    else
      SearchEdtTxt.setHint("")
    end
  end
}

网页顶栏及头部空白物理遮盖

javascript:
if(document.getElementsByTagName('BODY')[0].scrollTop<46){
      document.getElementsByTagName('BODY')[0].scrollTop=46;
    } else {
      return false;
    }

浮动广告查杀脚本

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);

清除缓存

第一部分

//自定义事件 > 程序启动
function clr()  
  import "java.io.File" 
  items={"浏览记录","缓存文件"}
  多选对话框=AlertDialog.Builder(this)
  .setTitle("清除记录")  
  .setPositiveButton("确定",function()
    if clearhistory==1 and clearall==1 then
      File(lstads).delete()
      File(lstwebads).delete()
      lst={}
      lstweb={}
      os.execute("pm clear "..activity.getPackageName())
    elseif clearhistory==0 and clearall==1 then
      os.execute("pm clear "..activity.getPackageName())
    elseif clearhistory==1 and clearall==0 then
      File(lstads).delete()
      File(lstwebads).delete()
      lst={}
      lstweb={}
    else return nil
    end
  end)
  .setMultiChoiceItems(items, nil,{ onClick=function(v,p)     
      if p==0 then clearhistory=1
      end    
      if p==1 then clearall=1
      end
    end})
  多选对话框.show();
  clearhistory=0
  clearall=0
end

第二部分 填入点击事件

clr()

“FusionApp小技巧(网上收集整合)”的24,509个回复

  1. Takip2018 den sende dilersen Türk dilersen yabancı takipçi alabilirsin
    instagram Takipçi Satın Al hizmet ve işlemi gerçekleştirerek Hemen fenomen adayları
    arasında yerini alabilirsin.
    İster iş ister real hayatınız da herzaman 1 adım önde olmak istemezmisiniz?
    Herkes ister tabiki ,
    O halde instagram takipçi satın almalısınız. Ucuz ve en güvenilir takipçi sitesini kullanarak
    instagram takipçi satın alabilrisiniz

  2. Having read this I thought it was really informative.
    I appreciate you taking the time and energy
    to put this informative article together. I once again find myself personally spending way too
    much time both reading and leaving comments. But so what, it was still worthwhile!

  3. My developer is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type
    on a number of websites for about a year and am worried about switching to another platform.

    I have heard very good things about blogengine.net. Is there a
    way I can import all my wordpress content into it?
    Any kind of help would be really appreciated!

  4. I was wondering if you ever thought of changing the
    layout of your blog? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way
    of content so people could connect with it better.

    Youve got an awful lot of text for only having one or two images.
    Maybe you could space it out better?

  5. After I initially commented I appear to have clicked the -Notify me when new comments are added- checkbox and from now on whenever a comment is added
    I receive four emails with the same comment. Perhaps there is a means you can remove me from that service?
    Kudos!

  6. I think this is one of the most vital info for me. And i’m glad reading your article.
    But want to remark on few general things, The site style is great,
    the articles is really great : D. Good job, cheers

  7. Hello! I know this is kinda off topic but I was wondering if you knew where I could get a
    captcha plugin for my comment form? I’m using the same blog platform as
    yours and I’m having problems finding one?
    Thanks a lot!

  8. Very nice post. I simply stumbled upon your weblog and
    wished to say that I’ve really enjoyed surfing
    around your blog posts. After all I will
    be subscribing in your rss feed and I hope you
    write once more soon!

  9. I’m not sure where you’re getting your info, but great topic.
    I needs to spend some time learning much more or understanding more.

    Thanks for wonderful information I was looking for this
    information for my mission.

  10. Write more, thats all I have to say. Literally, it seems as though you
    relied on the video to make your point. You definitely know what youre talking about, why waste your
    intelligence on just posting videos to your site when you could be giving us something informative to read?

  11. Hey I know this is off topic but I was wondering if you knew of any widgets I
    could add to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for quite some time
    and was hoping maybe you would have some experience with something like
    this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to
    your new updates.

  12. I needs to spend some time learning more or understanding more. Thanks for fantastic information I was looking for this info for my mission.