-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
109 lines (103 loc) · 3.14 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Scripting test file for the development process
// console.log($('h1').element());
// $('h1').html('I have edit it from the script file!')
// $('h1').html(`
// <h1>hello there</h1>
// <h5>hello there</h5>
// `)
// $('h1').insert('p').text('I have made this element from the script file');
// console.log($('h1').insert('p').text('Get the parent of this new element').parent().element());
// console.log($('h1').child('h5').element());
// console.log($('h1').child('h5').remove().element());
// $('h1').event('click', _ => {
// console.log("Wow! it's work");
// });
// $('h1').addAttr('data-test', 'we added this attribute from the script file')
// console.log($('h1').getAttr('data-test'));
// console.log($('h1').removeAttr('data-test'));
// $('h1').addClass('7mra')
// $('h1').toggleClass('sfra')
// $('h1').setId('sfra')
// $('h1').removeId()
// console.log($('body').getCssStyle('background'));
console.log(gm("h1"));
console.log(gm("h1").element());
gm("h1").event("click", (_) => {
gm(".container")
.position("relative")
.insert("div")
.position("absolute")
.width("50%")
.height("50%")
.bg("rgb(255 255 255 / 100%)")
.radius(15)
.shadow("0 5px 7px #cccccc7a")
.display("flex")
.alignItems("center")
.justify("center")
.padding("40px")
.setId("pop-form")
// .opacity(.5)
.insert("p")
.text("X")
.position("absolute")
.top("0")
.left("20px")
.cursor("pointer")
.fontWeight("900")
.color("red")
.event("click", (_) => {
gm(".container div#pop-form").remove();
})
.parent()
.createForm("form", "requstForm", true)
.input("name", true, "text", "type your name here", null, "input", "test")
.input("phone", false, "text", "type your phone number here", null, "input")
.input("email", false, "email", "type your email here", null, "input")
.inputContainer(
"text",
false,
"text",
"test field",
"input-container",
"input",
"text field",
null,
"test-text"
)
.button("click me", "blue-btn")
.formRequest("test", "post", (x) => {
console.log(x);
});
// .insert('form')
// .setId('requstForm')
// .width('100%')
// .insert('h2')
// .text('test form')
// .parent()
// .insert('input')
// .addAttr('type','text')
// .addAttr('name','name')
// .addAttr('placeholder','Type your name here')
// .addClass('input')
// .parent()
// .insert('input')
// .addAttr('type','text')
// .addAttr('name','phone')
// .addAttr('placeholder','Type your phone number here')
// .addClass('input')
// .parent()
// .insert('button')
// .text('Click me !')
// .addClass('blue-btn');
//
// formRequest('.container form#requstForm','test/url')
// formRequest($('.container form#requstForm'),'test/url')
// $('.container div#pop-form').remove();
});
// requst('https://dummyjson.com/products/1', 'GET', 'json').then(Response=> {
// console.log(Response);
// });
console.log(num("712"));
gm('body').addAttrs({ 'attr1': 'value1', 'attr2': 'value2' })
gm('body').removeAttr(['attr1', 'attr2'])