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