-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (34 loc) · 1.39 KB
/
Copy pathscript.js
File metadata and controls
57 lines (34 loc) · 1.39 KB
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
54
55
56
57
function getData() {
$.ajax({
url: 'https://api.quotable.io/random',
success: function(data) {
console.log(data);
$('#advice').html('"'+data.content+'"'+"<br>"+"<span>"+"- "+data.author+"</span>");
$('#twitterlink').attr("href","https://twitter.com/share?text="+'"'+data.content+'"'+" - "+data.author);
$('#whatsapplink').attr("href","whatsapp://send?text="+'"'+data.content+'"'+" - "+data.author);
$('.dummy').css("display","none");
$('.social').fadeIn();
//$('#facebooklink').attr("href","https://www.facebook.com/sharer/sharer.php?u="+data.content+" - "+data.author);
}
})
}
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
showMessage();
}
function showMessage(){
$('header').text("COPIED!!");
$('header').css("color","#FFF");
//$('header').css("backgroundColor","#f0002f");
$('header').css("backgroundColor","#53a653");
setTimeout(hideMessage, 1500)
}
function hideMessage(){
$('header').text("RANDOM QUOTE");
$('header').css("color","#f0002f");
$('header').css("backgroundColor","#000");
}