GX-Task #44419 » Zwischenstand__44419.patch
| src/templates/Honeygrid/styles/modules/_product_info.scss (revision ) | ||
|---|---|---|
| 514 | 514 |
.product-info-share {
|
| 515 | 515 |
padding: 0 ($grid-gutter-width / 2) 10px; |
| 516 | 516 |
@include clearfix(); |
| 517 |
.product-info-share-item {
|
|
| 518 |
margin: 0 ($grid-gutter-width / 2) $grid-gutter-width 0; |
|
| 519 |
float: left; |
|
| 520 |
img {
|
|
| 521 |
cursor: pointer; |
|
| 522 |
} |
|
| 523 |
} |
|
| 524 | 517 |
} |
| 525 | 518 |
|
| 526 | 519 |
|
| development_tools/gulp_tasks/honeygrid/gulp_honeygrid_vendor.js (revision ) | ||
|---|---|---|
| 52 | 52 |
'respond', |
| 53 | 53 |
'Swiper', |
| 54 | 54 |
'blueimp-file-upload', |
| 55 |
'honeygrid-modernizr' |
|
| 55 |
'honeygrid-modernizr', |
|
| 56 |
'shariff' |
|
| 56 | 57 |
], |
| 57 | 58 |
overrides = {
|
| 58 | 59 |
'jQuery-rwdImageMaps': {
|
| src/templates/Honeygrid/javascript/engine/widgets/social_share.js (revision ) | ||
|---|---|---|
| 1 | 1 |
/* -------------------------------------------------------------- |
| 2 |
social_share.js 2015-10-15 gm
|
|
| 2 |
social_share.js 2016-02-19
|
|
| 3 | 3 |
Gambio GmbH |
| 4 | 4 |
http://www.gambio.de |
| 5 |
Copyright (c) 2015 Gambio GmbH
|
|
| 5 |
Copyright (c) 2016 Gambio GmbH
|
|
| 6 | 6 |
Released under the GNU General Public License (Version 2) |
| 7 | 7 |
[http://www.gnu.org/licenses/gpl-2.0.html] |
| 8 | 8 |
-------------------------------------------------------------- |
| ... | ... | |
| 11 | 11 |
/** |
| 12 | 12 |
* Widget that enables the social sharing support |
| 13 | 13 |
* (e.g.: Facebook, Twitter, Google+) |
| 14 |
* |
|
| 15 |
* https://github.com/heiseonline/shariff |
|
| 14 | 16 |
*/ |
| 15 | 17 |
gambio.widgets.module( |
| 16 | 18 |
'social_share', |
| 17 | 19 |
|
| 18 |
['xhr'],
|
|
| 20 |
[], |
|
| 19 | 21 |
|
| 20 | 22 |
function(data) {
|
| 21 | 23 |
|
| ... | ... | |
| 24 | 26 |
// ########## VARIABLE INITIALIZATION ########## |
| 25 | 27 |
|
| 26 | 28 |
var $this = $(this), |
| 27 |
defaults = {
|
|
| 28 |
// URL from where the social share markup gets delivered. |
|
| 29 |
url: jse.core.registry.get('tplPath') + 'social_sharing/get.php'
|
|
| 30 |
}, |
|
| 29 |
defaults = {},
|
|
| 31 | 30 |
options = $.extend(true, {}, defaults, data),
|
| 32 | 31 |
module = {};
|
| 33 | 32 |
|
| 34 | 33 |
|
| 35 |
// ########## EVENT HANDLER ########## |
|
| 36 |
|
|
| 37 | 34 |
/** |
| 38 |
* Click handler for the social sharing buttons / links
|
|
| 39 |
* @private
|
|
| 35 |
* Init function of the widget
|
|
| 36 |
* @constructor
|
|
| 40 | 37 |
*/ |
| 41 |
var _clickHandler = function() {
|
|
| 42 |
var $self = $(this), |
|
| 43 |
dataset = $self.data(); |
|
| 38 |
module.init = function(done) {
|
|
| 39 |
$this.addClass('shariff');
|
|
| 44 | 40 |
|
| 45 |
// Get the current configuration |
|
| 46 |
dataset = dataset.social_share || $self.parseModuleData('social_share');
|
|
| 41 |
var config = {
|
|
| 42 |
url: 'og:url', |
|
| 43 |
theme: 'standard', |
|
| 44 |
lang: jse.core.config.get('languageCode'),
|
|
| 45 |
services: [] |
|
| 46 |
}; |
|
| 47 | 47 |
|
| 48 |
// Collect data for the backend |
|
| 49 |
dataset.url = location.href; |
|
| 50 |
dataset.title = document.title; |
|
| 51 |
dataset.product_image = $('#product_image_swiper .swiper-slide img').first().attr('src');
|
|
| 48 |
if (options.facebook !== undefined) {
|
|
| 49 |
config.services.push('facebook');
|
|
| 50 |
} |
|
| 52 |
|
|
| 51 |
|
|
| 53 |
// Get the markup |
|
| 54 |
jse.libs.xhr.ajax({url: options.url, data: dataset, dataType: 'html'}).done(function(result) {
|
|
| 55 |
var $button = $(result), |
|
| 56 |
iframe = $button.is('iframe'),
|
|
| 57 |
$preloader = $('<div class="preloader" ></div>');
|
|
| 52 |
if (options.twitter !== undefined) {
|
|
| 53 |
config.services.push('twitter');
|
|
| 54 |
} |
|
| 58 |
|
|
| 55 |
|
|
| 59 |
// Appends a click handler if the new state is "off" |
|
| 60 |
if (dataset.state !== 'on') {
|
|
| 61 |
$self.one('click', _clickHandler);
|
|
| 62 |
dataset.state = 'on'; |
|
| 56 |
if (options.googleplus !== undefined) {
|
|
| 57 |
config.services.push('googleplus');
|
|
| 63 |
} |
|
| 64 |
|
|
| 58 |
} |
|
| 59 |
|
|
| 65 |
if (iframe) {
|
|
| 66 |
// If it is an iframe, show a preloader |
|
| 67 |
// and remove it, after the iframe has loaded |
|
| 68 |
$button.one('load', function() {
|
|
| 69 |
$preloader.remove(); |
|
| 70 |
}); |
|
| 71 |
|
|
| 72 |
$self |
|
| 73 |
.data('social_share', dataset)
|
|
| 74 |
.empty() |
|
| 75 |
.append($preloader) |
|
| 76 |
.append($button); |
|
| 77 |
|
|
| 78 |
} else {
|
|
| 79 |
// Else just append the button |
|
| 80 |
$self |
|
| 81 |
.data('social_share', dataset)
|
|
| 82 |
.empty() |
|
| 83 |
.append($button); |
|
| 60 |
if (options.pinterest !== undefined) {
|
|
| 61 |
config.services.push('pinterest');
|
|
| 84 |
} |
|
| 85 |
|
|
| 62 |
} |
|
| 63 |
|
|
| 86 |
}); |
|
| 87 |
}; |
|
| 88 |
|
|
| 89 |
|
|
| 90 |
// ########## INITIALIZATION ########## |
|
| 91 |
|
|
| 92 |
/** |
|
| 93 |
* Init function of the widget |
|
| 94 |
* @constructor |
|
| 95 |
*/ |
|
| 96 |
module.init = function(done) {
|
|
| 97 |
|
|
| 98 |
// In first instance perform the |
|
| 99 |
// action that will be performed |
|
| 100 |
// on click also |
|
| 101 |
$this |
|
| 102 |
.find('[data-social_share-service]')
|
|
| 103 |
.each(_clickHandler); |
|
| 64 |
new Shariff($this, config); |
|
| 104 |
|
|
| 65 |
|
|
| 105 | 66 |
done(); |
| 106 | 67 |
}; |
| 107 | 68 |
|
| src/templates/Honeygrid/snippets/product_info/social_share.html (revision ) | ||
|---|---|---|
| 1 | 1 |
{if $SHOW_FACEBOOK || $SHOW_TWITTER || $SHOW_GOOGLEPLUS || $SHOW_PINTEREST}
|
| 2 |
<div data-gambio-widget="social_share"> |
|
| 3 |
{if $SHOW_FACEBOOK}
|
|
| 4 |
<div data-social_share-service="facebook" data-social_share-state="off" class="product-info-share-item"></div> |
|
| 5 |
{/if}
|
|
| 6 |
{if $SHOW_TWITTER}
|
|
| 7 |
<div data-social_share-service="twitter" data-social_share-state="off" class="product-info-share-item"></div> |
|
| 8 |
{/if}
|
|
| 9 |
{if $SHOW_GOOGLEPLUS}
|
|
| 10 |
<div data-social_share-service="googleplus" data-social_share-state="off" class="product-info-share-item"></div> |
|
| 11 |
{/if}
|
|
| 12 |
{if $SHOW_PINTEREST}
|
|
| 13 |
<div data-social_share-service="pinterest" data-social_share-state="off" class="product-info-share-item"></div> |
|
| 14 |
{/if}
|
|
| 2 |
<div data-gambio-widget="social_share" |
|
| 3 |
{if $SHOW_FACEBOOK}data-social_share-facebook{/if}
|
|
| 4 |
{if $SHOW_TWITTER}data-social_share-twitter{/if}
|
|
| 5 |
{if $SHOW_GOOGLEPLUS}data-social_share-googleplus{/if}
|
|
| 6 |
{if $SHOW_PINTEREST}data-social_share-pinterest{/if}>
|
|
| 15 | 7 |
</div> |
| 16 | 8 |
{/if}
|
| bower.json (revision ) | ||
|---|---|---|
| 30 | 30 |
"spectrum": "~1.8.0", |
| 31 | 31 |
"codemirror": "CodeMirror#~5.10.0", |
| 32 | 32 |
"datetimepicker": "~2.4.5", |
| 33 |
"honeygrid-modernizr": "https://sources.gambio-server.net/gambio/honeygrid-modernizr.git" |
|
| 33 |
"honeygrid-modernizr": "https://sources.gambio-server.net/gambio/honeygrid-modernizr.git", |
|
| 34 |
"shariff": "^1.23.0" |
|
| 34 | 35 |
}, |
| 35 | 36 |
"devDependencies": {},
|
| 36 | 37 |
"resolutions": {
|
| 37 |
"jquery": ">=1.6"
|
|
| 38 |
"jquery": "~1.11.3"
|
|
| 38 | 39 |
} |
| 39 | 40 |
} |