Skip to content

Commit

Permalink
fixed: copyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
ircfspace committed Feb 4, 2024
1 parent ee62cee commit c42d95f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@ input:checked + .slider {
cursor: pointer;
}

.jsonOutput {
width: 1px;
height: 1px;
border: none;
outline: none;
color: #fff;
background: transparent;
margin: 0;
}

footer {
padding: 10px 0;
/*position: fixed;
Expand Down
6 changes: 2 additions & 4 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,11 @@ $(document).on('click', '#copyCode', function (e) {
generateJson()
.then(data => {
data = JSON.stringify(data, null, 2);
const input = document.createElement('input');
input.setAttribute('value', data);
document.body.appendChild(input);
document.getElementById("jsonOutput").value = data;
const input = document.getElementById('jsonOutput');
input.select();
input.setSelectionRange(0, 99999);
document.execCommand('copy');
document.body.removeChild(input);
alert('کد در کلیپ‌بورد کپی شد.');
})
.catch(error => {
Expand Down
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link href="./assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="./assets/css/bootstrap-rtl.min.css" rel="stylesheet" />
<link href="./assets/css/vazir.css" rel="stylesheet" />
<link href="./assets/css/style.css?v1.8.3" rel="stylesheet" />
<link href="./assets/css/style.css?v1.8.9" rel="stylesheet" />
<link href="./assets/css/lang.css?v1.1" rel="stylesheet" />
<title>IRCF | ابزار فرگمنت</title>
<meta name="description" content="آی پی سالم و تمیز برای کلودفلر (کلادفلر) جهت دسترسی به اینترنت آزاد" />
Expand Down Expand Up @@ -141,6 +141,8 @@ <h1>اینترنت برای همه؛ یا هیچ‌کس!</h1>
<button class="btn btn-default active" id="copyCode" data-i18n="config_form_copy"></button>
</div>
<div class="clearfix"></div>
<textarea id="jsonOutput" class="jsonOutput"></textarea>
<div class="clearfix"></div>
<br>
<div id="donate" class="modal fade" role="dialog">
<div class="modal-dialog modal-sm">
Expand Down Expand Up @@ -199,7 +201,7 @@ <h4 class="modal-title">دونیت</h4>
<script src="./assets/js/jquery.min.js"></script>
<script src="./assets/js/bootstrap.min.js"></script>
<script src="./assets/js/lang.js?v1.3"></script>
<script src="./assets/js/script.js?v1.8.7"></script>
<script src="./assets/js/script.js?v1.8.9"></script>
</footer>
</div>
</div>
Expand Down

0 comments on commit c42d95f

Please sign in to comment.