From c9b475711b89361b61197cf625decf65c607bc2c Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Wed, 30 Oct 2013 09:59:32 -0500 Subject: [PATCH] switch `chrome.runtime` for `chrome.extension` --- WebContent/background.js | 2 +- WebContent/content.js | 12 ++++++------ WebContent/csseditor.js | 2 +- WebContent/manifest.json | 2 +- WebContent/options.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/WebContent/background.js b/WebContent/background.js index 3b6ff3a..28a866c 100644 --- a/WebContent/background.js +++ b/WebContent/background.js @@ -50,7 +50,7 @@ function refreshMenuEntry() { } function init() { - chrome.extension.onConnect.addListener(function(port) { + chrome.runtime.onConnect.addListener(function(port) { port.onMessage.addListener(function(msg) { var workerFormatter, workerJSONLint, json = msg.json; diff --git a/WebContent/content.js b/WebContent/content.js index 100a5e4..a6bb58c 100644 --- a/WebContent/content.js +++ b/WebContent/content.js @@ -1,4 +1,4 @@ -var port = chrome.extension.connect(), collapsers, options, jsonObject; +var port = chrome.runtime.connect(), collapsers, options, jsonObject; function displayError(error, loc, offset) { var link = document.createElement("link"), pre = document.body.firstChild.firstChild, text = pre.textContent.substring(offset), start = 0, ranges = [], idx = 0, end, range = document @@ -6,7 +6,7 @@ function displayError(error, loc, offset) { .createElement("div"), closeButton = document.createElement("div"); link.rel = "stylesheet"; link.type = "text/css"; - link.href = chrome.extension.getURL("content_error.css"); + link.href = chrome.runtime.getURL("content_error.css"); document.head.appendChild(link); while (idx != -1) { idx = text.indexOf("\n", start); @@ -23,7 +23,7 @@ function displayError(error, loc, offset) { errorPosition.className = "error-position"; errorPosition.id = "error-position"; range.surroundContents(errorPosition); - imgError.src = chrome.extension.getURL("error.gif"); + imgError.src = chrome.runtime.getURL("error.gif"); errorPosition.insertBefore(imgError, errorPosition.firstChild); content.className = "content"; closeButton.className = "close-error"; @@ -41,7 +41,7 @@ function displayError(error, loc, offset) { function displayUI(theme, html) { var statusElement, toolboxElement, expandElement, reduceElement, viewSourceElement, optionsElement, content = ""; - content += ''; + content += ''; content += ""; content += html; document.body.innerHTML = content; @@ -66,7 +66,7 @@ function displayUI(theme, html) { viewSourceElement.href = "view-source:" + location.href; optionsElement = document.createElement("img"); optionsElement.title = "options"; - optionsElement.src = chrome.extension.getURL("options.png"); + optionsElement.src = chrome.runtime.getURL("options.png"); toolboxElement.appendChild(expandElement); toolboxElement.appendChild(reduceElement); toolboxElement.appendChild(viewSourceElement); @@ -79,7 +79,7 @@ function displayUI(theme, html) { expandElement.addEventListener('click', onexpand, false); reduceElement.addEventListener('click', onreduce, false); optionsElement.addEventListener("click", function() { - window.open(chrome.extension.getURL("options.html")); + window.open(chrome.runtime.getURL("options.html")); }, false); copyPathElement.addEventListener("click", function() { port.postMessage({ diff --git a/WebContent/csseditor.js b/WebContent/csseditor.js index 0816c74..fba974d 100644 --- a/WebContent/csseditor.js +++ b/WebContent/csseditor.js @@ -4,7 +4,7 @@ var SAMPLE_PART2 = '
{}
'; var PASSIVE_KEYS = [ "Down", "Up", "Left", "Right", "End", "Home", "PageDown", "PageUp", "Control", "Alt", "Shift", "Insert" ]; - var bgPage = chrome.extension.getBackgroundPage(), editor = document.getElementById("editor"), resetButton = document.getElementById("reset-button"), saveButton = document + var bgPage = chrome.runtime.getBackgroundPage(), editor = document.getElementById("editor"), resetButton = document.getElementById("reset-button"), saveButton = document .getElementById("save-button"), previewer = document.getElementById("previewer").contentWindow, codemirror; function updatePreview() { diff --git a/WebContent/manifest.json b/WebContent/manifest.json index af3aeca..4cb29e8 100644 --- a/WebContent/manifest.json +++ b/WebContent/manifest.json @@ -4,7 +4,7 @@ "16": "jsonview16.png", "48": "jsonview48.png", "128": "jsonview128.png"}, - "version": "0.0.32", + "version": "0.0.32.1", "description": "Validate and view JSON documents", "options_page": "options.html", "background" : { diff --git a/WebContent/options.js b/WebContent/options.js index c8ff7ce..5ccd9d0 100644 --- a/WebContent/options.js +++ b/WebContent/options.js @@ -1,5 +1,5 @@ function initOptions() { - var bgPage = chrome.extension.getBackgroundPage(), options = localStorage.options ? JSON.parse(localStorage.options) : {}; + var bgPage = chrome.runtime.getBackgroundPage(), options = localStorage.options ? JSON.parse(localStorage.options) : {}; var safeMethodInput = document.getElementById("safeMethodInput"), injectInFrameInput = document.getElementById("injectInFrameInput"), addContextMenuInput = document.getElementById("addContextMenuInput"); safeMethodInput.checked = options.safeMethod; injectInFrameInput.checked = options.injectInFrame;