| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「MediaWiki:Common.js」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
 
4行目: 4行目:
 
$(function () {
 
$(function () {
 
   $(".amazonlink").each(function(){
 
   $(".amazonlink").each(function(){
       var asin = $(this).find("img").attr("alt").slice(0,10);
+
       var asin = $(this).find("img").attr("alt");
 +
      asin = asin.slice(0, asin.indexOf('.'));
 
       $(this).click(function() {       
 
       $(this).click(function() {       
 
         window.location.href = "https://www.amazon.co.jp/exec/obidos/ASIN/" + asin + "/typea09-22";
 
         window.location.href = "https://www.amazon.co.jp/exec/obidos/ASIN/" + asin + "/typea09-22";

2020年2月13日 (木) 08:34時点における版

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */

// Template:Amazon に 画面遷移を付与
$(function () {
  $(".amazonlink").each(function(){
       var asin = $(this).find("img").attr("alt");
       asin = asin.slice(0, asin.indexOf('.'));
       $(this).click(function() {       
         window.location.href = "https://www.amazon.co.jp/exec/obidos/ASIN/" + asin + "/typea09-22";
       })
  });
}());