Jump to content

Is there anyway that emby can load JavaScript code when login


shure

Recommended Posts

shure
4 minutes ago, Cheesegeezer said:

You have a pull request.  

Thanks for your pr. Big surprise for me.

Is it possible to realize the fuction in CustomCssJS.js by IServerEntryPoint instead of adding list.push("./modules/CustomCssJS.js") in app.js

Link to comment
Share on other sites

Cheesegeezer
6 minutes ago, shure said:

Thanks for your pr. Big surprise for me.

Is it possible to realize the fuction in CustomCssJS.js by IServerEntryPoint instead of adding list.push("./modules/CustomCssJS.js") in app.js

Yes, i think you would need to acquire that file, add in your line and then upload it back to the server.

Link to comment
Share on other sites

shure
53 minutes ago, Cheesegeezer said:

Yes, i think you would need to acquire that file, add in your line and then upload it back to the server.

I'm sorry i'm not good at C#. Could you please give me some code example that the JS file can be executed from the back-end if you have time

for the time being, I only know JS file will be executed when i open the plugin config page.

or Modify the app.js in front-end to make JS file executed when UI loaded.

Link to comment
Share on other sites

Cheesegeezer

 

 

59 minutes ago, shure said:

I'm sorry i'm not good at C#. Could you please give me some code example that the JS file can be executed from the back-end if you have time

 

 

 

Now's the time to start learning c# lol.  

Stack overflow would probably have it but you need to use File and Directory Classes, which is part of System.IO

You can also use Emby's IFileSystem interface, which would be better in this case, this will give you direct access to any users Emby Server installation.

something like this to read and insert you text in the app js file.

 

string text = File.ReadAllText("app.js");    
string line = "your text is here";  
string insertpointtext = "text your location of insert line";   

int searchindex = text.IndexOf(insertpointtext);  
string first = text.substring(0,searchindex);  
string last =  text.substring(searchindex,text.length());  
text = first + line + last;  
File.WriteAllText("app.js", text);    

 

Link to comment
Share on other sites

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...