diff --git a/extractor/find_hours.py b/extractor/find_hours.py index b3e4e1b..b1dd27f 100755 --- a/extractor/find_hours.py +++ b/extractor/find_hours.py @@ -17,11 +17,19 @@ def borders_ok(text, start, end): return False +def delete_duplicates(text): + text = re.sub(' +', ' ', text) + text = re.sub(' ?\n ?', '\n', text) + text = re.sub('\n{5,}', '\n\n\n', text) + text = re.sub('\n\n', '\n', text) + return text + + def get_context(text, start, end, minsize): hour = text[start:end] - prefix = re.sub(' +', ' ', text[:start]).rsplit( - ' ', maxsplit=minsize + 2)[1:] - suffix = re.sub(' +', ' ', text[end:]).split( + prefix = delete_duplicates(text[:start]).rsplit( + ' ', maxsplit=minsize + 12)[1:] + suffix = delete_duplicates(text[end:]).split( ' ', maxsplit=minsize + 2)[:-1] return ' '.join(prefix), hour, ' '.join(suffix) @@ -33,12 +41,12 @@ def hours_iterator(text, minsize=20, color=False): if not borders_ok(text, start, end): continue prefix, hour, suffix = get_context(text, start, end, minsize) - utterance = f'{prefix}&&&{hour}###{suffix}' if color: + utterance = f'{prefix}&&&{hour}###{suffix}' yield utterance, color_hour(prefix, hour, suffix, Fore.GREEN, Style.BRIGHT) else: - yield utterance + yield prefix, hour, suffix # w klasyfikatorze dzielić tak aby jeszcze \n było oddzielnie diff --git a/get_utterances.py b/get_utterances.py index d8d4d6e..5a4cb22 100755 --- a/get_utterances.py +++ b/get_utterances.py @@ -8,7 +8,6 @@ import re import pickle -# r = redis.StrictRedis(host='localhost', port=6379, db=0) class Utterance(): def __init__(self, utterance, url, button_text, depth, filename, line_no): "docstring" @@ -23,11 +22,26 @@ class Utterance(): def add_utterances(parish_page, parish_path, utterances): utterances_nr = 0 content = parish_page['content'] - for utterances_nr, utterance in enumerate(hours_iterator(content)): - utterance_inst = Utterance( - utterance, parish_page['url'], parish_page['button_text'], - parish_page['depth'], parish_path, parish_page['line_no']) - utterances.append(utterance_inst) + for utterances_nr, (prefix, hour, suffix) in enumerate( + hours_iterator(content)): + # utterance_inst = Utterance( + # utterance, parish_page['url'], parish_page['button_text'], + # parish_page['depth'], parish_path, parish_page['line_no']) + utterance_dict = { + 'prefix': prefix, + 'hour': hour, + 'suffix': suffix, + 'url': parish_page['url'], + 'button_text': parish_page['button_text'], + 'depth': parish_page['depth'], + 'filepath': parish_path, + 'line_no': parish_page['line_no'] + } + # print(prefix) + # print(hour) + # print('-------------------------------------------------') + # print(suffix) + utterances.append(utterance_dict) return utterances_nr @@ -96,9 +110,11 @@ def remove_duplicates(utterances): seen = set() res = [] for utt in utterances: - if utt.utterance not in seen: + # TODO: check why with &&&hour### it gives more utterances!!! + utterance_text = utt['prefix'] + utt['hour'] + utt['suffix'] + if utterance_text not in seen: res.append(utt) - seen.add(utt.utterance) + seen.add(utterance_text) return res @@ -148,6 +164,7 @@ def get_extracted_by_rules(filename): def main(): + # TODO: use argparse and add makefile goal extracted_by_rules = get_extracted_by_rules('./extracted-by-rules.txt') utterances = load_parishes('./parishwebsites/text-data', extracted_by_rules) diff --git a/parishwebsites/parish2text-commands.sh b/parishwebsites/parish2text-commands.sh new file mode 100755 index 0000000..c6a8b69 --- /dev/null +++ b/parishwebsites/parish2text-commands.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +for file in $1/*; do + filename=`basename $file` + echo "./parish2text.py < \"$file\" > \"text-data/$filename\" 2> \"text-data-logs/$filename\"" +done diff --git a/webapp/app.py b/webapp/app.py index 1e2c4d3..8d07e95 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -1,38 +1,169 @@ -from flask import Flask, render_template, request, make_response +from flask import Flask, render_template, request, make_response, jsonify +import os +from get_utterances import Utterance import redis +import pickle +import re + app = Flask(__name__) - -def load_parishes(directory): - return {} +r = redis.StrictRedis(host='localhost', port=6379, db=0) -parishes = load_parishes('dir') +def log(msg): + with open('/tmp/tmp', 'w') as f: + print(msg, f, flush=True) -def post_action(): - return get_action() +def load_utterances(filename): + with open(filename, 'rb') as f: + utterances = pickle.load(f) + return utterances -def get_action(): - hour = '12.00' - left_context = 'Dawno, dawno temu był sobia para młoda, bardzo piękna para młoda. Msza rozpocznie się o godzinie ' - right_context = '. Następnie para młoda uda się na wesele do Kubusia i będą się bawić do białegop prana.' - resp = make_response( - render_template( - 'index.html', - hour=hour, - left_context=left_context, - right_context=right_context)) +utterances = load_utterances( + '/home/siulkilulki/gitrepos/mass-scraper/utterances.pkl') + +UTT_SCORES = 'utterance-scores' +# log(utterances[0:2]) + +#initialize_redis_db +# r.flushdb() +# status = None +status = r.get('status') +if status: + status = status.decode('utf-8') +else: + r.flushdb() +if status != 'filled': + log('filling status') + for i in range(len(utterances)): + r.zadd(UTT_SCORES, 0, str(i)) + r.set('status', 'filled') + status = 'filled' + + +def get_next(): + index = int(r.zrangebyscore(UTT_SCORES, '-inf', 'inf')[1]) + left_context = utterances[index]['prefix'].replace('\n', '') + hour = utterances[index]['hour'].replace('\n', '') + right_context = ' '.join( + utterances[index]['suffix'].split(' ')[:10]).replace('\n', '') + # log('get_next index: {}, score: {}'.format(index, + # r.zscore(UTT_SCORES, index))) + return index, left_context, hour, right_context + + +def get_next_response(cookie_hash): + index, left_context, hour, right_context = get_next() + resp = jsonify( + index=index, + left_context=left_context, + hour=hour, + right_context=right_context) + if cookie_hash: + resp.set_cookie('cookie-hash', cookie_hash, max_age=60 * 60 * 24 * 90) return resp +def get_by_index(index): + left_context = utterances[index]['prefix'].replace('\n', '') + hour = utterances[index]['hour'].replace('\n', '') + right_context = ' '.join( + utterances[index]['suffix'].split(' ')[:10]).replace('\n', '') + # log('get_next index: {}, score: {}'.format(index, + # r.zscore(UTT_SCORES, index))) + return index, left_context, hour, right_context + + +def get_response_by_index(index, cookie_hash): + index, left_context, hour, right_context = get_by_index(index) + resp = jsonify( + index=index, + left_context=left_context, + hour=hour, + right_context=right_context) + if cookie_hash: + resp.set_cookie('cookie-hash', cookie_hash, max_age=60 * 60 * 24 * 90) + return resp + + +def annotate_redis(yesno, index): + cookie_hash = request.cookies.get('cookie-hash') + if not cookie_hash: + return None + annotation = r.get('{}:{}'.format( + cookie_hash, index)) # previous annotation of utterance by that user + if annotation: + log('!!!!!!!!!!!') + log(annotation) + str_index = int(annotation.decode('utf-8').split(':')[1]) + log(str_index) + r.setrange(index, str_index, yesno) #sets str_index to yesno value + else: + # before = r.zscore(UTT_SCORES, index) + r.zincrby(UTT_SCORES, index) + # log('incrementing index {}, before_val: {}, value: {}'.format( + # index, before, r.zscore(UTT_SCORES, index))) + str_index = r.append(index, yesno) - 1 + r.set('{}:{}'.format(cookie_hash, index), '{}:{}'.format(yesno, str_index)) + r.lpush(cookie_hash, '{}:{}:{}'.format(yesno, index, str_index)) + return cookie_hash + + +def set_cookie(js_hash): + # dodawać nowe js_hash do listy z key bedacym cookie_hash + old_cookie_hash = None + cookie_hash = request.cookies.get('cookie-hash') + if not cookie_hash: + old_cookie_hash = r.get(js_hash) + if not old_cookie_hash: + cookie_hash = str( + int.from_bytes(os.urandom(4), byteorder='little')) + r.set(js_hash, cookie_hash, nx=True) + else: + cookie_hash = str(old_cookie_hash) + log('old_cookie: {}, cookie: {}'.format(old_cookie_hash, cookie_hash)) + return cookie_hash + + +def http_post(request): + index = str(request.form.get('index')) + action = request.form['action'] + js_hash = request.form['hash'] + log(request.form) + log(f'action: {action}') + if action == 'get': + cookie_hash = set_cookie(js_hash) + return get_next_response(cookie_hash) + elif action == 'undo': + cookie_hash = request.cookies.get('cookie-hash') + if cookie_hash: + last_action = r.lpop(cookie_hash) + if last_action: + index = int(last_action.decode('utf-8').split(':')[1]) + return get_response_by_index(index, cookie_hash) + # if no cookie-hash or action list is empty return None + elif action == 'yes': + cookie_hash = annotate_redis('y', index) + if cookie_hash: + return get_next_response(cookie_hash) + elif action == 'no': + cookie_hash = annotate_redis('n', index) + if cookie_hash: + return get_next_response(cookie_hash) + + +def http_get(): + return render_template('index.html') + + @app.route("/", methods=['GET', 'POST']) def root(): if request.method == 'POST': - return post_action() + return http_post(request) else: - return get_action() + return http_get() if __name__ == "__main__": diff --git a/webapp/static/hash.min.js b/webapp/static/hash.min.js new file mode 100644 index 0000000..eb70c57 --- /dev/null +++ b/webapp/static/hash.min.js @@ -0,0 +1 @@ +!function(e,t,r){"use strict";"function"==typeof window.define&&window.define.amd?window.define(r):"undefined"!=typeof module&&module.exports?module.exports=r():t.exports?t.exports=r():t.Fingerprint2=r()}(0,this,function(){"use strict";var e=function(t){if(!(this instanceof e))return new e(t);this.options=this.extend(t,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[],excludeDoNotTrack:!0,excludePixelRatio:!0}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map};return e.prototype={extend:function(e,t){if(null==e)return t;for(var r in e)null!=e[r]&&t[r]!==e[r]&&(t[r]=e[r]);return t},get:function(e){var t=this,r={data:[],addPreprocessedComponent:function(e){var n=e.value;"function"==typeof t.options.preprocessor&&(n=t.options.preprocessor(e.key,n)),r.data.push({key:e.key,value:n})}};r=this.userAgentKey(r),r=this.languageKey(r),r=this.colorDepthKey(r),r=this.deviceMemoryKey(r),r=this.pixelRatioKey(r),r=this.hardwareConcurrencyKey(r),r=this.screenResolutionKey(r),r=this.availableScreenResolutionKey(r),r=this.timezoneOffsetKey(r),r=this.sessionStorageKey(r),r=this.localStorageKey(r),r=this.indexedDbKey(r),r=this.addBehaviorKey(r),r=this.openDatabaseKey(r),r=this.cpuClassKey(r),r=this.platformKey(r),r=this.doNotTrackKey(r),r=this.pluginsKey(r),r=this.canvasKey(r),r=this.webglKey(r),r=this.webglVendorAndRendererKey(r),r=this.adBlockKey(r),r=this.hasLiedLanguagesKey(r),r=this.hasLiedResolutionKey(r),r=this.hasLiedOsKey(r),r=this.hasLiedBrowserKey(r),r=this.touchSupportKey(r),r=this.customEntropyFunction(r),this.fontsKey(r,function(r){var n=[];t.each(r.data,function(e){var t=e.value;t&&"function"==typeof t.join&&(t=t.join(";")),n.push(t)});var i=t.x64hash128(n.join("~~~"),31);return e(i,r.data)})},customEntropyFunction:function(e){return"function"==typeof this.options.customFunction&&e.addPreprocessedComponent({key:"custom",value:this.options.customFunction()}),e},userAgentKey:function(e){return this.options.excludeUserAgent||e.addPreprocessedComponent({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.addPreprocessedComponent({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.addPreprocessedComponent({key:"color_depth",value:window.screen.colorDepth||-1}),e},deviceMemoryKey:function(e){return this.options.excludeDeviceMemory||e.addPreprocessedComponent({key:"device_memory",value:this.getDeviceMemory()}),e},getDeviceMemory:function(){return navigator.deviceMemory||-1},pixelRatioKey:function(e){return this.options.excludePixelRatio||e.addPreprocessedComponent({key:"pixel_ratio",value:this.getPixelRatio()}),e},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return t=this.options.detectScreenOrientation&&window.screen.height>window.screen.width?[window.screen.height,window.screen.width]:[window.screen.width,window.screen.height],e.addPreprocessedComponent({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return window.screen.availWidth&&window.screen.availHeight&&(t=this.options.detectScreenOrientation?window.screen.availHeight>window.screen.availWidth?[window.screen.availHeight,window.screen.availWidth]:[window.screen.availWidth,window.screen.availHeight]:[window.screen.availHeight,window.screen.availWidth]),void 0!==t&&e.addPreprocessedComponent({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.addPreprocessedComponent({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.addPreprocessedComponent({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.addPreprocessedComponent({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.addPreprocessedComponent({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return!this.options.excludeAddBehavior&&document.body&&document.body.addBehavior&&e.addPreprocessedComponent({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.addPreprocessedComponent({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.addPreprocessedComponent({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.addPreprocessedComponent({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.addPreprocessedComponent({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.addPreprocessedComponent({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return!this.options.excludeWebGL&&this.isWebGlSupported()&&e.addPreprocessedComponent({key:"webgl",value:this.getWebglFp()}),e},webglVendorAndRendererKey:function(e){return!this.options.excludeWebGLVendorAndRenderer&&this.isWebGlSupported()&&e.addPreprocessedComponent({key:"webgl_vendor",value:this.getWebglVendorAndRenderer()}),e},adBlockKey:function(e){return this.options.excludeAdBlock||e.addPreprocessedComponent({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.addPreprocessedComponent({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.addPreprocessedComponent({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.addPreprocessedComponent({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.addPreprocessedComponent({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(e,t){return this.options.excludeFlashFonts?t(e):this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()?void 0===this.options.swfPath?t(e):void this.loadSwfAndDetectFonts(function(r){e.addPreprocessedComponent({key:"swf_fonts",value:r.join(";")}),t(e)}):t(e)},jsFontsKey:function(e,t){var r=this;return setTimeout(function(){var n=["monospace","sans-serif","serif"],i=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];r.options.extendedJsFonts&&(i=i.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"])),i=(i=i.concat(r.options.userDefinedFonts)).filter(function(e,t){return i.indexOf(e)===t});var a=document.getElementsByTagName("body")[0],o=document.createElement("div"),s=document.createElement("div"),l={},d={},h=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.fontStyle="normal",e.style.fontWeight="normal",e.style.letterSpacing="normal",e.style.lineBreak="auto",e.style.lineHeight="normal",e.style.textTransform="none",e.style.textAlign="left",e.style.textDecoration="none",e.style.textShadow="none",e.style.whiteSpace="normal",e.style.wordBreak="normal",e.style.wordSpacing="normal",e.innerHTML="mmmmmmmmmmlli",e},c=function(e){for(var t=!1,r=0;rt.name?1:e.name=0?"Windows Phone":t.indexOf("win")>=0?"Windows":t.indexOf("android")>=0?"Android":t.indexOf("linux")>=0?"Linux":t.indexOf("iphone")>=0||t.indexOf("ipad")>=0?"iOS":t.indexOf("mac")>=0?"Mac":"Other",("ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==r){if((r=r.toLowerCase()).indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(r.indexOf("linux")>=0&&"Linux"!==e&&"Android"!==e)return!0;if(r.indexOf("mac")>=0&&"Mac"!==e&&"iOS"!==e)return!0;if((-1===r.indexOf("win")&&-1===r.indexOf("linux")&&-1===r.indexOf("mac"))!=("Other"===e))return!0}return n.indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e||((n.indexOf("linux")>=0||n.indexOf("android")>=0||n.indexOf("pike")>=0)&&"Linux"!==e&&"Android"!==e||((n.indexOf("mac")>=0||n.indexOf("ipad")>=0||n.indexOf("ipod")>=0||n.indexOf("iphone")>=0)&&"Mac"!==e&&"iOS"!==e||((-1===n.indexOf("win")&&-1===n.indexOf("linux")&&-1===n.indexOf("mac"))!=("Other"===e)||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e)))},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),r=navigator.productSub;if(("Chrome"===(e=t.indexOf("firefox")>=0?"Firefox":t.indexOf("opera")>=0||t.indexOf("opr")>=0?"Opera":t.indexOf("chrome")>=0?"Chrome":t.indexOf("safari")>=0?"Safari":t.indexOf("trident")>=0?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==r)return!0;var n,i=eval.toString().length;if(37===i&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===i&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===i&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),n=!0}catch(e){n=!1}}return!(!n||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var e=this.getWebglCanvas();return!!window.WebGLRenderingContext&&!!e},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(e){var t="___fp_swf_loaded";window[t]=function(t){e(t)};var r=this.options.swfContainerId;this.addFlashDivNode();var n={onReady:t};window.swfobject.embedSWF(this.options.swfPath,r,"1","1","9.0.0",!1,n,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t},each:function(e,t,r){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]+t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]+t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]+t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]+t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var r=[0,0,0,0];return r[3]+=e[3]*t[3],r[2]+=r[3]>>>16,r[3]&=65535,r[2]+=e[2]*t[3],r[1]+=r[2]>>>16,r[2]&=65535,r[2]+=e[3]*t[2],r[1]+=r[2]>>>16,r[2]&=65535,r[1]+=e[1]*t[3],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[2]*t[2],r[0]+=r[1]>>>16,r[1]&=65535,r[1]+=e[3]*t[1],r[0]+=r[1]>>>16,r[1]&=65535,r[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],r[0]&=65535,[r[0]<<16|r[1],r[2]<<16|r[3]]},x64Rotl:function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])},x64LeftShift:function(e,t){return 0===(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),e=this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){e=e||"",t=t||0;for(var r=e.length%16,n=e.length-r,i=[0,t],a=[0,t],o=[0,0],s=[0,0],l=[2277735313,289559509],d=[1291169091,658871167],h=0;h>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},e.VERSION="1.8.0",e}); \ No newline at end of file diff --git a/webapp/templates/index.html b/webapp/templates/index.html index 388c488..0b577d6 100644 --- a/webapp/templates/index.html +++ b/webapp/templates/index.html @@ -1,6 +1,7 @@ - + + @@ -9,10 +10,11 @@ Annotator mszy świętych - - + + + - + Cofnij @@ -20,12 +22,11 @@ Czy zaznaczono godzinę mszy świętej? - - {{ left_context }}{{ hour }}{{right_context}} + - + Nie Tak @@ -35,49 +36,102 @@ + - + +
{{ left_context }}{{ hour }}{{right_context}}