1; 2(function ($) { 3 4 'use strict'; 5 6 $(function () { 7 8 window.stecSharer = function ($instance, glob, helper, url, id, repeatOffset) { 9 10 this.$instance = $instance; 11 this.glob = glob; 12 this.$share = null; 13 this.url = url; 14 this.id = id; 15 this.repeatOffset = repeatOffset; 16 17 this.init = function () { 18 var parent = this; 19 $('.stec-share').not('.stec-share-template').remove(); 20 this.$share = $(glob.template.share).appendTo('body'); 21 this.$share.removeClass('stec-share-template'); 22 this.$share.find('input[name=stec_permalink]').val(url); 23 this.getEmbed(id, this.$share.find('input[name=stec_embed_width]').val(), function (embedCode) { 24 parent.$share.find('textarea[name=stec_embed]').text(embedCode); 25 }); 26 27 this.open(); 28 }; 29 30 this.open = function () { 31 $('body').addClass('stec-modal-opened'); 32 }; 33 34 this.close = function () { 35 this.$share.remove(); 36 $('body').removeClass('stec-modal-opened'); 37 }; 38 39 this.getEmbed = function (eventid, width, callback) { 40 var frameHeight = 0; 41 var frameWidth = width ? width : 400; 42 var embedHtml = ''; 43 44 var embed = '<iframe src="' + window.resturl + 'stec/v2/get/embed/' + eventid + '/' + repeatOffset + '" width="' + frameWidth + '" frameborder=0></iframe>'; 45 46 var $iframe = $(embed).css({ 47 position: 'fixed', 48 left: -9999, 49 visibility: 'hidden' 50 }).appendTo('body'); 51 52 $iframe.on('load', function () { 53 frameHeight = $(this).contents().outerHeight(true); 54 $iframe.remove(); 55 embedHtml = ('<iframe src="' + window.resturl + 'stec/v2/get/embed/' + eventid + '/' + repeatOffset + '" height="' + frameHeight + '" width="' + frameWidth + '" frameborder=0></iframe>'); 56 callback(embedHtml); 57 }); 58 }; 59 60 this.Controller = function () { 61 62 var parent = this; 63 64 this.$share.on(helper.clickHandle(), function () { 65 parent.close(); 66 }); 67 68 this.$share.find('.stec-share-close').on(helper.clickHandle(), function () { 69 parent.close(); 70 }); 71 72 this.$share.find('.stec-share-block').on(helper.clickHandle(), function (e) { 73 e.stopPropagation(); 74 }); 75 76 this.$share.find('input[name=stec_embed_width]').on('change', function () { 77 parent.getEmbed(id, $(this).val(), function (embedCode) { 78 parent.$share.find('textarea[name=stec_embed]').text(embedCode); 79 }); 80 }); 81 82 this.$share.find('button[data-copy-permalink]').on(helper.clickHandle(), function () { 83 var linkURL = parent.$share.find('input[name=stec_permalink]').val(); 84 var $temp = $("<input>"); 85 $("body").append($temp); 86 $temp.val(linkURL).select(); 87 document.execCommand("copy"); 88 $temp.remove(); 89 alert(window.stecLang.copiedToClipboard); 90 }); 91 92 this.$share.find('button[data-copy-embed]').on(helper.clickHandle(), function () { 93 var embedCode = parent.$share.find('textarea[name=stec_embed]').text(); 94 var $temp = $("<input>"); 95 $("body").append($temp); 96 $temp.val(embedCode).select(); 97 document.execCommand("copy"); 98 $temp.remove(); 99 alert(window.stecLang.copiedToClipboard); 100 }); 101 102 }; 103 104 this.init(); 105 this.Controller(); 106 }; 107 108 window.stecEmailEvent = function ($instance, glob, helper, url, id, repeatOffset) { 109 110 this.$instance = $instance; 111 this.glob = glob; 112 this.$emailForm = null; 113 this.url = url; 114 this.id = id; 115 this.repeatOffset = repeatOffset; 116 117 this.init = function () { 118 var parent = this; 119 $('.stec-email-event').not('.stec-email-event-template').remove(); 120 this.$emailForm = $(glob.template.emailEvent).appendTo('body'); 121 this.$emailForm.removeClass('stec-email-event-template'); 122 this.open(); 123 }; 124 125 this.open = function () { 126 $('body').addClass('stec-modal-opened'); 127 }; 128 129 this.close = function () { 130 this.$emailForm.remove(); 131 $('body').removeClass('stec-modal-opened'); 132 }; 133 134 this.Controller = function () { 135 136 var parent = this; 137 138 this.$emailForm.on(helper.clickHandle(), function () { 139 parent.close(); 140 }); 141 142 this.$emailForm.find('.stec-email-event-close').on(helper.clickHandle(), function () { 143 parent.close(); 144 }); 145 146 this.$emailForm.find('.stec-email-event-block').on(helper.clickHandle(), function (e) { 147 e.stopPropagation(); 148 }); 149 150 this.$emailForm.find('.stec-email-event-compose').on(helper.clickHandle(), function (e) { 151 152 var email = parent.$emailForm.find('input[name="stec_email"]').val(); 153 var body = parent.$emailForm.find('textarea[name="stec_message"]').val(); 154 155 body += "\n\n" + parent.url; 156 157 $(this).attr('href', 'mailto:' + encodeURIComponent(email) + '?body=' + encodeURIComponent(body)); 158 }); 159 160 161 }; 162 163 this.init(); 164 this.Controller(); 165 }; 166 167 }); 168 169})(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.