MediaWiki:Common.js

Revision as of 19:13, 18 February 2019 by Iskwiki.admin (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
//Accept Privacy policy
   $(document).on('click','.btn-accept-policy', function(e){
           e.preventDefault();
           footer_data_privacy('accepted');
   });
//Load Footer Data Privacy
footer_data_privacy('');
function footer_data_privacy(datas){
    $.ajax({
            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);
            }
    });
};