Export Your Stanford Curriculum!

Export your SU curriculum and add it to your calendar App.

// ==UserScript==
// @name         Export Your Stanford Curriculum!
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Export your SU curriculum and add it to your calendar App.
// @author       GaōYǎRénShì
// @license      MIT
// @match        https://simpleenroll.stanford.edu/SimpleEnroll/index
// @icon         https://www.google.com/s2/favicons?sz=64&domain=stanford.edu
// @require      https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js
// @grant        none
// ==/UserScript==

// Code from https://github.com/nwcell/ics.js/
// Didn't find a CDN.
var ics=function(e,t){"use strict";{if(!(navigator.userAgent.indexOf("MSIE")>-1&&-1==navigator.userAgent.indexOf("MSIE 10"))){void 0===e&&(e="default"),void 0===t&&(t="Calendar");var r=-1!==navigator.appVersion.indexOf("Win")?"\r\n":"\n",n=[],i=["BEGIN:VCALENDAR","PRODID:"+t,"VERSION:2.0"].join(r),o=r+"END:VCALENDAR",a=["SU","MO","TU","WE","TH","FR","SA"];return{events:function(){return n},calendar:function(){return i+r+n.join(r)+o},addEvent:function(t,i,o,l,u,s){if(void 0===t||void 0===i||void 0===o||void 0===l||void 0===u)return!1;if(s&&!s.rrule){if("YEARLY"!==s.freq&&"MONTHLY"!==s.freq&&"WEEKLY"!==s.freq&&"DAILY"!==s.freq)throw"Recurrence rrule frequency must be provided and be one of the following: 'YEARLY', 'MONTHLY', 'WEEKLY', or 'DAILY'";if(s.until&&isNaN(Date.parse(s.until)))throw"Recurrence rrule 'until' must be a valid date string";if(s.interval&&isNaN(parseInt(s.interval)))throw"Recurrence rrule 'interval' must be an integer";if(s.count&&isNaN(parseInt(s.count)))throw"Recurrence rrule 'count' must be an integer";if(void 0!==s.byday){if("[object Array]"!==Object.prototype.toString.call(s.byday))throw"Recurrence rrule 'byday' must be an array";if(s.byday.length>7)throw"Recurrence rrule 'byday' array must not be longer than the 7 days in a week";s.byday=s.byday.filter(function(e,t){return s.byday.indexOf(e)==t});for(var c in s.byday)if(a.indexOf(s.byday[c])<0)throw"Recurrence rrule 'byday' values must include only the following: 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'"}}var g=new Date(l),d=new Date(u),f=new Date,S=("0000"+g.getFullYear().toString()).slice(-4),E=("00"+(g.getMonth()+1).toString()).slice(-2),v=("00"+g.getDate().toString()).slice(-2),y=("00"+g.getHours().toString()).slice(-2),A=("00"+g.getMinutes().toString()).slice(-2),T=("00"+g.getSeconds().toString()).slice(-2),b=("0000"+d.getFullYear().toString()).slice(-4),D=("00"+(d.getMonth()+1).toString()).slice(-2),N=("00"+d.getDate().toString()).slice(-2),h=("00"+d.getHours().toString()).slice(-2),I=("00"+d.getMinutes().toString()).slice(-2),R=("00"+d.getMinutes().toString()).slice(-2),M=("0000"+f.getFullYear().toString()).slice(-4),w=("00"+(f.getMonth()+1).toString()).slice(-2),L=("00"+f.getDate().toString()).slice(-2),O=("00"+f.getHours().toString()).slice(-2),p=("00"+f.getMinutes().toString()).slice(-2),Y=("00"+f.getMinutes().toString()).slice(-2),U="",V="";y+A+T+h+I+R!=0&&(U="T"+y+A+T,V="T"+h+I+R);var B,C=S+E+v+U,j=b+D+N+V,m=M+w+L+("T"+O+p+Y);if(s)if(s.rrule)B=s.rrule;else{if(B="rrule:FREQ="+s.freq,s.until){var x=new Date(Date.parse(s.until)).toISOString();B+=";UNTIL="+x.substring(0,x.length-13).replace(/[-]/g,"")+"000000Z"}s.interval&&(B+=";INTERVAL="+s.interval),s.count&&(B+=";COUNT="+s.count),s.byday&&s.byday.length>0&&(B+=";BYDAY="+s.byday.join(","))}(new Date).toISOString();var H=["BEGIN:VEVENT","UID:"+n.length+"@"+e,"CLASS:PUBLIC","DESCRIPTION:"+i,"DTSTAMP;VALUE=DATE-TIME:"+m,"DTSTART;VALUE=DATE-TIME:"+C,"DTEND;VALUE=DATE-TIME:"+j,"LOCATION:"+o,"SUMMARY;LANGUAGE=en-us:"+t,"TRANSP:TRANSPARENT","END:VEVENT"];return B&&H.splice(4,0,B),H=H.join(r),n.push(H),H},download:function(e,t){if(n.length<1)return!1;t=void 0!==t?t:".ics",e=void 0!==e?e:"calendar";var a,l=i+r+n.join(r)+o;if(-1===navigator.userAgent.indexOf("MSIE 10"))a=new Blob([l]);else{var u=new BlobBuilder;u.append(l),a=u.getBlob("text/x-vCalendar;charset="+document.characterSet)}return saveAs(a,e+t),l},build:function(){return!(n.length<1)&&i+r+n.join(r)+o}}}console.log("Unsupported Browser")}};

const re = /(.+) \| [A-Z][A-Z][A-Z] \((.+)\)/;

function setStyles(element, styles)
{
    for(var s in styles) {
        element.style[s] = styles[s];
    }
}

sessionList_enJAnoJbNu0y8vDbsZrq=[];

SE_CourseSet.prototype.showDetails=function(section) {
    sessionList_enJAnoJbNu0y8vDbsZrq.push(section)
	var this_ref = this;
	// get details to show the
	if(section.hasMoreDetails == true ){
		this_ref.getMoreDetails(section);
		return;
	}

	SE_Container.ScheduleView.unHighlightScheduleEntries();
	var setDetailsPane = this.domRegion.find('div.class_details_pane');
	if(setDetailsPane.size() > 0) {
		var currDispId = setDetailsPane.attr('id');
		this.domRegion.find("div.course div.actions_trigger").fadeOut(this_ref.ANIMATION_DURATION);
		setDetailsPane.animate({height: 0}, this.ANIMATION_DURATION, function(){
			setDetailsPane.remove();
			this_ref.domRegion.find('div.notifyRegion').remove();
			$('.cls_container #'+currDispId).removeClass('open');
			if(currDispId != section.domUID) {
				this_ref.injectDetails(section);
			}
		});
	} else {
		this_ref.injectDetails(section);
	}
};

var btn=document.createElement("button")
btn.onclick=function() {
    var classList=document.querySelectorAll("div[class='cls_container']")[0].getElementsByClassName("course");
    var cal=new ics();
    for (const classShell of classList) {
        var classLink=classShell.querySelector("#name");
        if (classLink.textContent.includes("LEC")) {
            $._data(classLink,"events").click[0].handler.call(classLink)
        }
    }
    for (var session of sessionList_enJAnoJbNu0y8vDbsZrq) {
        var classNumber = `${session.subject} ${session.courseNum}`
        var className=session.courseTitle
        var instructors=session.instructors.join(' & ')
        var coursePlace=session.scheduleEntries[0].room
        var courseStart=session.scheduleEntries[0].startTime
        var courseEnd=session.scheduleEntries[0].endTime
        var weekDay=session.scheduleEntries[0].daysText.map(x => x.toUpperCase())
        var semesterStart=session.scheduleEntries[0].startDate.toDateString()
        var semesterEnd=session.scheduleEntries[0].endDate
        semesterEnd.setDate(semesterEnd.getDate()+1);
        cal.addEvent(classNumber,`${className} Instructor(s): ${instructors}`,coursePlace,`${semesterStart} ${courseStart}`, `${semesterStart} ${courseEnd}`,{freq:'WEEKLY',until:semesterEnd,byday:weekDay});
    }

    cal.download()
    delete sessionList_enJAnoJbNu0y8vDbsZrq;
}
btn.textContent='Export as .ics File'
setStyles(btn,{WebkitTextSizeAdjust: "100%","--accent-archway": "#5d4b3c","--accent-archway-dark": "#2f2424","--accent-archway-light": "#766253","--accent-bay": "#6fa287","--accent-bay-dark": "#417865","--accent-bay-light": "#8ab8a7","--accent-brick": "#651c32","--accent-brick-dark": "#42081b","--accent-brick-light": "#7f2d48","--accent-fog": "#dad7cb","--accent-fog-dark": "#b6b1a9","--accent-fog-light": "#f4f4f4","--accent-illuminating": "#fedd5c","--accent-illuminating-dark": "#fec51d","--accent-illuminating-light": "#ffe781","--accent-olive": "#8f993e","--accent-olive-dark": "#7a863b","--accent-olive-light": "#a6b168","--accent-palo-alto": "#175e54","--accent-palo-alto-dark": "#014240","--accent-palo-alto-light": "#2d716f","--accent-palo-verde": "#279989","--accent-palo-verde-dark": "#017e7c","--accent-palo-verde-light": "#59b3a9","--accent-poppy": "#e98300","--accent-poppy-dark": "#d1660f","--accent-poppy-light": "#f9a44a","--accent-sky": "#4298b5","--accent-sky-dark": "#016895","--accent-sky-light": "#67afd2","--accent-spirited": "#e04f39","--accent-spirited-dark": "#c74632","--accent-spirited-light": "#f4795b","--accent-stone": "#7f7776","--accent-stone-dark": "#544948","--accent-stone-light": "#d4d1d1","--background-cardinal-background": "#e8d0d0","--background-general-background": "#f9f6ef","--background-lagunita-background": "#b6cfd3","--background-plum-background": "#cab6c8","--coolgray-700": "#4a5568","--coolgray-white": "#ffffff","--documentation-margin-bottom": "rgba(53, 255, 234, 0.5)","--documentation-margin-left": "rgba(251, 151, 95, 0.5)","--documentation-margin-right": "rgba(255, 245, 0, 0.5)","--documentation-margin-top": "rgba(229, 11, 248, 0.5)","--documentation-padding": "rgba(92, 255, 109, 0.5)","--forms-digital-blue-vivid": "#0597ff","--interactive-digital-blue": "#006cb8","--interactive-digital-blue-dark": "#00548f","--interactive-digital-blue-light": "#85ccff","--interactive-digital-green": "#008566","--interactive-digital-green-dark": "#006f54","--interactive-digital-green-light": "#1aecba","--interactive-digital-red": "#b1040e","--interactive-digital-red-dark": "#820000","--interactive-digital-red-light": "#e50808","--primary-black": "#2e2d29","--primary-black-10": "#eaeaea","--primary-black-20": "#d5d5d4","--primary-black-30": "#c0c0bf","--primary-black-40": "#ababa9","--primary-black-50": "#979694","--primary-black-60": "#767674","--primary-black-70": "#6d6c69","--primary-black-80": "#585754","--primary-black-90": "#43423e","--primary-cardinal": "#8c1515","--primary-cardinal-dark": "#820000","--primary-cardinal-light": "#b83a4b","--primary-cool-grey": "#53565a","--primary-lagunita": "#007c92","--primary-lagunita-dark": "#006b81","--primary-lagunita-light": "#009ab4","--primary-plum": "#620059","--primary-plum-dark": "#350d36","--primary-plum-light": "#734675","--primary-white": "#ffffff","--secondary-mint": "#009b76","--secondary-sky": "#0098db","--stroke-card-outline": "#e3e3e3","--cool-gray-400": "#9ca3af","--cool-gray-500": "#6b7280","--cool-gray-900": "#111827","--purple-600": "#9333ea","--_14-semibold-font-family": "'FS Me', 'FSMe'","--_14-semibold-font-size": "14px","--_14-semibold-letter-spacing": "0px","--_14-semibold-line-height": "150%","--_14-semibold-font-weight": "400","--_14-semibold-color": "black","--_16-semibold-font-family": "'FS Me', 'FSMe'","--_16-semibold-font-size": "16px","--_16-semibold-letter-spacing": "0px","--_16-semibold-line-height": "150%","--_16-semibold-font-weight": "400","--_16-semibold-color": "black","--_18-regular-font-family": "'FS Me', 'FSMe-Light'","--_18-regular-font-size": "18px","--_18-regular-letter-spacing": "0px","--_18-regular-line-height": "150%","--_18-regular-font-weight": "300","--_18-regular-color": "black","--a-sans-md-lg-xl-cta-big-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--a-sans-md-lg-xl-cta-big-font-size": "25px","--a-sans-md-lg-xl-cta-big-letter-spacing": "0px","--a-sans-md-lg-xl-cta-big-line-height": "120%","--a-sans-md-lg-xl-cta-big-font-weight": "400","--a-sans-md-lg-xl-cta-big-color": "black","--a-sans-md-lg-xl-intro-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--a-sans-md-lg-xl-intro-font-size": "29px","--a-sans-md-lg-xl-intro-letter-spacing": "0px","--a-sans-md-lg-xl-intro-line-height": "150%","--a-sans-md-lg-xl-intro-font-weight": "400","--a-sans-md-lg-xl-intro-color": "black","--a-sans-md-lg-xl-subheading-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--a-sans-md-lg-xl-subheading-font-size": "25px","--a-sans-md-lg-xl-subheading-letter-spacing": "0px","--a-sans-md-lg-xl-subheading-line-height": "120%","--a-sans-md-lg-xl-subheading-font-weight": "400","--a-sans-md-lg-xl-subheading-color": "black","--a-serif-md-lg-xl-type-4-font-family":  "'Source Serif Pro', 'SourceSerifPro-Bold'","--a-serif-md-lg-xl-type-4-font-size": "51px","--a-serif-md-lg-xl-type-4-letter-spacing": "0px","--a-serif-md-lg-xl-type-4-line-height": "110%","--a-serif-md-lg-xl-type-4-font-weight": "700","--a-serif-md-lg-xl-type-4-color": "black","--saa-sans-md-lg-xl-small-paragraph-font-family":  "'Proxima Nova', 'ProximaNova-Regular'","--saa-sans-md-lg-xl-small-paragraph-font-size": "19px","--saa-sans-md-lg-xl-small-paragraph-letter-spacing": "0px","--saa-sans-md-lg-xl-small-paragraph-line-height": "125%","--saa-sans-md-lg-xl-small-paragraph-font-weight": "400","--saa-sans-md-lg-xl-small-paragraph-color": "black","--sans-md-lg-xl-big-cta-link-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-big-cta-link-font-size": "23px","--sans-md-lg-xl-big-cta-link-letter-spacing": "0px","--sans-md-lg-xl-big-cta-link-line-height": "125%","--sans-md-lg-xl-big-cta-link-font-weight": "600","--sans-md-lg-xl-big-cta-link-color": "black","--sans-md-lg-xl-block-quote-font-family":  "'Source Sans Pro', 'SourceSansPro-It'","--sans-md-lg-xl-block-quote-font-size": "25px","--sans-md-lg-xl-block-quote-letter-spacing": "0px","--sans-md-lg-xl-block-quote-line-height": "138.3%","--sans-md-lg-xl-block-quote-font-weight": "400","--sans-md-lg-xl-block-quote-font-style": "italic","--sans-md-lg-xl-block-quote-color": "black","--sans-md-lg-xl-button-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-md-lg-xl-button-font-size": "20px","--sans-md-lg-xl-button-letter-spacing": "0px","--sans-md-lg-xl-button-line-height": "119.4%","--sans-md-lg-xl-button-font-weight": "400","--sans-md-lg-xl-button-color": "black","--sans-md-lg-xl-cta-link-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-cta-link-font-size": "21px","--sans-md-lg-xl-cta-link-letter-spacing": "0px","--sans-md-lg-xl-cta-link-line-height": "125%","--sans-md-lg-xl-cta-link-font-weight": "600","--sans-md-lg-xl-cta-link-color": "black","--sans-md-lg-xl-cta-link-hover-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-cta-link-hover-font-size": "21px","--sans-md-lg-xl-cta-link-hover-letter-spacing": "0px","--sans-md-lg-xl-cta-link-hover-line-height": "125%","--sans-md-lg-xl-cta-link-hover-font-weight": "600","--sans-md-lg-xl-cta-link-hover-text-decoration": "underline","--sans-md-lg-xl-cta-link-hover-color": "black","--sans-md-lg-xl-caption-font-family":  "'Source Sans Pro', 'SourceSansPro-It'","--sans-md-lg-xl-caption-font-size": "16px","--sans-md-lg-xl-caption-letter-spacing": "0px","--sans-md-lg-xl-caption-line-height": "119.4%","--sans-md-lg-xl-caption-font-weight": "400","--sans-md-lg-xl-caption-font-style": "italic","--sans-md-lg-xl-caption-color": "black","--sans-md-lg-xl-card-paragraph-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-md-lg-xl-card-paragraph-font-size": "21px","--sans-md-lg-xl-card-paragraph-letter-spacing": "0px","--sans-md-lg-xl-card-paragraph-line-height": "125%","--sans-md-lg-xl-card-paragraph-font-weight": "400","--sans-md-lg-xl-card-paragraph-color": "black","--sans-md-lg-xl-credit-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-md-lg-xl-credit-font-size": "16px","--sans-md-lg-xl-credit-letter-spacing": "0px","--sans-md-lg-xl-credit-line-height": "119.4%","--sans-md-lg-xl-credit-font-weight": "400","--sans-md-lg-xl-credit-color": "black","--sans-md-lg-xl-form-label-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-form-label-font-size": "18px","--sans-md-lg-xl-form-label-letter-spacing": "0px","--sans-md-lg-xl-form-label-line-height": "125%","--sans-md-lg-xl-form-label-font-weight": "600","--sans-md-lg-xl-form-label-color": "black","--sans-md-lg-xl-form-text-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-md-lg-xl-form-text-font-size": "18px","--sans-md-lg-xl-form-text-letter-spacing": "0px","--sans-md-lg-xl-form-text-line-height": "125%","--sans-md-lg-xl-form-text-font-weight": "400","--sans-md-lg-xl-form-text-color": "black","--sans-md-lg-xl-inline-link-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-inline-link-font-size": "21px","--sans-md-lg-xl-inline-link-letter-spacing": "0px","--sans-md-lg-xl-inline-link-line-height": "119.4%","--sans-md-lg-xl-inline-link-font-weight": "600","--sans-md-lg-xl-inline-link-text-decoration": "underline","--sans-md-lg-xl-inline-link-color": "black","--sans-md-lg-xl-subhead-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-md-lg-xl-subhead-font-size": "25px","--sans-md-lg-xl-subhead-letter-spacing": "0px","--sans-md-lg-xl-subhead-line-height": "119.4%","--sans-md-lg-xl-subhead-font-weight": "400","--sans-md-lg-xl-subhead-color": "black","--sans-md-lg-xl-superhead-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-superhead-font-size": "18px","--sans-md-lg-xl-superhead-letter-spacing": "0px","--sans-md-lg-xl-superhead-line-height": "119.4%","--sans-md-lg-xl-superhead-font-weight": "700","--sans-md-lg-xl-superhead-text-transform": "capitalize","--sans-md-lg-xl-superhead-color": "black","--sans-md-lg-xl-type-0-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-0-font-size": "23px","--sans-md-lg-xl-type-0-letter-spacing": "0px","--sans-md-lg-xl-type-0-line-height": "120%","--sans-md-lg-xl-type-0-font-weight": "700","--sans-md-lg-xl-type-0-color": "black","--sans-md-lg-xl-type-1-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-1-font-size": "25px","--sans-md-lg-xl-type-1-letter-spacing": "0px","--sans-md-lg-xl-type-1-line-height": "120%","--sans-md-lg-xl-type-1-font-weight": "700","--sans-md-lg-xl-type-1-color": "black","--sans-md-lg-xl-type-2-semibold-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-md-lg-xl-type-2-semibold-font-size": "30px","--sans-md-lg-xl-type-2-semibold-letter-spacing": "0px","--sans-md-lg-xl-type-2-semibold-line-height": "100%","--sans-md-lg-xl-type-2-semibold-font-weight": "600","--sans-md-lg-xl-type-2-semibold-color": "black","--sans-md-lg-xl-type-3-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-3-font-size": "35px","--sans-md-lg-xl-type-3-letter-spacing": "0px","--sans-md-lg-xl-type-3-line-height": "120%","--sans-md-lg-xl-type-3-font-weight": "700","--sans-md-lg-xl-type-3-color": "black","--sans-md-lg-xl-type-4-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-4-font-size": "44px","--sans-md-lg-xl-type-4-letter-spacing": "0px","--sans-md-lg-xl-type-4-line-height": "120%","--sans-md-lg-xl-type-4-font-weight": "700","--sans-md-lg-xl-type-4-color": "black","--sans-md-lg-xl-type-5-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-5-font-size": "54px","--sans-md-lg-xl-type-5-letter-spacing": "0px","--sans-md-lg-xl-type-5-line-height": "120%","--sans-md-lg-xl-type-5-font-weight": "700","--sans-md-lg-xl-type-5-color": "black","--sans-md-lg-xl-type-6-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-md-lg-xl-type-6-font-size": "68px","--sans-md-lg-xl-type-6-letter-spacing": "0px","--sans-md-lg-xl-type-6-line-height": "120%","--sans-md-lg-xl-type-6-font-weight": "700","--sans-md-lg-xl-type-6-color": "black","--sans-xs-sm-big-paragraph-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-xs-sm-big-paragraph-font-size": "18px","--sans-xs-sm-big-paragraph-letter-spacing": "0px","--sans-xs-sm-big-paragraph-line-height": "150%","--sans-xs-sm-big-paragraph-font-weight": "400","--sans-xs-sm-big-paragraph-color": "black","--sans-xs-sm-button-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-xs-sm-button-font-size": "16px","--sans-xs-sm-button-letter-spacing": "0px","--sans-xs-sm-button-line-height": "95%","--sans-xs-sm-button-font-weight": "400","--sans-xs-sm-button-color": "black","--sans-xs-sm-cta-link-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-xs-sm-cta-link-font-size": "17px","--sans-xs-sm-cta-link-letter-spacing": "0px","--sans-xs-sm-cta-link-line-height": "125%","--sans-xs-sm-cta-link-font-weight": "600","--sans-xs-sm-cta-link-color": "black","--sans-xs-sm-caption-font-family": "'Source Sans Pro', 'SourceSansPro-It'","--sans-xs-sm-caption-font-size": "15px","--sans-xs-sm-caption-letter-spacing": "0px","--sans-xs-sm-caption-line-height": "119.4%","--sans-xs-sm-caption-font-weight": "400","--sans-xs-sm-caption-font-style": "italic","--sans-xs-sm-caption-color": "black","--sans-xs-sm-card-paragraph-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-xs-sm-card-paragraph-font-size": "18px","--sans-xs-sm-card-paragraph-letter-spacing": "0px","--sans-xs-sm-card-paragraph-line-height": "125%","--sans-xs-sm-card-paragraph-font-weight": "400","--sans-xs-sm-card-paragraph-color": "black","--sans-xs-sm-credit-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-xs-sm-credit-font-size": "15px","--sans-xs-sm-credit-letter-spacing": "0px","--sans-xs-sm-credit-line-height": "119.4%","--sans-xs-sm-credit-font-weight": "400","--sans-xs-sm-credit-color": "black","--sans-xs-sm-form-label-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-xs-sm-form-label-font-size": "17px","--sans-xs-sm-form-label-letter-spacing": "0px","--sans-xs-sm-form-label-line-height": "119.4%","--sans-xs-sm-form-label-font-weight": "600","--sans-xs-sm-form-label-color": "black","--sans-xs-sm-form-text-font-family":  "'Source Sans Pro', 'SourceSansPro-Regular'","--sans-xs-sm-form-text-font-size": "17px","--sans-xs-sm-form-text-letter-spacing": "0px","--sans-xs-sm-form-text-line-height": "119.4%","--sans-xs-sm-form-text-font-weight": "400","--sans-xs-sm-form-text-color": "black","--sans-xs-sm-inline-link-font-family":  "'Source Sans Pro', 'SourceSansPro-SemiBold'","--sans-xs-sm-inline-link-font-size": "16px","--sans-xs-sm-inline-link-letter-spacing": "0px","--sans-xs-sm-inline-link-line-height": "95%","--sans-xs-sm-inline-link-font-weight": "600","--sans-xs-sm-inline-link-text-decoration": "underline","--sans-xs-sm-inline-link-color": "black","--sans-xs-sm-superhead-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-xs-sm-superhead-font-size": "15px","--sans-xs-sm-superhead-letter-spacing": "0px","--sans-xs-sm-superhead-line-height": "119.4%","--sans-xs-sm-superhead-font-weight": "700","--sans-xs-sm-superhead-text-transform": "capitalize","--sans-xs-sm-superhead-color": "black","--sans-xs-sm-type-0-font-family": "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-xs-sm-type-0-font-size": "16px","--sans-xs-sm-type-0-letter-spacing": "0px","--sans-xs-sm-type-0-line-height": "95%","--sans-xs-sm-type-0-font-weight": "700","--sans-xs-sm-type-0-color": "black","--sans-xs-sm-type-4-font-family": "'Source Sans Pro', 'SourceSansPro-Bold'","--sans-xs-sm-type-4-font-size": "32px","--sans-xs-sm-type-4-letter-spacing": "0px","--sans-xs-sm-type-4-line-height": "100%","--sans-xs-sm-type-4-font-weight": "700","--sans-xs-sm-type-4-color": "black","--serif-md-lg-xl-small-paragraph-font-family":  "'Source Serif Pro', 'SourceSerifPro-Regular'","--serif-md-lg-xl-small-paragraph-font-size": "17px","--serif-md-lg-xl-small-paragraph-letter-spacing": "0px","--serif-md-lg-xl-small-paragraph-line-height": "105%","--serif-md-lg-xl-small-paragraph-font-weight": "400","--serif-md-lg-xl-small-paragraph-color": "black","--serif-md-lg-xl-subheading-font-family":  "'Source Serif Pro', 'SourceSerifPro-Regular'","--serif-md-lg-xl-subheading-font-size": "22.5px","--serif-md-lg-xl-subheading-letter-spacing": "0px","--serif-md-lg-xl-subheading-line-height": "120%","--serif-md-lg-xl-subheading-font-weight": "400","--serif-md-lg-xl-subheading-color": "black","--serif-md-lg-xl-type-1-font-family":  "'Source Serif Pro', 'SourceSerifPro-SemiBold'","--serif-md-lg-xl-type-1-font-size": "22.5px","--serif-md-lg-xl-type-1-letter-spacing": "0px","--serif-md-lg-xl-type-1-line-height": "130.2%","--serif-md-lg-xl-type-1-font-weight": "600","--serif-md-lg-xl-type-1-color": "black","--serif-md-lg-xl-type-2-font-family":  "'Source Serif Pro', 'SourceSerifPro-SemiBold'","--serif-md-lg-xl-type-2-font-size": "28px","--serif-md-lg-xl-type-2-letter-spacing": "0px","--serif-md-lg-xl-type-2-line-height": "130.2%","--serif-md-lg-xl-type-2-font-weight": "600","--serif-md-lg-xl-type-2-color": "black","--slab-md-lg-xl-superhead-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--slab-md-lg-xl-superhead-font-size": "17px","--slab-md-lg-xl-superhead-letter-spacing": "0px","--slab-md-lg-xl-superhead-line-height": "125.3%","--slab-md-lg-xl-superhead-font-weight": "700","--slab-md-lg-xl-superhead-text-transform": "capitalize","--slab-md-lg-xl-superhead-color": "black","--slab-xs-sm-superhead-font-family":  "'Source Sans Pro', 'SourceSansPro-Bold'","--slab-xs-sm-superhead-font-size": "15px","--slab-xs-sm-superhead-letter-spacing": "0px","--slab-xs-sm-superhead-line-height": "125.3%","--slab-xs-sm-superhead-font-weight": "700","--slab-xs-sm-superhead-text-transform": "capitalize","--slab-xs-sm-superhead-color": "black","--slab-xs-sm-type-0-font-family": "'Source Sans Pro', 'SourceSansPro-Bold'","--slab-xs-sm-type-0-font-size": "16px","--slab-xs-sm-type-0-letter-spacing": "0px","--slab-xs-sm-type-0-line-height": "95%","--slab-xs-sm-type-0-font-weight": "700","--slab-xs-sm-type-0-color": "black","--slab-xs-sm-type-1-font-family": "'Source Sans Pro', 'SourceSansPro-Bold'","--slab-xs-sm-type-1-font-size": "20px","--slab-xs-sm-type-1-letter-spacing": "0px","--slab-xs-sm-type-1-line-height": "95%","--slab-xs-sm-type-1-font-weight": "700","--slab-xs-sm-type-1-color": "black","--primary-color": "#8c1515","--primary-color-light": "#b83a4b","--primary-color-dark": "#820000","--primary-color-background": "#e8d0d0","--sr-annote-color-0": "#b4d9fb","--sr-annote-color-1": "#ffeb3b","--sr-annote-color-2": "#a2e9f2","--sr-annote-color-3": "#a1e0ff","--sr-annote-color-4": "#a8ea68","--sr-annote-color-5": "#ffb7da",boxSizing: "inherit",WebkitFontSmoothing: "antialiased",fontFamily:  '"Source Sans Pro", "Helvetica Neue", "Helvetica", "Arial", sans-serif',border: "0",fontWeight: 400,lineHeight: 1,textAlign: "center",width: "auto",transition: "background-color 0.25s ease-in-out, color 0.25s ease-in-out",appearance: "unset",padding: "1rem 2rem 1.15rem",backgroundColor: "#ffffff",boxShadow: "inset 0 0 0 2px var(--primary-color)",cursor: "pointer",color: "#000000",textDecoration: "none",cssFloat: "right",position: "relative",fontSize: "12px",display: "inline"})
btn.style['marginLeft']=20

var refbtn=document.querySelector("#bookstore_trigger")

var container=document.querySelector("#enrolled")

container.insertBefore(btn,refbtn)