Skip to content

Instantly share code, notes, and snippets.

@sanasol
Created April 18, 2022 19:37
Show Gist options
  • Save sanasol/be5dfebdfd4cb3f4d91429cba06554c9 to your computer and use it in GitHub Desktop.
Save sanasol/be5dfebdfd4cb3f4d91429cba06554c9 to your computer and use it in GitHub Desktop.
Index: html/index.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/html/index.php b/html/index.php
--- a/html/index.php (revision 53c0955071791d35ddae7bdebc087c59a7fa09be)
+++ b/html/index.php (date 1650015922000)
@@ -11,6 +11,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
+ <!-- Внес изминения в проект второй раз -->
<title>Statbate: Chaturbate Top 100</title>
<meta name="description" content="How much do webcam models make? Now you know the answer!"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@@ -19,6 +20,7 @@
<link rel="stylesheet" href="./css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="./css/metricsgraphics.min.css">
<link rel="stylesheet" href="./css/main.css?54">
+ <link rel="stylesheet" href="./css/redezine.css">
<script src="./js/jquery.js"></script>
<script src="./js/d3.min.js"></script>
<script src="./js/metricsgraphics.min.js"></script>
@@ -138,6 +140,36 @@
}
showStat();
+
+
+
+ // Вот тут функция оптимизации резайса (троттлинг)
+ (function() {
+ var throttle = function(type, name, obj) {
+ obj = obj || window;
+ var running = false;
+ var func = function() {
+ if (running) { return; }
+ running = true;
+ requestAnimationFrame(function() {
+ obj.dispatchEvent(new CustomEvent(name));
+ running = false;
+ });
+ };
+ obj.addEventListener(type, func);
+ };
+
+ /* init - you can init any event */
+ throttle("resize", "optimizedResize");
+ })();
+
+
+ // При срабатывании события optimizedResize
+ // перерисовываеться график
+ window.addEventListener("optimizedResize", function() {
+ console.log(`Изминения разрешения екрана`);
+ showStat();
+ });
</script>
@@ -147,15 +179,15 @@
</div>
- <div class="row d-flex">
+ <div style="margin-bottom: 4px;" class="row d-flex">
<div class="col-md-7 col-xs-12 order-1 order-md-0 pt-2 pt-sm-0 pr-md-custom-1 d-none d-sm-block">
- <div class="wslog">
+ <div class="wslog" id="marginTop">
<div class="wstext"></div>
</div>
</div>
<div class="col-md-5 col-xs-12 order-0 order-md-1 pl-md-1">
- <table class="table table-curved table-bordered"
- style="margin-bottom: 0px; margin-top: 0px;">
+ <table style="margin-bottom: 2%" class="table table-curved table-bordered"
+ >
<tr>
<th height="28" colspan="2" style="font-weight: normal; padding: 4px 0px;">
Statistics for the last month
@@ -185,7 +217,7 @@
</div>
</div>
- <hr style="margin-top: 10px; margin-bottom: 10px;">
+ <hr style="margin-top: 0px; margin-bottom: 5px;">
<ul class="nav nav-tabs d-none d-lg-flex">
<li class="nav-item">
@@ -230,7 +262,7 @@
</ul>
<div class="row d-block d-lg-none">
- <div class="dropdown select-tab">
+ <div class="dropdown select-tab" style="padding: 2%;">
<button class="col btn btn-dark dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Rooms
</button>
@@ -450,7 +482,7 @@
</div> -->
<div class="modal fade" id="donRoomModal" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog" style="max-width: 400px;">
+ <div class="modal-dialog" style="max-width: 400px; margin: 0 auto">
<div class="modal-content">
<div class="modal-body">
<table id="donRoomTable" class="table table-striped DonTable">
Index: html/js/main.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/html/js/main.js b/html/js/main.js
--- a/html/js/main.js (revision 53c0955071791d35ddae7bdebc087c59a7fa09be)
+++ b/html/js/main.js (date 1650018801000)
@@ -1,207 +1,285 @@
-$(function () {
- $('[data-toggle="tooltip"]').tooltip()
-
-
- $.extend( $.fn.DataTable.ext.classes, {
- sWrapper: "dataTables_wrapper dt-bootstrap4",
- // sFilter: "",
- sLength: isTabletOrDesktop ? "dataTables_length":'',
- } );
-})
-let isTabletOrDesktop = screen.width >= 568;
-if(navigator.userAgent.toLocaleLowerCase().indexOf('iphone') !== -1) {
- isTabletOrDesktop = false
-}
-console.log('isTabletOrDesktop', isTabletOrDesktop, screen)
-let dataTableOptions = {
- bAutoWidth: false,
- oLanguage: {
- sLengthMenu: isTabletOrDesktop ? "Show _MENU_ entries":"_MENU_",
- sSearch: "",
- sSearchPlaceholder: "Search",
- },
- bInfo: isTabletOrDesktop,
- paging: isTabletOrDesktop,
- pagingType: isTabletOrDesktop ? 'simple_numbers':'numbers',
- iDisplayLength: isTabletOrDesktop ? 10:100,
- order: [[5, "desc"]],
-
- dom: isTabletOrDesktop ? "<'row'<'col-6'l><'col-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5 d-none d-sm-block'i><'col-sm-12 col-md-7 col-12'p>>":"<'row'<'col-12'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5 d-none d-sm-block'i><'col-sm-12 col-md-7 col-12'p>>"
-};
-
-$(document).ready(function() {
- $('.select-tab').on('shown.bs.tab', 'a', function(e) {
- console.log(e.target);
- $('.select-tab .dropdown-toggle').text($(this).text());
- if (e.target) {
- $(e.target).removeClass('active');
- }
- })
-
- var table = $("#main").DataTable({
- ...dataTableOptions,
- aoColumns: [
- {"orderable": false, "searchable": false, "sWidth": "5%" },
- { "orderable": false, "sWidth": "35%" },
- { "orderable": false, "searchable": false, "sWidth": "15%" },
- { "orderable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- ],
- });
-});
-
-$(document).ready(function() {
- var table = $("#couple_table").DataTable({
- ...dataTableOptions,
- "aoColumns": [
- {"orderable": false, "searchable": false, "sWidth": "5%" },
- { "orderable": false, "sWidth": "35%" },
- { "orderable": false, "searchable": false, "sWidth": "15%" },
- { "orderable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- ],
- });
-});
-
-$(document).ready(function() {
- var table = $("#boys_table").DataTable({
- ...dataTableOptions,
- "aoColumns": [
- {"orderable": false, "searchable": false, "sWidth": "5%" },
- { "orderable": false, "sWidth": "35%" },
- { "orderable": false, "searchable": false, "sWidth": "15%" },
- { "orderable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- ],
- });
-});
-
-$(document).ready(function() {
- var table = $("#trans_table").DataTable({
- ...dataTableOptions,
- "aoColumns": [
- {"orderable": false, "searchable": false, "sWidth": "5%" },
- { "orderable": false, "sWidth": "35%" },
- { "orderable": false, "searchable": false, "sWidth": "15%" },
- { "orderable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- ],
- });
-});
-
-$(document).ready(function() {
- var table = $("#top100dons").DataTable({
- ...dataTableOptions,
- "aoColumns": [
- { "orderable": false, "searchable": false, "sWidth": "5%" },
- { "orderable": false, "sWidth": "35%" },
- { "orderable": false, "searchable": false,"sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- { "searchable": false, "sWidth": "15%" },
- ],
- });
-});
-
-$(document).on("click", "[data-modal-info]", function(e) {
- $(this).blur();
- e.preventDefault();
-
- var id = $(this).data('modal-id');
- var name = $(this).data('modal-name');
- var type = $(this).data('modal-type');
-
- $.post("/info.php", {'type': type, 'id': id}, function(json){
- data = JSON.parse(json);
- if(data.table.length != 0){
- $("#donRoomTable tr:first th:first").html(name);
- $("#donRoomTable tbody").html(data.table);
- $('#donRoomModal').modal('show');
- }
-
- if(data.amount.length != 0){
- $("#allIncome").html(isTabletOrDesktop ? '<hr />':'');
- $("#allIncome").append("<center><b>All time "+type+": "+data.amount+" USD</b></center><hr/>");
- }
-
- if(data.chart.length != 0 && isTabletOrDesktop){
- xx11 = JSON.parse(data.chart);
- //if(xx11.length > 28){
- // xx11.pop();
- //}
- var xx22 = MG.convert.date(xx11, 'date');
- MG.data_graphic({
- data: xx22,
- width: 380,
- height: 120,
- right: 10,
- missing_is_zero: true,
- top: 30,
- bottom: 0,
- left: 40,
- target: document.getElementById('modelChart'),
- x_accessor: 'date',
- y_accessor: 'value',
- //color: ['#25639a'],
- x_axis: false,
- });
- }
-
- });
-});
-
-function printWsText(text){
- if(text.length == 0){
- return;
- }
- date = new Date();
- xMin = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes()
- xSec = (date.getSeconds() < 10 ? '0' : '') + date.getSeconds()
- time = date.getHours() + ":" + xMin + ":" + xSec;
-
- let message = text;
- if(isTabletOrDesktop) {
- message = '[' + time + '] ' + message;
- }
-
- $(".wstext").prepend(`<div class="message">${message}</div>`);
- msg = $('.wstext .message');
- if (msg.length > 8) {
- msg.last().remove();
- }
-}
-
-function bStat() {
- var sock = new WebSocket('wss://statbate.com/ws/');
- sock.onopen = function() {
- console.log('open');
- setTimeout(function wsPing() {
- sock.send('h')
- setTimeout(wsPing, 60000);
- }, 60000);
- $(".wstext").prepend('<div class="message text-center">----------------------------------- last big tips -----------------------------------</div>');
- };
- sock.onmessage = function(evt) {
- j = JSON.parse(evt.data);
- if(j.count){
- $(".trackCount").text("track "+j.count+" rooms");
- return;
- }
- text = "<a href='https://chaturbate.com/"+j.donator+"' rel='nofollow' target='_blank'>"+j.donator+"</a> send "+j.amount+" tokens to <a href='https://chaturbate.com/"+j.room+"' rel='nofollow' target='_blank'>"+j.room+"</a>";
- if(j.amount > 499){
- text = '<font color="#ae8d0b"><b>' + text + '</b></font>';
- }
- printWsText(text);
- };
- sock.onclose = function(e) {
- console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);
- setTimeout(function() {
- bStat();
- }, 1000);
- };
-}
-bStat();
+
+
+ $(function () {
+ $('[data-toggle="tooltip"]').tooltip()
+
+ console.log(`КЛИКНУТО НАА ЧЕКБОКС`)
+ $.extend( $.fn.DataTable.ext.classes, {
+ sWrapper: "dataTables_wrapper dt-bootstrap4",
+ // sFilter: "",
+ // Клас отвечающий за количество елементов в таблице
+ sLength: isTabletOrDesktop ? "dataTables_length TEST":'',
+ } );
+ })
+ // screen.width >= 568
+ // screen.width >= 0
+ let isTabletOrDesktop = true;
+
+ if(navigator.userAgent.toLocaleLowerCase().indexOf('iphone') !== -1) {
+ isTabletOrDesktop = false
+ }
+
+ console.log('isTabletOrDesktop', isTabletOrDesktop, screen)
+ let dataTableOptions = {
+ bAutoWidth: false,
+ oLanguage: {
+ sLengthMenu: isTabletOrDesktop ? "Show _MENU_ entries":"_MENU_",
+ sSearch: "",
+ sSearchPlaceholder: "Search",
+ },
+ bInfo: isTabletOrDesktop,
+ paging: false,
+ pagingType: isTabletOrDesktop ? 'simple_numbers':'numbers',
+ iDisplayLength: isTabletOrDesktop ? 10:100,
+ order: [[5, "desc"]],
+
+ dom: isTabletOrDesktop ? "<'row'<'col-6'l><'col-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5 d-none d-sm-block'i><'col-sm-12 testTWO col-md-7 col-12'p>>":"<'row'<'col-12'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5 d-none d-sm-block'i><'col-sm-12 col-md-7 col-12'p>>"
+ };
+
+ $(document).ready(function() {
+ $('.select-tab').on('shown.bs.tab', 'a', function(e) {
+ console.log(e.target);
+ $('.select-tab .dropdown-toggle').text($(this).text());
+ if (e.target) {
+ $(e.target).removeClass('active');
+ }
+ })
+
+ var table = $("#main").DataTable({
+ ...dataTableOptions,
+ aoColumns: [
+ {"orderable": false, "searchable": false, "sWidth": "5%" },
+ { "orderable": false, "sWidth": "35%" },
+ { "orderable": false, "searchable": false, "sWidth": "15%" },
+ { "orderable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ ],
+ });
+ });
+
+ $(document).ready(function() {
+ var table = $("#couple_table").DataTable({
+ ...dataTableOptions,
+ "aoColumns": [
+ {"orderable": false, "searchable": false, "sWidth": "5%" },
+ { "orderable": false, "sWidth": "35%" },
+ { "orderable": false, "searchable": false, "sWidth": "15%" },
+ { "orderable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ ],
+ });
+ });
+
+ $(document).ready(function() {
+ var table = $("#boys_table").DataTable({
+ ...dataTableOptions,
+ "aoColumns": [
+ {"orderable": false, "searchable": false, "sWidth": "5%" },
+ { "orderable": false, "sWidth": "35%" },
+ { "orderable": false, "searchable": false, "sWidth": "15%" },
+ { "orderable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ ],
+ });
+ });
+
+ $(document).ready(function() {
+ var table = $("#trans_table").DataTable({
+ ...dataTableOptions,
+ "aoColumns": [
+ {"orderable": false, "searchable": false, "sWidth": "5%" },
+ { "orderable": false, "sWidth": "35%" },
+ { "orderable": false, "searchable": false, "sWidth": "15%" },
+ { "orderable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ ],
+ });
+ });
+
+ $(document).ready(function() {
+ var table = $("#top100dons").DataTable({
+ ...dataTableOptions,
+ "aoColumns": [
+ { "orderable": false, "searchable": false, "sWidth": "5%" },
+ { "orderable": false, "sWidth": "35%" },
+ { "orderable": false, "searchable": false,"sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ { "searchable": false, "sWidth": "15%" },
+ ],
+ });
+ });
+
+ $(document).on("click", "[data-modal-info]", function(e) {
+ $(this).blur();
+ e.preventDefault();
+
+ var id = $(this).data('modal-id');
+ var name = $(this).data('modal-name');
+ var type = $(this).data('modal-type');
+
+ $.post("/info.php", {'type': type, 'id': id}, function(json){
+ data = JSON.parse(json);
+ if(data.table.length != 0){
+ $("#donRoomTable tr:first th:first").html(name);
+ $("#donRoomTable tbody").html(data.table);
+ $('#donRoomModal').modal('show');
+ }
+
+ if(data.amount.length != 0){
+ $("#allIncome").html(isTabletOrDesktop ? '<hr />':'');
+ $("#allIncome").append("<center><b>All time "+type+": "+data.amount+" USD</b></center><hr/>");
+ }
+
+ if(data.chart.length != 0 && isTabletOrDesktop){
+ xx11 = JSON.parse(data.chart);
+ //if(xx11.length > 28){
+ // xx11.pop();
+ //}
+ var xx22 = MG.convert.date(xx11, 'date');
+ MG.data_graphic({
+ data: xx22,
+ width: 380,
+ height: 120,
+ right: 10,
+ missing_is_zero: true,
+ top: 30,
+ bottom: 0,
+ left: 40,
+ target: document.getElementById('modelChart'),
+ x_accessor: 'date',
+ y_accessor: 'value',
+ //color: ['#25639a'],
+ x_axis: false,
+ });
+ }
+
+ });
+ });
+
+ function printWsText(text){
+ if(text.length == 0){
+ return;
+ }
+ date = new Date();
+ xMin = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes()
+ xSec = (date.getSeconds() < 10 ? '0' : '') + date.getSeconds()
+ time = date.getHours() + ":" + xMin + ":" + xSec;
+
+ let message = text;
+ if(isTabletOrDesktop) {
+ message = '[' + time + '] ' + message;
+ }
+
+ $(".wstext").prepend(`<div class="message">${message}</div>`);
+ msg = $('.wstext .message');
+ if (msg.length > 8) {
+ msg.last().remove();
+ }
+ }
+
+ function bStat() {
+ var sock = new WebSocket('wss://statbate.com/ws/');
+ sock.onopen = function() {
+ console.log('open');
+ setTimeout(function wsPing() {
+ sock.send('h')
+ setTimeout(wsPing, 60000);
+ }, 60000);
+ $(".wstext").prepend('<div class="message text-center">----------------------------------- last big tips -----------------------------------</div>');
+ };
+ sock.onmessage = function(evt) {
+ j = JSON.parse(evt.data);
+ if(j.count){
+ $(".trackCount").text("track "+j.count+" rooms");
+ return;
+ }
+ text = "<a href='https://chaturbate.com/"+j.donator+"' rel='nofollow' target='_blank'>"+j.donator+"</a> send "+j.amount+" tokens to <a href='https://chaturbate.com/"+j.room+"' rel='nofollow' target='_blank'>"+j.room+"</a>";
+ if(j.amount > 499){
+ text = '<font color="#ae8d0b"><b>' + text + '</b></font>';
+ }
+
+ printWsText(text);
+ };
+ sock.onclose = function(e) {
+ console.log('Socket is closed. Reconnect will be attempted in 1 second.', e.reason);
+ setTimeout(function() {
+ bStat();
+ }, 1000);
+ };
+ }
+ bStat();
+
+
+
+
+
+ // Вот тут функция оптимизации резайса (троттлинг)
+ (function() {
+ var throttle = function(type, name, obj) {
+ obj = obj || window;
+ var running = false;
+ var func = function() {
+ if (running) { return; }
+ running = true;
+ requestAnimationFrame(function() {
+ obj.dispatchEvent(new CustomEvent(name));
+ running = false;
+ });
+ };
+ obj.addEventListener(type, func);
+ };
+
+ /* init - you can init any event */
+ throttle("resize", "optimizedResize");
+ })();
+
+
+
+ // При срабатывании события optimizedResize
+ // перерисовываеться график
+ window.addEventListener("optimizedResize", function() {
+ console.log(`Перерисовка таблицы`);
+
+
+
+
+ console.log(`БЛОКИ КОТОРЫЕ СКРИВАЮТЬСя`);
+ dataTableOptions.paging = true;
+
+ if(window.screen.width < 568){
+ console.log(`РАЗМЕР МОБИЛКИ`)
+ document.querySelector(`.TEST`).style.display = `none`;
+ document.querySelector(`.testTWO`).style.display = `none`;
+ } else {
+ document.querySelector(`.TEST`).style.display = `block`;
+ document.querySelector(`.testTWO`).style.display = `block`;
+ }
+
+
+
+ });
+
+// Убирания вида страничек переключения
+/*
+window.addEventListener(`load`, ()=>{
+ console.log(`КОТИРОВКА ИЗМИНЕНИЙ РАЗМЕРА`)
+ if(window.screen.width < 568){
+ console.log(`РАЗМЕР МОБИЛКИ`)
+ document.querySelector(`.TEST`).style.display = `none`;
+ document.querySelector(`.testTWO`).style.display = `none`;
+ } else {
+ document.querySelector(`.TEST`).style.display = `block`;
+ document.querySelector(`.testTWO`).style.display = `block`;
+ }
+})
+*/
+
+
+
+
+
Index: html/html/index.new.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/html/html/index.new.php b/html/html/index.new.php
--- a/html/html/index.new.php (revision 53c0955071791d35ddae7bdebc087c59a7fa09be)
+++ b/html/html/index.new.php (date 1649870425000)
@@ -11,6 +11,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
+ <!-- Изминения успешно вступили в силу -->
<title>Statbate: Chaturbate Top 100</title>
<meta name="description" content="How much do webcam models make? Now you know the answer!"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@@ -448,7 +449,7 @@
</div> -->
<div class="modal fade" id="donRoomModal" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog" style="max-width: 400px; min-height: 680px;">
+ <div class="modal-dialog" id="edit" style="max-width: 400px; margin: 0 auto; min-height: 680px;">
<div class="modal-content">
<div class="modal-body">
<table id="donRoomTable" class="table table-striped DonTable">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment