iTunes AppStore QR code

Add QRCode to iTunes AppStore page.

As of 14.10.2018. See апошняя версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         iTunes AppStore QR code
// @namespace    https://www.iplaysoft.com
// @version      0.5
// @description  Add QRCode to iTunes AppStore page.
// @author       X-Force
// @match        https://itunes.apple.com/*
// @grant        none
// @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require https://greatest.deepsurf.us/scripts/373256-qrcode-js/code/QRCode-Js.js?version=636795
// ==/UserScript==

(function() {
    if(document.title.match("Mac App Store")==null){
        var url = location.href.split('#')[0];
        var regex = /\/id([0-9]+)/;
        var match = url.match(regex);
        var id = null;
        if(match!==null){
            id = match[1];
        }
        if(id!==null){
            var xurl = "itmss://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id="+id+"&mt=8&at=10laHZ";
            var mydiv = document.createElement("div");
            var html = '<style>#xf_itunes_link{display: inline-block;padding: 8px 22px;background: #228fff;color: #fff;font-size: 16px;border-radius: 6px;}#xf_itunes_link:hover{text-decoration:none}</style>';
            html = html + '<a id="xf_itunes_link" href="'+xurl+'">在 iTunes 中查看</a>';
            html = html + '<div id="qrcode" style="position:absolute;right:2px;top:10px;width:260px;height:260px"></div>';
            mydiv.innerHTML = html;
            document.getElementsByClassName("product-header")[0].appendChild(mydiv);
            document.getElementsByClassName("product-hero")[0].style.position="relative";
            var qrcode = new QRCode(document.getElementById("qrcode"), {
                text: url+'&at=10laHZ',
                width: 260,
                height: 260,
                colorDark : "#000000",
                colorLight : "#ffffff",
                correctLevel : QRCode.CorrectLevel.H
            });
        }
    }
})();