Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 112d86b

Browse files
committed
Adjustment javascript section
1 parent f9a15c2 commit 112d86b

File tree

10 files changed

+223
-207
lines changed

10 files changed

+223
-207
lines changed

resources/views/announcement/create.blade.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@
6969
@endsection
7070

7171
@section('javascript')
72-
$(function () {
73-
$('#datetimepicker1').datetimepicker({
74-
format: 'YYYY/MM/DD HH:mm:ss'
72+
<script type="text/javascript">
73+
$(function () {
74+
$('#datetimepicker1').datetimepicker({
75+
format: 'YYYY/MM/DD HH:mm:ss'
76+
});
77+
$('#datetimepicker2').datetimepicker({
78+
format: 'YYYY/MM/DD HH:mm:ss'
79+
});
7580
});
76-
$('#datetimepicker2').datetimepicker({
77-
format: 'YYYY/MM/DD HH:mm:ss'
78-
});
79-
});
81+
</script>
8082
@endsection
8183

resources/views/announcement/edit.blade.php

+9-7
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@
7070
@endsection
7171

7272
@section('javascript')
73-
$(function () {
74-
$('#datetimepicker1').datetimepicker({
75-
format: 'YYYY/MM/DD HH:mm:ss'
73+
<script type="text/javascript">
74+
$(function () {
75+
$('#datetimepicker1').datetimepicker({
76+
format: 'YYYY/MM/DD HH:mm:ss'
77+
});
78+
$('#datetimepicker2').datetimepicker({
79+
format: 'YYYY/MM/DD HH:mm:ss'
80+
});
7681
});
77-
$('#datetimepicker2').datetimepicker({
78-
format: 'YYYY/MM/DD HH:mm:ss'
79-
});
80-
});
82+
</script>
8183
@endsection

resources/views/app.blade.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
@if(App::environment('production'))
5252
{!! HTML::script('js/analyticstracking.js') !!}
5353
@endif
54-
@yield('script')
54+
55+
@yield('javascript')
56+
5557
<script type="text/javascript">
5658
@if(Session::has('global'))
5759
/* Global message */
@@ -110,8 +112,6 @@
110112
stem: false
111113
});
112114
});
113-
114-
@yield('javascript')
115115
</script>
116116
</body>
117117
</html>

resources/views/booth/show.blade.php

+31-29
Original file line numberDiff line numberDiff line change
@@ -97,36 +97,38 @@
9797
@endsection
9898

9999
@section('javascript')
100-
var vote=function($action,$booth,$candidate){
101-
var URLs="{{ URL::route('vote-api.vote') }}";
100+
<script type="text/javascript">
101+
var vote = function ($action, $booth, $candidate) {
102+
var URLs = "{{ URL::route('vote-api.vote') }}";
102103
103-
$.ajax({
104-
url: URLs,
105-
data: {
106-
action: $action,
107-
booth: $booth,
108-
candidate:$candidate
109-
},
110-
headers: {
111-
'X-CSRF-Token': "{{ Session::token() }}" ,
112-
"Accept": "application/json"
113-
},
114-
type:"POST",
115-
dataType: "json",
104+
$.ajax({
105+
url: URLs,
106+
data: {
107+
action: $action,
108+
booth: $booth,
109+
candidate: $candidate
110+
},
111+
headers: {
112+
'X-CSRF-Token': "{{ Session::token() }}",
113+
"Accept": "application/json"
114+
},
115+
type: "POST",
116+
dataType: "json",
116117
117-
success: function(data){
118-
if(data.success == true){
119-
//alert(data.count);
120-
$('#count_' + $booth + '_' + $candidate).html(data.count);
121-
}else{
122-
alert("error");
123-
}
124-
},
118+
success: function (data) {
119+
if (data.success == true) {
120+
//alert(data.count);
121+
$('#count_' + $booth + '_' + $candidate).html(data.count);
122+
} else {
123+
alert("error");
124+
}
125+
},
125126
126-
error:function(xhr, ajaxOptions, thrownError){
127-
alert(xhr.status);
128-
alert(thrownError);
129-
}
130-
});
131-
}
127+
error: function (xhr, ajaxOptions, thrownError) {
128+
alert(xhr.status);
129+
alert(thrownError);
130+
}
131+
});
132+
}
133+
</script>
132134
@endsection

resources/views/course/create.blade.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@
8686
@endsection
8787

8888
@section('javascript')
89-
$(function () {
90-
$('#datetimepicker').datetimepicker({
91-
format: 'YYYY/MM/DD HH:mm:ss'
89+
<script type="text/javascript">
90+
$(function () {
91+
$('#datetimepicker').datetimepicker({
92+
format: 'YYYY/MM/DD HH:mm:ss'
93+
});
9294
});
93-
});
9495
95-
$('#tag').select2({
96-
placeholder: "請輸入分類標籤(多個請以半形逗號分隔)",
97-
multiple: true,
98-
tags: true,
99-
tokenSeparators: [',', ' ']
100-
});
96+
$('#tag').select2({
97+
placeholder: "請輸入分類標籤(多個請以半形逗號分隔)",
98+
multiple: true,
99+
tags: true,
100+
tokenSeparators: [',', ' ']
101+
});
102+
</script>
101103
@endsection

resources/views/course/edit.blade.php

+40-38
Original file line numberDiff line numberDiff line change
@@ -117,49 +117,51 @@
117117
@endsection
118118

119119
@section('javascript')
120-
$(function () {
121-
$('#datetimepicker').datetimepicker({
122-
format: 'YYYY/MM/DD HH:mm:ss'
120+
<script type="text/javascript">
121+
$(function () {
122+
$('#datetimepicker').datetimepicker({
123+
format: 'YYYY/MM/DD HH:mm:ss'
124+
});
123125
});
124-
});
125126
126-
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
127-
// e.target -> newly activated tab
128-
if(e.target.id == 'tab_preview'){
129-
$("#preview").html("Loading...");
127+
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
128+
// e.target -> newly activated tab
129+
if (e.target.id == 'tab_preview') {
130+
$("#preview").html("Loading...");
130131
131-
var URLs = "{{ URL::route('markdown.preview') }}"
132-
var val = $('#edit textarea').val();
132+
var URLs = "{{ URL::route('markdown.preview') }}"
133+
var val = $('#edit textarea').val();
133134
134-
$.ajax({
135-
url: URLs,
136-
data: val,
137-
headers: {
138-
'X-CSRF-Token': "{{ Session::token() }}" ,
139-
"Accept": "application/json"
140-
},
141-
type:"POST",
142-
dataType: "text",
135+
$.ajax({
136+
url: URLs,
137+
data: val,
138+
headers: {
139+
'X-CSRF-Token': "{{ Session::token() }}",
140+
"Accept": "application/json"
141+
},
142+
type: "POST",
143+
dataType: "text",
143144
144-
success: function(data){
145-
if(data){
146-
$("#preview").html(data);
147-
}else{
148-
alert("error");
145+
success: function (data) {
146+
if (data) {
147+
$("#preview").html(data);
148+
} else {
149+
alert("error");
150+
}
151+
},
152+
error: function (xhr, ajaxOptions, thrownError) {
153+
alert(xhr.status);
154+
alert(thrownError);
149155
}
150-
},
151-
error: function(xhr, ajaxOptions, thrownError){
152-
alert(xhr.status);
153-
alert(thrownError);
154-
}
155-
});
156-
}
157-
})
156+
});
157+
}
158+
})
158159
159-
$('#tag').select2({
160-
placeholder: "請輸入分類標籤(多個請以半形逗號分隔)",
161-
multiple: true,
162-
tags: true,
163-
tokenSeparators: [',', ' ']
164-
});
160+
$('#tag').select2({
161+
placeholder: "請輸入分類標籤(多個請以半形逗號分隔)",
162+
multiple: true,
163+
tags: true,
164+
tokenSeparators: [',', ' ']
165+
});
166+
</script>
165167
@endsection

resources/views/home.blade.php

+39-39
Original file line numberDiff line numberDiff line change
@@ -185,54 +185,54 @@
185185
</div>
186186
@endsection
187187

188-
@section('script')
188+
@section('javascript')
189189
{!! HTML::script('//cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.5.9/jquery.fullPage.min.js') !!}
190190
{!! HTML::script('//cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.5.9/vendors/jquery.easings.min.js') !!}
191191
{!! HTML::script('//cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.5.9/vendors/jquery.slimscroll.min.js') !!}
192192
{!! HTML::script('https://apis.google.com/js/platform.js') !!}
193-
@endsection
194193

195-
@section('javascript')
196-
$(document).ready(function() {
197-
$('#fullpage').fullpage({
198-
{{-- Extra small devices (xs) is < 768px --}}
199-
paddingTop: ($( window ).width() >= 768) ? '50px' : '0px',
200-
scrollOverflow: ($( window ).width() >= 768),
201-
scrollBar: true,
202-
responsive: 768,
203-
{{-- sectionsColor: ['black', '#4BBFC3', '#7BAABE', '#ccddff'], --}}
204-
anchors: ['welcome', 'about', 'class', 'activity']
194+
<script type="text/javascript">
195+
$(document).ready(function () {
196+
$('#fullpage').fullpage({
197+
{{-- Extra small devices (xs) is < 768px --}}
198+
paddingTop: ($(window).width() >= 768) ? '50px' : '0px',
199+
scrollOverflow: ($(window).width() >= 768),
200+
scrollBar: true,
201+
responsive: 768,
202+
{{-- sectionsColor: ['black', '#4BBFC3', '#7BAABE', '#ccddff'], --}}
203+
anchors: ['welcome', 'about', 'class', 'activity']
204+
});
205205
});
206-
});
207-
$(document).ready(function () {
208-
{{-- //TODO:: 隱藏顯示不下的課程,暫時從前台下手
209-
未來應該改成從後台下手,固定顯示數量,
210-
前台在動態固定表格高度,可能在加一層div
211-
這樣在空間不足時,還有個卷軸可用
212-
雖然應該會很難操作。--}}
213-
{{-- 限制課程清單只有 section3 高度的 50% --}}
214-
var targetTableHeight = ($( window ).width() >= 768) ? $( window ).height() * 0.5 : $( window ).height() * 1.5;
215-
if ($('#classList').height() > targetTableHeight) {
216-
var trList = $('#classList tbody tr');
217-
for (var i = 0; i < trList.length; i++) {
218-
{{-- jQuery 怪怪的,不能用 hasClass ... --}}
219-
{{-- //TODO:: 未來可能會有 Bug --}}
220-
if (trList[i].className.indexOf('success') != -1) {
221-
trList[i].style.display = 'none';
222-
if ($('#classList').height() <= targetTableHeight) break;
206+
$(document).ready(function () {
207+
{{-- //TODO:: 隱藏顯示不下的課程,暫時從前台下手,
208+
未來應該改成從後台下手,固定顯示數量
209+
前台在動態固定表格高度,可能在加一層div
210+
這樣在空間不足時,還有個卷軸可用
211+
雖然應該會很難操作。--}}
212+
{{-- 限制課程清單只有 section3 高度的 50% --}}
213+
var targetTableHeight = ($(window).width() >= 768) ? $(window).height() * 0.5 : $(window).height() * 1.5;
214+
if ($('#classList').height() > targetTableHeight) {
215+
var trList = $('#classList tbody tr');
216+
for (var i = 0; i < trList.length; i++) {
217+
{{-- jQuery 怪怪的,不能用 hasClass ... --}}
218+
{{-- //TODO:: 未來可能會有 Bug --}}
219+
if (trList[i].className.indexOf('success') != -1) {
220+
trList[i].style.display = 'none';
221+
if ($('#classList').height() <= targetTableHeight) break;
222+
}
223223
}
224224
}
225-
}
226225
227-
if ($('#classList').height() > targetTableHeight) {
228-
var trList = $('#classList tbody tr');
229-
var hasNone = false;
230-
for (var i = trList.length - 1; i >= 0 ; i--) {
231-
if (trList[i].className.indexOf('info') != -1) {
232-
trList[i].style.display = 'none';
233-
if ($('#classList').height() <= targetTableHeight) break;
226+
if ($('#classList').height() > targetTableHeight) {
227+
var trList = $('#classList tbody tr');
228+
var hasNone = false;
229+
for (var i = trList.length - 1; i >= 0; i--) {
230+
if (trList[i].className.indexOf('info') != -1) {
231+
trList[i].style.display = 'none';
232+
if ($('#classList').height() <= targetTableHeight) break;
233+
}
234234
}
235235
}
236-
}
237-
});
236+
});
237+
</script>
238238
@endsection

resources/views/signin/create.blade.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@
5656
@endsection
5757

5858
@section('javascript')
59-
$(function () {
60-
$('#datetimepicker').datetimepicker({
61-
format: 'YYYY/MM/DD HH:mm:ss'
59+
<script type="text/javascript">
60+
$(function () {
61+
$('#datetimepicker').datetimepicker({
62+
format: 'YYYY/MM/DD HH:mm:ss'
63+
});
6264
});
63-
});
65+
</script>
6466
@endsection

0 commit comments

Comments
 (0)