select.html
29.4 KB
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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
<!DOCTYPE html>
<html lang="en">
<head>
<title>StoryMap JS</title>
<meta name="description" content="Telling stories with maps.">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="//cdn.knightlab.com/libs/blueline/latest/assets/logos/favicon.ico">
<link href="//cloud.webtype.com/css/d4767ecb-457a-4677-8761-72f890add836.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="http://cdn.knightlab.com/libs/blueline/latest/css/blueline.min.css">
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="//cdn.knightlab.com/libs/blueline/latest/js/blueline.min.js"></script>
<!-- === storymap -->
<link rel="stylesheet" href="{{ CDN_URL }}css/storymap.css?v1">
<!-- === Moment.js -->
<script src="{{ STATIC_URL }}js/moment.min.js"></script>
<script src="{{ STATIC_URL }}js/moment-timezone.min.js"></script>
<script src="{{ STATIC_URL }}js/moment-timezone-data.js"></script>
<!-- === editor -->
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.history.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/json2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/editor.js"></script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/editor.css">
</head>
<body>
{% include '_editor.html' %}
<div id="ie_modal" class="modal hide fade" data-backdrop="static">
<div class="modal-body">
The StoryMapJS authoring tool is not compatible with Internet Explorer. Please use a different browser.
</div>
</div>
<div id="entry_modal" class="modal hide fade" data-backdrop="static">
<!-- error -->
<div class="modal-body">
<div class="modal-error hide">
<span class="modal-msg error"></span>
</div>
<!-- login panel -->
<div class="entry-panel entry-login hide">
<div>
<div>
<!--
<p>Your StoryMaps will be saved to your Google Drive.</p>
-->
<a id="entry_login" href="{{ url_for('google_auth_start') }}" class="btn btn-success">Login with your Google account</a>
</div>
</div>
</div>
<!-- migrate panel (initial) -->
<div class="entry-panel entry-migrate hide">
<p>In order to continue to use the StoryMap Editor, you must migrate your data.
This process will make copies of the StoryMaps currently on your Google Drive and store them on our new storage site.
</p>
<p>
None of the original data on your Google Drive will be altered, moved, or deleted, but the StoryMap Editor
will only work with the migrated copies.
</p>
</div>
<!-- migrate panel (resume) -->
<div class="entry-panel entry-migrate-resume hide">
<p>In order to continue to use the StoryMap Editor, you must finish migrating your data.
This process will make copies of the StoryMaps still on your Google Drive and store them on our new storage site.
</p>
<p>
None of the original data on your Google Drive will be altered, moved, or deleted, but the StoryMap Editor
will only work with the migrated copies.
</p>
</div>
<!-- list panel -->
<div class="entry-panel entry-list hide">
<div class="table-header">
<strong>Your StoryMaps </strong>
<div class="table-toggles">
<div class="btn-group" data-toggle="buttons-radio">
<button id="entry_sort_title" type="button" class="btn btn-small active" onclick="$('#entry_modal').trigger('display_list', 'title');">
Title <i class="icon-angle-up"></i></button>
<button id="entry_sort_date" type="button" class="btn btn-small" onclick="$('#entry_modal').trigger('display_list', 'date');">
Date <i class="icon-angle-down"></i></button>
</div>
</div>
<div style="clear:both;"></div>
</div>
<table class="table table-striped table-bordered">
<tbody></tbody>
</table>
</div>
<!-- create select type panel -->
<div class="entry-panel entry-type hide">
<p>What type of story do you want to create?</p>
<div class="type-panel">
<div>
<a href="javascript:;" class="vco-icon-location icon-button" onclick="$('#entry_modal').trigger('show_create_map');"></a>
</div>
<label onclick="$('#entry_modal').trigger('show_create_map');">Map</label>
</div>
<div class="type-panel">
<div>
<a href="javascript:;" class="vco-icon-image icon-button" onclick="$('#entry_modal').trigger('show_create_zoomify');"></a>
</div>
<label><span onclick="$('#entry_modal').trigger('show_create_zoomify');">Gigapixel</span> <a class="help" href="javascript:;"
data-placement="top"
data-html="true"
data-content="Tell a story using a large photograph, a piece of art, or a historic map. <a href='{{ url_for('gigapixel') }}' target='_blank'>Learn more</a>"
> <i class="icon-question-sign icon-large"></i></a>
</label>
</div>
</div>
<!-- create map panel -->
<div class="entry-panel entry-create-map hide">
<p>
<label>Great! Let's create your StoryMap. What do you want to call it?</label>
<input type="text" class="entry-create-title stretch" data-onsubmit="entry_create" />
</p>
</div>
<!-- create zoomify panel -->
<div class="entry-panel entry-create-zoomify hide">
<p>
<label>Great! Let's create your StoryMap. What do you want to call it?</label>
<input type="text" class="entry-create-title stretch" data-onsubmit="entry_create" />
</p>
<p>
<label>URL path for your image directory:</label>
<input type="text" id="entry_create_path" class="stretch" value="" placeholder="http://www.domain.org/directory/" />
</p>
<p>
<label>Maximum dimensions of your image:</label>
<div class="controls">
<div class="input-prepend">
<span class="add-on">Width</span>
<input type="text" id="entry_create_width" value="" class="input-small">
</div>
<div class="input-prepend">
<span class="add-on">Height</span>
<input type="text" id="entry_create_height" value="" class="input-small">
</div>
</div>
</p>
</div>
<!-- import panel -->
<div class="entry-panel entry-import hide">
<p>
<label>Let's import your StoryMap. What do you want to call it?</label>
<input type="text" class="entry-import-title stretch" data-onsubmit="entry_import" />
</p>
</div>
<!-- rename panel -->
<div class="entry-panel entry-rename hide">
<p>
<label>Enter a new name for your <strong class="entry-rename-title-old"></strong> StoryMap:</label>
<input type="text" class="entry-rename-title stretch" data-onsubmit="entry_rename" />
</p>
</div>
<!-- copy panel -->
<div class="entry-panel entry-copy hide">
<p>
<label>Enter a name for your copy of <strong class="entry-copy-title-old"></strong> StoryMap:</label>
<input type="text" class="entry-copy-title stretch" data-onsubmit="entry_copy" />
</p>
</div>
</div>
<!-- FOOTER -->
<div class="modal-footer">
<div id="entry_user_info" class="hide">
<span id="entry_user_name"></span> | <a id="entry_logout" href="{{ url_for('logout') }}">Logout</a>
</div>
<span> </span>
<a id="entry_migrate" class="entry-panel entry-migrate hide btn btn-success" href="javascript:;">
Start Migration</a>
<a id="entry_migrate_resume" class="entry-panel entry-migrate-resume hide btn btn-success" href="javascript:;">
Resume Migration</a>
<a id="entry_create_cancel" class="entry-panel entry-create entry-import entry-rename entry-copy hide btn" onclick="$('#entry_modal').trigger('show_list');">
Cancel</a>
<a id="entry_create" class="entry-panel entry-create hide btn btn-success" href="javascript:;">
Create</a>
<a class="entry-panel entry-list hide btn btn-success" href="javascript:;" onclick="$('#entry_modal').trigger('show_type');">
<i class="icon-file "></i> New</a>
<a id="entry_rename" class="entry-panel entry-rename hide btn btn-success" href="javascript:;">
Rename</a>
<a id="entry_copy" class="entry-panel entry-copy hide btn btn-success" href="javascript:;">
Copy</a>
<a id="entry_import" class="entry-panel entry-import hide btn btn-success" href="javascript:;">
Import</a>
</div>
<!-- progress -->
<div class="modal-progress hide">
<div>
<div>
<i class="icon-spinner icon-4x icon-spin"></i>
<p><span class="modal-msg"></span>...</p>
</div>
</div>
</div>
<!-- confirm -->
<div class="modal-confirm hide">
<div>
<div>
<p><span class="modal-msg"></span></p>
<button class="btn">No</button>
<button class="btn btn-primary">Yes</button>
</div>
</div>
</div>
</div>
<!-- TEMPLATES START -->
<script id="storymap_row_template" type="text/template">
<tr storymap-data="<%= id %>">
<td>
<div style="display: inline;float: right">
<div class="dropdown">
<a class="list-item-options dropdown-toggle" data-toggle="dropdown" href="javascript:" title="Options"><i class="icon-cog icon-large"></i></a>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="javascript:" class="list-item-rename">Rename</a></li>
<li><a href="javascript:" class="list-item-copy">Copy</a></li>
<li><a href="javascript:" class="list-item-delete">Delete</a></li>
</ul>
</div>
</div>
<a class="title" href="{{ url_for('edit') }}?id=<%= id %>"><%= title %></a>
<% if(published_on) { %>
<p class="modded">Published on <%= format_dt(published_on) %></p>
<% } %>
<% if(draft_on > published_on) { %>
<p class="modded">
<% if(published_on) { %>
<i class="icon-warning-sign" title="This draft is newer than the most recently published version."></i>
<% } %>
Edited on <%= format_dt(draft_on) %>
<% } %>
</p>
</td>
</tr>
</script>
<!-- TEMPLATES END -->
<script type="text/javascript">
var _user = {};
{% if user %}
_user = {{ user|tojson }};
{% endif %}
var storymap_row_template = _.template($('#storymap_row_template').html().trim());
var _storymap_list = []; // [object]
var _migrate_list = []; // [object]
var _params = parseQueryString(); // for import
//
// sort
//
function sortby_date(a, b) {
adt = (a.draft_on > a.published_on) ? a.draft_on : a.published_on;
bdt = (b.draft_on > b.published_on) ? b.draft_on : b.published_on;
return (adt > bdt) ? -1 : 1;
}
function sortby_title(a, b) {
return (a.title.toUpperCase() < b.title.toUpperCase()) ? -1 : 1;
}
//
// misc
//
function make_storymap_list() {
_storymap_list = [];
for(var id in _user.storymaps) {
_storymap_list.push(_user.storymaps[id]);
}
}
function validate_storymap_name($modal, name) {
if(!name.length) {
$modal.trigger('error_show', 'You must enter a name');
return false;
}
for(var i = 0; i < _user.storymaps.length; i++) {
if(name.toLowerCase() == _user.storymaps[i].title.toLowerCase()) {
$modal.trigger('error_show', 'You already have a StoryMap named "'+name+'".');
return false;
}
}
return true;
}
function handle_onload() {
var isIE = !!(window.ActiveXObject || "ActiveXObject" in window);
if(isIE) {
$('#ie_modal').modal('show');
} else {
$('#entry_modal').modal('show');
}
}
//
// MAIN
//
$(function() {
// bind input.text return key events to button clicks
$('input[type="text"][data-onsubmit]').each(function(i, val) {
var $el = $(this);
$el.keyup(function(event) {
if(event.keyCode == 13) {
$('#'+$el.attr('data-onsubmit')).click();
}
});
});
// ------------------------------------------------------------
// migrate
// ------------------------------------------------------------
function _do_migrate(callback) {
var $modal = $('#entry_modal');
if(_migrate_list.length) {
var info = _migrate_list.pop();
$modal.trigger('progress_show', 'Copying '+info.title);
ajax_post("{{ url_for('storymap_migrate') }}",
{
title: info.title,
url: info.url,
draft_on: info.draft_on,
published_on: info.published_on,
file_list: JSON.stringify(info.file_list)
},
function(error) {
_migrate_list.push(info); // push back onto list
callback(error);
},
function(data) {
_user.storymaps[data.id] = data;
_storymap_list.push(data);
_do_migrate(callback);
}
);
} else {
callback();
}
}
$('#entry_migrate, #entry_migrate_resume').click(function(event) {
var $modal = $('#entry_modal');
_do_migrate(function(error) {
if(error) {
$modal.trigger('reset', format_error('Error migrating StoryMap', error));
} else {
ajax_get("{{ url_for('storymap_migrate_done') }}", {},
function(error) {
$modal.trigger('reset', format_error('Error setting migration status', error));
},
function(data) {
$modal.trigger('show_list');
}
);
}
});
});
// ------------------------------------------------------------
// rename
// ------------------------------------------------------------
$('#entry_rename').click(function(event) {
var $modal = $('#entry_modal');
var $panel = $('.entry-rename');
var title = $panel.find('.entry-rename-title').val().trim();
if(!validate_storymap_name($modal, title)) {
return false;
}
var id = $(this).attr('storymap-data');
ajax_post("{{ url_for('storymap_update_meta') }}",
{id: id, key:'title', value: title},
function(error) {
$modal.trigger('reset', format_error('Error renaming StoryMap', error));
},
function(data) {
_user.storymaps[id].title = title;
$modal.trigger('show_list');
}
);
});
// ------------------------------------------------------------
// copy
// ------------------------------------------------------------
$('#entry_copy').click(function(event) {
var $modal = $('#entry_modal');
var $panel = $('.entry-copy');
var title = $panel.find('.entry-copy-title').val().trim();
if(!validate_storymap_name($modal, title)) {
return false;
}
var id = $(this).attr('storymap-data');
$modal.trigger('progress_show', 'Copying StoryMap');
ajax_get("{{ url_for('storymap_copy') }}",
{id: id, title: title},
function(error) {
$modal.trigger('reset', format_error('Error copying StoryMap', error));
},
function(data) {
_user.storymaps[data.id] = data;
_storymap_list.push(data);
$modal.trigger('show_list', true);
}
);
});
// ------------------------------------------------------------
// import
// ------------------------------------------------------------
$('#entry_import').click(function() {
var $modal = $('#entry_modal');
var $panel = $('.entry-import');
var name = $panel.find('.entry-import-title').val().trim();
if(!validate_storymap_name($modal, name)) {
return false;
}
$modal.trigger('progress_show', 'Importing StoryMap');
ajax_get(_params.import_url, {},
function(error) {
$modal.trigger('reset', format_error('Error loading storymap', error));
},
function(data) {
ajax_post("{{ url_for('storymap_create') }}",
{title: name, d: JSON.stringify(data)},
function(error) {
$modal.trigger('reset', format_error('Error creating StoryMap', error));
},
function(data) {
// Replace history state
var url = document.location.href;
url = url.substring(0, url.indexOf("?"));
History.replaceState(null, document.title, url);
document.location.href = "{{ url_for('edit') }}?id="+data.id;
}
);
}
);
});
// ------------------------------------------------------------
// create
// ------------------------------------------------------------
$('#entry_create').click(function() {
var $modal = $('#entry_modal');
var is_map_type = $('.entry-create-map').is(":visible");
var $panel = (is_map_type) ? $('.entry-create-map') : $('.entry-create-zoomify');
var data = {
storymap: {
map_as_image: false,
call_to_action: true,
call_to_action_text: "",
slides: []
}
};
var name = $panel.find('.entry-create-title').val().trim();
if(!validate_storymap_name($modal, name)) {
return false;
}
if(!is_map_type) {
// Zoomify properties
var path = $('#entry_create_path').val().trim();
if(!path.length) {
$modal.trigger('error_show', 'You must enter an URL path');
return false;
}
if(!path.match(/\/$/)) {
path += '/';
$('#entry_create_path').val(path);
}
var width = parseInt($('#entry_create_width').val().trim());
if(!width || isNaN(width)) {
$modal.trigger('error_show', 'Image width must be a positive integer');
return false;
}
var height = parseInt($('#entry_create_height').val().trim());
if(!height || isNaN(height)) {
$modal.trigger('error_show', 'Image height must be a positive integer');
return false;
}
$.extend(data.storymap, {
map_type: 'zoomify',
map_as_image: true,
zoomify: {path: path, width: width, height: height, tolerance: 0.9, attribution: ''}
});
}
$modal.trigger('progress_show', 'Creating StoryMap');
ajax_post("{{ url_for('storymap_create') }}",
{title: name, d: JSON.stringify(data)},
function(error) {
$modal.trigger('reset', format_error('Error creating StoryMap', error));
},
function(data) {
document.location.href = "{{ url_for('edit') }}?id="+data.id;
}
);
});
// ------------------------------------------------------------
// main
// ------------------------------------------------------------
modal_init($('#entry_modal'))
////// custom
.on('show', function(event) {
if (event.target.id == 'entry_modal') {
$(this).trigger('handle_auth', _user.uid);
}
})
.on('handle_auth', function(event, authorized) {
var $modal = $(this);
$modal.find('.entry-panel').hide();
if(!authorized) {
$modal.trigger('show_login');
return;
}
// Show user information
$('#entry_user_name').html(_user.uname);
$('#entry_user_info').show();
make_storymap_list();
// Already migrated?
if(_user.migrated) {
if(_params.import_url) {
$modal.trigger('show_import');
} else {
$modal.trigger('show_list');
}
return;
}
$modal = $(this).trigger('progress_show', 'Checking migration status');
ajax_get("{{ url_for('storymap_migrate_list') }}", {},
function(error) {
$modal.trigger('reset', format_error('Error getting migration list', error));
},
function(data) {
if(data.migrate_list.length) {
_migrate_list = data.migrate_list;
if(Object.keys(_user.storymaps).length) {
$modal.trigger('show_migrate_resume');
} else {
$modal.trigger('show_migrate');
}
} else {
ajax_get("{{ url_for('storymap_migrate_done') }}", {},
function(error) {
$modal.trigger('reset', format_error('Error setting migration status', error));
},
function(data) {
if(_params.import_url) {
$modal.trigger('show_import');
} else {
$modal.trigger('show_list');
}
}
);
}
}
);
})
.on('show_login', function(event) {
$(this).find('.entry-panel').hide();
$(this).find('.entry-login').show();
$(this).trigger('progress_hide');
})
.on('show_type', function(event) {
$(this).find('.entry-panel').hide();
$(this).find('a.help').popover('hide');
$(this).find('.entry-type').show();
$(this).trigger('progress_hide');
})
.on('show_create_map', function(event) {
$('.entry-create-map input[type="text"]').val('');
$(this).find('.entry-panel').hide();
$(this).find('.entry-create, .entry-create-map').show();
})
.on('show_create_zoomify', function(event) {
$('.entry-create-zoomify input[type="text"]').val('');
$(this).find('.entry-panel').hide();
$(this).find('.entry-create, .entry-create-zoomify').show();
})
.on('show_migrate', function(event) {
$(this).find('.entry-panel').hide();
$(this).trigger('error_hide');
$(this).find('.entry-migrate').show();
$(this).trigger('progress_hide');
})
.on('show_migrate_resume', function(event) {
$(this).find('.entry-panel').hide();
$(this).trigger('error_hide');
$(this).find('.entry-migrate-resume').show();
$(this).trigger('progress_hide');
})
.on('show_list', function(event, force_reload) {
$(this).find('.entry-panel').hide();
var $modal = $(this)
.trigger('error_hide')
.trigger('progress_show', 'Getting StoryMap list');
if(_storymap_list.length > 0) {
$modal.find('.entry-list').show();
$modal.trigger('display_list', 'title');
} else {
$modal.trigger('show_type');
}
})
.on('display_list', function(event, sortby) {
if(sortby == 'date') {
_storymap_list = _storymap_list.sort(sortby_date);
} else {
_storymap_list = _storymap_list.sort(sortby_title);
}
var $modal = $(this);
var $table = $('.entry-list tbody').html('');
var html = '';
for(var i = 0; i < _storymap_list.length; i++) {
html += storymap_row_template(_storymap_list[i]);
}
$table.append(html);
$table.find('.list-item-rename').click(function(event) {
$modal.trigger('show_rename', this);
});
$table.find('.list-item-copy').click(function(event) {
$modal.trigger('show_copy', this);
});
$table.find('.list-item-delete').click(function(event) {
$modal.trigger('delete_storymap', this);
});
$table.find('.list-item-share').click(function(event) {
$modal.trigger('share_storymap', this);
});
$('a[data-toggle="tooltip"]').tooltip();
$modal.trigger('progress_hide');
})
.on('show_rename', function(event, obj) {
var id = $(obj).closest('tr').attr('storymap-data');
var item = _user.storymaps[id];
$('.entry-rename-title-old').html(item.title);
$('.entry-rename input[type="text"]').val('');
$('#entry_rename').attr('storymap-data', id);
$(this).find('.entry-panel').hide();
$(this).find('.entry-rename').show();
$('.entry-rename-title').focus();
})
.on('show_copy', function(event, obj) {
var id = $(obj).closest('tr').attr('storymap-data');
var item = _user.storymaps[id];
$('.entry-copy-title-old').html(item.title);
$('.entry-copy input[type="text"]').val('');
$('#entry_copy').attr('storymap-data', id);
$(this).find('.entry-panel').hide();
$(this).find('.entry-copy').show();
$('.entry-copy-title').focus();
})
.on('show_import', function(event) {
$('.entry-import input[type="text"]').val('');
var $modal = $(this).trigger('reset');
$modal.find('.entry-panel').hide();
$modal.find('.entry-import').show();
$('entry-import-title').focus();
})
.on('delete_storymap', function(event, obj) {
var $modal = $(this);
var $tr = $(obj).closest('tr');
var id = $tr.attr('storymap-data');
var item = _user.storymaps[id];
$modal.trigger('confirm_show', ['Delete <strong>'+item.title+'</strong> StoryMap?', function(yes) {
if(yes) {
$modal.trigger('progress_show', 'Deleting StoryMap');
ajax_get("{{ url_for('storymap_delete') }}",
{id: id},
function(error) {
$modal.trigger('error_show', format_error('Error deleting StoryMap', error));
},
function(data) {
_storymap_list.remove(item);
delete _user.storymaps[id];
$tr.remove();
},
function(error) {
$modal.trigger('progress_hide');
}
);
}
}]);
});
handle_onload();
});
</script>
<!-- LEAVE THIS HERE -->
<script type="text/javascript" src="{{ STATIC_URL }}js/modals.js"></script>
</body>
</html>