Jump to content

Recommended Posts

Posted

In web client and eletron client. JavaScript code "window.location.reload()" works fine.

But in android app. If I use this function, the app just crash and I need to reopen it.

Thanks for your help

 

Posted

Why do you want to do this?

Posted
9 hours ago, softworkz said:

Why do you want to do this?

In my plugin page, there is a reload button。“onclick = window.location.reload() ” works fine in web client and eletron client. 

Posted
12 minutes ago, shure said:

In my plugin page, there is a reload button。“onclick = window.location.reload() ” works fine in web client and eletron client. 

What's the purpose of the "reload button"? Reloading destroys all context and should not be needed actually.

Posted
On 6/5/2023 at 3:41 AM, softworkz said:

What's the purpose of the "reload button"? Reloading destroys all context and should not be needed actually.

My plugin let user can add their own javascript code to modify ui for different servers.

but the changement such as a style or link node added will be kept when change server.

Posted

So I need reload index.html after changing server

Posted

In android app, you can use 

MainActivity.exitApp();
window.open("emby://items", "_blank");

to reload app (if not work, set timeout for window,open less than 200). and

typeof MainActivity === "undefined"

to determine the environment

Posted

Are you aiming for that plugin to become included in the official plugin catalog?

Posted
3 hours ago, softworkz said:

Are you aiming for that plugin to become included in the official plugin catalog?

this is the plugin I'm working on https://github.com/Shurelol/Emby.CustomCssJS

I'm not sure if it violates the policy about emby plugin

Posted
15 minutes ago, shure said:

this is the plugin I'm working on https://github.com/Shurelol/Emby.CustomCssJS

Interesting - looks like quite a bit of work you have put into it...

 

17 minutes ago, shure said:

I'm not sure if it violates the policy about emby plugin

I'm not sure either 🙂 

What does the plugin do, what's the purpose..?

Posted
23 minutes ago, softworkz said:

Interesting - looks like quite a bit of work you have put into it...

 

I'm not sure either 🙂 

What does the plugin do, what's the purpose..?

For server managers, they can provide scripts (javascript and css) for their user. 

For users, they can choose to use the scripts provided by  server manager or make their own scripts

 

Posted (edited)

For example

As server manager, I provide External Players and Dark Theme.

image.png.15c2b7e329b0cc5d58a18a470d13496b.png

Edited by shure
Posted

As user, I choose to use External Players provided by server manager and my own script Photo Carousel

photo_2023-06-09_09-18-42.jpg.795897a3986be928fa7593b1e7d0c7d1.jpg

Posted

Photo Carousel

photo_2023-06-09_09-20-02.thumb.jpg.c0007992edaa3b4a328fe698fb766468.jpg

 

External Players

photo_2023-06-09_09-22-47.jpg.3c2a76d97ff7c24bf971d5d65c6430a7.jpg

Posted

Ahh, so this is some kind of Plug-In system for Emby clients, right?

I understand the Photo Carousel, it's nice.

But why would somebody need all those external players?

Posted

You were asking about Android - how do you interact with the Android app to modify it?

Posted
25 minutes ago, softworkz said:

Ahh, so this is some kind of Plug-In system for Emby clients, right?

I understand the Photo Carousel, it's nice.

But why would somebody need all those external players?

just for more choices, if you use web client in a temporary environment and don‘t want to transcode. you can use local player to play

Posted
26 minutes ago, softworkz said:

You were asking about Android - how do you interact with the Android app to modify it?

the main fuction is completed, there is a bug that if I add a script node in body,  the node will still be there after changing server.

so I need to find a way to reload the index to prevent that you use a script in Server A but  the script still work after you changing to Server B. 

for now, I use 

MainActivity.exitApp();
window.open("emby://items", "_blank");

not stable but work

Posted
3 minutes ago, shure said:

for now, I use 

MainActivity.exitApp();
window.open("emby://items", "_blank");

not stable but work

Where do you use that code? Do you have your own Android app?

Posted
13 minutes ago, softworkz said:
MainActivity.exitApp();

Is Java code, not .js.

For changing assets\www\*`* you either need a rooted Android device or a patching apk - that's what I was wondering about..

MainActivity.exitApp();

did work in JavaScript,

because in jave this function uses Decorator @JavascriptInterface

in apphost.js, you can find 

image.png.dcf3ddb9303589ac776fc896fae21e55.png

Posted

Ah, you're right, MainActivity is exported to js. But how do you change the js files?

Posted

you can also add 

if (webResourceRequest.getUrl().toString().startwith("file:///android_asset/www/index")) {
  return false;
}

in function 

shouldOverrideIrlLoading()

to make 

window.location.reload()

or 

window.location.href = "index.html"

work

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...