Skip to content

Commit

Permalink
Updates for Chrome 0.4.8, Firefox 1.2.12 and Opera 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispederick committed Feb 16, 2017
1 parent 50e830d commit 36e50dd
Show file tree
Hide file tree
Showing 37 changed files with 220 additions and 169 deletions.
2 changes: 1 addition & 1 deletion configuration/chrome/configuration.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
common.prefix=
description=Adds a toolbar button with various web developer tools. The official port of the Web Developer extension for Firefox.
version=0.4.7
version=0.4.8
2 changes: 1 addition & 1 deletion configuration/firefox/configuration.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
common.prefix=chrome://web-developer/content
description=Adds a menu and a toolbar with various web developer tools.
version=1.2.11
version=1.2.12
2 changes: 1 addition & 1 deletion configuration/firefox/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:maxVersion>49.*</em:maxVersion>
<em:maxVersion>51.*</em:maxVersion>
<em:minVersion>3.6</em:minVersion>
</Description>
</em:targetApplication>
Expand Down
2 changes: 1 addition & 1 deletion configuration/opera/configuration.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
common.prefix=
description=Adds a toolbar button with various web developer tools. The official port of the Web Developer extension for Firefox.
version=0.2.1
version=0.2.2
2 changes: 1 addition & 1 deletion source/chrome/html/overlay/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
<li><a href="#" id="make-form-fields-writable"><span></span></a></li>
<li><a href="#" id="outline-form-fields-without-labels"><span></span></a></li>
<li><a href="#" id="populate-form-fields"><span></span></a></li>
<li><a href="#" id="remove-form-validation"><span></span></a></li>
<li><a href="#" id="remove-maximum-lengths"><span></span></a></li>
<li><a href="#" id="view-form-information"><span></span></a></li>
<li><a href="#" id="disable-form-validation"><span></span></a></li>
</ul>
</div>

Expand Down
5 changes: 1 addition & 4 deletions source/chrome/javascript/overlay/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,7 @@ WebDeveloper.Overlay.Cookies.submitAddCookie = function()
// Toggles cookies
WebDeveloper.Overlay.Cookies.toggleCookies = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("cookies", menu, "http://*/*", "enableCookiesResult", "disableCookiesResult");
WebDeveloper.Overlay.toggleContentSetting("cookies", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("cookies", $(this), "enableCookiesResult", "disableCookiesResult");
};

// Returns true if the add dialog is valid
Expand Down
20 changes: 4 additions & 16 deletions source/chrome/javascript/overlay/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,23 @@ WebDeveloper.Overlay.Disable.resetFeatures = function()
// Toggles JavaScript
WebDeveloper.Overlay.Disable.toggleJavaScript = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("javascript", menu, "http://*/*", "enableJavaScriptResult", "disableJavaScriptResult");
WebDeveloper.Overlay.toggleContentSetting("javascript", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("javascript", $(this), "enableJavaScriptResult", "disableJavaScriptResult");
};

// Toggles notifications
WebDeveloper.Overlay.Disable.toggleNotifications = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("notifications", menu, "http://*/*", "enableNotificationsResult", "disableNotificationsResult");
WebDeveloper.Overlay.toggleContentSetting("notifications", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("notifications", $(this), "enableNotificationsResult", "disableNotificationsResult");
};

// Toggles plugins
WebDeveloper.Overlay.Disable.togglePlugins = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("plugins", menu, "http://*/*", "enablePluginsResult", "disablePluginsResult");
WebDeveloper.Overlay.toggleContentSetting("plugins", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("plugins", $(this), "enablePluginsResult", "disablePluginsResult");
};

// Toggles popups
WebDeveloper.Overlay.Disable.togglePopups = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("popups", menu, "http://*/*", "enablePopupsResult", "disablePopupsResult");
WebDeveloper.Overlay.toggleContentSetting("popups", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("popups", $(this), "enablePopupsResult", "disablePopupsResult");
};
32 changes: 16 additions & 16 deletions source/chrome/javascript/overlay/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ $(function()
$("#make-form-fields-writable").append(WebDeveloper.Locales.getString("makeFormFieldsWritable")).on("click", WebDeveloper.Overlay.Forms.makeFormFieldsWritable);
$("#outline-form-fields-without-labels").append(WebDeveloper.Locales.getString("outlineFormFieldsWithoutLabels")).on("click", WebDeveloper.Overlay.Forms.outlineFormFieldsWithoutLabels);
$("#populate-form-fields").append(WebDeveloper.Locales.getString("populateFormFields")).on("click", WebDeveloper.Overlay.Forms.populateFormFields);
$("#remove-form-validation").append(WebDeveloper.Locales.getString("removeFormValidation")).on("click", WebDeveloper.Overlay.Forms.removeFormValidation);
$("#remove-maximum-lengths").append(WebDeveloper.Locales.getString("removeMaximumLengths")).on("click", WebDeveloper.Overlay.Forms.removeMaximumLengths);
$("#uncheck-all-checkboxes").append(WebDeveloper.Locales.getString("uncheckAllCheckboxes")).on("click", WebDeveloper.Overlay.Forms.uncheckAllCheckboxes);
$("#view-form-information").append(WebDeveloper.Locales.getString("viewFormInformation")).on("click", WebDeveloper.Overlay.Forms.viewFormInformation);
$("#disable-form-validation").append(WebDeveloper.Locales.getString("disableFormValidation")).on("click", WebDeveloper.Overlay.Forms.disableFormValidation);
});

// Adds a feature on a tab
Expand Down Expand Up @@ -248,6 +248,21 @@ WebDeveloper.Overlay.Forms.populateFormFields = function()
});
};

// Removes validation on all form fields
WebDeveloper.Overlay.Forms.removeFormValidation = function()
{
var featureItem = $(this);

WebDeveloper.Overlay.getSelectedTab(function(tab)
{
// If the tab is valid
if(WebDeveloper.Overlay.isValidTab(tab))
{
WebDeveloper.Overlay.Forms.addFeatureOnTab(featureItem, tab, "WebDeveloper.Forms.removeFormValidation([document]);");
}
});
};

// Removes maximum lengths from all elements
WebDeveloper.Overlay.Forms.removeMaximumLengths = function()
{
Expand Down Expand Up @@ -299,18 +314,3 @@ WebDeveloper.Overlay.Forms.viewFormInformation = function()
}
});
};

// Disables HTML5 validation
WebDeveloper.Overlay.Forms.disableFormValidation = function()
{
var featureItem = $(this);

WebDeveloper.Overlay.getSelectedTab(function(tab)
{
// If the tab is valid
if(WebDeveloper.Overlay.isValidTab(tab))
{
WebDeveloper.Overlay.Forms.addFeatureOnTab(featureItem, tab, "WebDeveloper.Forms.disableFormValidation([document]);");
}
});
};
5 changes: 1 addition & 4 deletions source/chrome/javascript/overlay/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,7 @@ WebDeveloper.Overlay.Images.toggleFeatureOnTab = function(featureItem, tab, scri
// Toggles images
WebDeveloper.Overlay.Images.toggleImages = function()
{
var menu = $(this);

WebDeveloper.Overlay.toggleContentSetting("images", menu, "http://*/*", "enableImagesResult", "disableImagesResult");
WebDeveloper.Overlay.toggleContentSetting("images", menu, "https://*/*");
WebDeveloper.Overlay.toggleContentSetting("images", $(this), "enableImagesResult", "disableImagesResult");
};

// Displays all the images
Expand Down
44 changes: 13 additions & 31 deletions source/chrome/javascript/overlay/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,43 +266,27 @@ WebDeveloper.Overlay.openURL = function(event)
};

// Toggles a content setting
WebDeveloper.Overlay.toggleContentSetting = function(settingType, menu, url, enableMessage, disableMessage)
WebDeveloper.Overlay.toggleContentSetting = function(settingType, menu, enableMessage, disableMessage)
{
chrome.contentSettings[settingType].get({ primaryUrl: url }, function(details)
chrome.contentSettings[settingType].get({ primaryUrl: "http://*/*" }, function(details)
{
var callback = null;
var setting = details.setting;

// If the setting is currently set to block
if(setting == "block")
// If the setting is currently set to allow
if(details.setting == "allow")
{
setting = "allow";
chrome.contentSettings[settingType].set({ primaryPattern: "<all_urls>", setting: "block" }, function()
{
WebDeveloper.Overlay.updateContentSettingMenu(menu, settingType);
WebDeveloper.Overlay.displayNotification(WebDeveloper.Locales.getString(disableMessage));
});
}
else
{
setting = "block";
}

// If the enable and disable message are set
if(enableMessage && disableMessage)
{
callback = function()
chrome.contentSettings[settingType].clear({}, function()
{
WebDeveloper.Overlay.updateContentSettingMenu(menu, settingType);

// If the setting is being allowed
if(setting == "allow")
{
WebDeveloper.Overlay.displayNotification(WebDeveloper.Locales.getString(enableMessage));
}
else
{
WebDeveloper.Overlay.displayNotification(WebDeveloper.Locales.getString(disableMessage));
}
};
WebDeveloper.Overlay.displayNotification(WebDeveloper.Locales.getString(enableMessage));
});
}

chrome.contentSettings[settingType].set({ primaryPattern: url, setting: setting }, callback);
});
};

Expand Down Expand Up @@ -333,10 +317,8 @@ WebDeveloper.Overlay.updateContentSettingMenu = function(menu, settingType)
{
chrome.contentSettings[settingType].get({ primaryUrl: "http://*/*" }, function(details)
{
var setting = details.setting;

// If the setting is currently set to block
if(setting == "block")
if(details.setting == "block")
{
menu.addClass("active");
}
Expand Down
2 changes: 1 addition & 1 deletion source/chrome/javascript/overlay/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WebDeveloper.Overlay.Tools.customTool = function()

WebDeveloper.Overlay.getSelectedTab(function(tab)
{
WebDeveloper.Overlay.openTab(featureItem.data("url") + tab.url);
WebDeveloper.Overlay.openTab(featureItem.data("url") + encodeURIComponent(tab.url));
});
};

Expand Down
38 changes: 37 additions & 1 deletion source/chrome/javascript/upgrade/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@ var WebDeveloper = WebDeveloper || {}; // eslint-disable-line no-use-before-defi

WebDeveloper.Upgrade = WebDeveloper.Upgrade || {};

// Fixes a content setting
WebDeveloper.Upgrade.fixContentSetting = function(settingType)
{
chrome.contentSettings[settingType].get({ primaryUrl: "http://*/*" }, function(details)
{
// If the setting is currently set to allow
if(details.setting == "allow")
{
chrome.contentSettings[settingType].clear({});
}
});
};

// Fixes the content settings
WebDeveloper.Upgrade.fixContentSettings = function()
{
// If content settings exists
if(chrome.contentSettings)
{
var settingTypes = ["cookies", "images", "javascript", "notifications", "plugins", "popups"];

// Loop through the setting types
for(var i = 0, l = settingTypes.length; i < l; i++)
{
WebDeveloper.Upgrade.fixContentSetting(settingTypes[i]);
}
}
};

// Migrates the tools
WebDeveloper.Upgrade.migrateTools = function()
{
Expand Down Expand Up @@ -82,7 +111,8 @@ WebDeveloper.Upgrade.setupDefaultOptions = function()
// Upgrades the extension
WebDeveloper.Upgrade.upgrade = function()
{
var previousVersion = WebDeveloper.Storage.getItem("version");
var contentSettingsVersion = "0.4.8";
var previousVersion = WebDeveloper.Storage.getItem("version");

// If the versions do not match
if(previousVersion != "@version@")
Expand All @@ -92,6 +122,12 @@ WebDeveloper.Upgrade.upgrade = function()
WebDeveloper.Upgrade.migrateTools();
}

// If this is the content settings version
if(contentSettingsVersion == "@version@")
{
WebDeveloper.Upgrade.fixContentSettings();
}

WebDeveloper.Upgrade.setupDefaultOptions();
};

Expand Down
22 changes: 11 additions & 11 deletions source/chrome/locales/en_US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,10 @@
"makeFormFieldsWritable": { "message": "Make Form Fields Writable" },
"outlineFormFieldsWithoutLabels": { "message": "Outline Form Fields Without Labels" },
"populateFormFields": { "message": "Populate Form Fields" },
"removeFormValidation": { "message": "Remove Form Validation" },
"removeMaximumLengths": { "message": "Remove Maximum Lengths" },
"uncheckAllCheckboxes": { "message": "Uncheck All Checkboxes" },
"viewFormInformation": { "message": "View Form Information" },
"disableFormValidation": { "message": "Disable HTML5 Validation" },
"disableFormValidationSingleResult": { "message": "1 validation element was disabled." },
"disableFormValidationMultipleResult": { "message": "$count$ validation elements were disabled.", "placeholders": { "count": { "content": "$1" } } },

"disableImages": { "message": "Disable Images" },
"displayAltAttributes": { "message": "Display Alt Attributes" },
Expand Down Expand Up @@ -270,10 +268,10 @@
"descriptionCannotBeEmpty": { "message": "The description cannot be empty." },
"disableCookiesResult": { "message": "Cookies have been disabled." },
"disableImagesResult": { "message": "Images have been disabled." },
"disableJavaScriptResult": { "message": "JavaScript has been disabled for all sites." },
"disableNotificationsResult": { "message": "Notifications have been disabled for all sites." },
"disablePluginsResult": { "message": "Plugins have been disabled for all sites." },
"disablePopupsResult": { "message": "Popups have been disabled for all sites." },
"disableJavaScriptResult": { "message": "JavaScript has been disabled." },
"disableNotificationsResult": { "message": "Notifications have been disabled." },
"disablePluginsResult": { "message": "Plugins have been disabled." },
"disablePopupsResult": { "message": "Popups have been disabled." },
"displayPasswordsSingleResult": { "message": "1 password displayed." },
"displayPasswordsMultipleResult": { "message": "$count$ passwords displayed.", "placeholders": { "count": { "content": "$1" } } },
"displayWindowSizeResult": { "message": "Window: $outerWidth$px x $outerHeight$px &nbsp;&nbsp;&nbsp; Viewport: $innerWidth$px x $innerHeight$px", "placeholders": { "outerWidth": { "content": "$1" }, "outerHeight": { "content": "$2" }, "innerWidth": { "content": "$3" }, "innerHeight": { "content": "$4" } } },
Expand All @@ -291,10 +289,10 @@
"enableFormFieldsSingleResult": { "message": "1 form field enabled." },
"enableFormFieldsMultipleResult": { "message": "$count$ form fields enabled.", "placeholders": { "count": { "content": "$1" } } },
"enableImagesResult": { "message": "Images have been enabled." },
"enableJavaScriptResult": { "message": "JavaScript has been enabled for all sites. <a href=\"@url@/help/#allow-notifications\" class=\"alert-link\" target=\"_blank\">Why all sites?</a>" },
"enableNotificationsResult": { "message": "Notifications have been enabled for all sites. <a href=\"@url@/help/#allow-notifications\" class=\"alert-link\" target=\"_blank\">Why all sites?</a>" },
"enablePluginsResult": { "message": "Plugins have been enabled for all sites. <a href=\"@url@/help/#allow-notifications\" class=\"alert-link\" target=\"_blank\">Why all sites?</a>" },
"enablePopupsResult": { "message": "Popups have been enabled for all sites. <a href=\"@url@/help/#allow-notifications\" class=\"alert-link\" target=\"_blank\">Why all sites?</a>" },
"enableJavaScriptResult": { "message": "JavaScript has been enabled." },
"enableNotificationsResult": { "message": "Notifications have been enabled." },
"enablePluginsResult": { "message": "Plugins have been enabled." },
"enablePopupsResult": { "message": "Popups have been enabled." },
"endPositionX": { "message": "End Position: X =" },
"expandAll": { "message": "Expand all" },
"expandSelectElementsSingleResult": { "message": "1 select element expanded." },
Expand Down Expand Up @@ -335,6 +333,8 @@
"reloadImagesResult": { "message": "The images have been reloaded." },
"reloadLayouts": { "message": "Reload Layouts" },
"reloadLinkedStyleSheetsResult": { "message": "The linked style sheets have been reloaded." },
"removeFormValidationMultipleResult": { "message": "Removed validation from $count$ form fields.", "placeholders": { "count": { "content": "$1" } } },
"removeFormValidationSingleResult": { "message": "Removed validation from 1 form field." },
"removeMaximumLengthsSingleResult": { "message": "Removed maximum length from 1 form field." },
"removeMaximumLengthsMultipleResult": { "message": "Removed maximum length from $count$ form fields.", "placeholders": { "count": { "content": "$1" } } },
"resetDisableFeatures": { "message": "Reset Disable Features" },
Expand Down
5 changes: 2 additions & 3 deletions source/common/javascript/dashboard/element-information.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ WebDeveloper.ElementInformation.generateTextInformation = function(element, cont
var textInformation = generatedDocument.createElement("div");
var textContent = "";

childElement.appendChild(contentDocument.createTextNode(WebDeveloper.ElementInformation.getLocaleString("text")));

childElement.appendChild(generatedDocument.createTextNode(WebDeveloper.ElementInformation.getLocaleString("text")));
textInformation.setAttribute("class", "col-sm-6 web-developer-css");
textInformation.appendChild(childElement);

Expand All @@ -350,7 +349,7 @@ WebDeveloper.ElementInformation.generateTextInformation = function(element, cont
textContent = textContent.trim();
}

childElement.appendChild(contentDocument.createTextNode(textContent));
childElement.appendChild(generatedDocument.createTextNode(textContent));
textInformation.appendChild(childElement);

return textInformation;
Expand Down
Loading

0 comments on commit 36e50dd

Please sign in to comment.