Skip to content

Commit

Permalink
fixed issue Sneezry#12
Browse files Browse the repository at this point in the history
  • Loading branch information
Sneezry committed Apr 30, 2015
1 parent 20b1853 commit 89336ea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ body {
font-family: arial, 'Microsoft YaHei';
cursor: default;
-webkit-user-select: none;
transform-origin: left top;
}

#header,
Expand Down
30 changes: 30 additions & 0 deletions javascript/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,34 @@ function getNewHotpCode() {
});
}

function getZoom() {
var zoomList = [25, 33, 50, 67, 75, 90, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500];
var zoom = Math.round(((window.outerWidth) / window.innerWidth)*100);
console.log(zoom)
var zoomDiff = -1;
for (var i = 0; i < zoomList.length; i++) {
if (zoomDiff < 0 || Math.abs(zoom - zoomList[i]) < zoomDiff) {
zoomDiff = Math.abs(zoom - zoomList[i]);
} else {
zoom = zoomList[i - 1];
break;
}
}
if (zoomList.indexOf(zoom) === -1) {
zoom = 500;
}
return zoom;
}

function rezoom() {
var zoom = getZoom();
if (zoom > 100) {
document.body.style.height = 480 * 100 / zoom + 'px';
document.body.style.marginRight = 320 * (100 / zoom - 1) + 'px';
document.body.style.transform = 'scale(' + (100 / zoom) + ')';
}
}

(function () {
var clientTime = new Date();
clientTime = Math.floor(clientTime.getTime() / 1000 / 3600 / 24);
Expand Down Expand Up @@ -909,3 +937,5 @@ function getNewHotpCode() {
}
}
})();

setTimeout(rezoom, 200);
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extName__",
"short_name": "__MSG_extShortName__",
"version": "4.10",
"version": "4.11",
"default_locale": "en",
"description": "__MSG_extDesc__",
"icons": {
Expand Down

0 comments on commit 89336ea

Please sign in to comment.