Skip to content

Commit

Permalink
Merge pull request #3 from Ictinus/develop
Browse files Browse the repository at this point in the history
Ready for Release 1.2.3
  • Loading branch information
Ictinus committed Jul 27, 2014
2 parents 5555e24 + e5c44e7 commit c88e289
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 429 deletions.
36 changes: 25 additions & 11 deletions embeddedXMLViewer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
var iibpd = {
debug: false,
options: {
discardMetadata: true,
hide_metadata: true,
autoOpenDepth: 1
},

simulateClick: function (elem) {
var evt = document.createEvent("MouseEvents");
Expand Down Expand Up @@ -50,22 +55,25 @@ var iibpd = {

loadOptions: function () {
chrome.storage.sync.get({
hide_metadata: true
discardMetadata: true,
hide_metadata: true,
autoOpenDepth: 1
}, function (items) {
iibpd.hide_metadata = items.hide_metadata;
iibpd.processConfigOptions();
iibpd.options.discardMetadata = items.discardMetadata;
iibpd.options.hide_metadata = items.hide_metadata;
iibpd.options.autoOpenDepth = items.autoOpenDepth;
var element, arrEl = document.getElementsByTagName('pre');
for (var i=0; i < arrEl.length; i++) {
element = arrEl[i];
LoadXMLString(element, element.textContent);
}
});
},

init: function () {
var element, arrEl = document.getElementsByTagName('pre');
for (var i=0; i < arrEl.length; i++) {
element = arrEl[i];
LoadXMLString(element, Encoder.htmlDecode(element.innerHTML));
}
document.addEventListener("keydown", iibpd.processKey, true);
iibpd.loadOptions();

document.addEventListener("keydown", iibpd.processKey, true);
chrome.storage.onChanged.addListener(function (changes, namespace) {
for (key in changes) {
var storageChange = changes[key];
Expand All @@ -78,9 +86,15 @@ var iibpd = {
storageChange.newValue);
}
if (key === "hide_metadata") {
iibpd.hide_metadata = storageChange.newValue;
iibpd.options.hide_metadata = storageChange.newValue;
iibpd.processConfigOptions();
}
if (key === "autoOpenDepth") {
iibpd.options.autoOpenDepth = storageChange.newValue;
}
if (key === "discardMetadata") {
iibpd.options.discardMetadata = storageChange.newValue;
}
}
});
},
Expand All @@ -90,7 +104,7 @@ var iibpd = {
var arrMetadata = document.querySelectorAll("div.metadata");
for (var i=0; i < arrMetadata.length; i++) {
if (!!arrMetadata[i]) {
arrMetadata[i].classList.toggle("hide_metadata", iibpd.hide_metadata);
arrMetadata[i].classList.toggle("hide_metadata", iibpd.options.hide_metadata);
}
}
},
Expand Down
243 changes: 0 additions & 243 deletions encoder.js

This file was deleted.

48 changes: 31 additions & 17 deletions loadxml.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
@charset "utf-8";
/* CSS Document */
pre {
/* using line-height rather than Element.padding so to ease max-height calculations*/
line-height: 1.5em;
}
.Utility {
color: black;
}
color: black;
}
.NodeName {
font-weight:bold;
color: #800080;
color: #800080;
}
.AttributeName {
font-weight:bold;
Expand All @@ -17,14 +21,35 @@
.NodeValue {
color: green;
}
.endTag {
opacity: 1;
transition: opacity .50s ease-in-out;
}
.fade {
opacity: 0;
transition: opacity .25s ease-in-out;
}
.Element {
border-left-color:#C2C2C2;
border-left-width:thin;
border-left-style:solid;
padding-top:0px;
/*margin-top:10px;*/
margin: 2px 0px;
padding: 0px 0px;
position: relative;

/*max-height: set by javascript*/
overflow: hidden;
/*opacity: 1;*/
transition: max-height 0.4s ease-in-out;/*, opacity .5s ease-in;*/
}
.Element > .Element {
left:15px;
}
.Element_hide, .hide_metadata {
max-height: 0 !important;
/*opacity: 0;*/
transition: max-height 0.4s ease-in-out; /*, opacity .5s ease-out;*/
overflow: hidden;

}
.Clickable {
font-weight:900;
Expand All @@ -36,14 +61,3 @@
vertical-align:middle;
user-select: none;
}

.metadata {
max-height: 1000px;
overflow: hidden;
transition: max-height 0.8s ease-in;
}
.hide_metadata {
max-height: 0;
transition: max-height 0.8s ease-out;
overflow: hidden;
}
Loading

0 comments on commit c88e289

Please sign in to comment.