• R/O
  • HTTP
  • SSH
  • HTTPS

pukiwiki: Commit


Commit MetaInfo

Revision4f66465183e77b916ac802a5c9d78bf894c0cee9 (tree)
Time2018-04-11 21:57:13
Authorumorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2431 topicpath-title: ensure a.textContent == page

Change Summary

Incremental Difference

--- a/lib/html.php
+++ b/lib/html.php
@@ -250,7 +250,11 @@ EOS;
250250 $plugin_prop = <<<EOS
251251 <input type="hidden" class="plugin-name" value="$h_plugin" />
252252 EOS;
253-
253+ // Page name
254+ $h_page_name = htmlsc($page);
255+ $page_name_data = <<<EOS
256+<input type="hidden" class="page-name" value="$h_page_name" />
257+EOS;
254258 // AutoTicketLink
255259 $filtered_ticket_link_sites = array();
256260 foreach ($ticket_link_sites as $s) {
@@ -287,6 +291,7 @@ EOS;
287291 <div id="pukiwiki-site-properties" style="display:none;">
288292 $site_props
289293 $plugin_prop
294+$page_name_data
290295 $ticketlink_data
291296 $external_link_cushion_data
292297 $topicpath_data
--- a/skin/main.js
+++ b/skin/main.js
@@ -467,7 +467,13 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
467467 });
468468 }
469469 function makeTopicpathTitle() {
470- var topicpathE = document.querySelector('#pukiwiki-site-properties .topicpath-links');
470+ if (!document.createDocumentFragment || !window.JSON) return;
471+ var sitePropE = document.querySelector('#pukiwiki-site-properties');
472+ if (!sitePropE) return;
473+ var pageNameE = sitePropE.querySelector('.page-name');
474+ if (!pageNameE || !pageNameE.value) return;
475+ var pageName = pageNameE.value;
476+ var topicpathE = sitePropE.querySelector('.topicpath-links');
471477 if (!topicpathE || !topicpathE.value) return;
472478 var topicpathLinks = JSON.parse(topicpathE.value);
473479 if (!topicpathLinks) return;
@@ -477,6 +483,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function(
477483 if (!aList || aList.length > 1) return;
478484 var a = titleH1.querySelector('a');
479485 if (!a) return;
486+ if (a.textContent !== pageName) return;
480487 var fragment = document.createDocumentFragment();
481488 for (var i = 0, n = topicpathLinks.length; i < n; i++) {
482489 var path = topicpathLinks[i];
Show on old repository browser