Difference between revisions of "MediaWiki:Common.js"

 
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
//Accept Privacy policy
+
$(document).ready(function(){
  $(document).on('click','.btn-accept-policy', function(e){
+
$('#toc').addClass('tochidden');
          e.preventDefault();
+
$('#toc ul').css('display', 'none');
          footer_data_privacy('accepted');
+
$('.togglelink').text('show');
  });
+
});
//Load Footer Data Privacy
+
$(window).on('load', function(){
footer_data_privacy('');
+
$('#toc').addClass('tochidden');
function footer_data_privacy(datas){
+
$('#toc ul').css('display', 'none');
    $.ajax({
+
$('.togglelink').text('show');
            type: 'POST',
+
});
            url: "/user_accept_policy.php",
 
            data: {
 
                    accept: (datas == '') ? '' : datas
 
            },
 
            datatype:'JSON',
 
            cache: false,
 
            success: function(data){
 
                    var ddata = JSON.parse(data);
 
                    var dhtml = '<div class="agreement-policy" style="width: 100%;background-color: rgb(0, 0, 0); color: rgb(255, 255, 255);text-align:center;padding: 1rem;position: fixed;bottom:0;opacity:0.8;z-index:100000;">'
 
                        + '<p style="font-size:11pt !important;margin-top:0px;">By clicking "Accept" or continuing to use our site, you agree to the university\'s Acceptable Use Policy and this site\'s terms and conditions.</p>'
 
                        + '<span class="btn-accept-policy" style="height:3rem;width:6rem;background-color:#fff;color:#000;margin:0;padding:.3rem;cursor:pointer;">Accept</span>'
 
                        + '<a href="https://upd.edu.ph/aup/" target="_blank" class="btn-uap" style="height:3rem;width:6rem;background-color:#fff;color:#000;margin:0;margin-left:2px;padding:.3rem;cursor:pointer;text-decoration:none;">Acceptable Use Policy</a></div>';
 
                        if(ddata.privacy == 1){
 
                                $('.agreement-policy').hide();
 
                        } else {
 
                                $('html').append(dhtml).show();
 
                        }
 
                    console.log(data);
 
            },
 
            error: function(data){
 
                    console.log(data);
 
            }
 
    });
 
};
 

Latest revision as of 17:12, 24 October 2019

/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function(){
	$('#toc').addClass('tochidden');
	$('#toc ul').css('display', 'none');
	$('.togglelink').text('show');
});
$(window).on('load', function(){
	$('#toc').addClass('tochidden');
	$('#toc ul').css('display', 'none');
	$('.togglelink').text('show');
});