PluginProbe
PowerPress Podcasting plugin by Blubrry / trunk
PowerPress Podcasting plugin by Blubrry vtrunk
11.17.9 11.17.8 11.17.7 11.17.6 11.17.4 11.17.3 11.17.2 11.17.1 11.17 11.16.11 11.16.10 11.16.9 11.16.8 11.16.7 11.16.6 11.16.5 11.16.4 11.16.3 11.16.2 11.16.1 11.9.13 11.9.14 11.9.15 11.9.16 11.9.17 All 383 releases
powerpress / js / post.js

post.js in PowerPress Podcasting plugin by Blubrry trunk, at js/post.js

74 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * PowerPress Post Entry Point
3 * unified ES6 module for episode editing (replaces metabox-episode.js, metabox-channel.js)
4 */
5
6 // ============================================
7 // PCI MANAGER IMPORTS
8 // ============================================
9
10 import { initLocationManager } from './modules/pci/LocationManager.js';
11 import { initCreditsManager } from './modules/pci/CreditsManager.js';
12 import { initValueRecipientManager } from './modules/pci/ValueRecipientsManager.js';
13 import { initSoundbitesManager } from './modules/pci/SoundbitesManager.js';
14 import { initSocialInteractManager } from './modules/pci/SocialInteractManager.js';
15 import { initTxtTagManager } from './modules/pci/TxtTagManager.js';
16 import { initAlternateEnclosureManager } from './modules/pci/AlternateEnclosureManager.js';
17 import { initContentLinksManager } from './modules/pci/ContentLinksManager.js';
18
19 // ============================================
20 // UTILITY IMPORTS
21 // ============================================
22
23 import { toggleVisibility, initCharCounter } from './utils/dom-utils.js';
24 import { initMediaEdit } from './modules/post-editor/EpisodeEnclosureManager.js';
25
26 // ============================================
27 // GLOBAL EXPORTS
28 // ============================================
29
30 // pci managers (for PHP template init calls)
31 window.initLocationManager = initLocationManager;
32 window.initCreditsManager = initCreditsManager;
33 window.initValueRecipientManager = initValueRecipientManager;
34 window.initSoundbitesManager = initSoundbitesManager;
35 window.initSocialInteractManager = initSocialInteractManager;
36 window.initTxtTagManager = initTxtTagManager;
37 window.initAlternateEnclosureManager = initAlternateEnclosureManager;
38 window.initContentLinksManager = initContentLinksManager;
39
40 // utilities
41 window.toggleVisibility = toggleVisibility;
42 window.initCharCounter = initCharCounter;
43
44 // ============================================
45 // AUTO-INITIALIZATION
46 // ============================================
47
48 // initialize character counters for any element with data-char-counter attribute
49 // usage: <textarea data-char-counter="counterId" data-char-warn="250">
50 // data-char-warn is optional; omit for no warning color
51 document.querySelectorAll('[data-char-counter]').forEach(input => {
52 const counterId = input.dataset.charCounter;
53 const warnAt = input.dataset.charWarn ? parseInt(input.dataset.charWarn, 10) : null;
54 initCharCounter(input.id, counterId, warnAt);
55 });
56
57 // Auto-Grow Text area for Show Notes in the post editor instead of allowing scroll
58 document.querySelectorAll('[id^="powerpress_shownotes_"]').forEach(ta => {
59 ta.style.overflow = 'hidden';
60 const grow = () => {
61 ta.style.height = 'auto';
62 const lineHeight = parseFloat(getComputedStyle(ta).lineHeight) || 20;
63 ta.style.height = (ta.scrollHeight + lineHeight) + 'px';
64 };
65 ta.addEventListener('input', grow);
66 grow();
67 });
68
69 // ============================================
70 // MEDIA EDIT INIT
71 // ============================================
72
73 initMediaEdit();
74