Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

harvard embed first version

  • Loading branch information...
commit b09e689e32614b79c7a6545c72bdbc02d865097f 1 parent 5cb3273
Ryan Morrison~Westphal authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 harvard-embed/he.js
35 harvard-embed/he.js
View
@@ -0,0 +1,35 @@
+$(function () {
+ $.getJSON("http://api.hostip.info/get_json.php").done(function (result) {
+ var edxDebug = result.ip;
+ var harvard = false;
+ var $iframe, src;
+
+ if (result.ip.substr(0, 3) === "140") {
+ edxDebug += " (Harvard)";
+ harvard = true;
+ }
+
+ $("iframe").each( function() {
+ // check every iframe for edx data
+ $iframe = $(this);
+ src = null;
+
+ if ( harvard ) {
+ src = $iframe.data( "edx-internal" );
+ } else {
+ src = $iframe.data( "edx-external" );
+ }
+
+ if ( src ) {
+ // actually change the iframe's src
+ $iframe.attr( "src", src );
+
+ edxDebug += "<br>" + src;
+ }
+ } );
+
+ // push IP & flag to debug element if present
+ $(".edx-debug").html(edxDebug);
+ });
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.