add userChrome CSS enablement for Firefox app mode
Former-commit-id: 0074d0968a
Former-commit-id: c93305d9a770275c675b2d70a07123b9b4af452a
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.i2pfirefox;
|
package net.i2p.i2pfirefox;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
@ -200,6 +201,28 @@ public class I2PFirefoxProfileBuilder extends I2PCommonBrowser {
|
|||||||
return copyStrictOptions(base, app);
|
return copyStrictOptions(base, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static boolean writeAppChrome(String profile) {
|
||||||
|
File dir = new File(profile, "chrome");
|
||||||
|
if (!dir.exists())
|
||||||
|
dir.mkdirs();
|
||||||
|
File f = new File(dir, "userChrome.css");
|
||||||
|
try{
|
||||||
|
Files.write(f.toPath(), userChromeCSS().getBytes());
|
||||||
|
}catch(IOException e){
|
||||||
|
logger.warning(e.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
protected static boolean deleteAppChrome(String profile) {
|
||||||
|
File dir = new File(profile, "chrome");
|
||||||
|
if (!dir.exists())
|
||||||
|
return true;
|
||||||
|
File f = new File(dir, "userChrome.css");
|
||||||
|
if (f.exists())
|
||||||
|
f.delete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Copy the strict options from the base profile to the profile
|
* Copy the strict options from the base profile to the profile
|
||||||
*
|
*
|
||||||
@ -238,11 +261,13 @@ public class I2PFirefoxProfileBuilder extends I2PCommonBrowser {
|
|||||||
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", false);",
|
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", false);",
|
||||||
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);",
|
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);",
|
||||||
userOverrides);
|
userOverrides);
|
||||||
|
writeAppChrome(profileDir.toString());
|
||||||
} else {
|
} else {
|
||||||
I2PFirefoxProfileChecker.undoValue(
|
I2PFirefoxProfileChecker.undoValue(
|
||||||
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);",
|
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);",
|
||||||
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", false);",
|
"user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", false);",
|
||||||
userOverrides);
|
userOverrides);
|
||||||
|
deleteAppChrome(profileDir.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user