2013-07-16 21:28:13 +04:00
|
|
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
var gWebDeveloper = {
|
2014-07-22 00:32:44 +04:00
|
|
|
validateThisPage: function() {
|
2013-07-16 21:28:13 +04:00
|
|
|
var service = GetLocalizedStringPref("browser.validate.html.service");
|
|
|
|
var uri = getBrowser().currentURI;
|
|
|
|
var checkURL = service + encodeURIComponent(uri.spec);
|
2013-09-14 14:31:33 +04:00
|
|
|
var opentab = Services.prefs.getBoolPref("browser.tabs.opentabfor.middleclick");
|
|
|
|
openUILinkIn(checkURL, opentab ? "tabfocused" : "window",
|
|
|
|
{ referrerURI: uri, relatedToCurrent: true });
|
2013-07-16 21:28:13 +04:00
|
|
|
},
|
|
|
|
|
2014-07-22 00:32:44 +04:00
|
|
|
enableDebugger: function(aItem) {
|
|
|
|
var shouldEnable = aItem.getAttribute("checked") == "true";
|
|
|
|
Services.prefs.setBoolPref("devtools.debugger.remote-enabled", shouldEnable);
|
|
|
|
},
|
|
|
|
|
|
|
|
handleEvent: function(aEvent) {
|
|
|
|
switch (aEvent.type) {
|
|
|
|
case "load":
|
|
|
|
window.removeEventListener("load", gWebDeveloper, false);
|
|
|
|
var popup = document.getElementById("toolsPopup");
|
|
|
|
popup.addEventListener("popupshowing", gWebDeveloper, false);
|
|
|
|
break;
|
|
|
|
case "popupshowing":
|
|
|
|
this.initMenuItems();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initMenuItems: function() {
|
2013-07-16 21:28:13 +04:00
|
|
|
var menuitem = document.getElementById("validatePage");
|
|
|
|
var uri = getBrowser().currentURI;
|
|
|
|
if (uri && (uri.schemeIs("http") || uri.schemeIs("https")))
|
|
|
|
menuitem.removeAttribute("disabled");
|
|
|
|
else
|
|
|
|
menuitem.setAttribute("disabled", true);
|
|
|
|
|
2014-07-22 00:32:44 +04:00
|
|
|
var enabled = Services.prefs
|
|
|
|
.getBoolPref("devtools.debugger.remote-enabled");
|
|
|
|
document.getElementById("devtoolsDebugger")
|
|
|
|
.setAttribute("checked", enabled);
|
|
|
|
},
|
2013-07-16 21:28:13 +04:00
|
|
|
}
|
|
|
|
|
2014-07-22 00:32:44 +04:00
|
|
|
window.addEventListener("load", gWebDeveloper, false);
|