MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 5: Line 5:
/* per http://www.mediawiki.org/wiki/Manual_talk:Collapsible_elements#Use_new_1.18_collapsible_in_1.17 */
/* per http://www.mediawiki.org/wiki/Manual_talk:Collapsible_elements#Use_new_1.18_collapsible_in_1.17 */


/*
Commented out 2018-04-17 by Andru (.makeCollapsible() has been depreciated)
mw.messages.set({"collapsible-collapse":"Collapse","collapsible-expand":"Expand"});
mw.messages.set({"collapsible-collapse":"Collapse","collapsible-expand":"Expand"});
$(document).ready(function(){
$(document).ready(function(){
$('.mw-collapsible').makeCollapsible();
  console.log('[debug] document ready.');
});
  $('.mw-collapsible').makeCollapsible();
});*/


// 01/02/2015 Tony Allan - Facebook support
// 01/02/2015 Tony Allan - Facebook support
Line 29: Line 32:
}(document, 'script', 'facebook-jssdk'));
}(document, 'script', 'facebook-jssdk'));


// 02/02/2015 Tony Allan - Facebook Like and Share button for lost plays.org pages
/* ALL A BIT HARD
// - David didn't like this... so removed
// 28/09/2015-02/10/2015 Tony Allan Gallery support
// $( '<div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>' ).insertAfter( "#firstHeading" );
 
 
// 28/09/2015 Tony Allan Gallery support
// See http://www.jssor.com/development/basic-usage-no-jquery.html
// See http://www.jssor.com/development/basic-usage-no-jquery.html
// See https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages
// See https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages
// http://stackoverflow.com/questions/950087/include-a-javascript-file-in-another-javascript-file
   var e1 = document.getElementById('ta-jssor');
   var e1 = document.getElementById('ta-jssor');
   if (e1 !== null) {
   if (e1 !== null) {
     console.log('[debug] Gallery support.');
     console.log('[debug] Gallery support.');
     $.getScript('/jssor.js', function() {
     // $.getScript('/jssor.js', function() {
      console.log('[debug] jssor.js loaded.');
    //  console.log('[debug] jssor.js loaded.');
      $.getScript('/jssor.slider.min.js', function() {
    //  $.getScript('/jssor.slider.js', function() {
        console.log('[debug] jssor.slider.min.js loaded.');
    //    console.log('[debug] jssor.slider.js loaded.');
        jssor_slider1_starter = function (containerId) {
    var jssor_slider1 = new $JssorSlider$('ta-jssor', {$AutoPlay: true});
          console.log('[debug] jssor_slider1_starter A.');
    console.log('[debug] jssor_slider1 started.');
          var options = { $AutoPlay: true };
    //  });
          var jssor_slider1 = new $JssorSlider$(containerId, options);
     // });
          console.log('[debug] jssor_slider1_starter B.');
        };
        var e2 = document.getElementById('slider1_container');
        if (e2 !== null) {
          console.log('[debug] calling jssor_slider1_starter.');
          jssor_slider1_starter('slider1_container');
        } else {
          console.log('[info] MediaWiki:Common.js: slider1_container not found.');
        };
      });
     });
   } else {
   } else {
     console.log('[info] MediaWiki:Common.js: ta-jssor not found.');
     console.log('[info] MediaWiki:Common.js: ta-jssor not found.');
   };
   };
 
*/
/*
/*
(function () {
(function () {

Latest revision as of 05:04, 18 April 2018

/* Any JavaScript here will be loaded for all users on every page load. */
console.log('[debug] MediaWiki:Common.js: started.');

/* Added by bholman 2012-03-28 to make collapsible elements work */
/* per http://www.mediawiki.org/wiki/Manual_talk:Collapsible_elements#Use_new_1.18_collapsible_in_1.17 */

/*
Commented out 2018-04-17 by Andru (.makeCollapsible() has been depreciated)
mw.messages.set({"collapsible-collapse":"Collapse","collapsible-expand":"Expand"});
$(document).ready(function(){
  console.log('[debug] document ready.');
  $('.mw-collapsible').makeCollapsible();
});*/

// 01/02/2015 Tony Allan - Facebook support
// see https://developers.facebook.com/quickstarts/727460864013163/?platform=web
window.fbAsyncInit = function() {
  FB.init({
    appId : '420807218085510',
    xfbml : true,
    version : 'v2.1'
  });
};

(function(d, s, id){
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/sdk.js";
  //js.src = "//connect.facebook.net/en_GB/sdk/debug.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

/* ALL A BIT HARD
// 28/09/2015-02/10/2015 Tony Allan Gallery support
// See http://www.jssor.com/development/basic-usage-no-jquery.html
// See https://www.mediawiki.org/wiki/Adding_HTML_to_wiki_pages
// http://stackoverflow.com/questions/950087/include-a-javascript-file-in-another-javascript-file
  var e1 = document.getElementById('ta-jssor');
  if (e1 !== null) {
    console.log('[debug] Gallery support.');
    // $.getScript('/jssor.js', function() {
    //   console.log('[debug] jssor.js loaded.');
    //   $.getScript('/jssor.slider.js', function() {
    //    console.log('[debug] jssor.slider.js loaded.');
    var jssor_slider1 = new $JssorSlider$('ta-jssor', {$AutoPlay: true});
    console.log('[debug] jssor_slider1 started.');
    //  });
    // });
  } else {
    console.log('[info] MediaWiki:Common.js: ta-jssor not found.');
  };
*/
/*
(function () {
  var e1 = document.getElementById('ta-jssor');
  if (e1 !== null) {
    e1.innerHTML = ' \
       <script src="jssor.js"></script> \
       <script src="jssor.slider.min.js"></script> \
       <script> \
         console.log(\'[debug] ta-jssor script invoked.\'); \
         jssor_slider1_starter = function (containerId) { \
           var options = { $AutoPlay: true }; \
           var jssor_slider1 = new $JssorSlider$(containerId, options); \
           console.log(\'[debug] ta-jssor function invoked.\'); \
         }; \
       </script>';
  } else {
    console.log('[info] MediaWiki:Common.js: ta-jssor not found.');
  }
}());
*/
/*
(function () {
  var e2 = document.getElementById('ta-jssor-trigger');
  if (e2 !== null) {
    e2.innerHTML = ' \
       <script> \
         jssor_slider1_starter("slider1_container"); \
         console.log(\'[debug] ta-jssor-trigger script invoked.\'); \
       </script>';
  } else {
    console.log('[info] MediaWiki:Common.js: ta-jssor-trigger not found.');
  }
}());
*/

// 01/10/2015 Tony Allan
// For twitter follow button
// See https://about.twitter.com/resources/buttons#follow
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');

(function () {
  var e3 = document.getElementById('ta-twitter-follow');
  if (e3 !== null) {
    e3.innerHTML = '<a href="https://twitter.com/lostplaysdb" \
      class="twitter-follow-button" data-show-count="false" data-size="large">Follow @lostplaysdb</a>';
  } else {
    console.log('[info] MediaWiki:Common.js: ta-twitter-follow not found.');
  }
}());

console.log('[debug] MediaWiki:Common.js: completed.');