-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (74 loc) · 5.15 KB
/
index.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Random Quote Generator</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link href='https://fonts.googleapis.com/css?family=Courgette' rel='stylesheet' type='text/css'>
</head>
<body class="picture" class="container-fluid">
<h1>Random Rumi Verse Generator</h1>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4 mainbox">
<p id="rumiQuote" class="text">“Let the beauty we love be what we do. There are hundreds of ways to kneel and kiss the ground.” ― Rumi</p>
</div>
<div class="col-md-4"></div>
</div>
<button onclick="newQuote()" id="rumiQuoteButton">Click for new Rumi Quote!</button>
<div class="row">
<div class="col-md-5"></div>
<div class="col-md-2">
<button id="twitterButton">Tweet</button>
</div>
<div class="col-md-5"></div>
</div>
<div id="bottom"></div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>-->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!--<script src="js/bootstrap.min.js">
</script>
<script src="js/main.js"></script>-->
<script>
var rumiQuotes = ['“Your task is not to seek for love, but merely to seek and find all the barriers within yourself that you have built against it.” ― Rumi', '"Out beyond ideas of wrongdoing and rightdoing there is a field. I\'ll meet you there. When the soul lies down in that grass the world is too full to talk about." - Rumi', '“The wound is the place where the Light enters you.” ― Rumi', '“Stop acting so small. You are the universe in ecstatic motion.” ― Rumi','“What you seek is seeking you.” ― Rumi','“Do not be satisfied with stories, how things have gone with others. Unfold your own myth.” ― Rumi', '“Set your self on fire. Seek those who fan your flames” ― Rumi', '“Forget safety. Live where you fear to live. Destroy your reputation. Be notorious.” ― Rumi', '“In Silence there is eloquence. Stop weaving and see how the pattern improves.” ― Rumi', '“You wander from room to room, Hunting for the diamond necklace That is already around your neck!” ― Rumi', '“You have to keep breaking your heart until it opens.” ― Rumi', '“Respond to every call that excites your spirit.” ― Rumi', '“Not only the thirsty seek the water, the water as well seeks the thirsty.” ― Rumi', '“And you? When will you begin that long journey into yourself?” ― Rumi', '“Let yourself be silently drawn by the strange pull of what you really love. It will not lead you astray.” ― Rumi', '“Who could be so lucky? Who comes to a lake for water and sees the reflection of moon.” ― Rumi', '"Why do you stay in prison When the door is so wide open?” ― Rumi'];
function newQuote() {
var randomKey = Math.floor(Math.random() * rumiQuotes.length);
/*console.log(randomKey);*/
var newTweet = rumiQuotes[randomKey]
document.getElementById("rumiQuote").innerHTML = newTweet;
console.log(newTweet);
var factText = document.getElementById("rumiQuote").innerHTML;
//var redirectUrl = <!---url you want to redirect from twitter -->;
// Convert to string
var factStr = factText.toString();
// Fact length
var factLen = factText.length;
// Formats "facts" that are too long... remove if not needed
if (factLen > 103) { // max chacters allowed
// trim, and allow space for '...'"
var trimFact = factStr.substring(0, 70);
var trimFact = trimFact.trim(); //<-- ensures the last character isnt ' '
factStr = trimFact + "...";
}
// Update the link
var linkRef = "https://twitter.com/intent/tweet?text= " + factStr;
console.log(linkRef);
document.getElementById("twitterButton").onclick = function(){window.open(linkRef, 'mywin','left=20,top=20,width=500,height=500,toolbar=1,resizable=0')
//jQuery('#factLink').attr('href', linkRef);
}
}
</script>
</body>
</html>