mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 01:56:47 +08:00
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||
@@ -193,20 +192,33 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
_webViewController?.evaluateJavascript(source: """
|
||||
Array.from(document.querySelectorAll('.ql-editor > p')).map(p => p.textContent).join('\\n');
|
||||
""").then((value) {
|
||||
try {
|
||||
String? summary = (value as String?);
|
||||
if (summary?.isNotEmpty == true) {
|
||||
VideoHttp.addNote(
|
||||
oid: widget.oid!,
|
||||
title: widget.title!,
|
||||
summary: summary!,
|
||||
);
|
||||
}
|
||||
} catch (_) {}
|
||||
// try {
|
||||
// String? summary = (value as String?);
|
||||
// if (summary?.isNotEmpty == true) {
|
||||
// VideoHttp.addNote(
|
||||
// oid: widget.oid!,
|
||||
// title: widget.title!,
|
||||
// summary: summary!,
|
||||
// );
|
||||
// }
|
||||
// } catch (_) {}
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
);
|
||||
_webViewController?.addJavaScriptHandler(
|
||||
handlerName: 'infoBarClicked',
|
||||
callback: (args) async {
|
||||
WebUri? uri = await _webViewController?.getUrl();
|
||||
if (uri != null) {
|
||||
String? oid =
|
||||
RegExp(r'oid=(\d+)').firstMatch(uri.toString())?.group(1);
|
||||
if (oid != null) {
|
||||
PiliScheme.videoPush(int.parse(oid), null);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
onProgressChanged: (controller, progress) {
|
||||
_progressStream.add(progress / 100);
|
||||
@@ -223,6 +235,11 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
||||
document.querySelector('.finish-btn').addEventListener('click', function() {
|
||||
window.flutter_inappwebview.callHandler('finishButtonClicked');
|
||||
});
|
||||
""");
|
||||
_webViewController?.evaluateJavascript(source: """
|
||||
document.querySelector('.info-bar').addEventListener('click', function() {
|
||||
window.flutter_inappwebview.callHandler('infoBarClicked');
|
||||
});
|
||||
""");
|
||||
} else if (url.toString().startsWith('https://live.bilibili.com')) {
|
||||
_webViewController?.evaluateJavascript(
|
||||
|
||||
Reference in New Issue
Block a user