Skip to content

Instantly share code, notes, and snippets.

@sodle

sodle/tempe.user.js

Created May 1, 2017
Embed
What would you like to do?
Userscript to add "Development Projects" link to Tempe.gov homepage
// ==UserScript==
// @name Tempe.gov Site Update
// @namespace http://asu.edu/
// @version 0.1
// @description Adds Development Projects link to Tempe.gov homepage
// @author Scott Odle, Chris Staggers, McGregor Crowley
// @match *://*.tempe.gov/*
// @grant none
// @require https://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
(function($, undefined) {
(function() {
'use strict';
console.log('Loaded jQuery version ' + $().jquery);
var $bottom = $('section.home_bottom');
if ($bottom.length == 1) {
console.log('home page bottom found');
var projectsH2 = document.createElement('h2');
projectsH2.textContent = 'DEVELOPMENT PROJECTS';
var projectsH3 = document.createElement('h3');
projectsH3.textContent = 'Upcoming improvements to your city';
var projectsImg = document.createElement('img');
projectsImg.src = '/Project/Contents/Main/_gfx/home/topics_link.png';
$(projectsImg).css('float', 'right').css('clear', 'both');
var projectsTextDiv = document.createElement('div');
$(projectsTextDiv).css({
'display': 'inline-block',
'width': '75%',
'margin': '0',
'padding': '0'
});
projectsTextDiv.appendChild(projectsH2);
projectsTextDiv.appendChild(projectsH3);
var projectsImgDiv = document.createElement('div');
$(projectsImgDiv).css({
'display': 'inline-block',
'width': '25%',
'margin': '0',
'padding': '0'
});
projectsImgDiv.appendChild(projectsImg);
var projectsDiv = document.createElement('div');
projectsDiv.appendChild(projectsTextDiv);
projectsDiv.appendChild(projectsImgDiv);
var projectsA = document.createElement('a');
projectsA.href = 'http://tempegov.maps.arcgis.com/apps/Shortlist/index.html?appid=e2b8a9338e3948c0ab6abf93b858f508';
projectsA.target = '_blank';
projectsA.appendChild(projectsDiv);
$(projectsDiv).css({
'padding': '1em',
'border': '1px solid black',
'border-radius': '1em',
'background': '#276faa',
'color': 'white',
'margin-top': '1em',
'margin-bottom': '1em'
});
$(projectsH2).css({
'color': 'white',
'text-decoration': 'none',
'font-size': '2em'
});
$(projectsH3).css({
'color': 'white',
'text-decoration': 'none',
'font-size': '1.5em'
});
$bottom.prepend(projectsA);
}
})();
})(window.jQuery.noConflict(true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment