changeset 939:6c2f8bb3cc6e draft

Activate direct link to attached files
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 06 Sep 2021 09:11:25 +0900
parents 627a7fdf3e16
children 102c2b14c5d8
files s4-blog.sh s4-main.js
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Tue Aug 17 09:46:29 2021 +0900
+++ b/s4-blog.sh	Mon Sep 06 09:11:25 2021 +0900
@@ -507,6 +507,7 @@
 	for i in $imgids; do
 	  mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}`
 	  _href="href=\"$catlink+$mrid\""
+	  _href_raw="href=\"$catlink+$mrid+raw\""
 	  fn=`echo "${i#*:}"|unhexize`
 	  fnb=$fn"(${sz})"
 	  case "$fn" in
@@ -553,7 +554,8 @@
 	      fi
 	      ;;
 	    *)
-	      echo "<__UNCLICKABLE__><a $_href><img src=\"$deficon\">$fnb</a>"
+	      echo -n "<__UNCLICKABLE__><a $_href><img src=\"$deficon\">$fnb</a>"
+	      echo "[<a ${_href_raw}>Direct</a>]"
 	      ;;
 	  esac
 	done
--- a/s4-main.js	Tue Aug 17 09:46:29 2021 +0900
+++ b/s4-main.js	Mon Sep 06 09:11:25 2021 +0900
@@ -90,8 +90,8 @@
 		text = td.textContent,
 		author = tr.getElementsByTagName("a");
 	    if (author) author = author[0].getAttribute("title");
-	    if (href.match(/\?showattc\+article_m\+([0-9+])/)) {
-		if (td.innerHTML.match(/x読み取り不可/)) {
+	    if (href.match(/\?showattc\+article_m\+([0-9]+)$/)) {
+		if (td.innerHTML.match(/読み取り不可/)) {
 		    a.removeAttribute("href");
 		    continue;
 		}

yatex.org