Skip to content

Commit

Permalink
modified: css/header.css
Browse files Browse the repository at this point in the history
	modified:   faq.html
	modified:   index.html
	modified:   item.html
	modified:   js/item.js
	new file:   js/logo.js
	modified:   submited.html
	modified:   templates/index.html
	modified:   translation.html
  • Loading branch information
MEGATREX4 committed Apr 17, 2024
1 parent dafc8e1 commit 3306f77
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 68 deletions.
9 changes: 4 additions & 5 deletions css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
}

.logo {
min-width: 41px;
min-height: 41px;
max-width: 41px;
max-height: 41px;
background-image: url(https://i.imgur.com/v6q6loF.png);
min-width: 39px;
min-height: 39px;
max-width: 39px;
max-height: 39px;
background-size: cover;
margin-left: 20px;
display: flex;
Expand Down
5 changes: 4 additions & 1 deletion faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

<body>
<div class="header">
<div class="logo"></div>
<div onlick="window.location.href='index';" class="logo"><svg id="be03f596-d4a4-4aa0-b150-31f929567437" data-name="Шар 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 370 370"><defs><style>.b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff{fill:snow;}.a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d{fill:#873735;}</style></defs><rect class="b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff" width="370" height="370" rx="50"/><path class="a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d" d="M296.71,124.58c17.26,0,34.53,0,51.8,0,11.16,0,19.05,5.52,24.32,15.1,2.39,4.33,2.89,9.11,3.1,14,.56,12.51.88,25,1.79,37.51a26.4,26.4,0,0,1-26.84,28.39A31.83,31.83,0,0,0,319.3,244a26.33,26.33,0,0,0,.29,13.48c4.93,18.33,21.31,30,38.26,36.53,24.89,9.44,21.7,51.93,19.34,73.53-1.89,13.62-13.48,20-26.56,19.79-30.51.07-61,.37-91.54,0-63.61,1-118-51.7-124.87-114-6.86-54.5,22.59-110.48,70.43-137.11a98.44,98.44,0,0,1,35.92-11.45C259.26,124.38,278,124.68,296.71,124.58Z" transform="translate(-80 -71)"/></svg></div>

<div class="headerbtn">
<div onclick="window.location.href='index';" class="main hbtn">Головна</div>
<div class="about hbtn">Про нас</div>
Expand Down Expand Up @@ -176,5 +177,7 @@ <h2>Як це працює?</h2>
</div>
<script type="module" src="js/countTranslations.js"></script>
<script src="js/randomItems.js"></script>

<script src="js/logo.js"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@




<div class="header">
<div class="logo"></div>
<div onlick="window.location.href='index';" class="logo"><svg id="be03f596-d4a4-4aa0-b150-31f929567437" data-name="Шар 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 370 370"><defs><style>.b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff{fill:snow;}.a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d{fill:#873735;}</style></defs><rect class="b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff" width="370" height="370" rx="50"/><path class="a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d" d="M296.71,124.58c17.26,0,34.53,0,51.8,0,11.16,0,19.05,5.52,24.32,15.1,2.39,4.33,2.89,9.11,3.1,14,.56,12.51.88,25,1.79,37.51a26.4,26.4,0,0,1-26.84,28.39A31.83,31.83,0,0,0,319.3,244a26.33,26.33,0,0,0,.29,13.48c4.93,18.33,21.31,30,38.26,36.53,24.89,9.44,21.7,51.93,19.34,73.53-1.89,13.62-13.48,20-26.56,19.79-30.51.07-61,.37-91.54,0-63.61,1-118-51.7-124.87-114-6.86-54.5,22.59-110.48,70.43-137.11a98.44,98.44,0,0,1,35.92-11.45C259.26,124.38,278,124.68,296.71,124.58Z" transform="translate(-80 -71)"/></svg></div>
<div class="headerbtn">
<div class="main hbtn">Головна</div>
<div class="about hbtn">Про нас</div>
Expand Down Expand Up @@ -68,5 +67,7 @@
</div>
</div>
<script rel="preconnect" src="js/showcards.js"></script>

<script src="js/logo.js"></script>
</body>
</html>
5 changes: 4 additions & 1 deletion item.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
</head>
<body>
<div class="header">
<div class="logo"></div>
<div onlick="window.location.href='index';" class="logo"><svg id="be03f596-d4a4-4aa0-b150-31f929567437" data-name="Шар 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 370 370"><defs><style>.b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff{fill:snow;}.a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d{fill:#873735;}</style></defs><rect class="b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff" width="370" height="370" rx="50"/><path class="a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d" d="M296.71,124.58c17.26,0,34.53,0,51.8,0,11.16,0,19.05,5.52,24.32,15.1,2.39,4.33,2.89,9.11,3.1,14,.56,12.51.88,25,1.79,37.51a26.4,26.4,0,0,1-26.84,28.39A31.83,31.83,0,0,0,319.3,244a26.33,26.33,0,0,0,.29,13.48c4.93,18.33,21.31,30,38.26,36.53,24.89,9.44,21.7,51.93,19.34,73.53-1.89,13.62-13.48,20-26.56,19.79-30.51.07-61,.37-91.54,0-63.61,1-118-51.7-124.87-114-6.86-54.5,22.59-110.48,70.43-137.11a98.44,98.44,0,0,1,35.92-11.45C259.26,124.38,278,124.68,296.71,124.58Z" transform="translate(-80 -71)"/></svg></div>

<div class="headerbtn">
<div onclick="window.location.href='index';" class="main hbtn">Головна</div>
<div class="about hbtn">Про нас</div>
Expand All @@ -42,5 +43,7 @@
<script type="module" src="js/countTranslations.js"></script>
<script src="js/randomItems.js"></script>


<script src="js/logo.js"></script>
</body>
</html>
97 changes: 40 additions & 57 deletions js/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,62 +185,6 @@ function generateTranslationDiv(translationLink, isMod, isVerified) {
$('#TranslationContainer').html(translationDiv);


// Function to update Open Graph (og) meta tags
function updateMetaTags(selectedItem) {
// Remove existing meta tags for Open Graph
document.querySelectorAll('meta[property^="og:"]').forEach(tag => tag.remove());

// Update og:title
const ogTitle = document.createElement('meta');
ogTitle.setAttribute('property', 'og:title');
ogTitle.setAttribute('content', "СУМ" + " - переклад " + selectedItem.title);
document.head.appendChild(ogTitle);

// Update og:description
const ogDescription = document.createElement('meta');
ogDescription.setAttribute('property', 'og:description');
ogDescription.setAttribute('content', truncateText(selectedItem.description, 120));
document.head.appendChild(ogDescription);

// Update og:image
const ogImage = document.createElement('meta');
ogImage.setAttribute('property', 'og:image');
ogImage.setAttribute('content', selectedItem.image);
document.head.appendChild(ogImage);
}

// Function to check if the user agent is a known social network bot
function isSocialBot() {
const userAgent = navigator.userAgent.toLowerCase();
// Add checks here to detect social network bots based on user agent
// Example: return userAgent.includes('facebookexternalhit') || userAgent.includes('twitterbot');
return false; // Placeholder, update with actual checks
}

// Function to handle dynamic generation of meta tags
function handleDynamicMetaTags() {
if (isSocialBot()) {
// Bot detected, fetch data and update meta tags
const itemId = getItemId(); // Replace with your logic to get item ID
if (itemId) {
fetchItemData(itemId)
.then(({ selectedItem }) => {
if (selectedItem) {
// Call function to update meta tags
updateMetaTags(selectedItem);
}
})
.catch(error => {
console.error("Error fetching item data:", error);
});
}
}
}

// Event listener for when the page has finished loading
window.addEventListener('load', handleDynamicMetaTags);

window.addEventListener('load', updateItemPage);

// Function to update the item page with the fetched data
async function updateItemPage() {
Expand All @@ -251,9 +195,48 @@ async function updateItemPage() {
const { selectedItem, modsData, otherData } = await fetchItemData(itemId);

if (selectedItem) {
updateMetaTags(selectedItem);
document.title = "СУМ" + " - переклад " + selectedItem.title;

// Update meta description
const metaDescription = document.createElement('meta');
metaDescription.setAttribute('name', 'description');
metaDescription.setAttribute('content', selectedItem.description);
document.head.appendChild(metaDescription);
// Update og:description
const ogDescription = document.createElement('meta');
ogDescription.setAttribute('property', 'og:description');
ogDescription.setAttribute('content', selectedItem.description);
ogDescription.setAttribute('content', truncateText(selectedItem.description, 120));
document.head.appendChild(ogDescription);

//update meta og:title
const ogTitle = document.createElement('meta');
ogTitle.setAttribute('property', 'og:title');
ogTitle.setAttribute('content', "СУМ" + " - переклад " + selectedItem.title);
document.head.appendChild(ogTitle);
//update meta og:image
const ogImage = document.createElement('meta');
ogImage.setAttribute('property', 'og:image');
ogImage.setAttribute('content', selectedItem.image);
document.head.appendChild(ogImage);
//update meta twitter:description
const twitterDescription = document.createElement('meta');
twitterDescription.setAttribute('name', 'twitter:description');
twitterDescription.setAttribute('content', selectedItem.description);
twitterDescription.setAttribute('content', truncateText(selectedItem.description, 120));
document.head.appendChild(twitterDescription);

//update meta twitter:title
const twitterTitle = document.createElement('meta');
twitterTitle.setAttribute('name', 'twitter:title');
twitterTitle.setAttribute('content', "СУМ" + " - переклад " + selectedItem.title);
document.head.appendChild(twitterTitle);
//update meta twitter:image
const twitterImage = document.createElement('meta');
twitterImage.setAttribute('name', 'twitter:image');
twitterImage.setAttribute('content', selectedItem.image);
document.head.appendChild(twitterImage);

// Create HTML string for tooltip content
const tooltipContent = selectedItem.tooltip ? selectedItem.tooltip : (selectedItem.verified ? 'Переклад вже в моді! Завантаження додаткових файлів не потрібно. Насолоджуйтеся грою з українською локалізацією!' : '');

Expand Down
6 changes: 6 additions & 0 deletions js/logo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// onlick svg logo -> index.html
$(document).ready(function(){
$(".logo").click(function(){
window.location.href = "index.html";
})
})
5 changes: 4 additions & 1 deletion submited.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
</head>
<body>
<div class="header">
<div class="logo"></div>
<div onlick="window.location.href='index';" class="logo"><svg id="be03f596-d4a4-4aa0-b150-31f929567437" data-name="Шар 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 370 370"><defs><style>.b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff{fill:snow;}.a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d{fill:#873735;}</style></defs><rect class="b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff" width="370" height="370" rx="50"/><path class="a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d" d="M296.71,124.58c17.26,0,34.53,0,51.8,0,11.16,0,19.05,5.52,24.32,15.1,2.39,4.33,2.89,9.11,3.1,14,.56,12.51.88,25,1.79,37.51a26.4,26.4,0,0,1-26.84,28.39A31.83,31.83,0,0,0,319.3,244a26.33,26.33,0,0,0,.29,13.48c4.93,18.33,21.31,30,38.26,36.53,24.89,9.44,21.7,51.93,19.34,73.53-1.89,13.62-13.48,20-26.56,19.79-30.51.07-61,.37-91.54,0-63.61,1-118-51.7-124.87-114-6.86-54.5,22.59-110.48,70.43-137.11a98.44,98.44,0,0,1,35.92-11.45C259.26,124.38,278,124.68,296.71,124.58Z" transform="translate(-80 -71)"/></svg></div>

<div class="headerbtn">
<div onclick="window.location.href='index';" class="main hbtn">Головна</div>
<div class="about hbtn">Про нас</div>
Expand Down Expand Up @@ -53,5 +54,7 @@
<script type="module" src="js/countTranslations.js"></script>
<script src="js/randomItems.js"></script>


<script src="js/logo.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ <h1>Edit Record</h1>
</div>

</div>

<script src="js/logo.js"></script>
</body>

</html>
5 changes: 4 additions & 1 deletion translation.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
</head>
<body>
<div class="header">
<div class="logo"></div>
<div onlick="window.location.href='index';" class="logo"><svg id="be03f596-d4a4-4aa0-b150-31f929567437" data-name="Шар 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 370 370"><defs><style>.b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff{fill:snow;}.a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d{fill:#873735;}</style></defs><rect class="b7f69e4e-d2aa-4f23-9e30-20b0a6dd5fff" width="370" height="370" rx="50"/><path class="a83e0ca3-bfc9-4cd3-95a9-f4d9c9eb972d" d="M296.71,124.58c17.26,0,34.53,0,51.8,0,11.16,0,19.05,5.52,24.32,15.1,2.39,4.33,2.89,9.11,3.1,14,.56,12.51.88,25,1.79,37.51a26.4,26.4,0,0,1-26.84,28.39A31.83,31.83,0,0,0,319.3,244a26.33,26.33,0,0,0,.29,13.48c4.93,18.33,21.31,30,38.26,36.53,24.89,9.44,21.7,51.93,19.34,73.53-1.89,13.62-13.48,20-26.56,19.79-30.51.07-61,.37-91.54,0-63.61,1-118-51.7-124.87-114-6.86-54.5,22.59-110.48,70.43-137.11a98.44,98.44,0,0,1,35.92-11.45C259.26,124.38,278,124.68,296.71,124.58Z" transform="translate(-80 -71)"/></svg></div>

<div class="headerbtn">
<div onclick="window.location.href='index';" class="main hbtn">Головна</div>
<div class="about hbtn">Про нас</div>
Expand Down Expand Up @@ -170,5 +171,7 @@
<div class="infotext">THIS PRODUCT IS NOT SUPPORTED BY OR AFFILIATED WITH MOJANG MICROSOFT OR STEAM.</div>
</div>
<script type="module" src="js/countTranslations.js"></script>

<script src="js/logo.js"></script>
</body>
</html>

0 comments on commit 3306f77

Please sign in to comment.