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,6 +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.
|
||||||
|
|
||||||
|
var TwoFactorModal = (function () {
|
||||||
|
|
||||||
|
function bindListeners() {
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#close_reload').click(function () {
|
$('#close_reload').click(function () {
|
||||||
location.reload();
|
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,
|
// 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,7 +76,7 @@
|
|||||||
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) {
|
||||||
@ -93,3 +96,15 @@ function setStatusIcon(status) {
|
|||||||
break;
|
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,
|
// 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 ServerList = (function () {
|
||||||
|
|
||||||
var Status = {
|
var Status = {
|
||||||
0: 'Offline',
|
0: 'Offline',
|
||||||
1: 'Online',
|
1: 'Online',
|
||||||
@ -24,7 +27,7 @@ var Status = {
|
|||||||
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