1var Pattern = { 2 3 searchResultsCount:0, 4 metaTags:[], 5 6 createTwikiActionFormStepSign:function(el) { 7 var sign = '►'; 8 var newEl = twiki.HTML.insertBeforeElement( 9 el, 10 'span', 11 sign 12 ); 13 newEl.className = 'twikiActionFormStepSign'; 14 }, 15 16 /** 17 Creates a attachment counter in the attachment table twisty. 18 */ 19 setAttachmentCount:function(inTableElement) { 20 var count = inTableElement.getElementsByTagName("tr").length - 1; 21 var countStr = " " + "<span class='patternAttachmentCount'>" + " (" + count + ")" + "<\/span>"; 22 var showElem = document.getElementById('topicattachmentslistshow'); 23 if (showElem != undefined) { 24 var labelElem = showElem.getElementsByTagName('a')[0].getElementsByTagName('span')[0]; 25 labelElem.innerHTML += countStr; 26 } 27 var hideElem = document.getElementById('topicattachmentslisthide'); 28 if (hideElem != undefined) { 29 var labelElem = hideElem.getElementsByTagName('a')[0].getElementsByTagName('span')[0]; 30 labelElem.innerHTML += countStr; 31 } 32 }, 33 34 addSearchResultsCounter:function(el) { 35 var count = twiki.HTML.getHtmlOfElement(el); 36 Pattern.searchResultsCount += parseInt(count); 37 }, 38 39 displayTotalSearchResultsCount:function(el) { 40 // write result count 41 if (Pattern.searchResultsCount >= 10) { 42 var text = " " + TEXT_NUM_TOPICS + " <b>" + Pattern.searchResultsCount + " <\/b>"; 43 twiki.HTML.setHtmlOfElement(el, text); 44 } 45 }, 46 47 displayModifySearchLink:function() { 48 var linkContainer = document.getElementById('twikiModifySearchContainer'); 49 if (linkContainer != null) { 50 if (Pattern.searchResultsCount > 0) { 51 var linkText=' <a href="#" onclick="location.hash=\'twikiSearchForm\'; return false;"><span class="twikiLinkLabel twikiSmallish">' + TEXT_MODIFY_SEARCH + '</span></a>'; 52 twiki.HTML.setHtmlOfElement(linkContainer, linkText); 53 } 54 } 55 } 56} 57 58var patternRules = { 59 '.twikiFormStep h3' : function(el) { 60 Pattern.createTwikiActionFormStepSign(el); 61 }, 62 'input#jumpFormField' : function(el) { 63 twiki.Form.initBeforeFocusText(el,TEXT_JUMP); 64 el.onfocus = function() { 65 twiki.Form.clearBeforeFocusText(this); 66 } 67 el.onblur = function() { 68 twiki.Form.restoreBeforeFocusText(this); 69 } 70 }, 71 'input#quickSearchBox' : function(el) { 72 twiki.Form.initBeforeFocusText(el,TEXT_SEARCH); 73 el.onfocus = function() { 74 twiki.Form.clearBeforeFocusText(this); 75 } 76 el.onblur = function() { 77 twiki.Form.restoreBeforeFocusText(this); 78 } 79 }, 80 '#tabletwikiAttachmentsTable' : function(el) { 81 Pattern.setAttachmentCount(el); 82 }, 83 'body.patternEditPage' : function(el) { 84 twiki.Event.addLoadEvent(initForm, false); // call after Behaviour 85 }, 86 '.twikiSearchResultCount' : function(el) { 87 Pattern.addSearchResultsCounter(el); 88 }, 89 '#twikiNumberOfResultsContainer' : function(el) { 90 Pattern.displayTotalSearchResultsCount(el); 91 }, 92 '#twikiWebSearchForm':function(el) { 93 Pattern.displayModifySearchLink(); 94 }, 95 '.twikiPopUp':function(el) { 96 el.onclick = function() { 97 twiki.Window.openPopup(el.href, {template:"viewplain"}); 98 return false; 99 } 100 }, 101 '.twikiFocus':function(el) { 102 el.focus(); 103 } 104}; 105Behaviour.register(patternRules); 106 107var initForm; // in case initForm is not defined (f.e. when TinyMCE is used and twiki_edit.js is not loaded 108var TEXT_JUMP = twiki.getMetaTag('TEXT_JUMP'); 109var TEXT_SEARCH = twiki.getMetaTag('TEXT_SEARCH'); 110var TEXT_NUM_TOPICS = twiki.getMetaTag('TEXT_NUM_TOPICS'); 111var TEXT_MODIFY_SEARCH = twiki.getMetaTag('TEXT_MODIFY_SEARCH');
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.