YaWK  24.1
Yet another WebKit
yawk-backend.js
Go to the documentation of this file.
1 $(document).ready(function() {
2 
3  // modal dialog data-confirm
4  $('a[data-confirm]').click(function(ev) {
5  modal = '#dataConfirmModal';
6  var href = $(this).attr('href');
7  var title = $(this).attr('title');
8  var icon = $(this).attr('data-icon');
9  if (!icon)
10  {
11  icon = 'fa fa-trash-o';
12  }
13 
14  if (!$(modal).length) {
15  $('body').append('<div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button><br><div class="col-md-1"><h3 class="modal-title"><i class="'+icon+'"></i></h3></div><div class="col-md-11"><h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3></div></h3></div><div class="modal-body"></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button><a type="button" class="btn btn-danger" id="dataConfirmOK"> <i class="'+icon+'"></i> L&ouml;schen</a></div></div></div></div>');
16  }
17  $(modal).find('.modal-body').text($(this).attr('data-confirm'));
18  $('#dataConfirmOK').attr('href', href);
19  $(modal).modal({show:true});
20  return false;
21  });
22 
23 
24  // terminate user account (this must be refactored and moved to yawk's backend core js file)
25  $('#terminateUser').click(function() {
26  var terminate = window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n" + "Bist Du Dir sicher, dass Du das tun willst?");
27  if (terminate === true) {
28  var terminateUser = window.confirm("Bist Du Dir wirklich ganz sicher?\n" + "Diese Aktion kann nicht rueckgaengig gemacht werden.");
29  if (terminateUser === true) {
30  $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) {
31  if (data === "true") {
32  setTimeout("window.location='logout.html'", 0);
33  } else {
34  alert("Fehler: " + data);
35  }
36  });
37  }
38  }
39  });
40 
41  function dismissNotifications() {
42  $.ajax({ // do ajax request
43  url: 'js/dismiss-notifications.php',
44  type: 'POST',
45  success: function (data) {
46  if (!data) {
47  alert('Something went wrong!');
48  return false;
49  }
50  }
51  });
52  // fade away the orange label on top
53  $("#bell-label").fadeOut();
54  $('#notification-header').html('You have 0 notifications');
55  $('#notification-menu').fadeOut();
56  }
57 
58  // NOTIFICATION DISMISS BTN
59  $("#dismiss").click(function()
60  { // get uid from data value
61  // var uid = $(this).attr('data-uid');
62  dismissNotifications();
63  });
64 
65  function disableButtons(delay)
66  {
67  // Disable the buttons
68  $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');
69  $('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');
70 
71  // Enable the buttons after the specified delay
72  setTimeout(function() {
73  $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');
74  $('#resetPasswordButton').removeClass().addClass('btn btn-danger');
75  }, delay);
76  }
77 
78  // submit login form
79  $("#loginButton").click(function(){
80  if ($('#loginButton').length > 0) {
81  // Either #loginButton or #LOGIN_FORBIDDEN element exists
82  if ($('#loginButton').hasClass('btn') && $('#loginButton').hasClass('btn-success') && $('#loginButton').hasClass('disabled'))
83  {
84  // The loginButton has all three classes: btn, btn-success, and disabled
85  }
86  else {
87  // The loginButton is not disabled
88  $("#loginForm").submit();
89  disableButtons(10000);
90  }
91  }
92  else if ($('#LOGIN_FORBIDDEN').length > 0)
93  {
94  // Either #loginButton or #LOGIN_FORBIDDEN element exists
95  if ($('#LOGIN_FORBIDDEN').hasClass('btn') && $('#LOGIN_FORBIDDEN').hasClass('btn-success') && $('#LOGIN_FORBIDDEN').hasClass('disabled')) {
96  // The loginButton has all three classes: btn, btn-success, and disabled
97  } else {
98  // The loginButton is not disabled
99  // $("#loginForm").submit();
100  }
101  }
102  });
103 
104  // BLOCKED USER BUTTON (user-edit.php)
105  $("#blockedBtn").hover(function()
106  {
107  $("#blockedBtn").hide();
108  $("#askBtn").fadeIn(820);
109  });
110  // var requestUID = $("#acceptBtn").attr('data-requestUID');//Attribut auslesen und in variable speichern
111 
112 });
$blog icon
function window
Definition: fuckAdBlock.js:8
type
Definition: menu-new.php:35
print $page title
Definition: page-edit.php:377
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L &ouml;schen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})