Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Em1dio/LolWitch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: caio-emidio/LolWitch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 6 commits
  • 52 files changed
  • 2 contributors

Commits on Feb 9, 2021

  1. Copy the full SHA
    31fb10d View commit details

Commits on Feb 10, 2021

  1. Merge pull request caio-emidio#2 from gitLucasHenrique/main

    added tft and badges
    caio-emidio authored Feb 10, 2021
    Copy the full SHA
    e0526f2 View commit details

Commits on Feb 17, 2021

  1. added bg option

    gitLucasHenrique committed Feb 17, 2021
    Copy the full SHA
    24918d7 View commit details

Commits on Feb 18, 2021

  1. Merge pull request caio-emidio#3 from gitLucasHenrique/main

    added bg option
    caio-emidio authored Feb 18, 2021
    Copy the full SHA
    a036a50 View commit details

Commits on Feb 19, 2021

  1. Copy the full SHA
    ca0a54f View commit details

Commits on Mar 8, 2021

  1. Merge pull request caio-emidio#4 from gitLucasHenrique/main

    center background button text
    caio-emidio authored Mar 8, 2021
    Copy the full SHA
    63434bf View commit details
Showing with 149 additions and 23 deletions.
  1. +53 −13 app.py
  2. BIN static/Emblem_Bronze.png
  3. BIN static/Emblem_Challenger.png
  4. BIN static/Emblem_Diamond.png
  5. BIN static/Emblem_Gold.png
  6. BIN static/Emblem_Grandmaster.png
  7. BIN static/Emblem_Iron.png
  8. BIN static/Emblem_Master.png
  9. BIN static/Emblem_Platinum.png
  10. BIN static/Emblem_Silver.png
  11. BIN static/Emblem_Unranked.png
  12. +8 −0 static/css/index.css
  13. +3 −0 static/css/main.css
  14. BIN static/imgs/Emblem_Bronze_I.png
  15. BIN static/imgs/Emblem_Bronze_II.png
  16. BIN static/imgs/Emblem_Bronze_III.png
  17. BIN static/imgs/Emblem_Bronze_IV.png
  18. BIN static/imgs/Emblem_Challenger_I.png
  19. BIN static/imgs/Emblem_Challenger_II.png
  20. BIN static/imgs/Emblem_Challenger_III.png
  21. BIN static/imgs/Emblem_Challenger_IV.png
  22. BIN static/imgs/Emblem_Diamond_I.png
  23. BIN static/imgs/Emblem_Diamond_II.png
  24. BIN static/imgs/Emblem_Diamond_III.png
  25. BIN static/imgs/Emblem_Diamond_IV.png
  26. BIN static/imgs/Emblem_Gold_I.png
  27. BIN static/imgs/Emblem_Gold_II.png
  28. BIN static/imgs/Emblem_Gold_III.png
  29. BIN static/imgs/Emblem_Gold_IV.png
  30. BIN static/imgs/Emblem_Grandmaster_I.png
  31. BIN static/imgs/Emblem_Grandmaster_II.png
  32. BIN static/imgs/Emblem_Grandmaster_III.png
  33. BIN static/imgs/Emblem_Grandmaster_IV.png
  34. BIN static/imgs/Emblem_Iron_I.png
  35. BIN static/imgs/Emblem_Iron_II.png
  36. BIN static/imgs/Emblem_Iron_III.png
  37. BIN static/imgs/Emblem_Iron_IV.png
  38. BIN static/imgs/Emblem_Master_I.png
  39. BIN static/imgs/Emblem_Master_II.png
  40. BIN static/imgs/Emblem_Master_III.png
  41. BIN static/imgs/Emblem_Master_IV.png
  42. BIN static/imgs/Emblem_Platinum_I.png
  43. BIN static/imgs/Emblem_Platinum_II.png
  44. BIN static/imgs/Emblem_Platinum_III.png
  45. BIN static/imgs/Emblem_Platinum_IV.png
  46. BIN static/imgs/Emblem_Silver_I.png
  47. BIN static/imgs/Emblem_Silver_II.png
  48. BIN static/imgs/Emblem_Silver_III.png
  49. BIN static/imgs/Emblem_Silver_IV.png
  50. BIN static/imgs/Emblem_Unranked.png
  51. +25 −2 templates/index.html
  52. +60 −8 templates/template.html
66 changes: 53 additions & 13 deletions app.py
Original file line number Diff line number Diff line change
@@ -19,16 +19,43 @@
}

images = {
"SILVER": "Emblem_Silver.png",
"PLATINUM": "Emblem_Platinum.png",
"MASTER": "Emblem_Master.png",
"IRON": "Emblem_Iron.png",
"GRANDMASTER": "Emblem_Grandmaster.png",
"GOLD": "Emblem_Gold.png",
"DIAMOND": "Emblem_Diamond.png",
"CHALLENGER": "Emblem_Challenger.png",
"BRONZE": "Emblem_Bronze.png",
"UNRANKED": "Emblem_Unranked.png",
"IRON_I": "imgs/Emblem_Iron_I.png",
"IRON_II": "imgs/Emblem_Iron_II.png",
"IRON_III": "imgs/Emblem_Iron_III.png",
"IRON_IV": "imgs/Emblem_Iron_IV.png",
"BRONZE_I": "imgs/Emblem_Bronze_I.png",
"BRONZE_II": "imgs/Emblem_Bronze_II.png",
"BRONZE_III": "imgs/Emblem_Bronze_III.png",
"BRONZE_IV": "imgs/Emblem_Bronze_IV.png",
"SILVER_I": "imgs/Emblem_Silver_I.png",
"SILVER_II": "imgs/Emblem_Silver_II.png",
"SILVER_III": "imgs/Emblem_Silver_III.png",
"SILVER_IV": "imgs/Emblem_Silver_IV.png",
"GOLD_I": "imgs/Emblem_Gold_I.png",
"GOLD_II": "imgs/Emblem_Gold_II.png",
"GOLD_III": "imgs/Emblem_Gold_III.png",
"GOLD_IV": "imgs/Emblem_Gold_IV.png",
"DIAMOND_I": "imgs/Emblem_Diamond_I.png",
"DIAMOND_II": "imgs/Emblem_Diamond_II.png",
"DIAMOND_III": "imgs/Emblem_Diamond_III.png",
"DIAMOND_IV": "imgs/Emblem_Diamond_IV.png",
"PLATINUM_I": "imgs/Emblem_Platinum_I.png",
"PLATINUM_II": "imgs/Emblem_Platinum_II.png",
"PLATINUM_III": "imgs/Emblem_Platinum_III.png",
"PLATINUM_IV": "imgs/Emblem_Platinum_IV.png",
"MASTER_I": "imgs/Emblem_Master_I.png",
"MASTER_II": "imgs/Emblem_Master_II.png",
"MASTER_III": "imgs/Emblem_Master_III.png",
"MASTER_IV": "imgs/Emblem_Master_IV.png",
"GRANDMASTER_I": "imgs/Emblem_Grandmaster_I.png",
"GRANDMASTER_II": "imgs/Emblem_Grandmaster_II.png",
"GRANDMASTER_III": "imgs/Emblem_Grandmaster_III.png",
"GRANDMASTER_IV": "imgs/Emblem_Grandmaster_IV.png",
"CHALLENGER_I": "imgs/Emblem_Challenger_I.png",
"CHALLENGER_II": "imgs/Emblem_Challenger_II.png",
"CHALLENGER_III": "imgs/Emblem_Challenger_III.png",
"CHALLENGER_IV": "imgs/Emblem_Challenger_IV.png",
"UNRANKED": "imgs/Emblem_Unranked.png",
}

@app.route("/")
@@ -41,8 +68,12 @@ def showData():
name = request.args.get('summoner')
queue = request.args.get('queue')
color = request.args.get('color')
data = define_map(get(region, name), queue)
return render_template('template.html', data = data[queue], color = color)
hasBg = request.args.get('hasBg')
if(queue == 'RANKED_TFT'):
data = define_map(getTFT(region, name), queue)
else:
data = define_map(get(region, name), queue)
return render_template('template.html', data = data[queue], color = color, hasBg = hasBg)


def requestLink(url):
@@ -60,12 +91,21 @@ def get(country, name):
response = requestLink(url)
return response

def getTFT(country, name):
url = f"https://{links[country]}/lol/summoner/v4/summoners/by-name/{name}"
response = requestLink(url)
id = response["id"]
url = f"https://{links[country]}/tft/league/v1/entries/by-summoner/{id}"
response = requestLink(url)
return response

def define_map(response, queue):
lista = {}
if(len(response) > 0):
print(response)
for res in response:
map = {
"tier": images[res["tier"]],
"tier": images[res["tier"] + "_" + res["rank"]],
"rank": res["rank"],
"leaguePoints": res["leaguePoints"],
"percentWin": float(res["wins"] / res["wins"] + res["losses"]),
Binary file removed static/Emblem_Bronze.png
Binary file not shown.
Binary file removed static/Emblem_Challenger.png
Binary file not shown.
Binary file removed static/Emblem_Diamond.png
Binary file not shown.
Binary file removed static/Emblem_Gold.png
Binary file not shown.
Binary file removed static/Emblem_Grandmaster.png
Binary file not shown.
Binary file removed static/Emblem_Iron.png
Binary file not shown.
Binary file removed static/Emblem_Master.png
Binary file not shown.
Binary file removed static/Emblem_Platinum.png
Binary file not shown.
Binary file removed static/Emblem_Silver.png
Binary file not shown.
Binary file removed static/Emblem_Unranked.png
Binary file not shown.
8 changes: 8 additions & 0 deletions static/css/index.css
Original file line number Diff line number Diff line change
@@ -64,7 +64,15 @@ body {
align-items: center;
justify-content: center;
padding-left: 10px;
}

.pRevert{
padding-left: revert;
}

.off{
background-color: #B01717;
initial-value: "OFF";
}

.region{
3 changes: 3 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@ body {
}

.info {
border-radius: 20px;
border-style: groove;
border-width: 0.6ch;
display: flex;
flex-direction: column;
align-items: center;
Binary file added static/imgs/Emblem_Bronze_I.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Bronze_II.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Bronze_III.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Bronze_IV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Challenger_I.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Challenger_II.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Challenger_III.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Challenger_IV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Diamond_I.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Diamond_II.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Diamond_III.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Diamond_IV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Gold_I.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Gold_II.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Gold_III.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/imgs/Emblem_Gold_IV.png
Binary file added static/imgs/Emblem_Grandmaster_I.png
Binary file added static/imgs/Emblem_Grandmaster_II.png
Binary file added static/imgs/Emblem_Grandmaster_III.png
Binary file added static/imgs/Emblem_Grandmaster_IV.png
Binary file added static/imgs/Emblem_Iron_I.png
Binary file added static/imgs/Emblem_Iron_II.png
Binary file added static/imgs/Emblem_Iron_III.png
Binary file added static/imgs/Emblem_Iron_IV.png
Binary file added static/imgs/Emblem_Master_I.png
Binary file added static/imgs/Emblem_Master_II.png
Binary file added static/imgs/Emblem_Master_III.png
Binary file added static/imgs/Emblem_Master_IV.png
Binary file added static/imgs/Emblem_Platinum_I.png
Binary file added static/imgs/Emblem_Platinum_II.png
Binary file added static/imgs/Emblem_Platinum_III.png
Binary file added static/imgs/Emblem_Platinum_IV.png
Binary file added static/imgs/Emblem_Silver_I.png
Binary file added static/imgs/Emblem_Silver_II.png
Binary file added static/imgs/Emblem_Silver_III.png
Binary file added static/imgs/Emblem_Silver_IV.png
Binary file added static/imgs/Emblem_Unranked.png
27 changes: 25 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoL Witch</title>
<link rel="stylesheet" href="./../static/css/index.css">

</head>

<body>
@@ -37,6 +36,7 @@
<option value="RANKED_FLEX_SR">Flex</option>
<option value="RANKED_SOLO_5x5">Solo 5v5</option>
<option value="RANKED_TEAM_5x5">Team 5v5</option>
<option value="RANKED_TFT">TFT</option>
</select>
</div>
<div class="formDivInput">
@@ -55,19 +55,42 @@
<option value="RU">Russia</option>
</select>
</div>
<div class="formDivInput">
<label for="bg">Background</label>
<input id='bg' class="formInput pRevert" name="bg" type="button" value="ON" onclick="toggle(this)">
<input id='hasBg' class="formInput" name="hasBg" type="text" style="display: none;">
</div>
<div class="formDivInput">
<label for="color">Color</label>
<input class="formInput color" name="color" type="color" value="#32D74B">
</div>
</div>
</div>

<button>Go!</button>
<button onclick="checkBG()">Go!</button>

</form>

</div>
<script>
function checkBG() {
const bg = document.getElementById("bg");
const bgText = document.getElementById("hasBg");

if (bg.value == 'ON') {
bgText.value = true;
} else
bgText.value = false;
}
function toggle(el) {
el.classList.toggle("off");
if (el.classList.contains('off')) {
el.value = "OFF";
} else if (!el.classList.contains('off')) {
el.value = "ON";
}
}
</script>
<footer>
<a href="https://www.twitch.tv/em1dio">Twitch: @Em1Dio</a>
<a href="http://github.com/caio-emidio/">Github: caio-emidio</a>
68 changes: 60 additions & 8 deletions templates/template.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,83 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="60">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoL Witch</title>
<style>
p {
font-size: 6.2em;
font-weight: 500;
margin: 1px;
color:
{{color}};
font-size: 2.2em;
font-weight: 700;
margin: 5px;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>

<body>
<div class="lolwitch">
<div class="images">
<img src="{{url_for('static', filename=data.tier)}}" />
<img id="badge" src="{{url_for('static', filename=data.tier)}}" />
</div>
<div class="info">
<p>Rank: {{data.rank}}</p>
<div id="PDLs">
<p>{{data.leaguePoints}} PDLs</p>
</div>
</div>
<script>
const params = Object.fromEntries(new URLSearchParams(location.search));
const elementP = document.getElementsByTagName('p')[0];
const elementBadge = document.getElementById('badge');
const elementPDLs = document.getElementById('PDLs');
elementP.style.color = params.color;

if (params.hasBg == 'true') {
elementPDLs.classList.add("info");
checkTier();
}
function checkTier() {
elementPDLs.classList.add("info")

if (elementBadge.src.toLowerCase().includes('iron')) {
elementPDLs.style.backgroundColor = "#5f5757";
elementPDLs.style.borderColor = "#575151";
}
else if (elementBadge.src.toLowerCase().includes('silver')) {
elementPDLs.style.backgroundColor = "#687c82";
elementPDLs.style.borderColor = "#62767b";
}
else if (elementBadge.src.toLowerCase().includes('gold')) {
elementPDLs.style.backgroundColor = "#ba782f";
elementPDLs.style.borderColor = "#1a6b30";
}
else if (elementBadge.src.toLowerCase().includes('diamond')) {
elementPDLs.style.backgroundColor = "#4d83b3";
elementPDLs.style.borderColor = "#da7bf7";
}
else if (elementBadge.src.toLowerCase().includes('platynum')) {
elementPDLs.style.backgroundColor = "#52908d";
elementPDLs.style.borderColor = "#332f35";
}
else if (elementBadge.src.toLowerCase().includes('_master')) {
elementPDLs.style.backgroundColor = "#b381d6";
elementPDLs.style.borderColor = "#592c2f";
}
else if (elementBadge.src.toLowerCase().includes('grandmaster')) {
elementPDLs.style.backgroundColor = "#c1b2bb";
elementPDLs.style.borderColor = "#cd1c22";
}
else if (elementBadge.src.toLowerCase().includes('challenger')) {
elementPDLs.style.backgroundColor = "#fbeedf";
elementPDLs.style.borderColor = "#fddb83";
}
else {
elementPDLs.style.backgroundColor = "#1e2328";
elementPDLs.style.borderColor = "#040d16";
}
}

</script>
</body>

</html>