Revisão | 303378153bd14e35b68d0b37f1fa3d62ebd2da05 (tree) |
---|---|
Hora | 2018-03-21 23:21:53 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/2434 Improve props transfer on Searching
@@ -239,9 +239,9 @@ EOS; | ||
239 | 239 | 'base_uri_pathname' => get_base_uri(PKWK_URI_ROOT), |
240 | 240 | 'base_uri_absolute' => get_base_uri(PKWK_URI_ABSOLUTE) |
241 | 241 | ); |
242 | - $props_json = htmlsc(json_encode($props, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
242 | + $h_props = htmlsc(json_encode($props, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
243 | 243 | $site_props = <<<EOS |
244 | -<div data-key="site-props" data-value="$props_json"></div> | |
244 | +<input type="hidden" class="site-props" value="$h_props" /> | |
245 | 245 | EOS; |
246 | 246 | $h_plugin = htmlsc($plugin); |
247 | 247 | $plugin_prop = <<<EOS |
@@ -96,11 +96,9 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
96 | 96 | } |
97 | 97 | function getSiteProps() { |
98 | 98 | var empty = {}; |
99 | - var propsDiv = document.getElementById('pukiwiki-site-properties'); | |
100 | - if (!propsDiv) return empty; | |
101 | - var jsonE = propsDiv.querySelector('div[data-key="site-props"]'); | |
102 | - if (!jsonE) return empty; | |
103 | - var props = JSON.parse(jsonE.getAttribute('data-value')); | |
99 | + var propsE = document.querySelector('#pukiwiki-site-properties .site-props'); | |
100 | + if (!propsE) return empty; | |
101 | + var props = JSON.parse(propsE.value); | |
104 | 102 | return props || empty; |
105 | 103 | } |
106 | 104 | /** |