This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
forked from splitbrain/dokuwiki-plugin-xfortune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
53 lines (49 loc) · 1.5 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* Script for plugin_jquotes
*
* Fetches a new quotation
*
* @author Andreas Gohr <[email protected]>
* @author Trailjeep <[email protected]>
*/
jQuery(function () {
jQuery('figure.plugin_jquotes').each(function () {
var $self = jQuery(this);
if(!$self.data('time')) return;
if(!$self.data('cookie')) return;
window.setInterval(function () {
jQuery.post(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_jquotes',
cookie: $self.data('cookie')
},
function (data) {
$full = data.split('|');
$quote = $full[0];
$cite = $full[1];
$self.children('blockquote').children('p').html($quote),
$self.children('figcaption').html($cite)
}
)
}, $self.data('time') * 1000);
});
});
/**
* Script for plugin_jquotes
*
* Copies quotation to the clipboard
*
* @author Trailjeep <[email protected]>
*/
function copy_quote() {
jQuery('figure.plugin_jquotes').fadeOut(50).fadeIn(50);
var $quote = jQuery('figure.plugin_jquotes > blockquote > p').text();
var $author = jQuery('figure.plugin_jquotes > figcaption').text();
var $full = $quote + '\n\u2014' + $author;
var $txt = jQuery( '<textarea />' );
$txt.val($full).css({ width: "1px", height: "1px" }).appendTo('body');
$txt.select();
document.execCommand('copy');
$txt.remove();
};