Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
HyunsDev committed May 18, 2021
1 parent 9ccd9c1 commit d679eac
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 182 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-server/
15 changes: 1 addition & 14 deletions block/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-B71G27CBP0');
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="../notion-tools-block-module.js"></script>
<title>노션툴즈 HTML블록</title>
<style>
* {
Expand All @@ -22,31 +22,18 @@
}

</style>

</head>

<body>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}

let code = decodeURIComponent(getParameterByName("c"))
let root = document.getElementById("root")

if (code.slice(-2) == "nt") {
history.pushState(null,null,"index.html")
document.write(code.slice(0,-2))
} else {
document.write("링크를 다시 생성해주세요. <a href='https://www.notion-tools.com/embeds/html'>노션툴즈</a>")
}
</script>

</body>

</html>
26 changes: 2 additions & 24 deletions block/imglink/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());

gtag('config', 'G-B71G27CBP0');
</script>
<style>
/* 정식 배포 */

* {
padding: 0;
margin: 0;
Expand Down Expand Up @@ -47,6 +44,7 @@
background-color: rgb(255, 255, 255);
}
</style>
<script src="../notion-tools-block-module.js"></script>
</head>

<body>
Expand All @@ -58,33 +56,13 @@ <h1 style="display: none;">노션툴즈 이미지링크 배포</h1>
</div>

<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}

const Theme = getParameterByName("t");
apply_theme()
const Imglink = decodeURIComponent(getParameterByName("i"))
const Hyperlink = decodeURIComponent(getParameterByName("l"))

if (Theme == "black") {
$("body").addClass("black")
} else {
$("body").addClass("white")
}

console.log(Imglink)
console.log(Hyperlink)

if (Imglink && Hyperlink) {
$("#img").attr("src", Imglink);
$("#link").attr("href", Hyperlink);
}

</script>
</body>

Expand Down
38 changes: 38 additions & 0 deletions block/notion-tools-block-module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

function copylink() {
var copyText = document.getElementById('output_link');
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
}

function apply_theme() {
let theme = getParameterByName('t');
if (theme != "black") {
$("body").addClass("white");
} else {
$("body").addClass("black");
}
}

if (window.location != window.parent.location) {
$.ajax({
url: 'https://api2.notion-tools.com/embed',
data: {
in: document.location.href,
out: document.referrer
},
type: "POST",
dataType: "json"
}).done(json => {
console.log("Server connection successful")
}).fail((xhr, status, errorThrown) => {
console.log(`Server connect fail ${status} ${errorThrown}`)
} )
}
4 changes: 0 additions & 4 deletions block/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,11 @@ body {

.memu {
font-size: 30px;
/* width: 40px;
height: 40px; */
position: fixed;
/* display: none; */
right: 10px;
bottom: -40px;
transition: 0.5s;
cursor: pointer;

}

.show {
Expand Down
26 changes: 2 additions & 24 deletions block/table/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
gtag('config', 'G-B71G27CBP0');
</script>
<script src="table.js"></script>
<script src="../notion-tools-block-module.js"></script>
<style>
.black {
background-color: rgb(47, 52, 55);
Expand All @@ -42,17 +43,13 @@
table {
box-sizing: border-box;
width: 100%;
/* border: 1px solid rgba(0, 0, 0, 0.3); */
/* border-top: 1px solid rgb(223, 223, 222); */
/* box-shadow: white -3px 0px 0px, rgb(223, 223, 222) 0px 1px 0px; */
line-height: 1.5;
border-collapse: collapse;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
-webkit-font-smoothing: auto;
}

td {
/* border: 1px solid rgba(0, 0, 0, 0.3); */
border: 1px solid rgba(55, 53, 47, 0.09);
box-sizing: border-box;
padding: 5px 10px;
Expand All @@ -74,22 +71,7 @@
</div>

<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null
? ""
: decodeURIComponent(results[1].replace(/\+/g, " "));
}

let theme = getParameterByName('t')
if (theme == "black") {
$("body").addClass("black")
} else {
$("body").addClass("white")
}

apply_theme()

let text = getParameterByName('tb')
if (text) {
Expand All @@ -102,10 +84,6 @@
} else {
document.getElementById('main').innerHTML = "테이블 정보를 찾을 수 없습니다. <a href='https://www.notion-tools.com/embeds/table'>Notion Tools</a>에서 테이블 블록을 제작해주세요.<br>Table info not found. Please make a Table Block in <a href='https://www.notion-tools.com/embeds/table'>Notion Tools</a>"
}




</script>
</body>

Expand Down
44 changes: 0 additions & 44 deletions block/template/index.html

This file was deleted.

21 changes: 17 additions & 4 deletions block/자주쓰는 코드.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Notion Tools 자주 사용하는 코드

*파라미터 가져오기
* 파라미터 가져오기

```js
function getParameterByName(name) {
Expand All @@ -13,7 +13,7 @@
}
```

*복사하기 (id 변경 필요)
* 복사하기 (id 변경 필요)

```js
function copylink() {
Expand All @@ -24,7 +24,7 @@ function copylink() {
}
```

*색상 테마
* 색상 테마

```js
if (theme != "black") {
Expand All @@ -34,7 +34,7 @@ if (theme != "black") {
}
```

*글자 방향
* 글자 방향

```js
if (align == "left") {
Expand All @@ -47,3 +47,16 @@ if (align == "left") {
$("#wcii").css("text-align", "center");
}
```

* 구글 애널리틱스
```html
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-B71G27CBP0"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-B71G27CBP0');
</script>
```

25 changes: 2 additions & 23 deletions make/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="../modal.css">
<script src="../module.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-B71G27CBP0"></script>
<script>
Expand Down Expand Up @@ -48,6 +49,7 @@
const htmlCode = encodeURIComponent($("#code").val() + "nt");
const url = "https://embed.notion-tools.com/block/html/?c=" + htmlCode;
$("#output_link").val(url);
make_embed(url)
}

const linkCopy = () => {
Expand All @@ -58,29 +60,6 @@
modal("링크 복사 완료", "good")
}
}

const modal = (modal, mode) => {
$(".modal_text").text(modal);
if (mode === "good") {
$("#modal").css("background-color", "#5691d4")
$("#modal").addClass("modal_show");
} else if (mode === "bad") {
$("#modal").css("background-color", "#df5151")
$("#modal").addClass("modal_show");
}

setTimeout(() => {
$("#modal").removeClass("modal_show");
}, 3000)
}

function copylink() {
var copyText = document.getElementById("output_link");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
}

</script>
</body>

Expand Down
Loading

0 comments on commit d679eac

Please sign in to comment.