Last active
August 30, 2016 08:28
-
-
Save ivmartel/fbb963defd711d52e57a7a8f276286c9 to your computer and use it in GitHub Desktop.
Dicom-support Wordpress plugin differences between v0.3 and v0.4
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
// special wp initialisation | |
// 'wp.pluginsUrl' is set by wordpress | |
dwv.wp = dwv.wp || {}; | |
dwv.wp.init_was_called = false; | |
dwv.wp.init = function () | |
{ | |
// avoid multiple calls | |
if ( dwv.wp.init_was_called ) { | |
return; | |
} | |
dwv.wp.init_was_called = true; | |
// image decoders (for web workers) | |
dwv.image.decoderScripts = { | |
"jpeg2000": wp.pluginsUrl + "/dicom-support/ext/pdfjs/decode-jpeg2000.js", | |
"jpeg-lossless": wp.pluginsUrl + "/dicom-support/ext/rii-mango/decode-jpegloss.js", | |
"jpeg-baseline": wp.pluginsUrl + "/dicom-support/ext/notmasteryet/decode-jpegbaseline.js" | |
}; | |
// check browser support | |
dwv.browser.check(); | |
// initialise i18n | |
dwv.i18nInitialise("auto", wp.pluginsUrl + "/dicom-support"); | |
} |
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
// variables: APPNUMBER and URLs | |
// special init | |
dwv.wp.init(); | |
// start app function | |
function startAppAPPNUMBER() { | |
var myapp = new dwv.App(); | |
myapp.init({ | |
"containerDivId": "dwv-APPNUMBER", | |
"tools": ["Scroll", "ZoomAndPan", "WindowLevel"], | |
"gui": ["tool"] }); | |
myapp.loadURLs(["URLs"]); | |
dwv.gui.appendResetHtml(myapp); | |
} | |
// launch when page and i18n are loaded | |
var domContentLoaded = false; | |
var i18nLoaded = false; | |
document.addEventListener("DOMContentLoaded", function (/*event*/) | |
{ | |
domContentLoaded = true; | |
launchAppAPPNUMBER(); | |
}); | |
dwv.i18nOnLoaded( function () { | |
i18nLoaded = true; | |
launchAppAPPNUMBER(); | |
}); | |
function launchAppAPPNUMBER() { | |
if ( domContentLoaded && i18nLoaded ) { | |
startAppAPPNUMBER(); | |
} | |
} |
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
// variables: APPNUMBER and URLs | |
document.addEventListener("DOMContentLoaded", function (/*event*/) | |
{ | |
var appAPPNUMBER = new dwv.App(); | |
appAPPNUMBER.init({ | |
"containerDivId": "dwv-APPNUMBER", | |
"tools": ["Scroll", "Zoom/Pan", "Window/Level"], | |
"gui": ["tool"] }); | |
appAPPNUMBER.loadURL(["URLs"]); | |
dwv.gui.appendResetHtml(appAPPNUMBER); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the code that was changed in the Wordpress DICOM Support plugin between version 0.3 (
wp-applauncher_OLD.js
) and 0.4 (wp-applauncher_NEW.js
andwp-appgui_init.js
).DWV introduced an internalisation scheme that needs to be initialised when DWV is launched. This is done in the
dwv.wp.init()
function defined here inwp-appgui_init.js
(the file is just namedappgui.js
in the plugin). Before DWV is launched, it needs to check if the language pack has been loaded, this is why it waits on the 'loaded' event (indwv.i18nOnLoaded
). DWV can be launched after this event and the document is loaded (DOMContentLoaded
).Regarding translations, anyone interested in helping can register on the dwv transifex page.
Another small change is in the tools naming:
Zoom/Pan
becomesZoomAndPan
andWindow/Level
becomesWindowLevel
.