Skip to content

Instantly share code, notes, and snippets.

@yobukodori
Last active November 11, 2017 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yobukodori/8ee65f4cf5c8b941a97a8f2c50fb94ad to your computer and use it in GitHub Desktop.
Save yobukodori/8ee65f4cf5c8b941a97a8f2c50fb94ad to your computer and use it in GitHub Desktop.
スマホサイト(モバイル用ウェブページ)を拡大(ズーム、拡大縮小)できるようにする(android版firefox/chrome用) Enable zoom on mobile website. (for firefox/chrome on android)
// ==UserScript==
// Note: I have NEVER posted this gist to SNIP2CODE.
// @name Zoom Me! for firefox/chrome
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description モバイル用ウェブページをズーム(拡大縮小)できるようにする(android版firefox/chrome用)
// @description enable zoom on mobile website (for firefox/chrome on android)
// @author yobukodori
// @match http*://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var d = document, e, s, i, temp, sc = "";
e = d.querySelector('meta[name="viewport"]');
if (e){
s = e.content;
while (s.length > 0){
if ((i = s.search(/[,;]/)) >= 0){
temp = s.substr(0, i);
s = s.substr(i+1);
}
else {
temp = s;
s = "";
}
if (! /^\s*(user-scalable|(max|min)imum-scale)\s*=/.test(temp)){
sc += "," + temp;
}
}
e.parentNode.removeChild(e);
}
sc += ", user-scalable=yes, minimum-scale=0, maximum-scale=10";
e = d.createElement("meta");
e.name = "viewport";
e.content = sc.substr(1); // remove ","
d.getElementsByTagName("head")[0].appendChild(e);
console.log(e.content);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment