first commit
This commit is contained in:
71
modules/ph_simpleblog/js/admin.js
Normal file
71
modules/ph_simpleblog/js/admin.js
Normal file
@@ -0,0 +1,71 @@
|
||||
$(function() {
|
||||
$('.simpleblog-post-type').hide();
|
||||
|
||||
showPostType($('#id_simpleblog_post_type').val());
|
||||
|
||||
function showPostType(id_simpleblog_post_type)
|
||||
{
|
||||
$('.simpleblog-post-type').hide();
|
||||
$('.simpleblog-post-type-' + id_simpleblog_post_type).show();
|
||||
}
|
||||
|
||||
function handleAuthorChange()
|
||||
{
|
||||
var currentAuthor = $('#id_simpleblog_author').val();
|
||||
var customAuthor = $('.form-group.post_author');
|
||||
if (currentAuthor == 0) {
|
||||
customAuthor.show();
|
||||
} else {
|
||||
customAuthor.hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('change', '#id_simpleblog_post_type', function()
|
||||
{
|
||||
showPostType($(this).val());
|
||||
});
|
||||
|
||||
$(document).on('change', '#id_simpleblog_author', handleAuthorChange);
|
||||
handleAuthorChange();
|
||||
|
||||
function formatResult(product) {
|
||||
if (!product.image) return product.text;
|
||||
return "<img class='product_image' src='" + product.image + "' style='max-width: 50px; height: auto; vertical-align: middle; margin-right: 10px;' />" + product.text;
|
||||
}
|
||||
|
||||
$.fn.select2.defaults.set( "theme", "bootstrap" );
|
||||
var productSelector = $('#select_product');
|
||||
productSelector.select2(
|
||||
{
|
||||
minimumInputLength: 3,
|
||||
width: null,
|
||||
multiple: true,
|
||||
// id: function(obj) {
|
||||
// return obj.product_name;
|
||||
// },
|
||||
ajax: {
|
||||
url: 'index.php',
|
||||
dataType: 'json',
|
||||
quietMillis: 100,
|
||||
data: function (params) {
|
||||
var queryParameters = {
|
||||
q: params.term,
|
||||
controller:'AdminSimpleBlogPosts',
|
||||
action:'searchProducts',
|
||||
token:token,
|
||||
ajax:1
|
||||
}
|
||||
|
||||
return queryParameters;
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {
|
||||
results: data
|
||||
};
|
||||
}
|
||||
},
|
||||
templateResult: formatResult,
|
||||
templateSelection: formatResult,
|
||||
escapeMarkup: function (markup) { return markup; }
|
||||
});
|
||||
});
|
||||
35
modules/ph_simpleblog/js/index.php
Normal file
35
modules/ph_simpleblog/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
8
modules/ph_simpleblog/js/isotope.pkgd.min.js
vendored
Normal file
8
modules/ph_simpleblog/js/isotope.pkgd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
modules/ph_simpleblog/js/jquery.bxslider.min.js
vendored
Normal file
10
modules/ph_simpleblog/js/jquery.bxslider.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
83
modules/ph_simpleblog/js/jquery.fitvids.js
Normal file
83
modules/ph_simpleblog/js/jquery.fitvids.js
Normal file
@@ -0,0 +1,83 @@
|
||||
/*global jQuery */
|
||||
/*jshint browser:true */
|
||||
/*!
|
||||
* FitVids 1.1
|
||||
*
|
||||
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
||||
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
||||
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
||||
*
|
||||
*/
|
||||
|
||||
(function( $ ){
|
||||
|
||||
"use strict";
|
||||
|
||||
$.fn.fitVids = function( options ) {
|
||||
var settings = {
|
||||
customSelector: null,
|
||||
ignore: null,
|
||||
};
|
||||
|
||||
if(!document.getElementById('fit-vids-style')) {
|
||||
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
|
||||
head.appendChild(div.childNodes[1]);
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
$.extend( settings, options );
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var selectors = [
|
||||
"iframe[src*='player.vimeo.com']",
|
||||
"iframe[src*='youtube.com']",
|
||||
"iframe[src*='youtube-nocookie.com']",
|
||||
"iframe[src*='kickstarter.com'][src*='video.html']",
|
||||
"object",
|
||||
"embed"
|
||||
];
|
||||
|
||||
if (settings.customSelector) {
|
||||
selectors.push(settings.customSelector);
|
||||
}
|
||||
|
||||
var ignoreList = '.fitvidsignore';
|
||||
|
||||
if(settings.ignore) {
|
||||
ignoreList = ignoreList + ', ' + settings.ignore;
|
||||
}
|
||||
|
||||
var $allVideos = $(this).find(selectors.join(','));
|
||||
$allVideos = $allVideos.not("object object"); // SwfObj conflict patch
|
||||
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
|
||||
|
||||
$allVideos.each(function(){
|
||||
var $this = $(this);
|
||||
if($this.parents(ignoreList).length > 0) {
|
||||
return; // Disable FitVids on this video.
|
||||
}
|
||||
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
||||
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
|
||||
{
|
||||
$this.attr('height', 9);
|
||||
$this.attr('width', 16);
|
||||
}
|
||||
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
||||
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
||||
aspectRatio = height / width;
|
||||
if(!$this.attr('id')){
|
||||
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
|
||||
$this.attr('id', videoID);
|
||||
}
|
||||
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
|
||||
$this.removeAttr('height').removeAttr('width');
|
||||
});
|
||||
});
|
||||
};
|
||||
// Works with either jQuery or Zepto
|
||||
})( window.jQuery || window.Zepto );
|
||||
123
modules/ph_simpleblog/js/ph_simpleblog.js
Normal file
123
modules/ph_simpleblog/js/ph_simpleblog.js
Normal file
@@ -0,0 +1,123 @@
|
||||
function markAlreadyLikedPost(guest, id_simpleblog_post)
|
||||
{
|
||||
if ($.cookie('guest_' + guest + '_' + id_simpleblog_post) == "voted")
|
||||
{
|
||||
$('.simpleblog-like-button').addClass('voted');
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
|
||||
if($('#module-ph_simpleblog-single').length > 0)
|
||||
{
|
||||
$('.ph_simpleblog a.fancybox').fancybox();
|
||||
$(".simpleblog-single").fitVids();
|
||||
|
||||
markAlreadyLikedPost($('#module-ph_simpleblog-single .simpleblog-like-button').data('guest'), $('.simpleblog-single .simpleblog-like-button').data('post'));
|
||||
|
||||
$(document).on('click', '.simpleblog-socialshare-icons button', function(){
|
||||
type = $(this).attr('data-type');
|
||||
if (type.length)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case 'twitter':
|
||||
window.open('https://twitter.com/intent/tweet?text=' + ph_sharing_name + ' ' + encodeURIComponent(ph_sharing_url), 'sharertwt', 'toolbar=0,status=0,width=640,height=445');
|
||||
break;
|
||||
case 'facebook':
|
||||
window.open('http://www.facebook.com/sharer.php?u=' + ph_sharing_url, 'sharer', 'toolbar=0,status=0,width=660,height=445');
|
||||
break;
|
||||
case 'google-plus':
|
||||
window.open('https://plus.google.com/share?url=' + ph_sharing_url, 'sharer', 'toolbar=0,status=0,width=660,height=445');
|
||||
break;
|
||||
case 'pinterest':
|
||||
window.open('http://www.pinterest.com/pin/create/button/?media=' + ph_sharing_img + '&url=' + ph_sharing_url, 'sharerpinterest', 'toolbar=0,status=0,width=660,height=445');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.simpleblog-like-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
var id_simpleblog_post = $(this).data('post');
|
||||
var id_guest = $(this).data('guest');
|
||||
var element = $(this);
|
||||
|
||||
if ($.cookie('guest_' + id_guest + '_' + id_simpleblog_post) == "voted")
|
||||
{
|
||||
$.cookie('guest_' + id_guest + '_' + id_simpleblog_post, '');
|
||||
var request = $.ajax({
|
||||
type: "POST",
|
||||
url: baseDir + 'modules/ph_simpleblog/ajax.php',
|
||||
data: {
|
||||
action: 'removeRating',
|
||||
id_simpleblog_post : id_simpleblog_post
|
||||
},
|
||||
success: function(result)
|
||||
{
|
||||
var data = $.parseJSON(result);
|
||||
if (data.status == 'success')
|
||||
{
|
||||
element.removeClass('voted').find('span').text(data.message);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$.cookie('guest_' + id_guest + '_' + id_simpleblog_post, 'voted');
|
||||
var request = $.ajax({
|
||||
type: "POST",
|
||||
url: baseDir + 'modules/ph_simpleblog/ajax.php',
|
||||
data: {
|
||||
action: 'addRating',
|
||||
id_simpleblog_post : id_simpleblog_post
|
||||
},
|
||||
success: function(result)
|
||||
{
|
||||
var data = $.parseJSON(result);
|
||||
if (data.status == 'success')
|
||||
{
|
||||
element.addClass('voted').find('span').text(data.message);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".simpleblog-post-item .post-item").fitVids();
|
||||
$('.simpleblog-post-item a.post-gallery-link').fancybox();
|
||||
|
||||
$(".simpleblog-post-type-video .post-thumbnail a").fancybox({
|
||||
maxWidth : 800,
|
||||
maxHeight : 600,
|
||||
fitToView : false,
|
||||
autoSize : false,
|
||||
closeClick : false,
|
||||
width : 640,
|
||||
height : 385,
|
||||
openEffect : 'none',
|
||||
closeEffect : 'none',
|
||||
iframe: {
|
||||
preload: false
|
||||
},
|
||||
helpers : {
|
||||
overlay : {
|
||||
css : {
|
||||
'background' : 'rgba(0, 0, 0, 0.90)'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
7
modules/ph_simpleblog/js/ph_simpleblog_masonry.js
Normal file
7
modules/ph_simpleblog/js/ph_simpleblog_masonry.js
Normal file
@@ -0,0 +1,7 @@
|
||||
$(window).load(function()
|
||||
{
|
||||
var $container = $('.simpleblog-posts');
|
||||
$container.isotope({
|
||||
itemSelector: '.simpleblog-post-item'
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user