noheader: Remove leftovers from "noheader"
[ninja.git] / application / views / js / iframe-adjust.js
blobf081d0f07571823ca817f1479ae81bd39d2ba024
2 $(document).ready(function() {
4         adjust_height();
6         if ($('#iframe') || $('#nagvis') || $('#hypermap')) {
7                 var elements = $('#iframe, #nagvis, #hypermap');
9                 var ua = navigator.userAgent.toLowerCase();
11                 if (ua.indexOf('ipad') != -1 || ua.indexOf('android') != -1) {
13                         var agent = (ua.indexOf('ipad') != -1) ? 'iPad' : 'Android';
15                         elements.load(function () {
17                                 var note = $('<div style="position: relative; border: 1px solid #eebb55; padding: 8px; background: #fea; font-size: 9pt;"></div>');
19                                 if (elements.attr('id') === 'iframe') {
20                                         note.css('top', '28px');
21                                 }
23                                 note.append('<span>Known issues on ' + agent + ' with iframes </span>');
24                                 note.append($('<a href="#"></a>').html('Open in a new window').click(function () {
25                                         window.open('https://' + window.location.hostname + elements.attr('src'), '_blank');
26                                 }))
28                                 var first = $(elements.contents().find('body')[0].firstChild);
29                                 first.before(note);
30                         });
31                 }
33         }
35 });
37 function adjust_height_frame( selector ) {
39         var content_div = $( "body > .container > #content" ),
40                         header_div = $( "body > .container >#header" ),
41                         body = $( "body" );
43         var height = body.height() - header_div.outerHeight();
44         var iframe = $( selector );
46         if( iframe ) {
47                 iframe.css( 'height', ( height - 4 ) + 'px' );
48                 content_div.css( "height", (height) + "px" );
49         }
53 function adjust_height() {
55         adjust_height_frame('#iframe');
56         adjust_height_frame('#nagvis');
57         adjust_height_frame('#hypermap');
58         adjust_height_frame('#content');
60         $('body').css('overflow-y', 'hidden');
64 $(window).bind( "resize", adjust_height );