質問編集履歴

8

エラーの変更

2019/02/18 06:02

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -10,27 +10,11 @@
10
10
 
11
11
 
12
12
 
13
- ※追記 chromeの検証にて、下記エラーが出ておりました。
13
+ ※追記02 chromeの検証にて、下記エラーが出ておりました。
14
14
 
15
15
  ```
16
16
 
17
- Uncaught SyntaxError: Invalid or unexpected token
17
+ Uncaught SyntaxError: Unexpected token <
18
-
19
- s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
20
-
21
- at https://satori.segs.jp/s_inner.html:46:27
22
-
23
- (anonymous) @ s_inner.html:46
24
-
25
- s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
26
-
27
- at https://satori.segs.jp/s_inner.html:46:27
28
-
29
- (anonymous) @ s_inner.html:46
30
-
31
- s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
32
-
33
- at https://satori.segs.jp/s_inner.html:46:27
34
18
 
35
19
  ```
36
20
 

7

エラーコードの修正

2019/02/18 06:02

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -14,14 +14,24 @@
14
14
 
15
15
  ```
16
16
 
17
- JQMIGRATE: Migrate is installed, version 1.4.1
18
-
19
- ?p=1464&preview=true:167 Uncaught SyntaxError: Unexpected token <
17
+ Uncaught SyntaxError: Invalid or unexpected token
20
18
 
21
19
  s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
22
20
 
23
21
  at https://satori.segs.jp/s_inner.html:46:27
24
22
 
23
+ (anonymous) @ s_inner.html:46
24
+
25
+ s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
26
+
27
+ at https://satori.segs.jp/s_inner.html:46:27
28
+
29
+ (anonymous) @ s_inner.html:46
30
+
31
+ s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
32
+
33
+ at https://satori.segs.jp/s_inner.html:46:27
34
+
25
35
  ```
26
36
 
27
37
 

6

インデントの修正

2019/02/18 05:50

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -38,252 +38,262 @@
38
38
 
39
39
  (function() {
40
40
 
41
- "user strict";
42
-
43
- var root = this;
44
-
45
- var domain, creative_key, loadScript, queryBuilder, params;
46
-
47
- root.SatoriForm = {
48
-
49
- configure: function(obj) {
50
-
51
- var self = this;
52
-
53
- root.__tempConfigureObj = obj;
41
+ "user strict";
42
+
43
+ var root = this;
44
+
45
+ var domain, creative_key, loadScript, queryBuilder, params;
46
+
47
+ root.SatoriForm = {
48
+
49
+ configure: function(obj) {
50
+
51
+ var self = this;
52
+
53
+ root.__tempConfigureObj = obj;
54
+
55
+ }
56
+
57
+ };
58
+
59
+ domain = "delivery.satr.jp";
60
+
61
+ creative_key = "フォームの作成キー";
62
+
63
+ loadScript = function(src, callback) {
64
+
65
+ var done = false;
66
+
67
+ var head = document.getElementsByTagName('head')[0];
68
+
69
+ var script = document.createElement('script');
70
+
71
+ script.src = src;
72
+
73
+ head.appendChild(script);
74
+
75
+
76
+
77
+ // Attach handlers for all browsers
78
+
79
+ script.onload = script.onreadystatechange = function() {
80
+
81
+ if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState ===
82
+
83
+ "complete")) {
84
+
85
+ done = true;
86
+
87
+ callback();
88
+
89
+
90
+
91
+ // Handle memory leak in IE
92
+
93
+ script.onload = script.onreadystatechange = null;
94
+
95
+ if (head && script.parentNode) {
96
+
97
+ head.removeChild(script);
98
+
99
+ }
100
+
101
+ }
102
+
103
+ };
104
+
105
+ };
106
+
107
+ getCookie = function(key) {
108
+
109
+ var cookieString, cookieKeyArray, i, len, targetCookie, valueIndex;
110
+
111
+ cookieString = document.cookie;
112
+
113
+ cookieKeyArray = cookieString.split(";");
114
+
115
+ len = cookieKeyArray.length;
116
+
117
+ for (i = 0; i < len; i++) {
118
+
119
+ targetCookie = cookieKeyArray[i];
120
+
121
+ targetCookie = targetCookie.replace(/^\s+|\s+$/g, "");
122
+
123
+ valueIndex = targetCookie.indexOf("=");
124
+
125
+ if (targetCookie.substring(0, valueIndex) == key) {
126
+
127
+ return unescape(targetCookie.slice(valueIndex + 1));
128
+
129
+ }
130
+
131
+ }
132
+
133
+ return "";
134
+
135
+ };
136
+
137
+ queryBuilder = function(params) {
138
+
139
+ var result = [];
140
+
141
+ Object.keys(params).forEach(function(key) {
142
+
143
+ result.push(key + "=" + encodeURIComponent(params[key]))
144
+
145
+ });
146
+
147
+ return result.join("&");
148
+
149
+ };
150
+
151
+ params = {
152
+
153
+ current_url: document.URL,
154
+
155
+ referer_url: document.referrer,
156
+
157
+ logging_status: "true",
158
+
159
+ st_segs: getCookie("st_segs"),
160
+
161
+ st_id: getCookie("satori_id")
162
+
163
+ };
164
+
165
+ loadScript("//" + domain + "/creative_set/" + creative_key + "/f.js?" +
166
+
167
+ queryBuilder(params),
168
+
169
+ function() {
170
+
171
+ var config = root.__tempConfigureObj;
172
+
173
+ root.__tempConfigureObj = undefined;
174
+
175
+ if (typeof configure == "object") {
176
+
177
+ SatoriCreative.configure(config);
178
+
179
+ }
180
+
181
+ SatoriCreative.start();
182
+
183
+ });
184
+
185
+ }).call(this);
186
+
187
+
188
+
189
+ </script>
190
+
191
+
192
+
193
+ ```
194
+
195
+
196
+
197
+ ### 試したこと
198
+
199
+
200
+
201
+ ①編集のテキストで上記コードを張り付けて使用。
202
+
203
+
204
+
205
+ 編集画面では表示されます。
206
+
207
+
208
+
209
+ ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード
210
+
211
+ ```ここに言語を入力
212
+
213
+ <div id="satori__creative_container">
214
+
215
+ <script id="-_-satori_creative-_-" src="//delivery.satr.jp/js/creative_set.js" data-key="フォームの生成キー">
216
+
217
+ </script>
218
+
219
+ </div>
220
+
221
+ ```を記入
222
+
223
+
224
+
225
+ 編集画面でも表示されません。
226
+
227
+
228
+
229
+ 個別Javaスクリプト読み込みコード
230
+
231
+ ```ここに言語を入力
232
+
233
+
234
+
235
+ //Custom JavaScript Widget
236
+
237
+ add_action('admin_menu', 'custom_js_hooks');
238
+
239
+ add_action('save_post', 'save_custom_js');
240
+
241
+ add_action('wp_head','insert_custom_js');
242
+
243
+ function custom_js_hooks() {
244
+
245
+ add_meta_box('custom_js', '個別JavaScript', 'custom_js_input', 'post', 'normal', 'high');
246
+
247
+ add_meta_box('custom_js', '個別JavaScript', 'custom_js_input', 'page', 'normal', 'high');
54
248
 
55
249
  }
56
250
 
57
- };
58
-
59
- domain = "delivery.satr.jp";
60
-
61
- creative_key = "フォームの作成キー";
62
-
63
- loadScript = function(src, callback) {
251
+ function custom_js_input() {
64
-
65
- var done = false;
252
+
66
-
67
- var head = document.getElementsByTagName('head')[0];
68
-
69
- var script = document.createElement('script');
70
-
71
- script.src = src;
72
-
73
- head.appendChild(script);
74
-
75
-
76
-
77
- // Attach handlers for all browsers
78
-
79
- script.onload = script.onreadystatechange = function() {
80
-
81
- if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) {
82
-
83
- done = true;
84
-
85
- callback();
253
+ global $post;
86
-
87
-
88
-
89
- // Handle memory leak in IE
254
+
90
-
91
- script.onload = script.onreadystatechange = null;
255
+ echo '<input type="hidden" name="custom_js_noncename" id="custom_js_noncename" value="'.wp_create_nonce('custom-js').'" />';
92
-
256
+
93
- if (head && script.parentNode) {
257
+ echo '<textarea name="custom_js" id="custom_js" rows="5" cols="30" style="width:100%;">'.get_post_meta($post->ID,'_custom_js',true).'</textarea>';
94
-
95
- head.removeChild(script);
96
258
 
97
259
  }
98
260
 
261
+ function save_custom_js($post_id) {
262
+
263
+ if (!wp_verify_nonce($_POST['custom_js_noncename'], 'custom-js')) return $post_id;
264
+
265
+ if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
266
+
267
+ $custom_js = $_POST['custom_js'];
268
+
269
+ update_post_meta($post_id, '_custom_js', $custom_js);
270
+
99
271
  }
100
272
 
273
+ function insert_custom_js() {
274
+
275
+ if (is_page() || is_single()) {
276
+
277
+ if (have_posts()) : while (have_posts()) : the_post();
278
+
279
+ if (get_post_meta(get_the_ID(), '_custom_js', true) !='') {
280
+
281
+ echo "<script type=\"text/javascript\">\n".get_post_meta(get_the_ID(), '_custom_js', true)."\n</script>\n";
282
+
101
- };
283
+ }
284
+
102
-
285
+ endwhile; endif;
286
+
287
+ rewind_posts();
288
+
103
- };
289
+ }
104
-
105
- getCookie = function(key) {
106
-
107
- var cookieString, cookieKeyArray, i, len, targetCookie, valueIndex;
108
-
109
- cookieString = document.cookie;
110
-
111
- cookieKeyArray = cookieString.split(";");
112
-
113
- len = cookieKeyArray.length;
114
-
115
- for (i = 0; i < len; i++) {
116
-
117
- targetCookie = cookieKeyArray[i];
118
-
119
- targetCookie = targetCookie.replace(/^\s+|\s+$/g, "");
120
-
121
- valueIndex = targetCookie.indexOf("=");
122
-
123
- if (targetCookie.substring(0, valueIndex) == key) {
124
-
125
- return unescape(targetCookie.slice(valueIndex + 1));
126
290
 
127
291
  }
128
292
 
129
- }
130
-
131
- return "";
132
-
133
- };
134
-
135
- queryBuilder = function(params) {
136
-
137
- var result = [];
138
-
139
- Object.keys(params).forEach(function(key) {
140
-
141
- result.push(key + "=" + encodeURIComponent(params[key]))
142
-
143
- });
144
-
145
- return result.join("&");
146
-
147
- };
148
-
149
- params = {
150
-
151
- current_url: document.URL,
152
-
153
- referer_url: document.referrer,
154
-
155
- logging_status: "true",
156
-
157
- st_segs: getCookie("st_segs"),
158
-
159
- st_id: getCookie("satori_id")
160
-
161
- };
162
-
163
- loadScript("//" + domain + "/creative_set/" + creative_key + "/f.js?" + queryBuilder(params), function() {
164
-
165
- var config = root.__tempConfigureObj;
166
-
167
- root.__tempConfigureObj = undefined;
168
-
169
- if (typeof configure == "object") {
170
-
171
- SatoriCreative.configure(config);
172
-
173
- }
174
-
175
- SatoriCreative.start();
176
-
177
- });
178
-
179
- }).call(this);
180
-
181
- </script>
182
-
183
293
  ```
184
294
 
185
295
 
186
296
 
187
- ### 試したこと
188
-
189
-
190
-
191
- ①編集のテキストで上記コードを張り付けて使用。
192
-
193
-
194
-
195
- 編集画面では表示されます。
196
-
197
-
198
-
199
- ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード
200
-
201
- ```ここに言語を入力
202
-
203
- <div id="satori__creative_container">
204
-
205
- <script id="-_-satori_creative-_-" src="//delivery.satr.jp/js/creative_set.js" data-key="フォームの生成キー">
206
-
207
- </script>
208
-
209
- </div>
210
-
211
- ```を記入
212
-
213
-
214
-
215
- 編集画面でも表示されません。
216
-
217
-
218
-
219
- 個別Javaスクリプト読み込みコード
220
-
221
- ```ここに言語を入力
222
-
223
-
224
-
225
- //Custom JavaScript Widget
226
-
227
- add_action('admin_menu', 'custom_js_hooks');
228
-
229
- add_action('save_post', 'save_custom_js');
230
-
231
- add_action('wp_head','insert_custom_js');
232
-
233
- function custom_js_hooks() {
234
-
235
- add_meta_box('custom_js', '個別JavaScript', 'custom_js_input', 'post', 'normal', 'high');
236
-
237
- add_meta_box('custom_js', '個別JavaScript', 'custom_js_input', 'page', 'normal', 'high');
238
-
239
- }
240
-
241
- function custom_js_input() {
242
-
243
- global $post;
244
-
245
- echo '<input type="hidden" name="custom_js_noncename" id="custom_js_noncename" value="'.wp_create_nonce('custom-js').'" />';
246
-
247
- echo '<textarea name="custom_js" id="custom_js" rows="5" cols="30" style="width:100%;">'.get_post_meta($post->ID,'_custom_js',true).'</textarea>';
248
-
249
- }
250
-
251
- function save_custom_js($post_id) {
252
-
253
- if (!wp_verify_nonce($_POST['custom_js_noncename'], 'custom-js')) return $post_id;
254
-
255
- if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
256
-
257
- $custom_js = $_POST['custom_js'];
258
-
259
- update_post_meta($post_id, '_custom_js', $custom_js);
260
-
261
- }
262
-
263
- function insert_custom_js() {
264
-
265
- if (is_page() || is_single()) {
266
-
267
- if (have_posts()) : while (have_posts()) : the_post();
268
-
269
- if (get_post_meta(get_the_ID(), '_custom_js', true) !='') {
270
-
271
- echo "<script type=\"text/javascript\">\n".get_post_meta(get_the_ID(), '_custom_js', true)."\n</script>\n";
272
-
273
- }
274
-
275
- endwhile; endif;
276
-
277
- rewind_posts();
278
-
279
- }
280
-
281
- }
282
-
283
- ```
284
-
285
-
286
-
287
297
  ### 補足情報(FW/ツールのバージョンなど)
288
298
 
289
299
 

5

インデントの追加

2019/02/18 05:47

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,8 @@
72
72
 
73
73
  head.appendChild(script);
74
74
 
75
+
76
+
75
77
  // Attach handlers for all browsers
76
78
 
77
79
  script.onload = script.onreadystatechange = function() {
@@ -82,6 +84,8 @@
82
84
 
83
85
  callback();
84
86
 
87
+
88
+
85
89
  // Handle memory leak in IE
86
90
 
87
91
  script.onload = script.onreadystatechange = null;
@@ -216,6 +220,8 @@
216
220
 
217
221
  ```ここに言語を入力
218
222
 
223
+
224
+
219
225
  //Custom JavaScript Widget
220
226
 
221
227
  add_action('admin_menu', 'custom_js_hooks');

4

インデントの追加

2019/02/18 05:40

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -198,7 +198,9 @@
198
198
 
199
199
  <div id="satori__creative_container">
200
200
 
201
- <script id="-_-satori_creative-_-" src="//delivery.satr.jp/js/creative_set.js" data-key="フォームの生成キー"></script>
201
+ <script id="-_-satori_creative-_-" src="//delivery.satr.jp/js/creative_set.js" data-key="フォームの生成キー">
202
+
203
+ </script>
202
204
 
203
205
  </div>
204
206
 

3

エラーコードの追記

2019/02/18 05:36

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -10,9 +10,17 @@
10
10
 
11
11
 
12
12
 
13
+ ※追記 chromeの検証にて、下記エラーが出ておりました。
14
+
13
15
  ```
14
16
 
17
+ JQMIGRATE: Migrate is installed, version 1.4.1
18
+
15
- wordpressにSATORIで作成したフォームを埋め込みたいのですが、編集画面で表示されるものの、プレビュー画面・公開画面では表示されません。
19
+ ?p=1464&preview=true:167 Uncaught SyntaxError: Unexpected token <
20
+
21
+ s_inner.html:46 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
22
+
23
+ at https://satori.segs.jp/s_inner.html:46:27
16
24
 
17
25
  ```
18
26
 

2

書式の修正

2019/02/18 05:22

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -184,7 +184,9 @@
184
184
 
185
185
 
186
186
 
187
- ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード```ここに言語を入力
187
+ ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード
188
+
189
+ ```ここに言語を入力
188
190
 
189
191
  <div id="satori__creative_container">
190
192
 

1

マークアップを追加しました。ご指摘ありがとうございます。

2019/02/18 05:04

投稿

jcas
jcas

スコア12

test CHANGED
File without changes
test CHANGED
@@ -184,11 +184,15 @@
184
184
 
185
185
 
186
186
 
187
- ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード(<div id="satori__creative_container">
187
+ ②個別Javaスクリプト読み込みのため、下記コードをfunctions.php最下部に記述し、個別Javaスクリプトの書き込み欄にスクリプトの設置コード```ここに言語を入力
188
+
189
+ <div id="satori__creative_container">
188
190
 
189
191
  <script id="-_-satori_creative-_-" src="//delivery.satr.jp/js/creative_set.js" data-key="フォームの生成キー"></script>
190
192
 
191
- </div>)を記入
193
+ </div>
194
+
195
+ ```を記入
192
196
 
193
197
 
194
198
 
@@ -198,6 +202,8 @@
198
202
 
199
203
  個別Javaスクリプト読み込みコード
200
204
 
205
+ ```ここに言語を入力
206
+
201
207
  //Custom JavaScript Widget
202
208
 
203
209
  add_action('admin_menu', 'custom_js_hooks');
@@ -256,9 +262,7 @@
256
262
 
257
263
  }
258
264
 
259
-
265
+ ```
260
-
261
-
262
266
 
263
267
 
264
268