-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5c0ea35
Showing
13 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
 | ||
|
||
# Steam Türk Lirasına Çevirme | ||
|
||
Steam Turkey Store now uses Dollars instead of Turkish Lira due to our fascinating economy. This plugin has been created by using the [Exchange Rate API](https://www.exchangerate-api.com), which calculates the prices according to the current exchange rate and shows them in Turkish lira instead of dollars. | ||
|
||
Chrome Web Store: [Steam Türk Lirasına Çevirme](https://chromewebstore.google.com/detail/steam-t%C3%BCrk-liras%C4%B1na-%C3%A7evir/amjkkjgaoobiepemkmiefmmbdeeindoj), | ||
|
||
[](https://chromewebstore.google.com/detail/steam-t%C3%BCrk-liras%C4%B1na-%C3%A7evir/amjkkjgaoobiepemkmiefmmbdeeindoj) | ||
|
||
|
||
--- | ||
**Bug reports, feature requests and pull requests are always welcome** |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name":"Steam Türk Lirasına Çevirme", | ||
"description" : "Steam Mağaza oyun fiyatlarını güncel dolar kuruna göre TL olarak görüntülemesini sağlar.", | ||
"version":"1.0.1", | ||
"manifest_version":3, | ||
"icons": { | ||
"16": "/icons/icon16.png", | ||
"32": "/icons/icon32.png", | ||
"48": "/icons/icon48.png", | ||
"128": "/icons/icon128.png" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": ["https://store.steampowered.com/*"], | ||
"js": ["scripts/content-scripts.js"] | ||
} | ||
], | ||
"action":{ | ||
"default_popup":"options/popup.html", | ||
"default_icon": { | ||
"16": "/icons/icon16.png", | ||
"32": "/icons/icon32.png", | ||
"48": "/icons/icon48.png", | ||
"128": "/icons/icon128.png" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" type="text/css" href="popup_css_compiled.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
</head> | ||
<body> | ||
<img id="logo" src="../icons/icon128.png" alt="Extension Logo"> | ||
<div id="text-and-button"> | ||
<h3>Steam Türk Lirasına Çevirme</h3> | ||
<p>Bug reports, feature requests and pull requests are always welcome.</p> | ||
<a id="github-button" href="https://github.com/srcemre/steamTurkishLiraExtensions" target="_blank"><i class="fa fa-github"></i></i> Visit GitHub Repository</a> | ||
</div> | ||
</body> | ||
</html> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
body { | ||
font-family: 'Arial', sans-serif; | ||
background: rgb(135,35,65); | ||
background: linear-gradient(4deg, rgba(135,35,65,1) 0%, rgba(34,9,44,1) 50%); | ||
color: #fd5b43; | ||
margin: 0; | ||
padding: 8px; | ||
width: 380px; | ||
display: flex; | ||
align-items: center; /* Align items vertically in the center */ | ||
} | ||
|
||
#logo { | ||
width: 128px; | ||
height: 128px; | ||
margin-right: 16px; | ||
} | ||
|
||
#text-and-button { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; /* Align items to the start (left) */ | ||
} | ||
|
||
#github-button { | ||
background-color: #333; | ||
color: #fff; | ||
padding: 5px; | ||
border: none; | ||
cursor: pointer; | ||
text-decoration: none; | ||
border-radius: 5px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
let extensionExecuted = false; | ||
|
||
async function replaceDiscountPrices() { | ||
|
||
if (extensionExecuted) { | ||
return; | ||
} | ||
|
||
// Sayfadaki çevrilmesini istediğin kısımların <div> elementlerini seç | ||
const discountOriginalPrice = document.querySelectorAll('.discount_original_price'); | ||
const discountElements = document.querySelectorAll('.discount_final_price'); | ||
const gameAreaDlcPrice = document.querySelectorAll('.game_area_dlc_price'); | ||
const price = document.querySelectorAll('.price'); | ||
|
||
const exchangeRate = await getExchangeRate(); | ||
|
||
discountElements.forEach((element) => { | ||
element.textContent = changeText(element.textContent, exchangeRate) | ||
}); | ||
discountOriginalPrice.forEach((element) => { | ||
element.textContent = changeText(element.textContent, exchangeRate) | ||
}); | ||
price.forEach((element) => { | ||
element.textContent = changeText(element.textContent, exchangeRate) | ||
}); | ||
gameAreaDlcPrice.forEach((element) => { | ||
|
||
if (element.querySelectorAll('.discount_prices').length==0) | ||
return; | ||
|
||
element.textContent = changeText(element.textContent, exchangeRate); | ||
|
||
}); | ||
|
||
extensionExecuted = true; | ||
} | ||
|
||
function changeText( originalContent, exchangeRate) { | ||
const matches = originalContent.match(/(\D+)([\d.]+)/); | ||
if (matches && matches.length === 3) { | ||
const currencySymbol = '₺'; | ||
const amount = parseFloat(matches[2]); | ||
if (!isNaN(amount)) { | ||
const convertedAmount = (amount * exchangeRate).toFixed(2); | ||
const convertedContent = currencySymbol + ' ' + convertedAmount + ' TL'; | ||
return convertedContent; | ||
} | ||
} | ||
return originalContent; | ||
} | ||
|
||
async function getExchangeRate() { | ||
const apiKey = ''; | ||
try { | ||
const response = await fetch(`https://v6.exchangerate-api.com/v6/${apiKey}/latest/USD`); | ||
if (!response.ok) { | ||
throw new Error('Unable to get exchange rate: ' + response.status); | ||
} | ||
|
||
const data = await response.json(); | ||
const exchangeRate = data.conversion_rates.TRY; | ||
|
||
return exchangeRate; | ||
} catch (error) { | ||
console.error('Unable to get exchange rate:', error.message); | ||
return null; | ||
} | ||
} | ||
|
||
replaceDiscountPrices(); | ||
|
||
var observer = new MutationObserver(replaceDiscountPrices); | ||
observer.observe(document.body, { subtree: false, childList: true }); |
Empty file.