1// mlab_popup.js v1.0.1, 18.03.2016 2// Copyright (c) 2014 Magneticlab (http://www.magneticlab.ch) 3 4jQuery(document).ready(function(){ 5 6 jQuery('#preview_help').hide(); 7 8 //Close Popups and Fade Layer 9 jQuery( '.mlab-close' ).on( 'click', function() { 10 //When clicking on the close or fade layer... 11 jQuery( '.mlab-modal' ).fadeOut( function() { 12 jQuery( '#mlab-modal-backdrops' ).hide(); 13 }); //fade them both out 14 return false; 15 }); 16 17 // Preview function in admin page 18 jQuery('#mlab_popup_preview').on('click', function() { 19 //reset 20 jQuery('.mlab-modal-title').html(''); 21 jQuery('.mlab-modal-body').html(''); 22 jQuery('.mlab-modal-label').val(''); 23 jQuery('.mlab-modal-link').attr("href", "#") 24 jQuery( '.mlab-modal-footer' ).hide(); 25 jQuery( '.mlab-modal-donotshow' ).hide(); 26 //get 27 var titre = jQuery('#popup_titre').attr( 'value' ); 28 var text = jQuery('#popup_content').val(); 29 var width = jQuery('#popup_width').attr( 'value' ); 30 var label = jQuery('#popup_label').attr( 'value' ); 31 var url = jQuery('#popup_link').attr( 'value' ); 32 var notshow = jQuery('#popup_donotshow' ).prop('checked') 33 //set 34 if ( url.length > 0 && label.length > 0){ 35 jQuery( '.mlab-modal-footer' ).show(); 36 } 37 if( notshow ){ 38 jQuery( '.mlab-modal-donotshow' ).show(); 39 } 40 jQuery('.mlab-modal-title').html( titre ); 41 jQuery('.mlab-modal-body').html( text ); 42 jQuery('.mlab-modal-dialog').css( "width", width+'px' ); 43 jQuery('.mlab-modal-label').val(label); 44 jQuery('.mlab-modal-link').attr("href", url) 45 46 jQuery('.mlab-modal').fadeIn(); 47 }); 48 49 if ( jQuery( '#mlab_popup_preview' ).is( ':disabled' ) == true ){ 50 jQuery( '#mlab_popup_preview' ).prop( 'disabled', false ); 51 jQuery( '#preview_help' ).hide(); 52 } 53 54 // Preview only available on text editor 55 jQuery('#popup_content-tmce').on('click', function() { 56 if ( jQuery('#mlab_popup_preview').is(':disabled') == false ){ 57 jQuery('#mlab_popup_preview').prop('disabled', true); 58 jQuery('#preview_help').show(); 59 } 60 }); 61 62 // Preview only available on text editor 63 jQuery('#popup_content-html').on('click', function() { 64 if ( jQuery( '#mlab_popup_preview' ).is( ':disabled' ) == true ){ 65 jQuery( '#mlab_popup_preview' ).prop( 'disabled', false ); 66 jQuery( '#preview_help' ).hide(); 67 } 68 }); 69 70 // Preview image from new src in admin page 71 function readURL(input) { 72 if (input.files && input.files[0]) { 73 var reader = new FileReader(); 74 75 reader.onload = function (e) { 76 jQuery("#preview_image").attr("src", e.target.result); 77 } 78 reader.readAsDataURL(input.files[0]); 79 } 80 } 81 82 jQuery("#popup_img").change(function(){ 83 readURL(this); 84 }); 85 86 // Send request for do not show session 87 jQuery("#donotshow").change(function(){ 88 SetAjax( 'session', jQuery(this).prop('checked') ); 89 }); 90 91 function SetAjax( tag, param ){ 92 jQuery.ajax({ 93 method: "POST", 94 url: popup_object.ajax_url, 95 data: { tag: param } 96 }) 97 } 98 99}); 100 101
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.