first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1 @@
tr.compat-field-pdfemb-upgrade td.field{padding-top:8px;margin:0px 1px}tr.compat-field-pdfemb-downloads td.field,tr.compat-field-pdfemb-views td.field{padding-top:8px;margin:0px 1px}

View File

@@ -0,0 +1 @@
.settings_page_pdfemb_list_options #wpcontent{padding-left:0 !important}.settings_page_pdfemb_list_options .nav-tab-wrapper{border:none;margin-top:-56px}.settings_page_pdfemb_list_options .nav-tab-wrapper .nav-tab{font-size:16px;border:none;background:transparent;padding:10px 24px;font-weight:400;margin-left:20px}.settings_page_pdfemb_list_options .nav-tab-wrapper .nav-tab-active{background-color:#f0f0f1;font-weight:600;border-top-left-radius:6px;border-top-right-radius:6px}#pdfemb-top-notification{position:relative;background-color:#282828;text-align:center;color:#fff;height:40px;vertical-align:middle}#pdfemb-top-notification p{margin:0;padding:0;line-height:40px;font-size:16px}#pdfemb-top-notification .pdfemb-dismiss{position:absolute;top:10px;right:10px}#pdfemb-top-notification a{color:#047dff;text-decoration:none}#pdfemb-header{background-color:#e6e6e6;background-repeat:repeat;height:160px}#pdfemb-header .pdfemb-logo{display:flex;margin-left:20px;align-items:center;line-height:120px}#pdfemb-header h1{margin:0;margin-left:10px}.pdfembtab.active{display:block}.pdfembtab{display:none}#pdfemb_toolbar{min-width:85px}label{float:left;margin-left:6px}input.textinput,textarea.textinput,select.select,input.checkbox{float:left;margin:12px 3px 0 0;padding:5px}textarea#pdfemb_wm_text{width:350px;height:150px;border:1px solid}label.radio{float:none;margin-left:6px}select.select{padding:0 24px 0 8px}input.checkbox.double{margin-top:2px}label.textinput,label.select,label.checkbox{background-color:rgba(0,0,0,0);margin:10px 0 5px;width:180px;font-weight:bold}label[for=input_pdfemb_height],label[for=input_pdfemb_width]{margin-top:20px}label.checkbox.plain{font-weight:normal;width:400px}label.big{font-size:1.3em;padding-top:8px}p.desc{font-style:italic;margin:6px 0 10px;padding:0 0 8px 22px}p.desc.big{padding-left:180px}a#pdfemb-personalinstrlink{color:#0074a2;text-decoration:underline}#pdfemb-tablewrapper{display:table;width:100%;padding:30px;box-sizing:border-box}#pdfemb-tableright{padding:0 0 0 40px;width:281px}#pdfemb-tableright div{width:235px;padding:5px;background-color:#e4e4e4;text-align:center;margin-bottom:20px}#pdfemb-tableright div span{padding:5px}#pdfemb-tableright div ul li{font-weight:bold}.pdfemb-tablecell{display:table-cell;height:500px;margin:0;padding:0;vertical-align:top}.lionsher-partners-wrap{display:grid;grid-template-columns:repeat(3, 1fr);column-gap:30px;padding-top:30px}.lionsher-partners{background-color:#f5f5f5;margin-bottom:30px;border-radius:6px}.lionsher-partners-main{display:flex;flex-direction:row;padding:30px 30px 20px;flex-grow:1;text-align:left;height:120px}.lionsher-partners-main h3{padding-top:0;margin-top:0}.lionsher-partners-main img{padding-right:15px}.lionsher-partners-footer{display:flex;text-align:left;align-items:center;vertical-align:middle;padding:20px;border-top:1px solid #e6e6e6}.lionsher-partners-footer .lionsher-partners-install-wrap{margin-left:auto}.lionsher-partners-footer .spinner{display:none}.lionsher-partners-footer .lionsher-partners-button{font-size:16px !important;height:40px !important;line-height:38px !important;border-radius:6px !important}.lionsher-partner-status{font-weight:bold}.lionsher-partner-status span{font-weight:normal}

View File

@@ -0,0 +1 @@
.wp-block-pdfemb-pdf-embedder-viewer{max-width:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

View File

@@ -0,0 +1 @@
(()=>{var e={311:a=>{"use strict";a.exports=jQuery}},s={};function n(a){var t=s[a];if(void 0!==t)return t.exports;t=s[a]={exports:{}};return e[a](t,t.exports,n),t.exports}var i,a;a=n(311),(i=a)(function(){function t(a){var t=i("#pdfemb_form");t.attr("action",t.attr("action").replace(/(#.+)?$/,"#"+a))}i("#pdfemb-tabs").find("a").click(function(){i("#pdfemb-tabs").find("a").removeClass("nav-tab-active"),i(".pdfembtab").removeClass("active");var a=i(this).attr("id").replace("-tab","");i("#"+a+"-section").addClass("active"),i(this).addClass("nav-tab-active"),"about"===a?i(".submit").hide():i(".submit").show(),t(a)});var a,e,s=window.location.hash.replace("#","");""!=s&&(a=i("#"+s+"-section"),e=i("#"+s+"-tab"),"about"===s?i(".submit").hide():i(".submit").show(),a&&e&&(i("#pdfemb-tabs").find("a").removeClass("nav-tab-active"),i(".pdfembtab").removeClass("active"),a.addClass("active"),e.addClass("nav-tab-active"),t(s))),i(".lionsher-partners").on("click",".lionsher-partners-install",function(a){a.preventDefault();var n=i(this),t=n.data("url"),a=n.data("basename"),r=i(this).parent().parent().find(".lionsher-partner-status"),t={url:pdfemb_args.ajax,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"pdfemb_partners_install",nonce:pdfemb_args.install_nonce,basename:a,download_url:t},success:function(a){n.text(pdfemb_args.activate).removeClass("lionsher-partners-install").addClass("lionsher-partners-activate"),i(r).text(pdfemb_args.inactive);var t=i(r),e=t.html().split(/\s+/),s=e.pop(),e=e.join(" ");t.html([e," <span>",s,"</span>"].join(""))},error:function(a,t,e){console.log(e)}};i.ajax(t)}),i(".lionsher-partners").on("click",".lionsher-partners-activate",function(a){a.preventDefault();var n=i(this),t=n.data("url"),a=n.data("basename"),r=i(this).parent().parent().find(".lionsher-partner-status"),t={url:pdfemb_args.ajax,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"pdfemb_partners_activate",nonce:pdfemb_args.activate_nonce,basename:a,download_url:t},success:function(a){n.text(pdfemb_args.deactivate).removeClass("lionsher-partners-activate").addClass("lionsher-partners-deactivate"),i(r).text(pdfemb_args.active);var t=i(r),e=t.html().split(/\s+/),s=e.pop(),e=e.join(" ");t.html([e," <span>",s,"</span>"].join("")),location.reload(!0)},error:function(a,t,e){console.log(e)}};i.ajax(t)}),i(".lionsher-partners").on("click",".lionsher-partners-deactivate",function(a){a.preventDefault();var n=i(this),t=n.data("url"),a=n.data("basename"),r=i(this).parent().parent().find(".lionsher-partner-status"),t={url:pdfemb_args.ajax,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"pdfemb_partners_deactivate",nonce:pdfemb_args.deactivate_nonce,basename:a,download_url:t},success:function(a){n.text(pdfemb_args.activate).removeClass("lionsher-partners-deactivate").addClass("lionsher-partners-activate"),i(r).text(pdfemb_args.inactive);var t=i(r),e=t.html().split(/\s+/),s=e.pop(),e=e.join(" ");t.html([e," <span>",s,"</span>"].join("")),location.reload(!0)},error:function(a,t,e){console.log(e)}};i.ajax(t)})})})();

View File

@@ -0,0 +1,221 @@
(function ($) {
$(function () {
function pdfembSetActionToTab(id) {
var frm = $('#pdfemb_form');
frm.attr(
'action',
frm.attr('action').replace(/(#.+)?$/, '#' + id),
);
}
$('#pdfemb-tabs')
.find('a')
.click(function () {
$('#pdfemb-tabs').find('a').removeClass('nav-tab-active');
$('.pdfembtab').removeClass('active');
var id = $(this).attr('id').replace('-tab', '');
$('#' + id + '-section').addClass('active');
$(this).addClass('nav-tab-active');
if ('about' === id) {
$('.submit').hide();
} else {
$('.submit').show();
}
// Set submit URL to this tab
pdfembSetActionToTab(id);
});
// Did page load with a tab active?
var active_tab = window.location.hash.replace('#', '');
if (active_tab != '') {
var activeSection = $('#' + active_tab + '-section');
var activeTab = $('#' + active_tab + '-tab');
if ('about' === active_tab) {
$('.submit').hide();
} else {
$('.submit').show();
}
if (activeSection && activeTab) {
$('#pdfemb-tabs').find('a').removeClass('nav-tab-active');
$('.pdfembtab').removeClass('active');
activeSection.addClass('active');
activeTab.addClass('nav-tab-active');
pdfembSetActionToTab(active_tab);
}
}
$('.lionsher-partners').on(
'click',
'.lionsher-partners-install',
function (e) {
e.preventDefault();
var $this = $(this);
var url = $this.data('url');
var basename = $this.data('basename');
var message = $(this)
.parent()
.parent()
.find('.lionsher-partner-status');
var install_opts = {
url: pdfemb_args.ajax,
type: 'post',
async: true,
cache: false,
dataType: 'json',
data: {
action: 'pdfemb_partners_install',
nonce: pdfemb_args.install_nonce,
basename: basename,
download_url: url,
},
success: function (response) {
$this.text(pdfemb_args.activate)
.removeClass('lionsher-partners-install')
.addClass('lionsher-partners-activate');
$(message).text(pdfemb_args.inactive);
// Trick here to wrap a span around he last word of the status
var heading = $(message),
word_array,
last_word,
first_part;
word_array = heading.html().split(/\s+/); // split on spaces
last_word = word_array.pop(); // pop the last word
first_part = word_array.join(' '); // rejoin the first words together
heading.html(
[
first_part,
' <span>',
last_word,
'</span>',
].join(''),
);
// Proc
},
error: function (xhr, textStatus, e) {
console.log(e);
},
};
$.ajax(install_opts);
},
);
$('.lionsher-partners').on(
'click',
'.lionsher-partners-activate',
function (e) {
e.preventDefault();
var $this = $(this);
var url = $this.data('url');
var basename = $this.data('basename');
var message = $(this)
.parent()
.parent()
.find('.lionsher-partner-status');
var activate_opts = {
url: pdfemb_args.ajax,
type: 'post',
async: true,
cache: false,
dataType: 'json',
data: {
action: 'pdfemb_partners_activate',
nonce: pdfemb_args.activate_nonce,
basename: basename,
download_url: url,
},
success: function (response) {
$this.text(pdfemb_args.deactivate)
.removeClass('lionsher-partners-activate')
.addClass('lionsher-partners-deactivate');
$(message).text(pdfemb_args.active);
// Trick here to wrap a span around he last word of the status
var heading = $(message),
word_array,
last_word,
first_part;
word_array = heading.html().split(/\s+/); // split on spaces
last_word = word_array.pop(); // pop the last word
first_part = word_array.join(' '); // rejoin the first words together
heading.html(
[
first_part,
' <span>',
last_word,
'</span>',
].join(''),
);
location.reload(true);
},
error: function (xhr, textStatus, e) {
console.log(e);
},
};
$.ajax(activate_opts);
},
);
$('.lionsher-partners').on(
'click',
'.lionsher-partners-deactivate',
function (e) {
e.preventDefault();
var $this = $(this);
var url = $this.data('url');
var basename = $this.data('basename');
var message = $(this)
.parent()
.parent()
.find('.lionsher-partner-status');
var deactivate_opts = {
url: pdfemb_args.ajax,
type: 'post',
async: true,
cache: false,
dataType: 'json',
data: {
action: 'pdfemb_partners_deactivate',
nonce: pdfemb_args.deactivate_nonce,
basename: basename,
download_url: url,
},
success: function (response) {
$this.text(pdfemb_args.activate)
.removeClass('lionsher-partners-deactivate')
.addClass('lionsher-partners-activate');
$(message).text(pdfemb_args.inactive);
// Trick here to wrap a span around he last word of the status
var heading = $(message),
word_array,
last_word,
first_part;
word_array = heading.html().split(/\s+/); // split on spaces
last_word = word_array.pop(); // pop the last word
first_part = word_array.join(' '); // rejoin the first words together
heading.html(
[
first_part,
' <span>',
last_word,
'</span>',
].join(''),
);
location.reload(true);
},
error: function (xhr, textStatus, e) {
console.log(e);
},
};
$.ajax(deactivate_opts);
},
);
});
})(jQuery);

View File

@@ -0,0 +1,5 @@
import './grabtopan-basic.js';
import './pdfemb-pv-core.js';
import './pdfemb-basic.js';
// import './pdfemb-blocks.js';
import './pdfemb-embed-pdf.js';

View File

@@ -0,0 +1,248 @@
window.pdfembGrabToPan = (function GrabToPanClosure() {
/**
* Construct a GrabToPan instance for a given HTML element.
* @param options.element {Element}
* @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`
* @param options.onActiveChanged {function(boolean)} optional. Called
* when grab-to-pan is (de)activated. The first argument is a boolean that
* shows whether grab-to-pan is activated.
*/
function GrabToPan(options) {
this.element = options.element;
this.document = options.element.ownerDocument;
if (typeof options.ignoreTarget === 'function') {
this.ignoreTarget = options.ignoreTarget;
}
this.onActiveChanged = options.onActiveChanged;
// Bind the contexts to ensure that `this` always points to
// the GrabToPan instance.
this.activate = this.activate.bind(this);
this.deactivate = this.deactivate.bind(this);
this.toggle = this.toggle.bind(this);
this._onmousedown = this._onmousedown.bind(this);
this._onmousemove = this._onmousemove.bind(this);
this._onmousewheel = this._onmousewheel.bind(this);
this._endPan = this._endPan.bind(this);
// This overlay will be inserted in the document when the mouse moves during
// a grab operation, to ensure that the cursor has the desired appearance.
var overlay = this.overlay = document.createElement('div');
overlay.className = 'grab-to-pan-grabbing';
}
GrabToPan.prototype = {
/**
* Class name of element which can be grabbed
*/
CSS_CLASS_GRAB: 'grab-to-pan-grab',
/**
* Bind a mousedown event to the element to enable grab-detection.
*/
activate: function GrabToPan_activate() {
if (!this.active) {
this.active = true;
this.element.addEventListener('mousedown', this._onmousedown, true);
this.element.addEventListener('mousewheel', this._onmousewheel);
this.element.addEventListener('wheel', this._onmousewheel);
this.element.addEventListener('DOMMouseScroll', this._onmousewheel);
this.element.classList.add(this.CSS_CLASS_GRAB);
if (this.onActiveChanged) {
this.onActiveChanged(true);
}
}
},
/**
* Removes all events. Any pending pan session is immediately stopped.
*/
deactivate: function GrabToPan_deactivate() {
if (this.active) {
this.active = false;
this.element.removeEventListener('mousedown', this._onmousedown, true);
this._endPan();
this.element.classList.remove(this.CSS_CLASS_GRAB);
if (this.onActiveChanged) {
this.onActiveChanged(false);
}
}
},
toggle: function GrabToPan_toggle() {
if (this.active) {
this.deactivate();
} else {
this.activate();
}
},
/**
* Whether to not pan if the target element is clicked.
* Override this method to change the default behaviour.
*
* @param node {Element} The target of the event
* @return {boolean} Whether to not react to the click event.
*/
ignoreTarget: function GrabToPan_ignoreTarget(node) {
// Use matchesSelector to check whether the clicked element
// is (a child of) an input element / link
return node[matchesSelector](
'a[href], a[href] *, input, textarea, button, button *, select, option'
);
},
/**
* @private
*/
_onmousedown: function GrabToPan__onmousedown(event) {
if (event.button !== 0 || this.ignoreTarget(event.target)) {
return;
}
if (event.originalTarget) {
try {
/* jshint expr:true */
var ottn = event.originalTarget.tagName;
} catch (e) {
// Mozilla-specific: element is a scrollbar (XUL element)
return;
}
}
this.scrollLeftStart = this.element.scrollLeft;
this.scrollTopStart = this.element.scrollTop;
this.clientXStart = event.clientX;
this.clientYStart = event.clientY;
this.document.addEventListener('mousemove', this._onmousemove, true);
this.document.addEventListener('mouseup', this._endPan, true);
// When a scroll event occurs before a mousemove, assume that the user
// dragged a scrollbar (necessary for Opera Presto, Safari and IE)
// (not needed for Chrome/Firefox)
this.element.addEventListener('scroll', this._endPan, true);
event.preventDefault();
event.stopPropagation();
this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);
var focusedElement = document.activeElement;
if (focusedElement && !focusedElement.contains(event.target)) {
focusedElement.blur();
}
},
/**
* @private
*/
_onmousemove: function GrabToPan__onmousemove(event) {
this.element.removeEventListener('scroll', this._endPan, true);
if (isLeftMouseReleased(event)) {
this._endPan();
return;
}
var xDiff = event.clientX - this.clientXStart;
var yDiff = event.clientY - this.clientYStart;
this.element.scrollTop = this.scrollTopStart - yDiff;
this.element.scrollLeft = this.scrollLeftStart - xDiff;
if (!this.overlay.parentNode) {
document.body.appendChild(this.overlay);
}
},
/**
* @private
*/
_onmousewheel: function GrabToPan__onmousewheel(event) {
this.element.removeEventListener('scroll', this._endPan, true);
var MOUSE_WHEEL_DELTA_FACTOR = 0.5;
if (event.deltaMode) {
// if 0, means measured in pixels
if (event.deltaMode == 1) { //Measured in lines
MOUSE_WHEEL_DELTA_FACTOR = 10;
}
if (event.deltaMode == 2) { // Measured in pages
MOUSE_WHEEL_DELTA_FACTOR = 1000;
}
}
var ticks = event.deltaY ? -event.deltaY // 'wheel'
: ( event.wheelDelta ? event.wheelDelta // 'mousewheel'
: -event.detail // 'DOMMouseScroll'
);
this.scrollLeftStart = this.element.scrollLeft;
this.scrollTopStart = this.element.scrollTop;
var yDiff = ticks * MOUSE_WHEEL_DELTA_FACTOR;
this.element.scrollTop = this.scrollTopStart - yDiff;
if (!this.overlay.parentNode) {
document.body.appendChild(this.overlay);
}
if (this.element.scrollTop != this.scrollTopStart || yDiff == 0) {
event.preventDefault();
return false;
}
},
/**
* @private
*/
_endPan: function GrabToPan__endPan() {
this.element.removeEventListener('scroll', this._endPan, true);
this.document.removeEventListener('mousemove', this._onmousemove, true);
this.document.removeEventListener('mouseup', this._endPan, true);
if (this.overlay.parentNode) {
this.overlay.parentNode.removeChild(this.overlay);
}
}
};
// Get the correct (vendor-prefixed) name of the matches method.
var matchesSelector;
['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {
var name = prefix + 'atches';
if (name in document.documentElement) {
matchesSelector = name;
}
name += 'Selector';
if (name in document.documentElement) {
matchesSelector = name;
}
return matchesSelector; // If found, then truthy, and [].some() ends.
});
// Browser sniffing because it's impossible to feature-detect
// whether event.which for onmousemove is reliable
var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;
var chrome = window.chrome;
var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
// ^ Chrome 15+ ^ Opera 15+
var isSafari6plus = /Apple/.test(navigator.vendor) &&
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
/**
* Whether the left mouse is not pressed.
* @param event {MouseEvent}
* @return {boolean} True if the left mouse button is not pressed.
* False if unsure or if the left mouse button is pressed.
*/
function isLeftMouseReleased(event) {
if ('buttons' in event && isNotIEorIsIE10plus) {
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
// Firefox 15+
// Internet Explorer 10+
return !(event.buttons | 1);
}
if (isChrome15OrOpera15plus || isSafari6plus) {
// Chrome 14+
// Opera 15+
// Safari 6.0+
return event.which === 0;
}
}
return GrabToPan;
})();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
jQuery(document).ready(function($) {
var pdfembPagesViewer = PDFEMB_NS.pdfembPagesViewer;
var pdfembPagesViewerBasic = function () {
pdfembPagesViewer.apply(this, arguments);
};
pdfembPagesViewerBasic.prototype = new pdfembPagesViewer();
PDFEMB_NS.pdfembPagesViewerUsable = pdfembPagesViewerBasic;
});
PDFEMB_NS.pdfembGetPDF = function(url, callback) {
callback(url, false);
};

View File

@@ -0,0 +1,183 @@
/*
* Gutenberg block Javascript code
*/
var __ = wp.i18n.__; // The __() function for internationalization.
var createElement = wp.element.createElement; // The wp.element.createElement() function to create elements.
var registerBlockType = wp.blocks.registerBlockType; // The registerBlockType() function to register blocks.
var make_title_from_url = function(url) {
var re = RegExp('/([^/]+?)(\\.pdf(\\?[^/]*)?)?$', 'i');
var matches = url.match(re);
if (matches.length >= 2) {
return matches[1];
}
return url;
}
/**
* Register block
*
* @param {string} name Block name.
* @param {Object} settings Block settings.
* @return {?WPBlock} Block itself, if registered successfully,
* otherwise "undefined".
*/
registerBlockType(
'pdfemb/pdf-embedder-viewer', // Block name. Must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
{
title: __( 'PDF Embedder' ), // Block title. __() function allows for internationalization.
icon: 'media-document', // Block icon from Dashicons. https://developer.wordpress.org/resource/dashicons/.
category: 'common', // Block category. Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
attributes: {
pdfID: {
type: 'number'
},
url: {
type: 'string'
},
width: {
type: 'string'
},
height: {
type: 'string'
},
toolbar: {
type: 'string',
default: 'bottom'
},
toolbarfixed: {
type: 'string',
default: 'off'
}
},
// Defines the block within the editor.
edit: function( props ) {
var {attributes , setAttributes, focus, className} = props;
var InspectorControls = wp.editor.InspectorControls;
var Button = wp.components.Button;
var RichText = wp.editor.RichText;
var Editable = wp.blocks.Editable; // Editable component of React.
var MediaUpload = wp.editor.MediaUpload;
var btn = wp.components.Button;
var TextControl = wp.components.TextControl;
var SelectControl = wp.components.SelectControl;
var RadioControl = wp.components.RadioControl;
var onSelectPDF = function(media) {
return props.setAttributes({
url: media.url,
pdfID: media.id
});
}
function onChangeWidth(v) {
setAttributes( {width: v} );
}
function onChangeHeight(v) {
setAttributes( {height: v} );
}
function onChangeToolbar(v) {
setAttributes( {toolbar: v} );
}
function onChangeToolbarfixed(v) {
setAttributes( {toolbarfixed: v} );
}
return [
createElement(
MediaUpload,
{
onSelect: onSelectPDF,
type: 'application/pdf',
value: attributes.pdfID,
render: function(open) {
return createElement(btn,{onClick: open.open },
attributes.url ? 'PDF: ' + attributes.url : 'Click here to Open Media Library to select PDF')
}
}
),
createElement( InspectorControls, { key: 'inspector' }, // Display the block options in the inspector pancreateElement.
createElement('div',{ className: 'pdf_div_main'} ,
createElement(
'hr',
{},
),
createElement(
'p',
{},
__('Change the Height & Width of the PDF'),
),
createElement(
'hr',
{},
),
createElement(
'p',
{},
__('Enter max or an integer number of pixels.')
),
createElement(
TextControl,
{
label: __('Width'),
value: attributes.width,
onChange: onChangeWidth
}
),
createElement(
TextControl,
{
label: __('Height'),
value: attributes.height,
onChange: onChangeHeight
}
),
createElement(
SelectControl,
{
label: __('Toolbar Location'),
value: attributes.toolbar,
options: [
{ label: 'Top', value: 'top' },
{ label: 'Bottom', value: 'bottom' },
{ label: 'Both', value: 'both' },
{ label: 'None', value: 'none' }
],
onChange: onChangeToolbar
}
),
createElement(
RadioControl,
{
label: __('Toolbar Hover'),
selected: attributes.toolbarfixed,
options: [
{ label: __('Toolbar appears only on hover over document'), value: 'off' },
{ label: __('Toolbar always visible '), value: 'on' }
],
onChange: onChangeToolbarfixed
}
),
),
),
];
},
// Defines the saved block.
save: function( props ) {
return createElement(
'p',
{
className: props.className,
key: 'return-key',
},props.attributes.content);
},
}
);

View File

@@ -0,0 +1,103 @@
// JQuery Plugin
jQuery(document).ready(function ($) {
$.fn.pdfEmbedder = function(cmapURL) {
this.each(function(index, rawAContainer) {
var divContainer;
var aContainer = $(rawAContainer);
if (aContainer.is('a')) {
// Copy 'a' to a 'div' version
var adata = aContainer.data();
divContainer = $('<div></div>', {
'class': aContainer.attr('class'),
'style': aContainer.attr('style')
});
divContainer.data($.extend({'pdf-url': aContainer.attr('href')}, adata));
aContainer.replaceWith(divContainer);
}
else {
// was a div all along
divContainer = aContainer;
}
divContainer.append($('<div></div>', {'class': 'pdfemb-loadingmsg'}).append(document.createTextNode(pdfemb_trans.objectL10n.loading)));
// Disable right click?
if (divContainer.data('disablerightclick') == 'on') {
divContainer.bind("contextmenu", function(e) {
e.preventDefault();
});
}
// Load PDF
var initPdfDoc = function(pdfDoc, showIsSecure) {
var pagesViewer = new PDFEMB_NS.pdfembPagesViewerUsable(pdfDoc, divContainer, showIsSecure);
pagesViewer.setup();
};
var callback = function(pdf, showIsSecure) {
/**
* Asynchronously downloads PDF.
*/
if (pdf === null) {
divContainer.empty().append($('<div></div>', {'class': 'pdfemb-errormsg'}).append(msgnode = $('<span></span>').append(
document.createTextNode('Failed to load and decrypt PDF'))));
return;
}
var loadingTask = pdfjsLib.getDocument(pdf,cmapURL);
loadingTask.promise.then(function(pdfDoc_) {
// you can now use *pdf* here
initPdfDoc(pdfDoc_, showIsSecure)
},
function(e) {
var msgnode = document.createTextNode(e.message);
if (e.name == 'UnknownErrorException' && e.message == 'Failed to fetch') {
// "Failed to fetch" - probably cross-domain issue
msgnode = $('<span></span>').append(
document.createTextNode(e.message+' '+pdfemb_trans.objectL10n.domainerror+' '))
.append($('<a href="https://wp-pdf.com/kb/error-url-to-the-pdf-file-must-be-on-exactly-the-same-domain-as-the-current-web-page/" target="_blank">'
+pdfemb_trans.objectL10n.clickhereinfo+'</a>'));
}
divContainer.empty().append($('<div></div>', {'class': 'pdfemb-errormsg'}).append(msgnode));
}
);
};
if (divContainer.data('pdfDoc')) {
initPdfDoc(divContainer.data('pdfDoc'), divContainer.data('showIsSecure'));
}
else {
var url = divContainer.data('pdf-url');
PDFEMB_NS.pdfembGetPDF(url, callback);
}
});
return this;
};
// Apply plugin to relevant divs
if (pdfemb_trans.cmap_url === "undefined") {
var cmapURLis = '';
}else{
var cmapURLis = pdfemb_trans.cmap_url;
}
$('.pdfemb-viewer').pdfEmbedder(cmapURLis);
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,178 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

View File

@@ -0,0 +1,3 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^

Some files were not shown because too many files have changed in this diff Show More