Skip to content

Commit

Permalink
Merge pull request #220 from TheWebTech/feature-developer-menu-updates
Browse files Browse the repository at this point in the history
Feature developer menu updates
  • Loading branch information
TheWebTech authored Apr 16, 2019
2 parents 377b51d + 44e749d commit 76371c8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ While this is not an official HubSpot brand product, HubSpot's developers are aw

We claim no legal rights to the HubSpot name/brand. We have posed the question of if it was okay to have the name HubSpot in the extension's name. It appears atleast for now HubSpot is okay with us using the name. We have no intention of misrepresenting the affiliation to HubSpot, but we also do appreciate being able to use the name, as without it - it would be harder for people to find.

## Supported Browsers
Officially currently we only support Google Chrome. That said the extension should work on:
* Chromium and most chromium based browsers.
* Opera (not directly, but through tools like: https://addons.opera.com/en/extensions/details/install-chrome-extensions/)
* We plan to support Microsoft Edge once it's Chromium version becomes public.

Firefox cannot run the extension. We do however want to support Firefox but need developers willing to help port it.
[We have already gathered information on how to do it.](https://github.com/TheWebTech/HubSpot-Developer-Extension/issues/51)

## How to Contribute:

1. [Read this first!](https://github.com/williamspiro/HubSpot-Developer-Extension/blob/master/CONTRIBUTING.md)
Expand Down
59 changes: 25 additions & 34 deletions design-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $(document).ready(function() {

/*trackClick sends the click event to the background js which has google analytics set up, this prevents google analytics running on the page and means the extension can only track it's own events.*/
function trackClick(eventName) { /*Analytics*/
//console.log("trackClick run");
chrome.runtime.sendMessage({ trackClick: eventName }, function(response) {
//console.log(response.farewell);
});
Expand Down Expand Up @@ -63,9 +64,9 @@ $(document).ready(function() {
} else if (currentScreen === "blog") {
//document.title = "📰Bl|"+portal+"|HS";
document.title = "Bl|" + portal + "|HS";
} else if (currentScreen === "url-mappings") {
} else if (currentScreen === "url-redirects") {
//document.title = "🔀UM|"+portal+"|HS";
document.title = "UM|" + portal + "|HS";
document.title = "UR|" + portal + "|HS";
}
}

Expand Down Expand Up @@ -213,19 +214,19 @@ $(document).ready(function() {
if (~tabUrl.indexOf("/blog/")) {
currentScreen = "blog";
}
if (~tabUrl.indexOf("/url-mappings")) {
currentScreen = "url-mappings";
if (~tabUrl.indexOf("/url-redirects")) {
currentScreen = "url-redirects";
}
chrome.storage.sync.get([
'uitweaks'
], function(items) {
if (items.uitweaks) {
if (currentScreen == "design-manager") {


waitForEl(".account-name", function() {
setTitle($(".account-name").text());
});
}
waitForEl(".account-name", function() {
setTitle($(".account-name").text());
});


function generateDevMenuItem(buttonLabel, hubId, url) {
/*expects button label string, hubId string, url string.*/
Expand All @@ -241,13 +242,16 @@ $(document).ready(function() {

function generateAllMenuItems(hubId) {
var html = generateDevMenuItem("Design Manager", hubId, "https://app.hubspot.com/design-manager/_HUB_ID_");
html += generateDevMenuItem("Content Staging", hubId, "https://app.hubspot.com/content/_HUB_ID_/staging/");
html += generateDevMenuItem("Website Pages", hubId, "https://app.hubspot.com/pages/_HUB_ID_/manage/site/domain/all/listing/all");
html += generateDevMenuItem("HubDB", hubId, "https://app.hubspot.com/hubdb/_HUB_ID_");
html += generateDevMenuItem("File Manager", hubId, "https://app.hubspot.com/file-manager-beta/_HUB_ID_");
html += generateDevMenuItem("Content Staging", hubId, "https://app.hubspot.com/content/_HUB_ID_/staging/");
html += generateDevMenuItem("Advanced Menus", hubId, "https://app.hubspot.com/settings/_HUB_ID_/website/navigation");
html += generateDevMenuItem("Content Settings", hubId, "https://app.hubspot.com/settings/_HUB_ID_/website/pages/all-domains/page-templates");
html += generateDevMenuItem("URL Mappings", hubId, "https://app.hubspot.com/content/_HUB_ID_/url-redirects");
html += generateDevMenuItem("URL Redirects", hubId, "https://app.hubspot.com/domains/_HUB_ID_/url-redirects");
html += generateDevMenuItem("Marketplace", hubId, "https://app.hubspot.com/marketplace/_HUB_ID_/products");


return html;
}

Expand All @@ -268,9 +272,14 @@ $(document).ready(function() {
html += '</div>';
html += '</li>';



$(".nav-links ul.primary-links>li:first-child").after(html);

$("#ext-dev-menu-wrapper > a").click(function(e) {
e.preventDefault();

//console.log("dev menu clicked!");
e.preventDefault();
/*$("#ext-dev-menu").toggleClass("expansion");*/

//$("#ext-dev-menu").toggle();
Expand All @@ -288,30 +297,11 @@ $(document).ready(function() {
});

$("#ext-dev-menu .navSecondaryLink, #ext-dev-menu .devMenuLink").click(function() {
console.log("track click");
var linkName = "devMenu:" + $(this).data("ext-track");
console.log(linkName);
//console.log("track click");
var linkName = "devMenu:" + $(this).text();
//console.log(linkName);
trackClick(linkName);
});

$(".nav-links ul.primary-links>li:first-child").after(html);

$("#ext-dev-menu-wrapper > a").click(function(e) {
e.preventDefault();
//console.log("dev menu clicked!");
/*$("#ext-dev-menu").toggleClass("expansion");*/

//$("#ext-dev-menu").toggle();

var isExpanded = $(this).attr('aria-expanded');

if (isExpanded === "true") {
$(this).attr("aria-expanded", "false");
} else {
$(this).attr("aria-expanded", "true");
}
$(this).parent("li").toggleClass("active");
});
}

/*get current HubSpot ID*/
Expand All @@ -330,4 +320,5 @@ $(document).ready(function() {
} else {
//console.log("This is not in the HubSpot Backend");
}

});

0 comments on commit 76371c8

Please sign in to comment.