Skip to content

Commit

Permalink
1. 添加全网资源搜索
Browse files Browse the repository at this point in the history
2. 修复sdk在网页未加载完成提前执行了
3. 完善国际化支持
  • Loading branch information
luoxianxu committed Apr 18, 2024
1 parent ae9e8a5 commit 3233229
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

不可替换为官方的webview.js的SDK,为了兼容问题,本应用对官方的SDK进行了比较大的修改,如果替换可能无法正常使用。

不支持夜神模拟器,这是一个纯nuve项目,使用模拟器运行要安卓9以上,或使用真机运行,编译白屏请授权本地储存权限。
不支持夜神模拟器,这是一个纯nvue项目,使用模拟器运行需要安卓9以上,或使用真机运行,编译白屏请授权本地储存权限。

如果只需要一个只有基础功能的浏览器,可以看看核心库 [Core地址](https://github.com/SHEE94/UnibrowserCore)

Expand Down
2 changes: 1 addition & 1 deletion components/menu/menu.nvue
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
// height: 230px;
background-color: rgba($color: #eeeeee, $alpha: 0.95);
padding: $uni-spacing-row-lg;

.item {
height: 80px;
align-items: center;
Expand Down
1 change: 1 addition & 0 deletions locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"setting.blank": "Open the page in a new window",
"setting.homepage": "Set home tab",
"setting.browser.name": "Webview Core",
"setting.home.page.add": "Add",

"weblog.override-resource": "blocked resources",
"weblog.type": "Type",
Expand Down
1 change: 1 addition & 0 deletions locale/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"setting.blank": "在新窗口打开页面",
"setting.homepage": "设置主页",
"setting.browser.name": "内核",
"setting.home.page.add": "添加",


"weblog.override-resource": "查看已拦截的资源",
Expand Down
12 changes: 3 additions & 9 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name" : "Script Browser 3",
"appid" : "__UNI__A92EF1E",
"description" : "",
"versionName" : "3.1.1",
"versionCode" : 30101,
"versionName" : "3.1.3",
"versionCode" : 30103,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
Expand All @@ -18,13 +18,7 @@
"delay" : 0
},
/* 模块配置 */
"modules" : {
"Webview-x5" : {
"timeOut" : 30000, // 超时时间
"allowDownloadWithoutWiFi" : true // 是否允许用户在非WiFi网络时进行x5内核的下载。默认值false(如果为true,就不会显示用户确认的弹窗。)
},
"VideoPlayer" : {}
},
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
Expand Down
25 changes: 20 additions & 5 deletions pages/home-page/home-page.nvue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</view>
</view>
<view class="right">
<button size="mini" @click="remove(index)">删除</button>
<button size="mini" @click="remove(index)">{{$t('script.tips.10')}}</button>
</view>
</label>
</radio-group>
Expand All @@ -22,7 +22,7 @@
</view>
</view>
<view class="right">
<button size="mini" type="primary" @click="addHome">添加</button>
<button size="mini" type="primary" @click="addHome">{{$t('setting.home.page.add')}}</button>
</view>
</view>
</view>
Expand All @@ -38,8 +38,18 @@
*@LastEditors: Xianxu
*@LastEditTime: 2024-02-02
*/

import {
initVueI18n,
I18n
} from '@dcloudio/uni-i18n'
import messages from '@/locale/index'
const {
t,
setLocale
} = initVueI18n(messages)
const app = getApp()
const settingConfig = app.globalData.webview.Setting.settingConfig;
setLocale(settingConfig.language[settingConfig.langCurrnt].code);
export default {
data() {
return {
Expand All @@ -64,15 +74,19 @@
url: 'https://m.baidu.com/',
default: false
},

{
title: 'searx',
url: 'https://searx.rhscz.eu/',
default: false
},

]
};
},
onLoad() {
this.webview = app.globalData.webview;
const homepageList = uni.getStorageSync('homepageList')
if (homepageList) {
if (homepageList && homepageList.length) {
this.homepageList = homepageList
}

Expand All @@ -92,6 +106,7 @@
})
},
methods: {
$t:t,
addHome() {
this.homepageList.push({
title: '',
Expand Down
6 changes: 5 additions & 1 deletion static/html/quarkHomePage/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ require(['jquery'], function($) {

var settingsFn = function(storage) {
this.storage = {
engines: "quark",
engines: "xsearch",
bookcolor: "black",
searchHistory: true
};
Expand Down Expand Up @@ -883,6 +883,7 @@ require(['jquery'], function($) {
window.via.searchText(text);
} else {
location.href = {
xsearch:"https://searx.rhscz.eu/search?q=%s&language=auto",
baidu: "https://m.baidu.com/s?wd=%s",
quark: "https://quark.sm.cn/s?q=%s",
google: "https://www.google.com/search?q=%s",
Expand Down Expand Up @@ -1354,6 +1355,9 @@ require(['jquery'], function($) {
"type": "select",
"value": "engines",
"data": [{
"t": "Searx",
"v": "xsearch"
}, {
"t": "夸克搜索",
"v": "quark"
}, {
Expand Down
5 changes: 3 additions & 2 deletions static/sdk/web-sdk.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";
globalThis.startTime = Date.now()

console.log('ADD SDK START')
try {
;
(function() {

cgsdk = function() {

// if(window.location.protocol.indexOf('http')==-1)return;
console.log('SDK LOADED')
window.WEB_SDK_LOADED = true;
const version = '3.0.0';
Expand Down Expand Up @@ -767,6 +767,7 @@ try {
}

if (!window.WEB_SDK_LOADED) {

window.plus ? cgsdk() : document.addEventListener('plusready', cgsdk, false);
}

Expand Down

0 comments on commit 3233229

Please sign in to comment.