Commit 691dd142 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent 9f158387
.sravnitel img{
max-width:none;
}
.sravnitel table{
display: table;
border-spacing: 2px;
box-sizing: unset;
-webkit-box-sizing:unset;
font-size: 1em;
}
.sravnitel th{
font-weight:bold;
text-align:center;
padding:0px;
}
.sravnitel td{
padding: 1px 1px 1px 1px;
line-height:1;
}
.sravnitel .divider_handle {
background-image: url('../images/handle_gray.png');
}
.sravnitel {
background:white;
}
This diff is collapsed.
This diff is collapsed.
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/
====
All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"name": "jquery-ui",
"title": "jQuery UI",
"description": "A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.",
"version": "1.12.1",
"homepage": "http://jqueryui.com",
"author": {
"name": "jQuery Foundation and other contributors",
"url": "https://github.com/jquery/jquery-ui/blob/1.12.1/AUTHORS.txt"
},
"main": "ui/widget.js",
"maintainers": [
{
"name": "Scott González",
"email": "scott.gonzalez@gmail.com",
"url": "http://scottgonzalez.com"
},
{
"name": "Jörn Zaefferer",
"email": "joern.zaefferer@gmail.com",
"url": "http://bassistance.de"
},
{
"name": "Mike Sherov",
"email": "mike.sherov@gmail.com",
"url": "http://mike.sherov.com"
},
{
"name": "TJ VanToll",
"email": "tj.vantoll@gmail.com",
"url": "http://tjvantoll.com"
},
{
"name": "Felix Nagel",
"email": "info@felixnagel.com",
"url": "http://www.felixnagel.com"
},
{
"name": "Alex Schmitz",
"email": "arschmitz@gmail.com",
"url": "https://github.com/arschmitz"
}
],
"repository": {
"type": "git",
"url": "git://github.com/jquery/jquery-ui.git"
},
"bugs": "https://bugs.jqueryui.com/",
"license": "MIT",
"scripts": {
"test": "grunt"
},
"dependencies": {},
"devDependencies": {
"commitplease": "2.3.0",
"grunt": "0.4.5",
"grunt-bowercopy": "1.2.4",
"grunt-cli": "0.1.13",
"grunt-compare-size": "0.4.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-csslint": "0.5.0",
"grunt-contrib-jshint": "0.12.0",
"grunt-contrib-qunit": "1.0.1",
"grunt-contrib-requirejs": "0.4.4",
"grunt-contrib-uglify": "0.11.1",
"grunt-git-authors": "3.1.0",
"grunt-html": "6.0.0",
"grunt-jscs": "2.1.0",
"load-grunt-tasks": "3.4.0",
"rimraf": "2.5.1",
"testswarm": "1.1.0"
},
"keywords": []
}
This diff is collapsed.
<?php
/**
* @file enqueue.php
* @brief shortcodes
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @par <b>License</b>:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function sravnitel_enqueue_script($hook){
wp_enqueue_style( 'style1', SRAVNITEL_URL.'/assets/css/sravnitel.css');
//wp_enqueue_script( 'script1', SRAVNITEL_URL.'/assets/js/jquery-3.1.1.js', array( 'jquery' ));
wp_enqueue_script( 'script2', SRAVNITEL_URL.'/assets/js/jquery.sravnitel.js', array( 'jquery' ));
wp_enqueue_script( 'script3', SRAVNITEL_URL.'/assets/js/jquery-ui-1.12.1/jquery-ui.js', array( 'jquery' ));
}
add_action( 'wp_enqueue_scripts', 'sravnitel_enqueue_script');
?>
<?php
/**
* @file shortcode.php
* @brief shortcodes
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @par <b>License</b>:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function sravnitel_init(){
function sravnitel_shortcode($atts,$content=null,$tag=''){
// from the: https://developer.wordpress.org/plugins/shortcodes/shortcodes-with-parameters/
// normalize attribute keys, lowercase
$atts = array_change_key_case((array)$atts, CASE_LOWER);
// override default attributes with user attributes
$defaults = Array(
'id' => 0,
'images' => '',
'showtitles' => false,
'width' => 530,
'height' => 300,
'index_l' => 0,
'index_r' => 1,
'zoom' => 0,
'center_x' => 0,
'center_y' => 0
);
$sravnitel_atts = shortcode_atts($defaults, $atts, $tag);
$images = explode(",",$sravnitel_atts['images']);
$titles = Array();
$images_urls = Array();
$content = "";
foreach($images as $img){
$img = intval(trim($img));
array_push($images_urls,wp_get_attachment_url($img));
$img_info= wp_get_attachment($img);
if (trim($img_info['description'])==""){
array_push($titles,$img_info['title']);
}else{
array_push($titles,$img_info['description']);
}
}
//echo "<p>testing defaults: {$sravnitel_atts['index_l']}</p>";
$id_str = "sravnitel_{$sravnitel_atts['id']}";
$images_str = "[\"".implode("\",\"",$images_urls)."\"]";
$titles_str = "[\"".implode("\",\"",$titles)."\"]";
if (!$sravnitel_atts['showtitles']){
$showtitles_str = "false";
}else{
$showtitles_str = "true";
}
$content = "<b>$titles_str</b>";
$content = <<<TXT
<div id="$id_str" style="position:relative;" class="sravnitel"></div>
<script>
jQuery(window).load(function(){
jQuery("#$id_str").sravnitel({
images: $images_str,
titles: $titles_str,
showtitles: $showtitles_str,
width: {$sravnitel_atts['width']},
height: {$sravnitel_atts['height']},
index_l: {$sravnitel_atts['index_l']},
index_r: {$sravnitel_atts['index_r']},
zoom: {$sravnitel_atts['zoom']},
center_x: {$sravnitel_atts['center_x']},
center_y: {$sravnitel_atts['center_y']},
});
});
</script>
TXT;
return $content;
}
add_shortcode('sravnitel',sravnitel_shortcode);
function wp_get_attachment( $attachment_id ) {
$attachment = get_post( $attachment_id );
return array(
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'caption' => $attachment->post_excerpt,
'description' => $attachment->post_content,
'href' => get_permalink( $attachment->ID ),
'src' => $attachment->guid,
'title' => $attachment->post_title
);
}
}
?>
\ No newline at end of file
<?php
/**
* @package Sravnitel
* @version 1.0
* @file sravnitel.php
* @brief shortcodes
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Oleg Dzhimiev <oleg@elphel.com>
*
* @par <b>License</b>:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Plugin Name: Sravnitel
Plugin URI: http://wordpress.org/plugins/sravnitel/
Description: Before-After overlayed image comparison plugin with: slider, zoom, 2+ images.
Author: Oleg Dzhimiev
Version: 1.0
Author URI: http://www3.elphel.com
*/
defined('ABSPATH') or die('No script kiddies please!');
define('SRAVNITEL_URL',plugins_url('', __FILE__ ));
add_action( 'init', 'sravnitel_init' );
include_once('inc/enqueue.php');
include_once('inc/shortcode.php');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment