[{"id":"498a155","elType":"container","settings":{"flex_direction":"column","ha_cmc_text":"Happy Addons","_title":"kod wrapowanie","content_width":"full"},"elements":[{"id":"7642c86","elType":"widget","settings":{"html":"<script>\n\n\n\njQuery( document ).ready(function() {\n    console.log( \"ready! w elementorze\" );\njQuery( \".events_admin .gv-list-view-content-description\" ).addClass( \"row\");\njQuery( \".events_admin .dt-buttons\" ).addClass( \"btn btn-outline-secondary  btn-sm\");\njQuery( \".wrap-card-1\" ).wrapAll( \"<div id='heats-list' class='container xy-4 card-1 col-md-7 col-12 ' \/><div class='card' \/>\");\njQuery( \".wrap-card-2\" ).wrapAll( \"<div id='participants-list' class='container xy-4 card-2 ' \/><div class='card' \/>\");\njQuery( \".wrap-card-3\" ).wrapAll( \"<div id='heats-timeline' class='container xy-4 card-3  col-md-5 col-12' \/><div class='card' \/>\");\njQuery( \".wrap-card-4\" ).wrapAll( \"<div id='heats-raports' class='container xy-4 card-3  col-12' \/><div class='card' \/>\");\njQuery( \".wrap-card-body-4\" ).wrapAll( \"<div class='card-body' \/>\");\n\njQuery( \".wrap-card-body-1\" ).wrapAll( \"<div class='card-body' \/>\");\njQuery( \".wrap-card-body-2\" ).wrapAll( \"<div class='card-body' \/>\");\n\n    \n});\n\n    \n    \n     jQuery( window ).on( \"load\", function() {\n        console.log( \"window loaded\" );\n         \/\/ Reference to the DataTable instance\nvar table_HeatsList = jQuery('#heats-list table.gv-datatables').DataTable();\nvar table_HeatsStamps = jQuery('.table_HeatsStamps table.gv-datatables').DataTable();\nvar table_ResultsHeats = jQuery('.table_ResultsHeats table.gv-datatables').DataTable();\n\/\/ Variable to track the auto-update state\nvar autoUpdate = true;\n\n\/\/ Function to auto-update the table\nfunction autoUpdateTable() {\n    if (autoUpdate) {\n        table_HeatsList.ajax.reload(null, false); \/\/ Reloads without resetting pagination\n        table_HeatsStamps.ajax.reload(null, false); \/\/ Reloads without resetting pagination\n       \/\/ table_ResultsHeats.ajax.reload(null, false); \/\/ Reloads without resetting pagination\n    }\n}\n\n\/\/ Set an interval for auto-updating (e.g., every 5 seconds)\nvar updateInterval = setInterval(autoUpdateTable, 5000);\n\n\/\/ Toggle button functionality\njQuery('.toggle-update').on('click', function () {\n    autoUpdate = !autoUpdate; \/\/ Toggle auto-update state\n\n    \/\/ Update button appearance and text based on state\n    if (autoUpdate) {\n        jQuery(this)\n            .removeClass('text-bg-primary')\n            .addClass('text-bg-success')\n            .html('<span id=\"toggle-update\" class=\"badge text-bg-success\"> Updating ...<\/span>');\n    } else {\n        jQuery(this)\n            .removeClass('text-bg-success')\n            .addClass('text-bg-primary')\n            .text('Resume Updates');\n    }\n});\n\n\njQuery(\".dataTables_processing\").addClass('syled-spinner-datatable').html('<div class=\"spinner-grow text-success\" role=\"status\">  <span class=\"visually-hidden\">Loading...<\/span><\/div>');\n\n\n\n\/\/ Initialize tooltips\n  const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle=\"tooltip\"]');\n  const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));\n\n\n    });\n    \n   \n\n<\/script>","ha_cmc_text":"Happy Addons"},"elements":[],"widgetType":"html"}],"isInner":false},{"id":"3c860c3","elType":"section","settings":{"ha_cmc_text":"Happy Addons","layout":"full_width"},"elements":[{"id":"2cf6208","elType":"column","settings":{"_column_size":100,"_inline_size":null,"ha_cmc_text":"Happy Addons"},"elements":[{"id":"2a5ce58","elType":"widget","settings":{"shortcode":"[gravityview id=\"131\"]","_css_classes":"events_admin","ha_cmc_text":"Happy Addons"},"elements":[],"widgetType":"shortcode"},{"id":"a147209","elType":"widget","settings":{"shortcode":"[gravityview id=\"602\"]","_css_classes":"events_admin","ha_cmc_text":"Happy Addons"},"elements":[],"widgetType":"shortcode"},{"id":"3773fe6","elType":"widget","settings":{"shortcode":"[gravityview id=\"883\"]","_css_classes":"events_admin","ha_cmc_text":"Happy Addons"},"elements":[],"widgetType":"shortcode"},{"id":"f6713d5","elType":"widget","settings":{"html":"<script>\n\n    \tjQuery( document ).ready(function() {\n    jQuery('.athlets-list table').addClass('table-bordered table table-striped');\n});\n\n\n\/\/ Generate a hex color based on a string (e.g., category name)\nfunction stringToHexColor(str) {\n    let hash = 0;\n    for (let i = 0; i < str.length; i++) {\n        hash = str.charCodeAt(i) + ((hash << 5) - hash); \/\/ Simple hash\n    }\n\n    \/\/ Use the hash to generate RGB values\n    const r = (hash & 0xFF0000) >> 16; \/\/ Extract red\n    const g = (hash & 0x00FF00) >> 8;  \/\/ Extract green\n    const b = hash & 0x0000FF;         \/\/ Extract blue\n\n    \/\/ Normalize and ensure vibrant colors (avoid overly dark\/washed-out colors)\n    const normalize = (value) => Math.min(255, Math.max(100, value)); \/\/ Keep in the range [100, 255]\n    const vibrantR = normalize(r);\n    const vibrantG = normalize(g);\n    const vibrantB = normalize(b);\n\n    \/\/ Convert RGB values to a hex color\n    const hexColor = `#${((1 << 24) + (vibrantR << 16) + (vibrantG << 8) + vibrantB).toString(16).slice(1)}`;\n    return hexColor;\n}\nfunction applyStylesToTableRow(row) {\n    const gender = row.querySelector('td[data-label=\"p\u0142e\u0107\"]').textContent.trim();\n    const category = row.querySelector('td[data-label=\"Category\"]').textContent.trim();\n\n    \/\/ Remove existing gender and category classes\n    row.classList.remove('gender-male', 'gender-female', 'gender-other');\n\n    \/\/ Add gender class or apply inline styles\n    if (gender === \"m\") {\n        row.classList.add(\"gender-male\");\n    } else if (gender === \"k\") {\n        row.classList.add(\"gender-female\");\n    } else {\n        row.classList.add(\"gender-other\");\n    }\n\n    \/\/ Dynamically generate and apply category background color\n    if (category) {\n        const categoryColor = stringToHexColor(category);\n        row.style.backgroundColor = categoryColor;\n    } else {\n        row.style.backgroundColor = \"\"; \/\/ Reset to default if no category\n    }\n}\n\n\/\/ Helper function to generate a color based on a string\nfunction stringToHexColor(str) {\n    let hash = 0;\n    for (let i = 0; i < str.length; i++) {\n        hash = str.charCodeAt(i) + ((hash << 5) - hash);\n    }\n    let color = \"#\";\n    for (let i = 0; i < 3; i++) {\n        color += (\"00\" + ((hash >> (i * 8)) & 0xff).toString(16)).slice(-2);\n    }\n    return color;\n}\n\n\/\/ Run the function on page load\njQuery(document).ready(function () {\n    jQuery('.athlets-list table tbody tr').each(function () {\n        applyStylesToTableRow(this);\n    });\n});\n<\/script>","ha_cmc_text":"Happy Addons"},"elements":[],"widgetType":"html"}],"isInner":false}],"isInner":false}]