PageSourceSearch

https://imaginaction.org/wp-content/plugins/wp-crowdfunding/assets/js/SocialShare.js?ver=2.2.2

js imaginaction.org collected 2026-10-02 17:47:41 UTC 9,048 bytes, 256 lines download raw bytes

vendor: 3,641 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap
2/******/ 	// The module cache
3/******/ 	var installedModules = {};
4/******/
5/******/ 	// The require function
6/******/ 	function __webpack_require__(moduleId) {
7/******/
8/******/ 		// Check if module is in cache
9/******/ 		if(installedModules[moduleId]) {
10/******/ 			return installedModules[moduleId].exports;
11/******/ 		}
12/******/ 		// Create a new module (and put it into the cache)
13/******/ 		var module = installedModules[moduleId] = {
14/******/ 			i: moduleId,
15/******/ 			l: false,
16/******/ 			exports: {}
17/******/ 		};
18/******/
19/******/ 		// Execute the module function
20/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ 		// Flag the module as loaded
23/******/ 		module.l = true;
24/******/
25/******/ 		// Return the exports of the module
26/******/ 		return module.exports;
27/******/ 	}
28/******/
29/******/
30/******/ 	// expose the modules object (__webpack_modules__)
31/******/ 	__webpack_require__.m = modules;
32/******/
33/******/ 	// expose the module cache
34/******/ 	__webpack_require__.c = installedModules;
35/******/
36/******/ 	// define getter function for harmony exports
37/******/ 	__webpack_require__.d = function(exports, name, getter) {
38/******/ 		if(!__webpack_require__.o(exports, name)) {
39/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
40/******/ 		}
41/******/ 	};
42/******/
43/******/ 	// define __esModule on exports
44/******/ 	__webpack_require__.r = function(exports) {
45/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47/******/ 		}
48/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
49/******/ 	};
50/******/
51/******/ 	// create a fake namespace object
52/******/ 	// mode & 1: value is a module id, require it
53/******/ 	// mode & 2: merge all properties of value into the ns
54/******/ 	// mode & 4: return value when already ns object
55/******/ 	// mode & 8|1: behave like require
56/******/ 	__webpack_require__.t = function(value, mode) {
57/******/ 		if(mode & 1) value = __webpack_require__(value);
58/******/ 		if(mode & 8) return value;
59/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60/******/ 		var ns = Object.create(null);
61/******/ 		__webpack_require__.r(ns);
62/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64/******/ 		return ns;
65/******/ 	};
66/******/
67/******/ 	// getDefaultExport function for compatibility with non-harmony modules
68/******/ 	__webpack_require__.n = function(module) {
69/******/ 		var getter = module && module.__esModule ?
70/******/ 			function getDefault() { return module['default']; } :
71/******/ 			function getModuleExports() { return module; };
72/******/ 		__webpack_require__.d(getter, 'a', getter);
73/******/ 		return getter;
74/******/ 	};
75/******/
76/******/ 	// Object.prototype.hasOwnProperty.call
77/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78/******/
79/******/ 	// __webpack_public_path__
80/******/ 	__webpack_require__.p = "";
81/******/
82/******/
83/******/ 	// Load entry module and return exports
84/******/ 	return __webpack_require__(__webpack_require__.s = "./addons/social-share/assets/js/SocialShare.js");
85/******/ })
86/************************************************************************/
87/******/ ({
88
89/***/ "./addons/social-share/assets/js/SocialShare.js":
90/*!******************************************************!*\
91  !*** ./addons/social-share/assets/js/SocialShare.js ***!
92  \******************************************************/
93/*! no static exports found */
94/***/ (function(module, exports, __webpack_require__) {
95
96"use strict";
97
98
99/*
100    SocialShare - jQuery plugin
101*/
102(function ($) {
103	function get_class_list(elem) {
104		if (elem.classList) {
105			return elem.classList;
106		} else {
107			return $(elem).attr('class').match(/\S+/gi);
108		}
109	}
110
111	$.fn.ShareLink = function (options) {
112		var defaults = {
113			title: '',
114			text: '',
115			image: '',
116			url: window.location.href,
117			class_prefix: 's_'
118		};
119
120		var options = $.extend({}, defaults, options);
121
122		var class_prefix_length = options.class_prefix.length;
123
124		var templates = {
125			twitter: 'https://twitter.com/intent/tweet?url={url}&text={text}',
126			facebook: 'https://www.facebook.com/sharer.php?s=100&p[title]={title}&u={url}&t={title}&p[summary]={text}&p[url]={url}',
127			pinterest: 'https://www.pinterest.com/pin/create/button/?media={image}&url={url}&description={text}',
128			linkedin: 'https://www.linkedin.com/shareArticle?mini=true&url={url}&title={title}&summary={text}&source={url}',
129			tumblr: 'https://tumblr.com/share?s=&v=3&t={title}&u={url}',
130			blogger: 'https://blogger.com/blog-this.g?t={text}&n={title}&u={url}',
131			delicious: 'https://delicious.com/save?url={url}&title={title}',
132			digg: 'https://digg.com/submit?url={url}&title={title}',
133			reddit: 'http://reddit.com/submit?url={url}&title={title}',
134			stumbleupon: 'https://www.stumbleupon.com/submit?url={url}&title={title}',
135			pocket: 'https://getpocket.com/edit?url={url}&title={title}',
136			wordpress: 'http://wordpress.com/wp-admin/press-this.php?u={url}&t={title}&s={text}&v=2',
137			whatsapp: 'whatsapp://send?text={url} {title}'
138		};
139
140		function link(network) {
141			var url = templates[network];
142			url = url.replace(/{url}/g, encodeURIComponent(options.url));
143			url = url.replace(/{title}/g, encodeURIComponent(options.title));
144			url = url.replace(/{text}/g, encodeURIComponent(options.text));
145			url = url.replace(/{image}/g, encodeURIComponent(options.image));
146			return url;
147		}
148
149		return this.each(function (i, elem) {
150			var classlist = get_class_list(elem);
151			for (var i = 0; i < classlist.length; i++) {
152				var cls = classlist[i];
153				if (cls.substr(0, class_prefix_length) == options.class_prefix && templates[cls.substr(class_prefix_length)]) {
154					var final_link = link(cls.substr(class_prefix_length));
155					$(elem).attr('href', final_link).click(function () {
156						if ($(this).attr('href').indexOf('http://') === -1 && $(this).attr('href').indexOf('https://') === -1) {
157							return window.open($(this).attr('href')) && false;
158						}
159						var screen_width = screen.width;
160						var screen_height = screen.height;
161						var popup_width = options.width ? options.width : screen_width - screen_width * 0.2;
162						var popup_height = options.height ? options.height : screen_height - screen_height * 0.2;
163						var left = screen_width / 2 - popup_width / 2;
164						var top = screen_height / 2 - popup_height / 2;
165						var parameters = 'toolbar=0,status=0,width=' + popup_width + ',height=' + popup_height + ',top=' + top + ',left=' + left;
166						return window.open($(this).attr('href'), '', parameters) && false;
167					});
168				}
169			}
170		});
171	};
172
173	$.fn.ShareCounter = function (options) {
174		var defaults = {
175			url: window.location.href,
176			class_prefix: 'c_',
177			display_counter_from: 0,
178			increment: false
179		};
180
181		var options = $.extend({}, defaults, options);
182
183		var class_prefix_length = options.class_prefix.length;
184
185		var social = {
186			linkedin: linkedin,
187			pinterest: pinterest,
188			facebook: facebook
189		};
190
191		return this.each(function (i, elem) {
192			var classlist = get_class_list(elem);
193			for (var i = 0; i < classlist.length; i++) {
194				var cls = classlist[i];
195				if (cls.substr(0, class_prefix_length) == options.class_prefix && social[cls.substr(class_prefix_length)]) {
196					social[cls.substr(class_prefix_length)](options.url, function (count) {
197						count = parseInt(count);
198						if (count >= options.display_counter_from) {
199							var current_value = parseInt($(elem).text());
200							if (options.increment && !isNaN(current_value)) {
201								count += current_value;
202							}
203							$(elem).text(count);
204						}
205					});
206				}
207			}
208		});
209
210		function linkedin(url, callback) {
211			$.ajax({
212				type: 'GET',
213				dataType: 'jsonp',
214				url: 'https://www.linkedin.com/countserv/count/share',
215				data: { url: url, format: 'jsonp' }
216			}).done(function (data) {
217				callback(data.count);
218			}).fail(function () {
219				callback(0);
220			});
221		}
222
223		function pinterest(url, callback) {
224			$.ajax({
225				type: 'GET',
226				dataType: 'jsonp',
227				url: 'https://api.pinterest.com/v1/urls/count.json',
228				data: { url: url }
229			}).done(function (data) {
230				callback(data.count);
231			}).fail(function () {
232				callback(0);
233			});
234		}
235
236		function facebook(url, callback) {
237			$.ajax({
238				type: 'GET',
239				dataType: 'jsonp',
240				url: 'https://graph.facebook.com',
241				data: { id: url }
242			}).done(function (data) {
243				if (data.share != undefined && data.share.share_count != undefined) {
244					callback(data.share.share_count);
245				}
246			}).fail(function () {
247				callback(0);
248			});
249		}
250	};
251})(jQuery);
252
253/***/ })
253
254
255/******/ });
256//# sourceMappingURL=SocialShare.js.map

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.