-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added Multi AUs support for iframe (#5)
- Loading branch information
1 parent
800bb42
commit c052aa7
Showing
3 changed files
with
106 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
/* Javascript for CMI5XBlock. */ | ||
function CMI5XBlock(runtime, element) { | ||
|
||
$(function($) { | ||
/* | ||
Use `gettext` provided by django-statici18n for static translations | ||
$(function ($) { | ||
/* | ||
Use `gettext` provided by django-statici18n for static translations | ||
var gettext = CMI5XBlocki18n.gettext; | ||
*/ | ||
|
||
var gettext = CMI5XBlocki18n.gettext; | ||
*/ | ||
/* Here's where you'd do things on page load. */ | ||
|
||
/* Here's where you'd do things on page load. */ | ||
$('ol a').click(function(event) { | ||
event.preventDefault(); | ||
var href = $(this).attr('href'); | ||
var liText = $(this).closest('li').text().trim(); | ||
updateIframeSrc(href, liText); | ||
|
||
}); | ||
|
||
function updateIframeSrc(href, liText) { | ||
if (liText.includes('AnyWindow')) { | ||
$('.cmi5-embedded').attr('src', href); | ||
} else if (liText.includes('OwnWindow')) { | ||
window.open(href, '_blank'); | ||
} | ||
} | ||
}); | ||
} | ||
} |