Difference between revisions of "MediaWiki:Common.js"
From Summertime Saga Wiki
Line 32: | Line 32: | ||
// Add our own custom CSS, again temporary | // Add our own custom CSS, again temporary | ||
− | headElm.append('<style type="text/css">.fresco-embed { text-decoration: none; display: block;}</style>'); | + | headElm.append('<style type="text/css">.fresco-embed { text-decoration: none; display: block; width: 352px; height: 288px; }</style>'); |
// Run our main function | // Run our main function |
Revision as of 21:50, 5 February 2017
/* Any JavaScript here will be loaded for all users on every page load. */ // Test code for youtube embeds -sam9 $(function() { // Click handler $('#content').on('click', '.fresco-embed', function(e) { e.preventDefault(); var elm = $(this); Fresco.show([{ url : elm.attr('href') }]); }); // Main parsing function var parseTags = function() { // Loop through our tags $('.yt').each(function(){ var elm = $(this); var ytId = elm.text(); elm.replaceWith('<a class="fresco-embed" href="https://youtube.com/' + ytId + '" target="_blank" style="background-image:url(//i.ytimg.com/vi/' + ytId + '/maxresdefault.jpg)" data-ytt="' + ytId + '"></a>'); }); }; // Load Fresco if it isn't already if (typeof Fresco === 'undefined') { // Temporary work around due to lack of server access $.getScript('//awesomo.tk/assets/vendor/fresco/js/fresco.js', function() { var headElm = $('head'); // Load Fresco CSS headElm.append('<link rel="stylesheet" type="text/css" href="//awesomo.tk/assets/vendor/fresco/css/fresco.css"/>'); // Add our own custom CSS, again temporary headElm.append('<style type="text/css">.fresco-embed { text-decoration: none; display: block; width: 352px; height: 288px; }</style>'); // Run our main function parseTags(); }); } else { // Run our main function parseTags(); } }());