-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgadgets-blogger-klikbayi.xml
397 lines (338 loc) · 13.6 KB
/
gadgets-blogger-klikbayi.xml
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?xml version="1.0" encoding="UTF-8" ?>
<!-- BLOGGER GADGETS - COPYRIGHT KLIKBAYI.COM - VERSION 1.4 -->
<Module>
<ModulePrefs title="__MSG_kb_gadgets_title__" description="__MSG_kb_gadgets_description__" author="Jevuska" author_email="[email protected]" title_url="http://klikbayi.com/">
<Require feature="google.blog"/>
<Optional feature="skins"/>
<Require feature="dynamic-height"/>
<Require feature="minimessage"/>
<Require feature="setprefs"/>
<Require feature="views" />
<Locale lang="all">
<msg name="kb_gadgets_title">KlikBayi.Com's Product</msg>
<msg name="kb_gadgets_description">Marketing Tool for KlikBayi Affiliate</msg>
<msg name="affiliate_id">Affiliate ID</msg>
<msg name="form_title">Form Title</msg>
<msg name="button_text">Button Text</msg>
<msg name="img_src">Image URL</msg>
<msg name="img_show">Show Image?</msg>
<msg name="form_order_type">Form Order Type</msg>
<msg name="form_order_style">Form Order Style</msg>
<msg name="full_name">Full Name</msg>
<msg name="email_address">Email</msg>
<msg name="address_zip">Shipping Address & Zip Code</msg>
<msg name="city_province">City & Province</msg>
<msg name="mobile_phone">Mobile Phone</msg>
<msg name="order_button">Order</msg>
<msg name="form_type">Form</msg>
<msg name="button_type">Button</msg>
<msg name="notice_aff_id">Your affiliate ID is not embedded yet.</msg>
<msg name="notice_error">Error on input.</msg>
<msg name="notice_success">Success!. Please check your email.</msg>
</Locale>
<Locale lang="in">
<msg name="kb_gadgets_title">Produk KlikBayi.Com</msg>
<msg name="kb_gadgets_description">Tool Pemasaran untuk para afiliasi Klikbayi</msg>
<msg name="affiliate_id">ID Afiliasi</msg>
<msg name="form_title">Judul Form</msg>
<msg name="button_text">Teks Tombol</msg>
<msg name="img_src">URL Gambar</msg>
<msg name="img_show">Tampilkan Gambar?</msg>
<msg name="form_order_type">Tipe Form</msg>
<msg name="form_order_style">Tampilan Form</msg>
<msg name="full_name">Nama Lengkap</msg>
<msg name="email_address">Alamat Email</msg>
<msg name="address_zip">Alamat Pengiriman & Kodepos</msg>
<msg name="city_province">Kota & Propinsi</msg>
<msg name="mobile_phone">Nomor Handphone</msg>
<msg name="order_button">Pesan</msg>
<msg name="form_type">Bentuk Form</msg>
<msg name="button_type">Bentuk Tombol</msg>
<msg name="notice_aff_id">ID Afiliasi Anda belum dimasukkan.</msg>
<msg name="notice_error">Ada kesalahan input.</msg>
<msg name="notice_success">Berhasil!. Silahkan periksa email Anda.</msg>
</Locale>
</ModulePrefs>
<UserPref name="klikbayi_aff" display_name="__MSG_affiliate_id__" default_value="" required="true"/>
<UserPref name="klikbayi_title" display_name="__MSG_form_title__" default_value="" />
<UserPref name="klikbayi_btn_txt" display_name="__MSG_button_text__" default_value="__MSG_order_button__" />
<UserPref name="klikbayi_image" display_name="__MSG_img_src__" default_value="" />
<UserPref name="klikbayi_choice" display_name="__MSG_img_show__" datatype="bool" default_value="false" />
<UserPref name="klikbayi_type" display_name="__MSG_form_order_type__" default_value="form" datatype="enum">
<EnumValue value="form" display_value="__MSG_form_type__" />
<EnumValue value="button" display_value="__MSG_button_type__" />
</UserPref>
<UserPref name="klikbayi_style" display_name="__MSG_form_order_style__" default_value="placeholder" datatype="enum">
<EnumValue value="inline" display_value="Inline" />
<EnumValue value="right" display_value="Right" />
<EnumValue value="left" display_value="Left" />
<EnumValue value="placeholder" display_value="Placeholder" />
</UserPref>
<Content type="html"><![CDATA[
<style>
#klikbayi_container img {
max-width: 100%;
}
#klikbayi_container table {
border-collapse: separate;
border-spacing: 0;
border-width: 1px 0 0 1px;
margin: 0 0 1.75em;
table-layout: fixed;
width: 100%;
}
#klikbayi_container th, #klikbayi_container td {
padding: 0.4375em;
border-width: 0px 1px 1px 0px;
font-weight: normal;
text-align: left;
}
#klikbayi_container table, #klikbayi_container th, #klikbayi_container td {
border: 1px solid #D1D1D1;
}
#klikbayi_container input[type="text"], #klikbayi_container input[type="email"], #klikbayi_container input[type="tel"], #klikbayi_container textarea {
background: #F7F7F7 none repeat scroll 0% 0%;
border: 1px solid #D1D1D1;
border-radius: 2px;
color: #686868;
line-height: normal;
padding: 0.461538em 0.538462em;
width: 100%;
}
#klikbayi_container button, #klikbayi_container input, #klikbayi_container select, #klikbayi_container textarea {
font-size: 0.8125rem;
line-height: 1.61538;
}
.mmlib_table {
background-color: #fff4c2;
border-collapse: separate;
border-spacing: 0px;
font: bold 9px arial,sans-serif;
padding: 1px 0px;
width: 100%;
}
.mmlib_xlink {
color: #fff;
cursor: pointer;
font: normal 1.1em arial,sans-serif;
font-weight: bold;
}
</style>
<div id="klikbayi_container"></div>
<div id="klikbayi_error_msg"></div>
<script type="text/javascript">
var textarea = document.createElement( "textarea" ),
element = document.getElementById( "klikbayi_container" );
gadgets.util.registerOnLoadHandler( klikBayiCreateHtml );
function klikBayiCreateHtml() {
var prefs = new gadgets.Prefs();
var type = prefs.getString( "klikbayi_type" ),
form_title = sanitizeText( prefs.getString( "klikbayi_title" ) ),
form_title = unescape( form_title ).trim(),
button_text = sanitizeText( prefs.getString( "klikbayi_btn_txt" ) ),
button_text = unescape( button_text ).trim(),
styles = prefs.getString( "klikbayi_style" );
var post_in = post_not_in = [];
var html = content = "";
var aff = klikBayiNotice( prefs );
html += '<div id="klikbayi-container';
if ( 1 > button_text.length )
button_text = "__MSG_order_button__";
if ( "form" == type ) {
form = klikBayiFormOrder( button_text, "button", form_title, styles, aff );
html += '">' + form + '</div>';
}
if ( "button" == type ) {
form = klikBayiFormOrder( button_text, "button", form_title, styles, aff );
button = klikBayiButtonOrder( button_text, "button", "klikbayi_button", true, form_title );
html += '-popup" style="display:none;">' + form + '</div>' + button;
}
klikBayiSetContent( html );
}
function klikBayiFormOrder( button_text, type, form_title, styles, aff ) {
var prefs = new gadgets.Prefs();
var url = klikBayiUrl( "aff", aff );
html = '';
if ( prefs.getBool( "klikbayi_choice" ) ) {
if ( "" != prefs.getString( "klikbayi_image" ) ) {
html += '<div class="klikbayi-content"><img id="klikbayi_img" src="' + decodeURIComponent( prefs.getString( "klikbayi_image" ) ) + '" alt="' + form_title + '"></div>';
}
}
if ( "" != form_title )
html += '<h3>' + form_title + '</h3>';
html += '<form action="' + url + '" id="klikbayi" method="post"><table id="klikbayi_table" class="klikbayi_table_' + styles + '">';
var item = klikBayiOrderArray();
for ( var key in item ) {
if ( item.hasOwnProperty( key ) ) {
var input_type = ( "email" == key || 'tel' == key ) ? key : "text";
var placeholder = ( "placeholder" != styles ) ? '' : item[key][0] ;
html += klikBayiInputOrder( key, item[key][0], input_type, placeholder, item[key][1], styles );
}
}
html += "</table>";
html += klikBayiButtonOrder( button_text, type, "btn-klikbayi", false, "" );
html += "</form>";
return html;
}
function klikBayiInputOrder( key, item_title, input_type, placeholder, name, styles ) {
var pos = '<th><label for="klikbayi_' + key + '">' + item_title + '</label></th>',
html = "<tr>";
if ( "inline" == styles ) {
html += pos;
html += "</tr><tr>";
}
if ( "left" == styles )
html += pos;
html += '<td><input type="' + input_type + '" id="klikbayi_' + key + '" value="" class="form-control klikbayi_' + key + '" placeholder="' + placeholder + '" name="' + name + '" required /></td>';
if ( "right" == styles )
html += pos;
html += "</tr>";
return html;
}
function klikBayiButtonOrder( button_text, type, id, btn_input, form_title ) {
var html = '<button class="button button-primary" name="submit" type="';
if ( false != btn_input ) {
html += type + '" id="' + id + '_popup';
} else {
html += type + '" id="' + id;
}
html += '">' + button_text + '</button>';
return html;
}
function klikBayiOrderArray() {
var prefs = new gadgets.Prefs();
var obj = {
"name": [ prefs.getMsg( "full_name" ), "nama"],
"email": [ prefs.getMsg( "email_address" ), "email"],
"address": [ prefs.getMsg( "address_zip" ), "alamat"],
"citizen": [ prefs.getMsg( "city_province" ), "kota"],
"tel": [ prefs.getMsg( "mobile_phone" ), "telpon"]
};
return obj;
}
function klikBayiUrl( options, aff ) {
var args = new Array;
if ( "" == options )
return;
url = "http://klikbayi.com";
domain = "klikbayi.com";
if ( "" != aff )
aff = "?ref=" + aff;
args = {
"domain": domain,
"url": url,
"aff": url + "/order1.php" + aff,
};
if ( "" != args[options] )
return args[options];
return;
}
function klikBayiSetContent( html )
{
var prefs = new gadgets.Prefs();
element.innerHTML = html;
var form = document.getElementById( "klikbayi" );
var btn = document.getElementById( "btn-klikbayi" );
var btn_popup = document.getElementById( "klikbayi_button_popup" );
if ( null != btn_popup ) {
btn_popup.addEventListener( "click", function( e ) {
e.target.remove();
document.getElementById( "klikbayi-container-popup" ).removeAttribute( "style" );
gadgets.window.adjustHeight();
}, false );
}
if ( null != btn ) {
btn.addEventListener( "click", function( e ) {
var url = form.getAttribute( 'action' );
var name = document.getElementById( "klikbayi_name" ).value;
var email = document.getElementById( "klikbayi_email" ).value;
var address = document.getElementById( "klikbayi_address" ).value;
var citizen = document.getElementById( "klikbayi_citizen" ).value;
var tel = document.getElementById( "klikbayi_tel" ).value;
var elError = document.getElementById( "klikbayi_error_msg" );
elError.removeAttribute( "style" );
elError.innerHTML = "";
var postdata = { nama : name, email : email, alamat : address, kota : citizen, telpon : tel };
makePOSTRequest( url, postdata );
}, false );
}
var img = document.getElementById( "klikbayi_img" );
if ( prefs.getBool( "klikbayi_choice" ) && "" != prefs.getString( "klikbayi_image" ) )
{
img.setAttribute( "width", img.clientWidth );
img.setAttribute( "height", img.clientHeight );
}
gadgets.window.adjustHeight();
}
function makePOSTRequest( url, postdata ) {
var params = {};
postdata = gadgets.io.encodeValues( postdata );
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
params[gadgets.io.RequestParameters.POST_DATA]= postdata;
gadgets.io.makeRequest( url, response, params );
};
function response( obj ) {
if ( 200 == obj.rc ) {
r = obj.text;
klikBayiNoticeSuccess( r );
}
gadgets.window.adjustHeight();
};
function klikBayiNoticeSuccess( r ) {
var prefs = new gadgets.Prefs();
var msg = new gadgets.MiniMessage(__MODULE_ID__);
var form = document.getElementById( "klikbayi" );
var elError = document.getElementById( "klikbayi_error_msg" );
if ( -1 != r.indexOf( "Error" ) ) {
elError.innerHTML = prefs.getMsg( "notice_error" );
var statusMsg = msg.createTimerMessage( elError, 5 );
statusMsg.style.backgroundColor = "red";
statusMsg.style.color = "white";
} else {
elError.removeAttribute( "style" );
elError.innerHTML = prefs.getMsg( "notice_success" );
var statusMsg = msg.createDismissibleMessage( elError );
statusMsg.style.backgroundColor = "green";
statusMsg.style.color = "white";
form.reset();
}
}
function klikBayiNotice( prefs ) {
var aff = sanitizeText( prefs.getString( "klikbayi_aff" ) ),
aff = unescape( aff ).trim();
if ( 1 > aff.length ) {
var msg = new gadgets.MiniMessage(__MODULE_ID__);
element.innerHTML = prefs.getMsg( "notice_aff_id" );
element.onmouseover = function() {
element.style.backgroundColor = "red";
element.style.color = "white";
};
element.onmouseout = function() {
element.removeAttribute( "style" );
};
msg.createDismissibleMessage( element );
}
return aff;
}
function sanitizeText( q ) {
var _text = stripTags( q );
try {
textarea.innerHTML = _text;
_text = stripTags( textarea.value );
} catch ( er ) {}
return _text;
}
function stripTags( string ) {
var string = string || "";
return string
.replace( /<!--[\s\S]*?(-->|$)/g, "" )
.replace( /<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/ig, "" )
.replace( /<\/?[a-z][\s\S]*?(>|$)/ig, "" )
.replace( /[\r\n\t ]|\xC2\xA0| /g, " " )
.replace( /^[,\s]+|[,\s]+$/g, "" ).replace( /,[,\s]*,/g, "," )
.replace( /\s+/g, " " );
}
</script>
]]>
</Content>
</Module>