1(function($) { 2 Drupal.behaviors.rsb = { 3 attach: function(context, settings) { 4 var pageTitle = document.title; //HTML page title 5 var pageUrl = location.href; //Location of the page 6 7 //var animateSpeed = Drupal.settings.responsive_share_buttons.animateSpeed; 8 //user hovers on the share button 9 $('#share-wrapper li').hover(function() { 10 var hoverEl = $(this); //get element 11 //browsers with width > 699 get button slide effect 12 if($(window).width() > 699) { 13 if (hoverEl.hasClass('visible')){ 14 hoverEl.animate({"margin-left":"-117px"}, "fast").removeClass('visible'); 15 } else { 16 hoverEl.animate({"margin-left":"0px"}, "fast").addClass('visible'); 17 } 18 } 19 }); 20 21 $('.button-wrap').click(function(event) { 22 var shareName = $(this).attr('class').split(' ')[0]; //get the first class name of clicked element 23 24 switch (shareName) //switch to different links based on different social name 25 { 26 case 'facebook': 27 var openLink = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle); 28 break; 29 case 'twitter': 30 var openLink = 'http://twitter.com/home?status=' + encodeURIComponent(pageTitle + ' ' + pageUrl); 31 break; 32 case 'digg': 33 var openLink = 'http://www.digg.com/submit?phase=2&url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle); 34 break; 35 case 'stumbleupon': 36 var openLink = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle); 37 break; 38 case 'delicious': 39 var openLink = 'http://del.icio.us/post?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle); 40 break; 41 case 'google': 42 var openLink = 'https://plus.google.com/share?url=' + encodeURIComponent(pageUrl) + '&title=' + encodeURIComponent(pageTitle); 43 break; 44 } 45 46 //Parameters for the Popup window 47 winWidth = 650; 48 winHeight = 450; 49 winLeft = ($(window).width() - winWidth) / 2, 50 winTop = ($(window).height() - winHeight) / 2, 51 winOptions = 'width=' + winWidth + ',height=' + winHeight + ',top=' + winTop + ',left=' + winLeft; 52 53 //open Popup window and redirect user to share website. 54 window.open(openLink,'Share This Link',winOptions); 55 return false; 56 }); 57 }, 58 } 59})(jQuery); 60;/*})'"*/ 61;/*})'"*/ 62(function ($) { 63 64/** 65 * A progressbar object. Initialized with the given id. Must be inserted into 66 * the DOM afterwards through progressBar.element. 67 * 68 * method is the function which will perform the HTTP request to get the 69 * progress bar state. Either "GET" or "POST". 70 * 71 * e.g. pb = new progressBar('myProgressBar'); 72 * some_element.appendChild(pb.element); 73 */ 74Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 75 var pb = this; 76 this.id = id; 77 this.method = method || 'GET'; 78 this.updateCallback = updateCallback; 79 this.errorCallback = errorCallback; 80 81 // The WAI-ARIA setting aria-live="polite" will announce changes after users 82 // have completed their current activity and not interrupt the screen reader. 83 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 84 this.element.html('<div class="bar"><div class="filled"></div></div>' + 85 '<div class="percentage"></div>' + 86 '<div class="message"> </div>'); 87}; 88 89/** 90 * Set the percentage and status message for the progressbar. 91 */ 92Drupal.progressBar.prototype.setProgress = function (percentage, message) { 93 if (percentage >= 0 && percentage <= 100) { 94 $('div.filled', this.element).css('width', percentage + '%'); 95 $('div.percentage', this.element).html(percentage + '%'); 96 } 97 $('div.message', this.element).html(message); 98 if (this.updateCallback) { 99 this.updateCallback(percentage, message, this); 100 } 101}; 102 103/** 104 * Start monitoring progress via Ajax. 105 */ 106Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 107 this.delay = delay; 108 this.uri = uri; 109 this.sendPing(); 110}; 111 112/** 113 * Stop monitoring progress via Ajax. 114 */ 115Drupal.progressBar.prototype.stopMonitoring = function () { 116 clearTimeout(this.timer); 117 // This allows monitoring to be stopped from within the callback. 118 this.uri = null; 119}; 120 121/** 122 * Request progress data from server. 123 */ 124Drupal.progressBar.prototype.sendPing = function () { 125 if (this.timer) { 126 clearTimeout(this.timer); 127 } 128 if (this.uri) { 129 var pb = this; 130 // When doing a post request, you need non-null data. Otherwise a 131 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 132 $.ajax({ 133 type: this.method, 134 url: this.uri, 135 data: '', 136 dataType: 'json', 137 success: function (progress) { 138 // Display errors. 139 if (progress.status == 0) { 140 pb.displayError(progress.data); 141 return; 142 } 143 // Update display. 144 pb.setProgress(progress.percentage, progress.message); 145 // Schedule next timer.
146 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 147 }, 148 error: function (xmlhttp) { 149 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 150 } 151 }); 152 } 153}; 154 155/** 156 * Display errors on the page. 157 */ 158Drupal.progressBar.prototype.displayError = function (string) { 159 var error = $('<div class="messages error"></div>').html(string); 160 $(this.element).before(error).hide(); 161 162 if (this.errorCallback) { 163 this.errorCallback(this); 164 } 165}; 166 167})(jQuery); 168 169;/*})'"*/ 170;/*})'"*/
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.