Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorbox #24

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ If you want to use the python code in utils.py (or the example_project, which
depends on it), you'll need to install the python requirements by doing
pip install -r requirements.txt and have the following binaries in your PATH:
- convert (from imagemagick)
- gs (from ghostscript)
- gs (from ghostscript)

We are now using Colorbox as a popup manager, you can change its default
behavior by doing something like this:

var colorbox_defaults = {
close: '',
[insert any setting here]
};

$.extend($.colorbox.settings, colorbox_defaults);
32 changes: 32 additions & 0 deletions digitalpaper/static/digitalpaper/css/reader.css
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,35 @@ p {
left: 260px;
display: none;
}

/****************** minimal out of the box Colorbox styles ***************/
#colorbox {
background-color: white;
z-index: 5;
overflow:hidden;
}
#colorbox div {
margin:0;
padding:0;
}
#colorbox iframe {
margin-bottom:-5px;
}
#cboxOverlay {
z-index: 4;
background-color: #000;
height: 100%;
width: 100%;
position: fixed;
top: 0px;
left: 0px;
}
#cboxContent {
position: relative;
}
#cboxClose {
cursor: pointer;
position: absolute;
top: 10px;
right: 10px;
}
16 changes: 13 additions & 3 deletions digitalpaper/static/digitalpaper/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,21 @@ var libeConfigFunc = function (data) {

var restrictedAccess = function() {
jQuery(document).trigger('show-restricted-access');
jQuery.openDOMWindow({
windowSourceID: '#restrictedAccess',
jQuery.colorbox({
iframe:false,
inline:true,
href:'#restrictedAccess',
width: 760,
height: 480,
windowPadding: 0
close: '',
onOpen:function() {
jQuery('body').css({'overflow': 'auto'});
jQuery('div#restrictedAccess').show();
},
onClosed:function() {
jQuery('body').css({'overflow': 'hidden'});
jQuery('div#restrictedAccess').hide();
}
});
return false;
};
Expand Down
6 changes: 6 additions & 0 deletions digitalpaper/static/digitalpaper/js/jquery.colorbox-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 6 additions & 20 deletions digitalpaper/static/digitalpaper/js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var libePage = function(pageNumber, pageId, pageChannel, pageMaps) {
return false;
}
var data = jQuery(this).data('area');

if (data.object_class == "article") {
var url = libeConfig.webservices.contentmodel;
var replaces = {
Expand All @@ -87,28 +88,13 @@ var libePage = function(pageNumber, pageId, pageChannel, pageMaps) {
if (libeConfig.modelmapping[k] == 'iframe' ||
libeConfig.modelmapping[k] == 'ajax' ||
libeConfig.modelmapping[k] == 'inline') {
var dw = jQuery(this).openDOMWindow({
windowSourceURL: url,
windowSourceID: '#contentmodelContent',

var dw = jQuery.colorbox({
href: url,
iframe: true,
width: parseInt(document.documentElement.clientWidth * 90 / 100, 10),
height: parseInt(document.documentElement.clientHeight * 90 / 100, 10),
fixedWindowY: 0,
windowSource: libeConfig.modelmapping[k],
loader: 1,
functionCallOnClose: function() {
jQuery('body').css({'overflow': 'auto'});
},
functionCallOnOpen: function() {
jQuery('body').css({'overflow': 'hidden'});
}
height: parseInt(document.documentElement.clientHeight * 90 / 100, 10)
});
if (libeConfig.modelmapping[k] == 'inline') {
// inline is interesting to add custom content, but
// it doesn't load the URL, so we have to do it manually
// Note: have a .inner element inside your #contentmodelContent
// when you want to use this!
jQuery('#DOMWindow .inner').load(url);
}
} else {
window.open(url);
}
Expand Down
3 changes: 2 additions & 1 deletion digitalpaper/static/digitalpaper/js/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ var libeReader = function() {
jQuery(document.body).css({'overflow': 'visible', 'height': 'auto' });
_isZoomed = false;
jQuery('#zoomButton').removeClass('unzoom');

return false;
}

Expand All @@ -179,7 +180,7 @@ var libeReader = function() {
}

function keyboardCallback(e) {
if (jQuery('#DOMWindow').length <= 0) {
if (jQuery('#colorbox').css('display') != 'block') {
if (_isZoomed) {
return zoomedKeyboardCallback(e);
} else {
Expand Down
5 changes: 3 additions & 2 deletions digitalpaper/templates/digitalpaper/_jquery.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}libe/js/history.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery-1.5.2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery.jdpicker.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery.DOMWindow.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}digitalpaper/js/jquery.colorbox-min.js"></script>
<script type="text/javascript">
$.noConflict();
</script>
Binary file modified example_project/example_digitalpaper_project.db
Binary file not shown.