增加hash链接转magnet
This commit is contained in:
parent
59f43c30ab
commit
20496e0657
|
@ -2,18 +2,16 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hty.browser"
|
||||
android:versionCode="4"
|
||||
android:versionName="4.33">
|
||||
android:versionName="4.34">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 查询网络状态权限 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- GPS权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_GPS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
|
|
|
@ -9,7 +9,7 @@ p { text-indent:2em; }
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.33</h2>
|
||||
<h2 align=center><img src=logo.png><br>海天鹰浏览器 V4.34</h2>
|
||||
<p>内置扩展的浏览器。</p>
|
||||
<p>扩展:链接关键字过滤,链接关键字高亮,图片自定义过滤,视频独立播放。</p>
|
||||
<p>作者:海天鹰</p>
|
||||
|
@ -23,6 +23,7 @@ p { text-indent:2em; }
|
|||
<p><a href="https://stackoverflow.com/questions/3462582/display-the-android-webviews-favicon" target="_blank">获取网页图标</a></p>
|
||||
<p><a href="https://www.jianshu.com/p/c9a18050a249" target="_blank">字符串转Bitmap</a></p>
|
||||
<h3>更新日志:</h3>
|
||||
<h3>V4.34 (2024-01-30)</h3><ol><li>增加hash链接转magnet。</li></ol>
|
||||
<h3>V4.33 (2024-01-19)</h3><ol><li>收藏夹分类:使用下拉列表代替单选组。</li></ol>
|
||||
<h3>V4.32 (2023-11-19)</h3><ol><li>增加GIF屏蔽。</li><li>在Activity中处理广告屏蔽规则。</li></ol>
|
||||
<h3>V4.31 (2023-04-17)</h3><ol><li>取消自动升级,以免因升级错误引起崩溃。</li></ol>
|
||||
|
|
|
@ -1047,7 +1047,7 @@ public class MainActivity extends Activity {
|
|||
istream.close();
|
||||
ostream.close();
|
||||
return s;
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + e);
|
||||
return s;
|
||||
}
|
||||
|
@ -1056,7 +1056,7 @@ public class MainActivity extends Activity {
|
|||
void ADBlock() {
|
||||
String s = readFile("blockrules");
|
||||
//Log.e(Thread.currentThread().getStackTrace()[2] + "", "" + s);
|
||||
if(!s.equals("")) {
|
||||
if (!s.equals("")) {
|
||||
// if (s.endsWith(",")) {
|
||||
// s = s.substring(0, s.length() - 1);
|
||||
// }
|
||||
|
@ -1075,6 +1075,11 @@ public class MainActivity extends Activity {
|
|||
list_webView.get(currentPage).loadUrl(js);
|
||||
}
|
||||
|
||||
void hashToMagnet(){
|
||||
String js = "javascript:var a=document.getElementsByTagName('a');for(i=0;i<a.length;i++){if(a[i].textContent.indexOf('?hash=')!=-1){var hash=a[i].textContent.substring(a[i].textContent.indexOf('?hash=')+6);a[i].textContent='magnet:?xt=urn:btih:'+hash;}if(a[i].href.indexOf('?hash=')!=-1){var hash=a[i].href.substring(a[i].href.indexOf('?hash=')+6);a[i].href='magnet:?xt=urn:btih:'+hash;}}";
|
||||
list_webView.get(currentPage).loadUrl(js);
|
||||
}
|
||||
|
||||
// 调用系统下载,https://www.jianshu.com/p/6e38e1ef203a
|
||||
private void downloadBySystem(String surl, String contentDisposition, String mimeType, String path, String fileName) {
|
||||
// 指定下载地址
|
||||
|
@ -1339,12 +1344,15 @@ public class MainActivity extends Activity {
|
|||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
super.onProgressChanged(view, newProgress);
|
||||
pgb1.setProgress(newProgress);
|
||||
|
||||
if (sharedPreferences.getBoolean("switch_adBlock", false)) {
|
||||
ADBlock();
|
||||
}
|
||||
|
||||
if (sharedPreferences.getBoolean("switch_gifBlock", false)) {
|
||||
GIFBlock();
|
||||
}
|
||||
|
||||
if (sharedPreferences.getBoolean("switch_iframeBlock", false)) {
|
||||
if (view.getUrl() != null) {
|
||||
if (!view.getUrl().contains("baidu.com")) {
|
||||
|
@ -1352,6 +1360,11 @@ public class MainActivity extends Activity {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sharedPreferences.getBoolean("switch_hashToMagnet", false)) {
|
||||
hashToMagnet();
|
||||
}
|
||||
|
||||
// 链接关键字屏蔽
|
||||
if (sharedPreferences.getBoolean("switch_filter", false)) {
|
||||
String sf = sharedPreferences.getString("filter", "");
|
||||
|
@ -1361,6 +1374,7 @@ public class MainActivity extends Activity {
|
|||
view.loadUrl(js);
|
||||
}
|
||||
}
|
||||
|
||||
// 链接关键字高亮
|
||||
if (sharedPreferences.getBoolean("switch_highlight", false)) {
|
||||
String shl = sharedPreferences.getString("highlight", "");
|
||||
|
@ -1370,6 +1384,7 @@ public class MainActivity extends Activity {
|
|||
view.loadUrl(js);
|
||||
}
|
||||
}
|
||||
|
||||
//图片宽度超出父元素适应父元素
|
||||
if (sharedPreferences.getBoolean("switch_shrink", false)) {
|
||||
String js = "javascript:var imgs=document.getElementsByTagName('img');for(var i=0;i<imgs.length;i++){if(imgs[i].parentNode.clientWidth > 0){if(imgs[i].clientWidth>imgs[i].parentNode.clientWidth){imgs[i].width=imgs[i].parentNode.clientWidth;}}}";
|
||||
|
|
|
@ -28,8 +28,13 @@
|
|||
android:defaultValue="false"
|
||||
android:title="iframe过滤"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="switch_hashToMagnet"
|
||||
android:defaultValue="false"
|
||||
android:title="hash转magnet"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="关键字过滤">
|
||||
android:title="链接关键字过滤">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="switch_filter"
|
||||
|
@ -45,7 +50,7 @@
|
|||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="关键字高亮">
|
||||
android:title="链接关键字高亮">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="switch_highlight"
|
||||
|
|
Loading…
Reference in New Issue