1!function ($) { 2 3 // Namespace 4 if (!$.jalios) { $.jalios = {}; } 5 if (!$.jalios.ui) { $.jalios.ui = {}; } 6 7 8 // ------------------------------------------ 9 // PRIVATE: Register 10 // ------------------------------------------ 11 12 // Action regexp 13 var pattern = /popin/i; 14 15 16 // Debug function 17 var callback = function(event){ 18 19 // Check event 20 var broker = $.jalios.Event.match(event, 'broker', pattern, true); 21 if (!broker){ return; } 22 23 // Element 24 var elm = broker.source.currentTarget; 25 26 // Call show() function 27 $.jalios.ui.Popin.open(elm); 28 29 } 30 31 32 var register = function(){ 33 // Register to broker 34 $(document).on("jalios:broker", callback); 35 } 36 37 38 var getPopinRefresh = function(){ 39 40 // Build a popin container 41 $popin = $('#PopinBottomLeft'); 42 if ($popin.exists()){ 43 $popin.remove(); 44 $popin = $('#PopinBottomLeft'); 45 } 46 47 if (!$popin.exists()){ 48 $popin = $('<div id="PopinBottomLeft" class="popin in fade bottom-left"></div>').appendTo('BODY'); 49 } 50 51 // Build popin option 52 var options = { 53 message: { html: '<div class="ajax-refresh-div"></div>' }, // $trigger.attr('title') 54 type: 'popin', 55 fadeOut: { enabled: true, delay: 3000 } 56 //onClosed : function(){ } 57 } 58 59 // Show the popin 60 var notif = $popin.notify(options); 61 notif.show(); 62 63 // Get ajax-refresh-div 64 return notif.$note.find('.ajax-refresh-div').first(); 65 } 66 67 // ------------------------------------------ 68 // PUBLIC 69 // ------------------------------------------ 70 71 /** 72 * Manage Jalios Popins using <a href="http://nijikokun.github.com/bootstrap-notify/">Bootstrap/Notify</a> framework. 73 * <br/><br/> 74 * 75 * <h5>Behavior</h5> 76 * 77 * Open a popin on BottomLeft screen corner, then perform an Ajax-Refresh with trigger.<br/> 78 * Triggers must contains <code>data-jalios-action="popin"</code> there is no class fallback. 79 * 80 * @namespace $.jalios.ui.Popin 81 * @copyright Jalios SA 82 * @see $.jalios.ui.Modal 83 * @see $.jalios.DataBroker 84 * @see $.jalios.AjaxRefresh 85 * 86 */ 87 $.jalios.ui.Popin = { 88 89 openFromUrl: function(url, options){ 90 91 // Create popin 92 var $div = getPopinRefresh(); 93 94 // Perform refresh 95 $div.refresh({ 96 'url' : url, 97 'noscroll' : true, 98 'nohistory' : true, 99 'waiting' : options ? options.waiting : false 100 }); 101 }, 102 103 open: function(trigger, options){ 104 if (!trigger){ return false; } 105 var $trigger = $(trigger); 106 107 // Create popin 108 var $div = getPopinRefresh(); 109 110 // Perform refresh 111 $trigger.refresh({ 112 'target' : $div, 113 'noscroll' : true, 114 'nohistory' : true, 115 'waiting' : options ? options.waiting : false 116 }); 117 } 118 } 119 120 121 // Plugin initialization on DOM ready 122 $(document).ready(function($) { 123 register(); 124 }); 125 126 127}(window.jQuery);
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.