mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 09:02:28 +01:00
convert frontend javascript into revealing module pattern
This commit is contained in:
parent
344e3b4330
commit
0c1559c922
@ -17,6 +17,10 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
var TwoFactorModal = (function () {
|
||||
|
||||
function bindListeners() {
|
||||
$(document).ready(function () {
|
||||
$('#close_reload').click(function () {
|
||||
location.reload();
|
||||
@ -74,3 +78,14 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
bindListeners();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
TwoFactorModal.init();
|
||||
|
@ -17,7 +17,10 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
(function initSocket() {
|
||||
|
||||
var Server = (function () {
|
||||
|
||||
function initSocket() {
|
||||
if (typeof $.notifyDefaults !== 'function') {
|
||||
console.error('Notify does not appear to be loaded.');
|
||||
return;
|
||||
@ -73,7 +76,7 @@
|
||||
Socket.on('status', function (data) {
|
||||
setStatusIcon(data.status);
|
||||
});
|
||||
})();
|
||||
}
|
||||
|
||||
function setStatusIcon(status) {
|
||||
switch (status) {
|
||||
@ -93,3 +96,15 @@ function setStatusIcon(status) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
initSocket();
|
||||
},
|
||||
|
||||
setStatusIcon: setStatusIcon,
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Server.init();
|
||||
|
@ -17,6 +17,9 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
var ServerList = (function () {
|
||||
|
||||
var Status = {
|
||||
0: 'Offline',
|
||||
1: 'Online',
|
||||
@ -24,7 +27,7 @@ var Status = {
|
||||
3: 'Stopping'
|
||||
};
|
||||
|
||||
(function updateServerStatus () {
|
||||
function updateServerStatus () {
|
||||
$('.dynamic-update').each(function (index, data) {
|
||||
var element = $(this);
|
||||
var serverShortUUID = $(this).data('server');
|
||||
@ -72,4 +75,14 @@ var Status = {
|
||||
});
|
||||
});
|
||||
setTimeout(updateServerStatus, 10000);
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
updateServerStatus();
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
ServerList.init();
|
||||
|
@ -17,7 +17,10 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
(function initTaskFunctions() {
|
||||
|
||||
var Tasks = (function () {
|
||||
|
||||
function initTaskFunctions() {
|
||||
$('[data-action="delete-task"]').click(function (event) {
|
||||
var self = $(this);
|
||||
swal({
|
||||
@ -99,4 +102,14 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
initTaskFunctions();
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Tasks.init();
|
||||
|
Loading…
Reference in New Issue
Block a user