|
| 1 | +<html><head> |
| 2 | +<meta content="text/html; charset=UTF-8" http-equiv="content-type"> |
| 3 | +<title>List Item HTML</title> |
| 4 | +<LINK href="stylesheets/wrap.css" rel="stylesheet" type="text/css"> |
| 5 | +<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script> |
| 6 | +<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js" type="text/javascript"></script> |
| 7 | +<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js" type="text/javascript"></script> |
| 8 | +<script src="javascripts/wrap.js" type="text/javascript"></script> |
| 9 | +<script src="javascripts/link-index.js" type="text/javascript"></script> |
| 10 | +<script src="javascripts/register-links.js" type="text/javascript"></script> |
| 11 | +<link rel="stylesheet" type="text/css" href="stylesheets/wrap.css"> |
| 12 | + |
| 13 | +<script type="text/javascript">//<![CDATA[ |
| 14 | + const prefills = { |
| 15 | + timestamp: () => `Article Updated on ${new Date().toLocaleString('default', { month: 'long' })} ${new Date().getFullYear()}`, |
| 16 | + https: () => 'Some HTTP links are updated to HTTPS', |
| 17 | + minor: () => 'Some minor text updates done', |
| 18 | + validated: () => `Content validated and updated for relevance in ${new Date().getFullYear()}`, |
| 19 | + brokenlinks: () => 'Updated broken links with latest URLs' |
| 20 | + }; |
| 21 | +$(document).ready(function(){ |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + $('#form').submit(function(){ |
| 26 | + var $this = $(this); |
| 27 | + $this.validate(); |
| 28 | + return false; |
| 29 | + }); |
| 30 | + |
| 31 | + $('#wrap').click(function () { |
| 32 | + var heading = wrapItem({ |
| 33 | + elementSelector: '#title', |
| 34 | + creator: createTag, |
| 35 | + openTag: '<h2>', |
| 36 | + closeTag: '</h2>', |
| 37 | + decorator: toTitleCase, |
| 38 | + useAllText: true |
| 39 | + }); |
| 40 | + |
| 41 | + const selectedPrefills = $('#prefill').val(); |
| 42 | + const prefillText = (selectedPrefills || []).filter(v => v).map(p => p && prefills[p]()).join('. ') || ''; |
| 43 | + const customText = $('#fulltext').val() || ''; |
| 44 | + let para = `${prefillText}. ${customText}`.trim(); |
| 45 | + if(para.length - 1 !== para.lastIndexOf('.')) { |
| 46 | + para = para + '.'; |
| 47 | + } |
| 48 | + if(heading && para) { |
| 49 | + $('#showtext').val(`<div class="related-index">${heading} <ul><li>${para}</p></li></ul></div>`); |
| 50 | + } |
| 51 | + }); |
| 52 | + |
| 53 | + $("#showtext").focus(function () { |
| 54 | + var $this = $(this); |
| 55 | + $this.select(); |
| 56 | + |
| 57 | + // Work around Chrome's little problem |
| 58 | + $this.mouseup(function () { |
| 59 | + // Prevent further mouseup intervention |
| 60 | + $this.unbind("mouseup"); |
| 61 | + return false; |
| 62 | + }); |
| 63 | + }); |
| 64 | + $('#wrap').click(); |
| 65 | + |
| 66 | +});//]]> |
| 67 | + |
| 68 | +</script> |
| 69 | + |
| 70 | + |
| 71 | +</head> |
| 72 | +<body> |
| 73 | +<form id="form"> |
| 74 | +<div class="container"> |
| 75 | +<ul class='index'></ul><p> <h2>List Item</h2></p> |
| 76 | +<div class="left"> |
| 77 | + <input type="text" id="title" value="Article Updates" placeholder="Enter Article Updates Headline"> |
| 78 | + <textarea id="fulltext" value="" placeholder="Add custom updates here"></textarea> |
| 79 | +<select name="prefill" id="prefill" multiple="multiple"> |
| 80 | + <option value="timestamp" selected="selected">Article Updated Timestamp Month/Year</option> |
| 81 | + <option value="https" selected="selected">HTTP Links Converted to HTTPS</option> |
| 82 | + <option value="brokenlinks" selected="selected">Fixed broken links</option> |
| 83 | + <option value="minor" selected="selected">Minor Text Updates Made</option> |
| 84 | + <option value="validated" selected="selected">Validate for current year</option> |
| 85 | +</select> |
| 86 | +</div> |
| 87 | +<div class="center"> |
| 88 | +<div id="log"></div> |
| 89 | +<button type="submit" id="wrap">Create HTML</button> |
| 90 | +</div> |
| 91 | +<div class="right"> |
| 92 | +<textarea id="showtext"></textarea> |
| 93 | +</div > |
| 94 | +</div> |
| 95 | +</form> |
| 96 | +</body></html> |
0 commit comments