From ced3f8e7111227ff6dbf17629bf604696bece5eb Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 29 Jan 2014 16:03:51 +0100 Subject: [PATCH] Moved css into library. --- h5p.classes.php | 18 ++++++++++++---- images/h5p_logo.png | Bin 0 -> 16238 bytes images/h5p_logo.svg | 26 ++++++++++++++++++++++ js/h5p.js | 40 ++++++++++++++++++++-------------- styles/h5p.css | 51 +++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 114 insertions(+), 21 deletions(-) create mode 100644 images/h5p_logo.png create mode 100644 images/h5p_logo.svg diff --git a/h5p.classes.php b/h5p.classes.php index 122c14d..b647efb 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -246,6 +246,16 @@ interface H5PFrameworkInterface { * Check if export is enabled. */ public function isExportEnabled(); + + /** + * Defines getEditorLibraries. + * + * @param $machineName Library identifier. + * @param $majorVersion Library identfier. + * @param $minorVersion Library identfier. + * @return array Editor libraries? + */ + public function getEditorLibraries($machineName, $majorVersion, $minorVersion, $complete = FALSE); } /** @@ -1121,7 +1131,7 @@ Class H5PExport { // Build h5p.json $h5pJson = array ( 'title' => $title, - 'language' => $exportData['language'] ? $exportData['language'] : 'und', + 'language' => $language ? $language : 'und', 'mainLibrary' => $exportData['mainLibrary'], 'embedTypes' => $embedTypes, ); @@ -1145,8 +1155,8 @@ Class H5PExport { } // Add preloaded and dynamic dependencies if they exist - if ($preloadedDependencies) { $h5pJson['preloadedDependencies'] = $preloadedDependencies; } - if ($dynamicDependencies) { $h5pJson['dynamicDependencies'] = $dynamicDependencies; } + if (isset($preloadedDependencies)) { $h5pJson['preloadedDependencies'] = $preloadedDependencies; } + if (isset($dynamicDependencies)) { $h5pJson['dynamicDependencies'] = $dynamicDependencies; } // Save h5p.json $results = print_r(json_encode($h5pJson), true); @@ -1198,7 +1208,7 @@ Class H5PExport { $h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR; $zipPath = $h5pDir . 'exports' . DIRECTORY_SEPARATOR . $contentId . '.h5p'; if (file_exists($zipPath)) { - file_delete($zipPath); + unlink($zipPath); } } diff --git a/images/h5p_logo.png b/images/h5p_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..4fb78641625e3b8d14bc359d65d4d2989b4f3e06 GIT binary patch literal 16238 zcmeI3dt4J&7RLvwMG;Ucz9_9RK1#tbnLG#?0|p5-P$OwT3%<&bOkgBrViHK8&|bwW6{MR_mj#wbcUFQl(n!3(Kcc)NTcKk^q4V%(|cL{;{9WB%eIa zJ@@?Xo$o#O%>8HHQqG_2>F(I@rM|$qQz4cR0H|*RNO+2-1S^aCPb}V+AV5zM;{gOfX$hAwl;&$_xDS3G# zKD^a*?7H!2*~RoyY!fynwO)^&Z_gJ0aoi&o`g-K2-|7!|L06}(e|YppplfsHg{oPe zohPyj0zBvC-qmk%>HmCVTX;64 zJ=dPi{Tbq)${Eg0H}7#-9)+rs{}#)s*n&qLDH@h9c@{@~HOARqV>izz-?1ZTW0zZ9 z(%&!YQDf!ugjer8;#b``({y>mnB4fRnTx_h;%;0CSXX@I#?=$nNnRwDrP}{PVD)#o zZ{FEnxo}&}@CVo6x)U)SHy6buK@d8gh>JJJE9RkUGA#(xkV$xuHO)Zrh9Jpos{vD| z;$~J7o=oUN*{w%v*(^d6%6?g>;3^CecnTrUGUBmW^W)T6scNx?Jv+=@Vnr!|G~A4_ ztZ6#E3AKi@?Yb!S-_{JXS@tgG)KGS~Z9rDMLdl9CjW|mfB;=^Mh=3&$2O&a45Q5BP z@wf;d=JH{L&p~)7SBxS;R`-h?=1%>S7&Tf{C3~TJILZoTriM} zL@XA=TprBhai|^~Q>NaGSvh*sREJ29jtn=cjfBBWkb0I)7fT}3&7o|zZJ^#)_jRQi zdI!>*y4g__VJl{UksvNSM36#3AC{IjXr##;nL*8@`^p9#&=i+xz+n|`BGZj(JTe2< zo2L#o35~i}$B=H++4*SHFs{SXs1Or1d1TNj76E#n`g){ z+)4})X7f10?5W^bAqka#XoL~R%%m}nBz0kqE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#6FA~M|e$RE|3-|k^Wedgp6OkEiej<>ggtt=bxong;DY-{xTtnw-ODmqdD>z8k+}L3`$`uC?+nZn~`u-vO_cYcqHm zZq_d}5p&jT_@?W8gv@HZWh0(REnGX( zEDPM{wfEqj*o?RwkGp^KB~>1IIgDr>VgjlbSiuLwc{}ds)N5g6JU6D;txS% zqkn%Zrt<2wO!w$<4<}V$_T0F%b`4syVOWUER(|tWA1t|-=dxnzhw||m9nw1;hwek| g_V?Wt(k?IPOhK&j%gd9aZO?N@Mb4L1%}IRYUt&Xp00000 literal 0 HcmV?d00001 diff --git a/images/h5p_logo.svg b/images/h5p_logo.svg new file mode 100644 index 0000000..7777c56 --- /dev/null +++ b/images/h5p_logo.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + diff --git a/js/h5p.js b/js/h5p.js index 17ede95..5edcafa 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -33,7 +33,7 @@ H5P.init = function () { else if (document.documentElement.mozRequestFullScreen) { H5P.fullScreenBrowserPrefix = 'moz'; } - else if (document.documentElement.msRequestFullScreen) { + else if (document.documentElement.msRequestFullscreen) { H5P.fullScreenBrowserPrefix = 'ms'; } } @@ -65,24 +65,30 @@ H5P.init = function () { var $iframe = H5P.jQuery(iframe), contentId = $iframe.data('content-id'), mainLibrary = $iframe.data('class'); + + $iframe.ready(function () { + // This is a bit hacky but necessary until libraries runs callbacks or similar when "done" or resizing or something. + resizeIframeInterval = setInterval(function () { + var $doc = $iframe.contents(); + var contentHeight = $doc.height(); + var frameHeight = $iframe.innerHeight(); + + if (frameHeight !== contentHeight) { + H5P.resizeIframe(contentId, contentHeight); + $doc[0].documentElement.style.margin = '0 0 1px 0'; + } + else { + // Small trick to make scrollbars go away in ie. + $doc[0].documentElement.style.margin = '0 0 0 0'; + } + + }, 300); + }); iframe.contentDocument.open(); iframe.contentDocument.write('' + H5PIntegration.getHeadTags(contentId) + '
'); iframe.contentDocument.close(); }); - - // TODO: This seems very hacky... why can't we just use the resize event? What happens if we ain't done before the next interval starts? - setInterval(function () { - $h5pIframes.each(function (idx, iframe) { - var $iframe = H5P.jQuery(iframe); - var contentHeight = $iframe.contents().height(); - var frameHeight = $iframe.innerHeight(); - - if (frameHeight !== contentHeight) { - H5P.resizeIframe($iframe.data('content-id'), contentHeight); - } - }); - }, 250); } }; @@ -175,7 +181,7 @@ H5P.fullScreen = function ($el, obj, exitCallback, $body) { $body.keyup(keyup); } else { - var first, eventName = H5P.fullScreenBrowserPrefix + 'fullscreenchange'; + var first, eventName = (H5P.fullScreenBrowserPrefix === 'ms' ? 'MSFullscreenChange' : H5P.fullScreenBrowserPrefix + 'fullscreenchange'); H5P.isFullscreen = true; document.addEventListener(eventName, function () { if (first === undefined) { @@ -203,7 +209,9 @@ H5P.fullScreen = function ($el, obj, exitCallback, $body) { $el[0].requestFullScreen(); } else { - $el[0][H5P.fullScreenBrowserPrefix + 'RequestFullScreen'](H5P.fullScreenBrowserPrefix === 'webkit' ? Element.ALLOW_KEYBOARD_INPUT : undefined); + var method = (H5P.fullScreenBrowserPrefix === 'ms' ? 'msRequestFullscreen' : H5P.fullScreenBrowserPrefix + 'RequestFullScreen'); + var params = (H5P.fullScreenBrowserPrefix === 'webkit' ? Element.ALLOW_KEYBOARD_INPUT : undefined); + $el[0][method](params); } $el.add(H5P.$body).addClass('h5p-fullscreen'); diff --git a/styles/h5p.css b/styles/h5p.css index b9874d6..ca637e6 100644 --- a/styles/h5p.css +++ b/styles/h5p.css @@ -27,6 +27,8 @@ div.h5p-semi-fullscreen { top: 0; left: 0; z-index: 101; + width: 100%; + height: 100%; } .h5p-content-controls { @@ -84,7 +86,7 @@ div.h5p-semi-fullscreen { background: -ms-linear-gradient(top, rgba(4,104,206,1) 0%,rgba(100,152,254,1) 100%); /* IE10+ */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0468ce', endColorstr='#6498fe',GradientType=0 ); /* IE6-9 */ } -.h5p-iframe-wrapper.h5p-fullscreen { +div.h5p-fullscreen { width: 100%; height: 100%; } @@ -167,3 +169,50 @@ body.h5p-iframe-content div.h5p-content { body.h5p-iframe-content.h5p-fullscreen div.h5p-content { height: 100%; } + +.h5p-export { + margin-top: 6px; + display: block; + position: relative; + float: left; + border-radius: 4px; + padding: 4px 58px 3px 12px; + font-weight: 900; + font-family: "Arial Black", Arial, sans-serif; + text-transform: uppercase; + color: white !important; + background-color: #ccc; + box-shadow: 0px 0px 4px #666; +} + +.h5p-export:after { + content: ""; + + display: inline; + width: 45px; + height: 27px; + + position: absolute; + right: 0; + top: 0; + + background-image: url(../images/h5p_logo.png); + background-image: url(../images/h5p_logo.svg), none; + background-repeat: no-repeat; + background-position: left center; +} + +.h5p-export:hover { + text-decoration: none; + color: white; + box-shadow: 0px 0px 6px #333; + background-color: #0092bf; + /* Firefox */ + -moz-transition: all 0.4s ease-in; + /* WebKit */ + -webkit-transition: all 0.4s ease-in; + /* Opera */ + -o-transition: all 0.4s ease-in; + /* Standard */ + transition: all 0.4s ease-in; +}