aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-05-26 14:06:48 +0200
committerGravatar GitHub <noreply@github.com> 2017-05-26 14:06:48 +0200
commit8de759477e02c874d9efed1a239d715f0049f75b (patch)
tree55f91c504bb0005a6fe252ac6295dfa116d3b547
parent5cb72d32c36355cc7ca5b6c7d17151a98e17c935 (diff)
parent0f83736cac1a03552c88a41bab75173f94b6cc2c (diff)
Merge pull request #1547 from Alkarex/CSS-JS-load-order-extensions
Change CSS load order to help CustomCSS extension
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/FreshRSS.php12
-rw-r--r--data/extensions-data/.gitignore1
-rw-r--r--data/extensions-data/index.html13
4 files changed, 21 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ed88c0bf1..1cdcd7476 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
* Fix update system via ZIP archive [#1498](https://github.com/FreshRSS/FreshRSS/pull/1498)
* Work around for IE / Edge bug in username pattern in version 1.6.3 [#1511](https://github.com/FreshRSS/FreshRSS/issues/1511)
* Fix *mark as read* articles when adding a new feed [#1535](https://github.com/FreshRSS/FreshRSS/issues/1535)
+ * Change load order of CSS and JS to help CustomCSS and CustomJS extensions [Extensions#13](https://github.com/FreshRSS/Extensions/issues/13), [#1547](https://github.com/FreshRSS/FreshRSS/pull/1547)
* UI
* New option for not closing the article when clicking outside its area [#1539](https://github.com/FreshRSS/FreshRSS/pull/1539)
* Download icon 💾 for other MIME types (e.g. `application/*`) [#1522](https://github.com/FreshRSS/FreshRSS/pull/1522)
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index 563393c90..90d6fae06 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -80,7 +80,7 @@ class FreshRSS extends Minz_FrontController {
public static function loadStylesAndScripts() {
$theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme);
if ($theme) {
- foreach($theme['files'] as $file) {
+ foreach(array_reverse($theme['files']) as $file) {
if ($file[0] === '_') {
$theme_id = 'base-theme';
$filename = substr($file, 1);
@@ -91,13 +91,13 @@ class FreshRSS extends Minz_FrontController {
$filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename);
$url = '/themes/' . $theme_id . '/' . $filename . '?' . $filetime;
header('Link: <' . Minz_Url::display($url, '', 'root') . '>;rel=preload', false); //HTTP2
- Minz_View::appendStyle(Minz_Url::display($url));
+ Minz_View::prependStyle(Minz_Url::display($url));
}
}
-
- Minz_View::appendScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')));
- Minz_View::appendScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js')));
- Minz_View::appendScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js')));
+ //Use prepend to insert before extensions. Added in reverse order.
+ Minz_View::prependScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js')));
+ Minz_View::prependScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js')));
+ Minz_View::prependScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js')));
}
private static function loadNotifications() {
diff --git a/data/extensions-data/.gitignore b/data/extensions-data/.gitignore
new file mode 100644
index 000000000..0a00d7014
--- /dev/null
+++ b/data/extensions-data/.gitignore
@@ -0,0 +1 @@
+*/ \ No newline at end of file
diff --git a/data/extensions-data/index.html b/data/extensions-data/index.html
new file mode 100644
index 000000000..85faaa37e
--- /dev/null
+++ b/data/extensions-data/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
+<head>
+<meta charset="UTF-8" />
+<meta http-equiv="Refresh" content="0; url=/" />
+<title>Redirection</title>
+<meta name="robots" content="noindex" />
+</head>
+
+<body>
+<p><a href="/">Redirection</a></p>
+</body>
+</html>