1(function () { 2 function normalizePublishDestination(raw) { 3 var value = String(raw || '').trim().toLowerCase(); 4 return value === 'nostr_now' ? 'nostr_now' : 'local_only'; 5 } 6 7 function normalizePublishMode(raw) { 8 var value = String(raw || '').trim().toLowerCase(); 9 if (value === 'scheduled' || value === 'drip' || value === 'immediate') { 10 return value; 11 } 12 return 'immediate'; 13 } 14 15 function escapeHtml(value) { 16 return String(value == null ? '' : value) 17 .replace(/&/g, '&') 18 .replace(/</g, '<') 19 .replace(/>/g, '>') 20 .replace(/"/g, '"') 21 .replace(/'/g, '''); 22 } 23 24 function primaryPublishLabel(mode, destination, opts) { 25 var options = opts || {}; 26 if (options.postTypeLocked) { 27 return 'Publish Changes'; 28 } 29 var pickedMode = normalizePublishMode(mode); 30 if (pickedMode === 'scheduled') { 31 return 'Schedule Post'; 32 } 33 if (pickedMode === 'drip') { 34 return 'Enqueue Post'; 35 } 36 return normalizePublishDestination(destination) === 'local_only' ? 'Publish to Server' : 'Publish to Nostr'; 37 } 38 39 function renderPublishDestinationField(opts) { 40 var options = opts || {}; 41 var inputName = String(options.inputName || 'compose-destination'); 42 var destination = normalizePublishDestination(options.destination); 43 return '' + 44 '<strong>Publish to</strong>' + 45 '<div class="mode-row">' + 46 '<label><input type="radio" name="' + escapeHtml(inputName) + '" value="local_only"' + (destination === 'local_only' ? ' checked' : '') + '> Server only</label>' + 47 '<label><input type="radio" name="' + escapeHtml(inputName) + '" value="nostr_now"' + (destination === 'nostr_now' ? ' checked' : '') + '> Server + Nostr</label>' + 48 '</div>'; 49 } 50 51 window.BlogComposeShared = { 52 normalizePublishDestination: normalizePublishDestination, 53 normalizePublishMode: normalizePublishMode, 54 primaryPublishLabel: primaryPublishLabel, 55 renderPublishDestinationField: renderPublishDestinationField 56 }; 57})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.