-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixcloud-embed-tinymce.html
214 lines (184 loc) · 7.1 KB
/
mixcloud-embed-tinymce.html
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Mixcloud Embed</title>
<script type="text/javascript">
// <![CDATA[
!function () {
var data = window.top.mixcloudEmbedDialogData
, loadJS = function (path) {
document.write('<script type="text/javascript" src="' + path + '"><\/script>');
}
, loadCSS = function (path) {
document.write('<link rel="stylesheet" type="text/css" href="' + path + '" \/>');
};
// Load CSS and JS
loadCSS(data.pluginsUrl + '/mixcloud-embed/bootstrap-1.4.0.min.css?v=' + data.pluginVersion);
loadJS(data.includesUrl + 'js/tinymce/tiny_mce_popup.js?v=' + data.pluginVersion);
}();
// ]]>
</script>
<script type="text/javascript">
// <![CDATA[
tinyMCEPopup.onInit.add(function (ed) {
var form = window.document.forms[0],
isEmpty = function (value) {
return (/^\s*$/.test(value));
},
encodeStr = function (value) {
return value.replace(/\s/g, "%20")
.replace(/"/g, "%22")
.replace(/'/g, "%27")
.replace(/=/g, "%3D")
.replace(/\[/g, "%5B")
.replace(/\]/g, "%5D")
.replace(/\//g, "%2F");
},
insertShortcode = function (e) {
var shortcode = "", params = " ",
inputs = form.elements, input, inputName, inputValue,
l = inputs.length, i = 0, cloudcastUrl = "";
for (; i < l; i++) {
input = inputs[i];
inputName = input.name;
inputValue = input.value;
// Video URL or ID validation
if (inputName == "url") {
if (isEmpty(inputValue)) {
alert("You need to introduce at least a Cloudcast URL.");
return false;
} else {
cloudcastUrl = inputValue;
continue;
}
}
if (inputName == "iframe"){
if (inputValue == 1) inputValue = "true";
else inputValue = "false";
}
if (inputName == "playlist"){
if (inputValue == 1) inputValue = "true";
else inputValue = "false";
}
if (inputName != "" ){
params += inputName + "=\"" + inputValue + "\" ";
}
}
shortcode = "[mixcloud" + params + "]" + cloudcastUrl + "[/mixcloud]";
ed.execCommand('mceInsertContent', 0, shortcode);
tinyMCEPopup.close();
return false;
};
form.onsubmit = insertShortcode;
tinyMCEPopup.resizeToInnerSize();
});
// ]]>
</script>
<style type="text/css">
html, body {
background-color: #fff !important;
font-size: 13px !important;
}
.form-stacked {
padding-left: 0;
}
.form-stacked fieldset {
border: none;
font-size: 13px;
}
.help-inline, .help-block {
font-size: 10px;
}
.form-stacked fieldset legend {
color: #2B6FB6;
font-size: 13px;
font-weight: bold;
}
.form-stacked span[class*="span"] {
display: inline-block
}
.form-stacked .actions {
margin-left: 0
}
.form-stacked div.label {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: normal;
line-height: 20px;
text-align: left;
width: auto;
color: #404040;
font-size: 13px;
white-space: normal;
}
.form-stacked .inputs-list:first-child {
padding-top: 0;
}
.form-stacked .deprecated {
font-style: italic;
color: orange
}
.form-stacked .required {
color: red
}
</style>
</head>
<body>
<form class="form-stacked" action="#">
<fieldset>
<legend>Mixcloud Embed</legend>
<div class="clearfix">
<ul class="inputs-list">
<li>
<label>
<span class="span2">Cloudcast/Profile <span class="required">*</span></span>
<input type="text" name="url" class="span4"/>
<span class="help-inline">Cloudcast URL or Profile URL</span>
</label>
</li>
</ul>
</div>
</fieldset>
<fieldset>
<legend>Property</legend>
<div class="clearfix">
<ul class="inputs-list">
<li>
<label>
<span class="span2">Width <span class="required">*</span></span>
<input type="text" name="width" class="span4"/>
<span class="help-inline">px or %</span>
</label>
</li>
<li>
<label>
<span class="span2">Height <span class="required">*</span></span>
<input type="text" name="height" class="span4"/>
<span class="help-inline">px or %</span>
</label>
</li>
<li>
<label>
<input type="checkbox" name="iframe" value="1"/>
<span class="span2">HTML5 Mode </span>
<span class="help-inline">iframe or flash object rendering</span>
</label>
</li>
<li>
<label>
<input type="checkbox" name="playlist" value="1"/>
<span class="span2">Retrive a playlist </span>
<span class="help-inline">get a playlist of the cloudcast</span>
</label>
</li>
</ul>
</div>
</fieldset>
<div class="actions">
<input type="submit" value="Insert shortcode" class="btn primary"/>
or
<input class="btn" type="reset" value="Reset settings"/>
</div>
</form>
</body>
</html>