Created
August 29, 2015 03:52
-
-
Save Matko95/4b0b226506b1844e1ef2 to your computer and use it in GitHub Desktop.
Revisions
-
Matko95 created this gist
Aug 29, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Quote machine ------------- A [Pen](http://codepen.io/Matko95/pen/GpKOWv) by [Mateja Trifunovski](http://codepen.io/Matko95) on [CodePen](http://codepen.io/). [License](http://codepen.io/Matko95/pen/GpKOWv/license). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <div class="container"> <div class="row"> <h1>Albert Einstein Quote Machine</h1> <p class="info">This machine serves you the best quotes from Albert Einstein. <br> Don't hesitate to press the button.</p> <div class="text-center"> <button class="btn btn-success btn-lg" id="dugme">Random Quote</button> </div> <div id="quote"> </div> <div class="text-center"> <button class="btn btn-default btn-lg" id="tweet"><a href="http://codepen.io/Matko95/full/GpKOWv/" title="This is my random quote: " class="tweet" target="_blank"><i class="fa fa-twitter"></i> Tweet this!</a></button> </div> </div> </div> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ $(document).ready(function() { $("#tweet").hide(); $("button").hover( function() { $(this).css({ "top": "-2px", "box-shadow": "7px 7px 7px #444" }); }, function() { $(this).css({ "top": "+2px", "box-shadow": "4px 4px 4px #222" }); } ); var einstein = ["Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.", "You have to learn the rules of the game. And then you have to play better than anyone else.", "Look deep into nature, and then you will understand everything better.", "We cannot solve our problems with the same thinking we used when we created them.", "A person who never made a mistake never tried anything new.", "Education is what remains after one has forgotten what one has learned in school.", "The difference between stupidity and genius is that genius has its limits.", "Try not to become a man of success, but rather try to become a man of value.", "Peace cannot be kept by force; it can only be achieved by understanding.", "The true sign of intelligence is not knowledge but imagination.", "When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity.", "To raise new questions, new possibilities, to regard old problems from a new angle, requires creative imagination and marks real advance in science.", "Insanity: doing the same thing over and over again and expecting different results.", "Logic will get you from A to B. Imagination will take you everywhere.", "It is the supreme art of the teacher to awaken joy in creative expression and knowledge.", "It has become appallingly obvious that our technology has exceeded our humanity.", "Weakness of attitude becomes weakness of character.", "The only source of knowledge is experience.", "Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.", "The world is a dangerous place to live; not because of the people who are evil, but because of the people who don't do anything about it."] function quotes() { var rand = Math.floor(Math.random() * ((einstein.length - 1) - 0 + 1)) + 0; return einstein[rand] } var txt = "" $("#dugme").click( function() { $("#tweet").show("slow"); var tekst = quotes(); $("#quote p").remove(); $("<p>" + tekst + "</p>").appendTo("#quote"); txt = tekst; }); $('a.tweet').click(function(e) { //We tell our browser not to follow that link e.preventDefault(); //We get the URL of the link var loc = $(this).attr('href'); //We get the title of the link var title = encodeURIComponent($(this).attr('title')); //We trigger a new window with the Twitter dialog, in the middle of the page window.open('http://twitter.com/share?url=' + loc + '&text=' + title + "'" + txt + "'" + '&', 'twitterwindow', 'height=450, width=550, top=' + ($(window).height() / 2 - 225) + ', left=' + $(window).width() / 2 + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0'); }); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ @import url(https://fonts.googleapis.com/css?family=Lemon); @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,800); body { background: url("http://getwallpapers.net/wallpapers/l/1920x1080/74/backgrounds_black_light_patterns_surface_1920x1080_73109.jpg"); } h1 { color: white; font-family: 'Lemon', cursive; text-align: center; text-shadow: 5px 5px 5px #333; } .info { color: white; font-family: 'Open Sans', sans-serif; text-align: center; font-size: 20px; background: rgba(0, 0, 0, 0.5); margin-left: auto; margin-right: auto; width: 50%; border-radius: 10%; margin-top: 50px; padding: 10px; } .btn { box-shadow: 4px 4px 4px #444; font-weight: bold; } #dugme { background: white; color: black; font-weight: bold; border: black; font-family: 'Open Sans', sans-serif; margin-bottom: 10px; } p { color: white; font-family: 'Open Sans', sans-serif; text-align: center; font-size: 20px; background: rgba(0, 0, 0, 0.5); margin-left: auto; margin-right: auto; width: 50%; border-radius: 10%; padding: 10px; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />