Created
January 15, 2017 10:45
-
-
Save laphilosophia/d46f298975281bc19acd6780e72b0afd to your computer and use it in GitHub Desktop.
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
<div id="wrapper"></div> | |
<input type="text" id="input" placeholder="Değeri Gir"><!-- | |
--><button id="convert" onClick="convert()">Dönüştür</button> | |
<p id="output"></p> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> |
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
function convert(){ | |
var input = document.getElementById("input"); | |
var button = document.getElementById("convert"); | |
var output = document.getElementById("output"); | |
var inputVal = input.value.toLowerCase(); | |
var dict = { | |
"İ": "I", | |
"Ğ": "G", | |
"Ç": "C", | |
"Ş": "S", | |
"Ö": "O", | |
"Ü": "U", | |
"ü": "u", | |
"ş": "s", | |
"ı": "i", | |
"ç": "c", | |
"ö": "o", | |
"ğ": "g" | |
}; | |
var str = inputVal.replace(/\s/g, '-'); | |
var replaced = str.replace(/[^\w ]/g, function(char) { | |
return dict[char] || char; | |
}); | |
output.innerHTML = replaced; | |
} |
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
* { | |
margin: 0; | |
box-sizing: border-box; | |
} | |
#wrapper { | |
margin: 20px auto auto;; | |
width: 100%; | |
height: 30px; | |
} | |
input, button { | |
display: inline-block; | |
vertical-align: top; | |
margin: 0; | |
} | |
input { | |
width: 85%; | |
height: 30px; | |
padding: 0 10px; | |
border: lightgray solid 1px; | |
} | |
button { | |
width: 15%; | |
height: 30px; | |
background: white; | |
border: none; | |
background: lightgray; | |
color: gray; | |
} | |
p { | |
display: block; | |
margin: 10px 0 0; | |
padding: 10px 20px; | |
border: lightgray solid 1px; | |
font-size: 14px; | |
color: gray; | |
line-height: 1.5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment