Skip to content

Commit

Permalink
Fix Options page. Fixes #97
Browse files Browse the repository at this point in the history
  • Loading branch information
NV committed Sep 25, 2015
1 parent d659ea8 commit de01a7f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chrome/manifest.json
@@ -1,6 +1,6 @@
{
"name": "DevTools Autosave",
"version": "1.2.3",
"version": "1.2.4",
"description": "Saves changes in CSS and JS that was made via Chrome DevTools",

"devtools_page": "devtools.html",
Expand Down
2 changes: 1 addition & 1 deletion chrome/options.css
@@ -1,7 +1,7 @@
html {
background: #E4E3EB url(vertical-stripes.png);
color: #8972A2;
font: 13px Helvetica, sans-serif;
font-family: Helvetica, sans-serif;
}
body {
min-width: 640px;
Expand Down
16 changes: 16 additions & 0 deletions chrome/options.js
Expand Up @@ -527,27 +527,43 @@ NodeList.prototype.setAttribute = function(name, value) {

Object.defineProperty(SVGGElement.prototype, 'x', {
get: function() {
if (!this.dataset) {
this.dataset = {};
}

if (typeof this.dataset.x === 'undefined') {
var matched = this.getAttribute('transform').match(/translate\(([\d.]+),[\d.]+\)/);
this.dataset.x = matched ? matched[1] : 0;
}
return parseInt(this.dataset.x);
},
set: function(x) {
if (!this.dataset) {
this.dataset = {};
}

this.dataset.x = x;
this.setAttribute('transform', 'translate(' + x + ',' + this.y + ')');
}
});

Object.defineProperty(SVGGElement.prototype, 'y', {
get: function() {
if (!this.dataset) {
this.dataset = {};
}

if (typeof this.dataset.y === 'undefined') {
var matched = this.getAttribute('transform').match(/translate\([\d.]+,([\d.]+)\)/);
this.dataset.y = matched ? matched[1] : 0;
}
return parseInt(this.dataset.y);
},
set: function(y) {
if (!this.dataset) {
this.dataset = {};
}

this.dataset.y = y;
this.setAttribute('transform', 'translate(' + this.x + ',' + y + ')');
}
Expand Down

0 comments on commit de01a7f

Please sign in to comment.