no title [bookmarklet]

    
      
  • /*
     * @title bookmarklet
     * @description my bookmarklet
     * @include http://*
     * @license MIT License
     * @require 
     */
    javascript:(function(){if(window.location.host=="www.amazon.co.jp"&&(window.location.href.match(/http:\/\/(www\.)?amazon\.co\.jp\/.+\/dp\/(\d+)/)||window.location.href.match(/http:\/\/(www\.)?amazon\.co\.jp\/gp\/product\/(\d+)\/.+/))){var information={};information["title"]=document.getElementById("productTitle").innerText;information["author"]=Array.prototype.map.call(document.getElementsByClassName("author"),function(x){if(x.className=="author notFaded"){return x.innerText}else if(x.className=="author"){return x.childNodes[1].innerText+x.childNodes[3].innerText.replace(/\s+/g,"")}}).join("");Array.prototype.filter.call(document.getElementsByClassName("bucket"),function(x){return x.nodeName=="TD"})[0].innerText.split("\n").forEach(function(e){var regexp_res=null;if((regexp_res=e.match(/出版社\:(.+)|発売日:\s+(.+)|ISBN\-10\:\s+(\d+)/))){switch(e[0]){case"出":information["publisher"]=regexp_res[1];break;case"I":information["ISBN"]=regexp_res[3];break;case"発":information["year"]=regexp_res[2];break}}});if(["title","author","publisher","ISBN","year"].map(function(x){return information[x]}).every(function(x){return x!=""&&x!=undefined})){var data={title:information["title"],author:information["author"],publisher:information["publisher"],year:information["year"].split("/")[0],isbn:information["ISBN"],nametext:__MEDIACENTER_EXT_NAMETEXT__,student_id:__MEDIACENTER_EXT_STUDENT_ID__,email:__MEDIACENTER_EXT_EMAIL_ADDRESS__,belong:__MEDIACENTER_EXT_BELONG__,notice:"on"};var query=Object.keys(data).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(data[e])}).join("&");window.open("http://localhost:4567/api/purchase/req?"+query,"Mediareq","width=610, height=420, menubar=no, toolbar=no, scrollbars=yes")}else{alert("申し訳ありませんが、リクエストに必要な情報をこのページから取得する事ができませんでした。")}}else{alert("Amazon.co.jpの商品ページで実行してください")}})();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2015/01/28 17:28:42 - 2015-01-28
  2. 2015/01/28 17:27:45 - 2015-01-28