Skip to content

Instantly share code, notes, and snippets.

@dotspencer
Last active February 5, 2016 23:18
Show Gist options
  • Save dotspencer/920929b97c2e8ed3aff5 to your computer and use it in GitHub Desktop.
Save dotspencer/920929b97c2e8ed3aff5 to your computer and use it in GitHub Desktop.
Project Page Format - Researchers

[auto_format] shortcode

EGI

Each researcher has a shortcode tag in the following format: [spencer_smith]
The shortcode will insert their information into the page.

The [auto_format] shortcode takes care of the formatting, adding color, and generating the correct mailto: link.


"Simple" shortcode format for researchers:

<h4>
    <a class="red" href="/about/staff/spencer-smith/">Spencer Smith</a>
    801 900 3246
    <a class="mail" href="mailto:ssmith@egi.utah.edu">ssmith@egi.utah.edu</a>
</h4>
var links = document.getElementsByTagName('a');
var projectTitle = document.title.split('»')[1].trim();
if(projectTitle.indexOf('&') != -1){
projectTitle = projectTitle.replace('&', '%26')
}
for(i = 0; i < links.length; i++){
if(links[i].href.indexOf('mailto:') != -1){
links[i].href += "?cc=ntaylor@egi.utah.edu&subject=";
links[i].href += projectTitle;
links[i].className += " red";
}
}
var reds = document.getElementsByClassName('red');
for(i = 0; i < reds.length; i ++){
reds[i].parentNode.style.marginTop = "-10px";
reds[i].parentNode.style.marginBottom = "-10px";
}
.red{
color: #990000 !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment