Browse Source

[index] Show bridge options when loading with URL fragment

Loading the page with an URL fragement (#bridge-*) should result in
the bridge showing all parameters by default. Unfortunately this is
not possible using PHP, which is why a new JavaScript function is
needed (select.js)

That way, when returning from a bridge ('back to rss-bridge') will
keep the selected bridge active (only works for HTML format).
logmanoriginal 6 years ago
parent
commit
cd012e115b
2 changed files with 11 additions and 0 deletions
  1. 1 0
      index.php
  2. 10 0
      static/select.js

+ 1 - 0
index.php

@@ -213,6 +213,7 @@ $formats = Format::searchInformation();
 	<title>RSS-Bridge</title>
 	<link href="static/style.css" rel="stylesheet">
 	<script src="static/search.js"></script>
+	<script src="static/select.js"></script>
 	<noscript>
 		<style>
 			.searchbar {

+ 10 - 0
static/select.js

@@ -0,0 +1,10 @@
+function select(){
+	var fragment = window.location.hash.substr(1);
+	var bridge = document.getElementById(fragment);
+
+	if(bridge !== null) {
+		bridge.getElementsByClassName('showmore-box')[0].checked = true;
+	}
+}
+
+document.addEventListener('DOMContentLoaded', select);