Created
March 14, 2013 22:12
-
-
Save christianvuerings/5165726 to your computer and use it in GitHub Desktop.
CalCentral - Debug campus links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var forEach = Array.prototype.forEach; | |
var div = document.createElement('div'); | |
div.setAttribute('data-ng-bind', 'link.description') | |
var cssDescription = 'font-size: 80%;margin: 0 0 3px 16px;line-height: 126%;clear:both;border-bottom: 1px solid #CCC;padding-bottom: 3px;'; | |
var cssButtons = 'font-size: 80%; margin-left: 16px; line-height: 126%; font-weight: bold'; | |
var cssButton = 'float:left; padding: 0 5px; border: 1px solid _border_; background-color: _background_; border-radius: 3px; margin-right: 1px'; | |
var cssButtonColors = { | |
'staff': 'paleTurquoise', | |
'student': 'lightpink', | |
'faculty': 'PeachPuff' | |
} | |
var items = document.querySelectorAll(".cc-page-campus-content ul li"); | |
forEach.call(items, function(item){ | |
var scope = window.angular.element(item).scope(); | |
var html = ''; | |
html += '<div style="' + cssButtons + '">'; | |
for(var i in cssButtonColors) { | |
if(cssButtonColors.hasOwnProperty(i)) { | |
var buttonBorderColor = '#fff'; | |
if (scope.link.roles[i]) { | |
buttonBorderColor = cssButtonColors[i]; | |
} | |
html += '<div style="' + cssButton.replace('_border_', cssButtonColors[i]).replace('_background_', buttonBorderColor) + '">' + i + '</div>'; | |
} | |
} | |
html += '</div>'; | |
html += '<div style="' + cssDescription + '">' + scope.link.description + '</div>'; | |
item.innerHTML += html; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment