Created
August 31, 2012 01:02
-
-
Save bluewhalelabs/3547042 to your computer and use it in GitHub Desktop.
TinyMeme HTML Templates
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 characters
| <!-- This HTML can be used as a base page --> | |
| <html> | |
| <body> | |
| <select id='trays'></select> | |
| <div class="stage"> | |
| <div id='tray'> | |
| </div> | |
| <div class="preview canvas"> | |
| <canvas id="meme-canvas" width="380" height="256"></canvas> | |
| </div> | |
| <div class="fields"> | |
| <input id="top_text" name="top_text" type="text" placeholder="top text" /> | |
| <input id="bottom_text" name="bottom_text" type="text" placeholder="bottom text" /> | |
| <button id='memeSave'>Save</button> | |
| </div> | |
| </div> | |
| <h2>Recent Submissions</h2> | |
| <div id='submissions'> | |
| </div> | |
| <div id="memeModal" class="reveal-modal"> | |
| <div class='meme-inner'> | |
| <div class='meme-image-container'> | |
| <img src=''> | |
| </div> | |
| <div class='meme-share'> | |
| <input type='text'> | |
| <a href='#' class='meme-share-facebook' target='_blank'>Facebook</a> | |
| <a href='#' class='meme-share-twitter' target='_blank'>Twitter</a> | |
| <a href='#' class='meme-share-tumblr' target='_blank'>Tumblr</a> | |
| <a href='#' class="meme-share-pinterest" target='_blank'>Pinterest</a> | |
| </div> | |
| </div> | |
| <a class="close-reveal-modal">×</a> | |
| </div> | |
| </body> | |
| </html> |
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 characters
| <!-- Required Scripts --> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
| <script src="http://chutedemos.heroku.com/leverage/jquery.reveal.js"></script> | |
| <!-- ADD YOUR GENERATOR ID TO THIS SCRIPT --> | |
| <script src="http://tinymeme.com/app/js/tinymeme.min.js?generator_id=GENERATOR_ID"></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 characters
| $(function(){ | |
| memeCanvas = new TinyMemeCanvas('meme-canvas', { | |
| fontSize : 30, | |
| topText : $('#top_text').val().toUpperCase(), | |
| bottomText : $('#bottom_text').val().toUpperCase() | |
| }); | |
| myMeme = TinyMeme.init('', { | |
| onTraysLoaded : function(){ | |
| $('.trays').addClass('loading'); | |
| myMeme.trays.render('#trays', '#traysTemplate', function(){ | |
| myMeme.trays.tray(myMeme.trays.data.data[0]['id']); | |
| }); | |
| }, | |
| onTrayLoaded : function(tray){ | |
| $('.trays').removeClass('loading'); | |
| tray.render('#tray', '#trayTemplate'); | |
| $('#tray img:first').click(); | |
| }, | |
| onGalleryLoaded : function(gallery){ | |
| gallery.render('#submissions', '#galleryTemplate'); | |
| var _shortcut = document.location.hash; | |
| if(_shortcut.length > 1){ | |
| $(_shortcut).click(); | |
| } | |
| } | |
| }); | |
| $('#tray img').live('click', function(event){ | |
| event.preventDefault(); | |
| $('.canvas').addClass('loading'); | |
| memeCanvas.setBackground($(this).attr('data-url') + '/380x256', function(){ | |
| // background loaded | |
| $('.canvas').removeClass('loading'); | |
| }); | |
| }); | |
| $('#trays').change(function(event){ | |
| myMeme.trays.tray($(this).val()); | |
| }); | |
| var loadMemePopup = function(data){ | |
| $('#memeModal .meme-share-facebook').attr('href', data.facebook_share_url); | |
| $('#memeModal .meme-share-twitter').attr('href', data.twitter_share_url); | |
| $('#memeModal .meme-share-tumblr').attr('href', data.tumblr_share_url); | |
| $('#memeModal .meme-share-pinterest').attr('href', data.pinterest_share_url); | |
| $('#memeModal .meme-image-container').html('<img src="'+ data.image + '/w/520' +'">'); | |
| $('#memeModal .meme-share input').val(data.share_url); $('#memeModal').reveal(); | |
| } | |
| $('#submissions a').live('click', function(event){ | |
| event.preventDefault(); | |
| memeCanvas.getData($(this).attr('data-id'), function(data){ loadMemePopup(data); }); | |
| }); | |
| $('#top_text, #bottom_text').bind('textchange', function (event, previousText) { | |
| memeCanvas.updateTopText($('#top_text').val().toUpperCase()); | |
| memeCanvas.updateBottomText($('#bottom_text').val().toUpperCase()); | |
| }); | |
| $('#memeSave').click(function(event){ | |
| event.preventDefault(); | |
| var me = $(this); | |
| me.addClass('submitting').attr('disabled', 'disabled'); | |
| // submit | |
| memeCanvas.save(function(data){ | |
| me.removeClass('submitting').removeAttr('disabled'); | |
| loadMemePopup(data); | |
| }); | |
| }); | |
| }); |
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 characters
| <!-- Required --> | |
| <link rel="stylesheet" href="http://chutedemos.heroku.com/leverage/reveal.css" type="text/css" /> | |
| <!-- Customize These Stylesheets To Match Your Design --> | |
| <link rel="stylesheet" href="http://chutedemos.heroku.com/leverage/main.css" type="text/css" /> |
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 characters
| <script id="traysTemplate" type="text/x-jquery-tmpl"> | |
| {{#data}} | |
| <option value="{{id}}" data-name="{{name}}">{{name}}</option> | |
| {{/data}} | |
| </script> | |
| <script id="trayTemplate" type="text/x-jquery-tmpl"> | |
| {{#data}} | |
| <img src="{{url}}/100x100" height="100" width="100" data-id="{{id}}" data-url="{{url}}" alt=""/> | |
| {{/data}} | |
| </script> | |
| <script id="galleryTemplate" type="text/x-jquery-tmpl"> | |
| {{#data}} | |
| <a data-id="{{id}}" id="{{id}}" href="{{url}}"><img src="{{url}}/100x100" /></a> | |
| {{/data}} | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment