Browse Source

first commit

master
Your Name 2 years ago
commit
d4cc58c9c3

+ 5
- 0
.gitignore View File

@@ -0,0 +1,5 @@
1
+*.DS_Store
2
+*.pyc
3
+*.db
4
+blogger/_pycache_
5
+app/img/*

+ 18
- 0
README.md View File

@@ -0,0 +1,18 @@
1
+# Flask Sqlalchemy Blogger Example
2
+
3
+
4
+A Simple Blogger application with user authentication, Using Flask, sqlalchemy connected to sqlite Database.
5
+
6
+
7
+## Usage
8
+
9
+- Frist clone the project and move to current working directory.
10
+- Install the required packages using requirements.txt file by the command ```pip install -r requirements.txt```
11
+- Run server by using ```python app.py```
12
+
13
+
14
+## Requirements
15
+- Python 2.7.x Python 3.x.x
16
+- Flask
17
+- Flask-SQLAlchemy
18
+- flask-WTF

+ 4
- 0
app.py View File

@@ -0,0 +1,4 @@
1
+from app import app
2
+
3
+if __name__ == '__main__':
4
+    app.run(host='0.0.0.0',debug=True)

+ 17
- 0
app/__init__.py View File

@@ -0,0 +1,17 @@
1
+from flask import Flask
2
+from flask_cors import CORS
3
+import os
4
+from flask import Flask, flash, request, redirect, url_for
5
+from werkzeug.utils import secure_filename
6
+basedir = os.path.abspath(os.path.dirname(__file__))
7
+app = Flask(__name__)
8
+CORS(app)
9
+UPLOAD_FOLDER = os.path.join(basedir, 'img')
10
+
11
+app.secret_key = 'poeticsoftware'
12
+app.config.from_object(__name__)
13
+app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
14
+app.config['CORS_HEADERS'] = 'Content-Type'
15
+app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
16
+from app import models
17
+from app import views

BIN
app/binary/29342695_384095108667726_3131815643153769741_n.jpg View File


+ 82
- 0
app/binary/api-result.html View File

@@ -0,0 +1,82 @@
1
+<!DOCTYPE html>
2
+<html class="client-js" dir="ltr" lang="en-GB"><head>
3
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
4
+<meta charset="UTF-8">
5
+<title>MediaWiki API result - workspace</title>
6
+<script>document.documentElement.className = document.documentElement.className.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );</script>
7
+<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgCanonicalNamespace":"Special","wgCanonicalSpecialPageName":"ApiHelp","wgNamespaceNumber":-1,"wgPageName":"Special:ApiHelp","wgTitle":"ApiHelp","wgCurRevisionId":0,"wgRevisionId":0,"wgArticleId":0,"wgIsArticle":false,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"en-gb","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"Special:ApiHelp","wgRelevantArticleId":0,"wgRequestId":"a3d6f7d4da6ed214eb3bd95e","wgIsProbablyEditable":false,"wgWikiEditorEnabledModules":{"toolbar":false,"dialogs":false,"preview":false,"publish":false}});mw.loader.state({"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"loading","user.tokens":"loading","mediawiki.apipretty":"ready","ext.pygments":"ready","ext.smw.style":"ready","ext.smw.tooltip.styles":"ready","mediawiki.legacy.shared":"ready","mediawiki.legacy.commonPrint":"ready","mediawiki.sectionAnchor":"ready","mediawiki.skinning.interface":"ready"});mw.loader.implement("user.options@1o6ohak",function($,jQuery,require,module){mw.user.options.set({"variant":"en-gb"});});mw.loader.implement("user.tokens@0id30ba",function ( $, jQuery, require, module ) {
8
+mw.user.tokens.set({"editToken":"+\\","patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"});/*@nomin*/;
9
+
10
+});mw.loader.load(["site","mediawiki.page.startup","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.searchSuggest","ext.smw.style"]);});</script>
11
+<link rel="stylesheet" href="api-result_files/load_002.css">
12
+<link rel="stylesheet" href="api-result_files/load.css">
13
+<script async="" src="api-result_files/load.php"></script>
14
+<style>
15
+.suggestions{overflow:hidden;position:absolute;top:0;left:0;width:0;border:0;z-index:1099;padding:0;margin:-1px 0 0 0}.suggestions-special{position:relative;background-color:#fff;cursor:pointer;border:solid 1px #aaa;margin:0;margin-top:-2px;display:none;padding:0.25em 0.25em;line-height:1.25em}.suggestions-results{background-color:#fff;cursor:pointer;border:solid 1px #aaa;padding:0;margin:0}.suggestions-result{color:#000;margin:0;line-height:1.5em;padding:0.01em 0.25em;text-align:left; overflow:hidden;-o-text-overflow:ellipsis; text-overflow:ellipsis;white-space:nowrap}.suggestions-result-current{background-color:#4c59a6;color:#fff}.suggestions-special .special-label{color:#808080;text-align:left}.suggestions-special .special-query{color:#000;font-style:italic;text-align:left}.suggestions-special .special-hover{background-color:#c0c0c0}.suggestions-result-current .special-label,.suggestions-result-current .special-query{color:#fff}.highlight{font-weight:bold}</style><style>
16
+.suggestions a.mw-searchSuggest-link,.suggestions a.mw-searchSuggest-link:hover,.suggestions a.mw-searchSuggest-link:active,.suggestions a.mw-searchSuggest-link:focus{color:#000;text-decoration:none}.suggestions-result-current a.mw-searchSuggest-link,.suggestions-result-current a.mw-searchSuggest-link:hover,.suggestions-result-current a.mw-searchSuggest-link:active,.suggestions-result-current a.mw-searchSuggest-link:focus{color:#fff}.suggestions a.mw-searchSuggest-link .special-query{ overflow:hidden;-o-text-overflow:ellipsis; text-overflow:ellipsis;white-space:nowrap}</style><meta name="ResourceLoaderDynamicStyles" content="">
17
+<meta name="generator" content="MediaWiki 1.29.2">
18
+<link rel="shortcut icon" href="https://space.alexroidl.de/favicon.ico">
19
+<link rel="search" type="application/opensearchdescription+xml" href="https://space.alexroidl.de/opensearch_desc.php" title="workspace (en-gb)">
20
+<link rel="EditURI" type="application/rsd+xml" href="http://space.alexroidl.de/api.php?action=rsd">
21
+<link rel="alternate" type="application/atom+xml" title="workspace Atom feed" href="https://space.alexroidl.de/index.php?title=Special:RecentChanges&amp;feed=atom">
22
+<script src="api-result_files/load_002.php"></script></head>
23
+<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns--1 ns-special mw-special-ApiHelp page-Special_ApiHelp rootpage-Special_ApiHelp skin-apioutput action-view">
24
+		<div class="mw-body" role="main">
25
+			<h1 class="firstHeading">MediaWiki API result</h1>
26
+			<div class="mw-body-content">
27
+				<div id="mw-content-text"><div class="api-pretty-header"><p>This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.
28
+</p><p>Specify the <var>format</var> parameter to change the output format. To see the non-HTML representation of the JSON format, set <kbd>format=json</kbd>.
29
+</p><p>See the <a href="https://www.mediawiki.org/wiki/Special:MyLanguage/API" class="extiw" title="mw:Special:MyLanguage/API">complete documentation</a>, or the <a href="https://space.alexroidl.de/api.php?action=help&amp;modules=main">API help</a> for more information.
30
+</p></div><div dir="ltr"><div class="mw-highlight"><pre><span></span><span class="p">{</span>
31
+    <span class="s2">"parse"</span><span class="o">:</span> <span class="p">{</span>
32
+        <span class="s2">"title"</span><span class="o">:</span> <span class="s2">"OCR"</span><span class="p">,</span>
33
+        <span class="s2">"pageid"</span><span class="o">:</span> <span class="mi">19</span><span class="p">,</span>
34
+        <span class="s2">"revid"</span><span class="o">:</span> <span class="mi">58</span><span class="p">,</span>
35
+        <span class="s2">"text"</span><span class="o">:</span> <span class="p">{</span>
36
+            <span class="s2">"*"</span><span class="o">:</span> <span class="s2">"&lt;h1&gt;&lt;span class=\"mw-headline\" id=\"Web_OCR\"&gt;Web OCR&lt;/span&gt;&lt;span class=\"mw-editsection\"&gt;&lt;span class=\"mw-editsection-bracket\"&gt;[&lt;/span&gt;&lt;a href=\"/index.php?title=OCR&amp;amp;action=edit&amp;amp;section=1\" title=\"Edit section: Web OCR\"&gt;edit&lt;/a&gt;&lt;span class=\"mw-editsection-bracket\"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;\n&lt;h2&gt;&lt;span class=\"mw-headline\" id=\"Libraries\"&gt;Libraries&lt;/span&gt;&lt;span class=\"mw-editsection\"&gt;&lt;span class=\"mw-editsection-bracket\"&gt;[&lt;/span&gt;&lt;a href=\"/index.php?title=OCR&amp;amp;action=edit&amp;amp;section=2\" title=\"Edit section: Libraries\"&gt;edit&lt;/a&gt;&lt;span class=\"mw-editsection-bracket\"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;\n&lt;p&gt;&lt;a rel=\"nofollow\" class=\"external free\" href=\"http://antimatter15.com/ocrad.js/demo.html\"&gt;http://antimatter15.com/ocrad.js/demo.html&lt;/a&gt;\n&lt;/p&gt;&lt;p&gt;&lt;a rel=\"nofollow\" class=\"external text\" href=\"http://tesseract.projectnaptha.com/\"&gt;Tesseract.js&lt;/a&gt;\n&lt;/p&gt;\n&lt;!-- \nNewPP limit report\nCached time: 20180710100001\nCache expiry: 86400\nDynamic content: false\n[SMW] In\u2010text annotation parser time: 0.008 seconds\nCPU time usage: 0.043 seconds\nReal time usage: 0.060 seconds\nPreprocessor visited node count: 6/1000000\nPreprocessor generated node count: 12/1000000\nPost\u2010expand include size: 0/2097152 bytes\nTemplate argument size: 0/2097152 bytes\nHighest expansion depth: 2/40\nExpensive parser function count: 0/100\n--&gt;\n&lt;!--\nTransclusion expansion time report (%,ms,calls,template)\n100.00%    0.000      1 -total\n--&gt;\n\n&lt;!-- Saved in parser cache with key my_wiki-wiki:pcache:idhash:19-0!*!*!!en-gb!*!* and timestamp 20180710100001 and revision id 58\n --&gt;\n"</span>
37
+        <span class="p">},</span>
38
+        <span class="s2">"langlinks"</span><span class="o">:</span> <span class="p">[],</span>
39
+        <span class="s2">"categories"</span><span class="o">:</span> <span class="p">[],</span>
40
+        <span class="s2">"links"</span><span class="o">:</span> <span class="p">[],</span>
41
+        <span class="s2">"templates"</span><span class="o">:</span> <span class="p">[],</span>
42
+        <span class="s2">"images"</span><span class="o">:</span> <span class="p">[],</span>
43
+        <span class="s2">"externallinks"</span><span class="o">:</span> <span class="p">[</span>
44
+            <span class="s2">"http://tesseract.projectnaptha.com/"</span><span class="p">,</span>
45
+            <span class="s2">"http://antimatter15.com/ocrad.js/demo.html"</span>
46
+        <span class="p">],</span>
47
+        <span class="s2">"sections"</span><span class="o">:</span> <span class="p">[</span>
48
+            <span class="p">{</span>
49
+                <span class="s2">"toclevel"</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span>
50
+                <span class="s2">"level"</span><span class="o">:</span> <span class="s2">"1"</span><span class="p">,</span>
51
+                <span class="s2">"line"</span><span class="o">:</span> <span class="s2">"Web OCR"</span><span class="p">,</span>
52
+                <span class="s2">"number"</span><span class="o">:</span> <span class="s2">"1"</span><span class="p">,</span>
53
+                <span class="s2">"index"</span><span class="o">:</span> <span class="s2">"1"</span><span class="p">,</span>
54
+                <span class="s2">"fromtitle"</span><span class="o">:</span> <span class="s2">"OCR"</span><span class="p">,</span>
55
+                <span class="s2">"byteoffset"</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span>
56
+                <span class="s2">"anchor"</span><span class="o">:</span> <span class="s2">"Web_OCR"</span>
57
+            <span class="p">},</span>
58
+            <span class="p">{</span>
59
+                <span class="s2">"toclevel"</span><span class="o">:</span> <span class="mi">2</span><span class="p">,</span>
60
+                <span class="s2">"level"</span><span class="o">:</span> <span class="s2">"2"</span><span class="p">,</span>
61
+                <span class="s2">"line"</span><span class="o">:</span> <span class="s2">"Libraries"</span><span class="p">,</span>
62
+                <span class="s2">"number"</span><span class="o">:</span> <span class="s2">"1.1"</span><span class="p">,</span>
63
+                <span class="s2">"index"</span><span class="o">:</span> <span class="s2">"2"</span><span class="p">,</span>
64
+                <span class="s2">"fromtitle"</span><span class="o">:</span> <span class="s2">"OCR"</span><span class="p">,</span>
65
+                <span class="s2">"byteoffset"</span><span class="o">:</span> <span class="mi">11</span><span class="p">,</span>
66
+                <span class="s2">"anchor"</span><span class="o">:</span> <span class="s2">"Libraries"</span>
67
+            <span class="p">}</span>
68
+        <span class="p">],</span>
69
+        <span class="s2">"parsewarnings"</span><span class="o">:</span> <span class="p">[],</span>
70
+        <span class="s2">"displaytitle"</span><span class="o">:</span> <span class="s2">"OCR"</span><span class="p">,</span>
71
+        <span class="s2">"iwlinks"</span><span class="o">:</span> <span class="p">[],</span>
72
+        <span class="s2">"properties"</span><span class="o">:</span> <span class="p">[]</span>
73
+    <span class="p">}</span>
74
+<span class="p">}</span>
75
+</pre></div>
76
+</div></div><div class="printfooter">
77
+Retrieved from ‘<a dir="ltr" href="http://space.alexroidl.de/index.php/Special:ApiHelp">http://space.alexroidl.de/index.php/Special:ApiHelp</a>’</div>
78
+			</div>
79
+		</div>
80
+
81
+		<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":557});});</script>		
82
+</body></html>

BIN
app/binary/audio.wav View File


+ 106
- 0
app/binary/changelog.txt View File

@@ -0,0 +1,106 @@
1
+Detailed change history is available from subversion https://www.assembla.com/code/chdk/subversion/commits
2
+
3
+=1.4=
4
+Current stable, released Nov 29 2015 as 1.4.1.
5
+
6
+Compatibility with 1.3:
7
+* Scripts are generally compatible.
8
+  You will see a warning if @chdk_version is not specified in the script header, but 1.3 compatible behavior will be used. If you use @chdk_version 1.4, the return values of some functions are changed.
9
+  See https://subversion.assembla.com/svn/chdk/trunk/CHDK/LUALIB/wrap13.lua for a list of functions with changed return values
10
+* Some CHDK script mode numbers have changed, and some names have been removed. This does not affect common modes like, M, P and Auto, but might affect scripts that use more obscure modes, especially if the are referred to by number rather than capmode.lua names
11
+* CFG files: CHDK 1.4 uses the same CFG files as 1.3.
12
+  It should generally be compatible and retain your settings, but if you don't want to risk re-doing your CFG, backing up the CHDK/*.CFG files before updating is recommended.  Custom colors will be reset, and if you switch back to 1.3, colors may be incorrect. CHDK 1.2 CFGs should be migrated as was done for 1.3.
13
+* Modules and language files are NOT compatible. You must update these when you update your build.
14
+
15
+Significant changes:
16
+* long file name support in script, file browser / selector.
17
+  Discussion http://chdk.setepontos.com/index.php?topic=10833.0
18
+* enhanced script @parameter header including compact format, Boolean values, table support, and full variable names in Lua.
19
+  Documentation: http://chdk.wikia.com/wiki/CHDK_Script_Header#Lua_Shorthand_Parameter_Syntax
20
+  Discussion: http://chdk.setepontos.com/index.php?topic=12121.0 
21
+* upper and lower case single characters can now be used as @param variables in uBASIC
22
+* script header now supports @subtitle for better organization in script that use many parameters
23
+* Lua scripts now "compile" when loaded to reduce memory needed (original script text no longer stored in memory)
24
+  Discussion: http://chdk.setepontos.com/index.php?topic=12117.msg118923#msg118923
25
+* Added @chdk_version parameter to specify version of CHDK script was written for, 1.3 assumed if none present.
26
+  Discussion: http://chdk.setepontos.com/index.php?topic=12138.0
27
+* Made Lua script API use of boolean values more consistent, (@chdk_version 1.3 provides backward compatible behavior)
28
+  Development thread http://chdk.setepontos.com/index.php?topic=12138.0
29
+* enhanced UI functions for touchscreen equipped cameras - touching menu areas and window buttons directly now works
30
+  Discussion: http://chdk.setepontos.com/index.php?topic=12090.msg118468#msg118468
31
+* rework of CHDK color palette handling to allow separate palette definitions for each camera model - transparent grey color defined for OSD background use
32
+  Discussion http://chdk.setepontos.com/index.php?topic=12046.msg118169#msg118169
33
+* updates to GPS functionality for cameras with built-in GPS
34
+* improvements in console handling when script running including console not timing out and console reset to "on" state when script errors are encountered.
35
+* upgrades to Lua RAW shooting hooks to allow analysis and modification of RAW buffer during shooting
36
+  Documentation: http://chdk.wikia.com/wiki/Lua/Raw_Hook_Operations
37
+  Discussion: http://chdk.setepontos.com/index.php?topic=11081.10
38
+* scripts added to the User Menu can now be started directly from the User Menu via a full press on the shutter button.  Using Func/Set now brings up a dialog box for ok/cancel.  Selecting ok makes the script the current script and exits to the Script menu.
39
+* usb_force_active now available on almost all cameras
40
+* filewrite / remote capture support for many more cameras
41
+* development support for digic 6 / thumb2 cameras
42
+* Improved focus overrides
43
+  Discussion http://chdk.setepontos.com/index.php?topic=12103.10
44
+* Convert shot histogram code to a module.
45
+
46
+=1.3=
47
+Obsolete, released Dec 18 2014. Implemented new features are listed below :
48
+* Address some of the longstanding issues with focus overrides - especially in scripts. Discussion: http://chdk.setepontos.com/index.php?topic=11078.0
49
+* Hooks to allow Lua to run at specific points in the shooting process. Discussion: http://chdk.setepontos.com/index.php?topic=11081.0
50
+* Increase available memory, allow CHDK to allocate from multiple pools. Discussion: http://chdk.setepontos.com/index.php?topic=10886.0
51
+* Eye-fi support
52
+* Splitting the CHDK configuration files into 4 parts for better management
53
+* Improved Lua cfg access from lua
54
+* Allow scripts to configure script interrupt key
55
+* Improved script control of OSD via set_draw_title_line()
56
+* Various clean-ups to which OSD icons get displayed and when
57
+* Improved script functions for working with APEX96  exposure values
58
+* Allow scripts to set shooting exposure parameters inside half shoot
59
+* Added font scaling to Lua draw_string() function
60
+* Added OSD font scaling and OSD editor upgrade to support it
61
+* Added option to launch the current script on entry to <ALT> mode
62
+* Added script function that locks out Canon automatic exposure adjustments
63
+* Added support for > 64 second exposures all cameras (thanks koshy and nafraf)
64
+* Added support for USB remote capture on many more cameras (thanks koshy and nafraf)
65
+* Added os.idir, iterates over directory listings without loading the whole list in memory.
66
+* Fix long standing FsIoNotify crash issues http://chdk.setepontos.com/index.php?topic=6179.msg111410#msg111410
67
+* added user choice for where RAW/DNG files are saved (with jpg, seperate DCIM folder, seperate RAW tree), also fixed naming of seperate DCIM folder
68
+* added choice of DNG crop  (full, active, JPG)
69
+* added ability to enable a high speed timer to improve USB remote timing precision and accuracy
70
+* added battery third terminal remote trigger capability (enabled for selected cameras only)
71
+* added hotshoe control capability (for cameras with hotshoes of course) 
72
+
73
+=1.2=
74
+Obsolete, released July 30 2013. The following major features were implemented for 1.2.
75
+* intermittent Lua crashing bug fixed (finally. Also backported to 1.1)
76
+* Improved UI - discussion thread http://chdk.setepontos.com/index.php?topic=8151.0
77
+** menu items renamed and sometimes moved for clarity
78
+** input of numeric values simplified
79
+** the "Disable Overrides" menu item is now understandable
80
+** Tv override input value can be in Ev step,  seconds or HHMMSS format
81
+* Remote capture over USB
82
+* Improved DNG performance, now very close to framebuffer raw
83
+* Support raw operations on DNG
84
+* Improved memory usage by moving more code to modules
85
+* Fast integer based trigonometric functions for Lua
86
+* new editor for User Menu
87
+* scripts can be added to the User Menu
88
+* menu option to enable Lua native calls
89
+* menu option to disable keyboard shortcuts
90
+* improve console mode with menu options to extend the visibility time of console or review (scroll back) console output
91
+* loadable palette values allow a better range of colors in the UI  (not implemented on all cameras)
92
+* auto operation of internal / external flash enabled when other exposure values are in "M" mode
93
+* enhanced UI for script parameters :  @value allows use of named input values rather than just numeric
94
+* scripts can be set to always use the default parameter values in the code rather than stored parameters
95
+* ISO input for override, bracketing and auto-ISO now use approximately the same units as Canon UI ("market" ISO)
96
+* addition of an annoying "help" window that continuously pops up in <ALT> mode until you figure out how to disable it from the CHDK menu
97
+
98
+=1.1=
99
+Obsolete, released July 25 2012. Major features added in this release include
100
+* Loadable binary modules
101
+* Re-write of USB remote code
102
+* "Live view" over the CHDK PTP Extension
103
+* Integration of chdkde features (actually got added to previous stable too)
104
+
105
+=1.0=
106
+Previous stable, no further changes. Released Feb 2012.

+ 21
- 0
app/binary/convert.sh View File

@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+FILE1=$1
4
+
5
+#to raw
6
+yes | cp -rf $1 input.raw
7
+
8
+#to audio
9
+sox -r 22050 -b 8 -c 1 -e signed input.raw audio.wav
10
+
11
+#to mp3
12
+ffmpeg -y -i audio.wav -vn -ar 44100 -ac 2 -b:a 192k -f mp3 output.mp3
13
+
14
+#to video
15
+ffmpeg -y -f rawvideo -s 32x18 -i input.raw video.mp4
16
+
17
+#scale up
18
+ffmpeg -y -i video.mp4 -vf scale=320:240 output.mp4
19
+
20
+#combine both
21
+ffmpeg -y -i output.mp4 -i output.mp3 -c copy -map 0:v:0 -map 1:a:0 output_both.mp4

BIN
app/binary/file View File


BIN
app/binary/gnome-sudoku View File


BIN
app/binary/input.raw View File


BIN
app/binary/output.mp3 View File


BIN
app/binary/output.mp4 View File


BIN
app/binary/output_both.mp4 View File


+ 21
- 0
app/binary/test.sh View File

@@ -0,0 +1,21 @@
1
+#!/bin/bash
2
+
3
+FILE1=$1
4
+
5
+#to raw
6
+yes | cp -rf $1 input.raw
7
+
8
+#to audio
9
+sox -r 22050 -b 8 -c 1 -e signed input.raw audio.wav
10
+
11
+#to mp3
12
+ffmpeg -y -i audio.wav -vn -ar 44100 -ac 2 -f mp3 output.mp3
13
+
14
+#to video
15
+ffmpeg -y -f rawvideo -s 32x18 -i input.raw video.mp4
16
+
17
+#scale up
18
+ffmpeg -y -i video.mp4 -vf scale=320:240 output.mp4
19
+
20
+#combine both
21
+#ffmpeg -y -i output.mp4 -i output.mp3 -c copy -map 0:v:0 -map 1:a:0 output_both.mp4

BIN
app/binary/video.mp4 View File


+ 170
- 0
app/binary/xpublib2.csv View File

@@ -0,0 +1,170 @@
1
+id,title,file,cover,fileformat,category,year_published,description,html,scapeX,scapeY,authors,stacks

2
+1,A Bed a Chair and a Table,,,,Special Issue,,,,0.00,0.00,Natasha Berting | Angeliki Diakrousi | Joca van der Horst | Alexander Roidl | Alice Strete | Zalan Szakacs,

3
+2,A Preface to Plato,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Eric Havelock,

4
+3,A Prehistory of the Cloud,,,pdf,Media Studies (Femke Trim 3),,,,0.00,0.00,Tung-Hui Hu,

5
+4,A Thousand Years of Nonlinear History,,,pdf,Philosophy,,,,0.00,0.00,Manuel De Landa,

6
+5,Actionscript for Flash MX: The Definitive Guide,,,pdf,Technical,,,,0.00,0.00,Colin Moock,

7
+6,Adorno,,,,Philosophy,,,,0.00,0.00,Martin Jay,

8
+7,Age of the Extremes: The Short Twentieth Century 1914-1991,,,pdf,Science/History,,,,0.00,0.00,Eric Hobsbawm,

9
+8,An Atlas of Typeforms,,,,design / writing / publishing,,,,0.00,0.00,James Sutton | Alan Bartram,

10
+9,An Introduction to Western Philosophy,,,,Philosophy,,,,0.00,0.00,Antony Flew,

11
+10,Anti-Media,,,,Media studies,,,,0.00,0.00,Florian Cramer,

12
+11,Apache 2 Pocket Reference,,,,Technical,,,,0.00,0.00,Andrew Ford,

13
+12,Archaeology,,,,Science/History,,,,0.00,0.00,Olsen | Shanks | Webmoor | Witmore,

14
+13,Art and Electronic Media,,,,Art,,,,0.00,0.00,Edward A. Shanken,

15
+14,Ashes and Broken Brickwork of a Logical Theory,,,,Art,,,,0.00,0.00,Susanne Kriemann,

16
+15,Barthes: Selected Writings,,,,Philosophy,,,,0.00,0.00,Roland Barthes,

17
+16,Bastard Culture!: How User Participation Transforms Cultural Production,,,pdf,Media studies,,,,0.00,0.00,Mirko Tobias Schäfer,

18
+17,Beginning Game Development with Python and Pygame,,,pdf,Technical,,,,0.00,0.00,Will McGugan,

19
+18,CSS Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Eric A. Meyer,

20
+19,Camera Lucida: Reflections on Photography,,,pdf,Philosophy,,,,0.00,0.00,Roland Barthes,

21
+20,Cocoa Programming for Mac OS X Second Edition,,,pdf,Technical,,,,0.00,0.00,Aaron Hillegaas,

22
+21,Control and Freedom: Power and Paranoia in the Age of Fiber Optics,,,pdf,desk,,,,0.00,0.00,Wendy Hui Kyong Chun,

23
+22,Convergence culture,,,pdf,Media studies,,,,0.00,0.00,Henry Jenkins,

24
+23,Convergence: The International Journal of Research into New Media Technologies - Volume 12 Number 3 August 2004,,,,Computer culture,,,,0.00,0.00,,

25
+24,Cybernetics & Ghosts,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Italo Calvino,

26
+25,Cyburbia,,,,Media studies,,,,0.00,0.00,James Harkin,

27
+26,DATA browser 01: Economising Culture,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa | Geoff Cox (editors),

28
+27,DATA browser 02: Engineering Culture,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa | Geoff Cox (editors),

29
+28,DATA browser 3: Curating Immateriality,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa (editor),

30
+29,Dark Money: The Hidden History of the Billionairs behind the Rise of the Radical Right,,,EPUB,Media studies,,,,0.00,0.00,Jane Mayer,

31
+30,Data Modeling for Everyone,,,,Technical,,,,0.00,0.00,Sharon Allen,

32
+31,Debt: The First 5000 Years,,,,Science/History,,,,0.00,0.00,David Graeber,

33
+32,Derrida For Beginners,,,pdf,Philosophy,,,,0.00,0.00,Jim Powell | Van Howell,

34
+33,DiY Survival // There is No Subculture Only Subversion,,,pdf,Computer culture,,,,0.00,0.00,Betti Marenko | Leon C6,

35
+34,Dialectic of Enlightenment,,,pdf,Philosophy,,,,0.00,0.00,Max Horkheimer | Theodor Adorno | Gunzelin Noeri | Edmund Jephcott,

36
+35,Digital Culture,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Charlie Gere,

37
+36,Digital Labor,,,pdf,Media studies,,,,0.00,0.00,Trebor Scholz,

38
+37,Digital Prohibition,,,pdf,Computer culture,,,,0.00,0.00,Carolyn Guertin,

39
+38,Discipline and Punish,,,pdf,Philosophy,,,,0.00,0.00,Michel Foucault,

40
+39,Distinction: A Social Critique of the Judgement of Taste,,,,Science/History,,,,0.00,0.00,Pierre Bourdieu,

41
+40,Ethics Subjectivity and Truth,,,pdf,Media studies,,,,0.00,0.00,Michel Foucault,

42
+41,Exploring Humans,,,,Philosophy,,,,0.00,0.00,H. Dooremalen | H. de Regt | MP Schouten,

43
+42,False Dawn: The Delusions of Global Capitalism,,,epub,Science/History,,,,0.00,0.00,John Gray,

44
+43,Formen interaktiver Medienkunst,,,pdf,Computer culture,,,,0.00,0.00,Gendolla | Schmirz | Schneider | Spangenberg (Hg),

45
+44,GNU Emacs Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Debra Cameron,

46
+45,"Game Programming with Python, Lua, and Ruby 1 edition",,,pdf,Technical,,,,0.00,0.00,Gutschmidt T.,

47
+46,Georges Bataille: An Intellectual Biography,,,,Science/History,,,,0.00,0.00,Michel Surya,

48
+47,Getting Gread Sounds: The Microphone Book,,,,Technical,,,,0.00,0.00,Tom Lubin,

49
+48,"Gramophone, Film, Typewriter",,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Friedrich Kittler,

50
+49,Guide to Open Content Licenses,,,pdf,Computer culture,,,,0.00,0.00,Lawrence Liang,

51
+50,Guy Debord and the Situationists International,,,,Art,,,,0.00,0.00,Tom McDonough,

52
+51,HTML Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Jennifer Niederst Robbins,

53
+52,Hardening Network Infrastructure: Bulletproof Your Systems Before You Are Hacked!,,,"chm, pdf",Technical,,,,0.00,0.00,Wes Noonan,

54
+53,Holding On to Reality: The Nature of Information at the Turn of the Millennium,,,pdf,Media studies,,,,0.00,0.00,Albert Borgman,

55
+54,How to Think Like a Computer Scientist,,,pdf,Technical,,,,0.00,0.00,Allen B. Downey | Jeffrey Elkner | Chris Meyers,

56
+55,I Read Where I Am: Exploring New Information Cultures,,,pdf,Desk,,,,0.00,0.00,Andrew Blauvelt (Author) | Mieke Gerritzen (Editor) | Geert Lovink (Editor) | Minke Kampman (Editor),

57
+56,Identity and Difference,,,pdf,Media studies,,,,0.00,0.00,Martin Heidegger,

58
+57,Ideology,,,pdf,Philosophy,,,,0.00,0.00,Terry Eagleton,

59
+58,Information - Documents of Contemporary Art,,,,Media studies,,,,0.00,0.00,Sarah Cook,

60
+59,Instruments and the Imagination,,,,Science/History,,,,0.00,0.00,Hankins & Silverman,

61
+60,Intensive Science and Virtual Philosophy,,,pdf,Philosophy,,,,0.00,0.00,Manuel DeLanda,

62
+61,Interface Culture,,,pdf,Media studies,,,,0.00,0.00,Steven Johnson,

63
+62,Interference: A Grand Scientific Musical Theory,,,,Science/History,,,,0.00,0.00,Richard Merrick,

64
+63,International Picture Language,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Otto Neurath,

65
+64,Introducing Baudrillard,,,pdf,Philosophy,,,,0.00,0.00,Chris Horrocks | Zoran Jevtic,

66
+65,Introducing Foucault,,,pdf,Philosophy,,,,0.00,0.00,Chris Horrocks | Zoran Jevtic,

67
+66,Introducing Kant,,,Philosophy, Andrzej Klimowski,,,,0.00,0.00,Christopher Want,

68
+67,Inventing The Victorians,,,,Science/History,,,,0.00,0.00,Matthew Sweet,

69
+68,Jean Paul A Reader,,,,Media studies,,,,0.00,0.00,Timothy J. Casey (ed.),

70
+69,Kant and the Platypus: Essays on Language and Cognition,,,pdf,Philosophy,,,,0.00,0.00,Umberto Eco | Alastair McEwen,

71
+70,LDAP System Administration,,,pdf,Technical,,,,0.00,0.00,Gerald Carter,

72
+71,Lacan For Beginners,,,pdf,Philosophy,,,,0.00,0.00,Phillip Hill | David Leach,

73
+72,Late Marxism,,,,Philosophy,,,,0.00,0.00,Frederic Jameson,

74
+73,Learning PHP and MYSQL,,,Technical, Jon A Phillips,,,,0.00,0.00,Michele E Davis,

75
+74,Learning Unix for Mac OS X,,,pdf,Technical,,,,0.00,0.00,Dave Taylor | Jerry Peek,

76
+75,Learning the Bash Shell,,,pdf,Technical,,,,0.00,0.00,Cameron Newham | Bill Rosenblatt,

77
+76,Linux System Administration,,,pdf,Technical,,,,0.00,0.00,Tom Adelstein | Bill Lubanovic,

78
+77,Lipstick Traces,,,,Science/History,,,,0.00,0.00,Greil Marcus,

79
+78,Literature Media,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Friedrich Kittler,

80
+79,Logic of Scientific Discovery,,,pdf,Philosophy,,,,0.00,0.00,Popper K.,

81
+80,Loving Big Brother: Surveillance Culture and Performance Space,,,pdf,Media studies,,,,0.00,0.00,John McGrath,

82
+81,Ludwig Wittgenstein,,,pdf,Philosophy,,,,0.00,0.00,Ray Monk,

83
+82,MYSQL In a Nutshell,,,pdf,Technical,,,,0.00,0.00,Russell Dyer,

84
+83,Mac OS X Leopard Edition,,,pdf,Technical,,,,0.00,0.00,David Pogue,

85
+84,Mac OS X Panther for Unix Geeks,,,"chm, pdf",Technical,,,,0.00,0.00,Brian Jepson | Ernest E. Rothman,

86
+85,Managing and Using MYSQL,,,"chm, pdf",Technical,,,,0.00,0.00,Tim King | George Reese | Randy Yarger | Hugh E. Williams | Randy Jay Yarger,

87
+86,Media Ecologies: Materialist Energies in Art and Technoculture,,,pdf,Media studies,,,,0.00,0.00,Matthew Fuller,

88
+87,Media Virus! Hidden Agendas in Popular Culture,,,pdf,Media studies,,,,0.00,0.00,Douglas Rushkoff,

89
+88,"Mind, Machines and Human Consciousness",,,,Science/History,,,,0.00,0.00,Robert Nadeau,

90
+89,Mondotheque: a radiated book / un livre irradiant / een iradierend boek,,,pdf,Computer culture,,,,0.00,0.00,André Castro | Sînziana Păltineanu | Dennis Pohl | Dick Reckard | Natacha Roussel | Femke Snelting | Alexia de Visscher,

91
+90,Mondothèque::a radiated book/un livre irradiant/een irradiërend boek,,,pdf,Media studies,,,,0.00,0.00,Matthew Fuller | Sînziana Păltineanu | Michael Murtaugh | Dennis Pohl | ShinJoung Yeo | Femke Snelting | Natacha Roussel | Dick Reckard | Geraldine Juárez | Tomislav Medak | Marcell Mars | Dušan Barok | Alexia de Visscher,

92
+91,New Media Art,,,,Computer culture,,,,0.00,0.00,Mark Tribe | Reena Jana,

93
+92,On Wine and Hishish,,,,Philosophy,,,,0.00,0.00,Charles Baudelaire,

94
+93,On revolution,,,pdf,Philosophy,,,,0.00,0.00,Hannah Arendt,

95
+94,Orality and Literacy,,,epub,Digital (Steve Trim 2 reading),,,,0.00,0.00,Walter Ong,

96
+95,Organized Networks,,,pdf,Media studies,,,,0.00,0.00,Ned Rossiter,

97
+96,Oulipo Compendium,,,,design / writing / publishing,,,,0.00,0.00,Harry Mathews | Alastair Brotchie,

98
+97,Over Mediatheorie,,,,Media studies,,,,0.00,0.00,Arjen Mulder,

99
+98,Pandora's Hope,,,pdf,Science/History,,,,0.00,0.00,Bruno Latour,

100
+99,Paratexts: Thresholds of Interpretation,,,pdf,"Literature, Culture, Theory ",,,,0.00,0.00,,

101
+100,Perl for Web Site Management,,,,Computer culture,,,,0.00,0.00,,

102
+101,Post Truth,,,,Media studies,,,,0.00,0.00,Matthew d'Ancona,

103
+102,Postscript on the Societies of Control ,,,pdf,Media studies,,,,0.00,0.00,Gilles Deleuze,

104
+103,Present Shock: When Everything Happens Now,,,EPUB,Media studies,,,,0.00,0.00,Douglas Rushkoff,

105
+104,Programming Firefox,,,pdf,Technical,,,,0.00,0.00,Kenneth C Feldt,

106
+105,Protocol,,,pdf,Media studies,,,,0.00,0.00,Alexander R. Galloway,

107
+106,Python Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Mark Lutz,

108
+107,Regular Expression Pocket Reference,,,"chm, pdf",Technical,,,,0.00,0.00,Tony Stubblebine,

109
+108,Rethinking Media Pluralism,,,,Science/History,,,,0.00,0.00,Karppinen,

110
+109,SQL Pocket Guide,,,pdf,Technical,,,,0.00,0.00,Jonathan Gennick,

111
+110,Save and Forget,,,pdf,Media studies,,,,0.00,0.00,Thomas Walskaar,

112
+111,Selections from Cultural Writings,,,,Media studies,,,,0.00,0.00,Antonio Gramsci,

113
+112,Seven Hundred Penguins,,,,design / writing / publishing,,,,0.00,0.00,,

114
+113,Software Studies \ a lexicon,,,pdf,Desk,,,,0.00,0.00,Matthew Fuller,

115
+114,Statements on Appropriation (London Version),,,,Media studies,,,,0.00,0.00,Michaelis Pichler,

116
+115,Structure of the Visual Book,,,,design / writing / publishing,,,,0.00,0.00,Keith Smith,

117
+116,Surrealist Painters and Poets: An Anthology,,,,Art,,,,0.00,0.00,Mary Ann Caws,

118
+117,System and Writing in the Philosophy of Jacques Derrida,,,pdf,Philosophy,,,,0.00,0.00,Christopher Johnson,

119
+118,The Absolute Report: Time Space Code Memory,,,,Art,,,,0.00,0.00,,

120
+119,The Book of Inkscape,,,pdf,Technical,,,,0.00,0.00,Dmitry Kirsanov,

121
+120,The Cathedral & The Bazaar,,,pdf,Computer culture,,,,0.00,0.00,Eric Raymond,

122
+121,The Century,,,pdf,Science/History,,,,0.00,0.00,Alain Badiou,

123
+122,The Chomsky Reader,,,epub,Science/History,,,,0.00,0.00,Noam Chomsky | James Peck (Editor),

124
+123,The Code Book,,,pdf,Computer culture,,,,0.00,0.00,Simon Singh,

125
+124,The Dustbin of History,,,,Science/History,,,,0.00,0.00,Greil Marcus,

126
+125,The Ear of the Other,,,pdf,Media studies,,,,0.00,0.00,Jaques Derrida,

127
+126,The Electronic Revolution,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,William Burroughs,

128
+127,The Enlightenment Reader,,,,Science/History,,,,0.00,0.00,,

129
+128,The Human Condition,,,pdf,Philosophy,,,,0.00,0.00,Hannah Arendt,

130
+129,The Infinite Conversation,,,pdf,Media studies,,,,0.00,0.00,Maurice Blanchot,

131
+130,The Interface Effect,,,pdf,Media studies,,,,0.00,0.00,Alexander R. Galloway,

132
+131,The Internet Is Not The Answer,,,pdf,Media studies,,,,0.00,0.00,Andrew Keen,

133
+132,The Invisible Generation,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,William Burroughs,

134
+133,The Lives of Michel Foucault,,,pdf,Philosophy,,,,0.00,0.00,David Mcey,

135
+134,"The Mag.net reader 3, Processual Publishing. Actual Gesture",,,pdf,Computer culture,,,,0.00,0.00,Alessandro Ludovico | Nat Muller (editors),

136
+135,The New Media Reader,,,pdf,desk,,,,0.00,0.00,Noah Wardrip-Fruin | Nick Montfort (editors),

137
+136,The New Spirit of Capitalism,,,pdf,Science/History,,,,0.00,0.00,Luc Boltanski & Eve Chiapello,

138
+137,The Perfect Crime,,,pdf,Philosophy,,,,0.00,0.00,Jean Baudrillard,

139
+138,The Philosophy of Symbolic Forms,,,pdf,Science/History,,,,0.00,0.00,Ernst Cassirer,

140
+139,"The Political Economy of Media: Enduring Issues, Emerging Dilemmas",,,,Science/History,,,,0.00,0.00,Robert W. McChesney,

141
+140,The Postmodern Turn,,,,Philosophy,,,,0.00,0.00,Best Kellner,

142
+141,The Psychopath Test,,,pdf,Science/History,,,,0.00,0.00,Jon Ronson,

143
+142,The Qmail Handbook,,,pdf,Technical,,,,0.00,0.00,Dave Sill,

144
+143,"The Rise of the Network Society, With a New Preface: Volume I: The Information Age: Economy, Society, and Culture (Information Age Series)",,,"epub, pdf",Desk,,,,0.00,0.00,Manuel Castells,

145
+144,The Selfish Gene,,,pdf,Science/History,,,,0.00,0.00,Richard Dawkins,

146
+145,The Situationist City,,,pdf,Art,,,,0.00,0.00,Simon Sadler,

147
+146,The Society of Mind,,,pdf,Science/History,,,,0.00,0.00,Marvin Minsky,

148
+147,The Ultimate Guide to the Vi and Ex Text Editors,,,,Technical,,,,0.00,0.00,Hewlett-Packard,

149
+148,The Uses of Literacy,,,pdf,design / writing / publishing,,,,0.00,0.00,Richard Hoggart,

150
+149,The World Explained,,,,Media studies,,,,0.00,0.00,Erick Beltran,

151
+150,The World Turned Upside Down: Radical Ideas During the English Revolution,,,pdf,Philosophy,,,,0.00,0.00,Christopher Hill,

152
+151,The culture of connectivity,,,pdf,Media studies,,,,0.00,0.00,Jose van Dijck,

153
+152,The structure of scientific revolutions,,,pdf,Philosophy,,,,0.00,0.00,Thomas S. Kuhn,

154
+153,Things That Talk,,,,Science/History,,,,0.00,0.00,Lorraine Daston (Editor),

155
+154,Travels in hyper reality : essays,,,pdf,Philosophy,,,,0.00,0.00,Umberto Eco | William Weave,

156
+155,Turning Back the Clock,,,,Philosophy,,,,0.00,0.00,Umberto Eco,

157
+156,Uncreative Writing,,,epub,Digital (Steve Trim 2 reading),,,,0.00,0.00,Kenneth Goldsmith,

158
+157,Understanding media economics,,,pdf,Media studies,,,,0.00,0.00,Gillian Doyle,

159
+158,"Urheberrecht im Alltag: Kopieren, bearbeiten, selber machen",,,,Computer culture,,,,0.00,0.00,Valie Djordjevic / Robert A. Gehring / Volker Grassmuck / Till Kreutzer / Matthias Spielkamp (Hrsg.),

160
+159,Walter Benjamin for beginners,,,,Media studies,,,,0.00,0.00,Howard Caygill | Alex Coles | Richard Appignanesi,

161
+160,Walter Benjamin: A Biography,,,,Philosophy,,,,0.00,0.00,Momme Brodersen,

162
+161,Weapons of Math Destruction,,,EPUB,Media studies,,,,0.00,0.00,Cathy O'Neil,

163
+162,Wired for war - Robotics revolution and conflict in the 21st century,,,EPUB,Media studies,,,,0.00,0.00,P. W. Singer,

164
+163,Working with Mediawiki,,,pdf,Technical,,,,0.00,0.00,Yaron Koren,

165
+164,Writing Machines,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Katherine Hayles,

166
+165,exquisite_code,,,book,Desk,,,,0.00,0.00,exquisite_code collective,

167
+166,"iSpace: Printed English after Joyce, Shannon, Derrida",,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Lydia Liu,

168
+167,vi Editor Pocket Reference,,,"epub, pdf",Technical,,,,0.00,0.00,Arnold Robbins,

169
+168,"»Present Continuous Past(s)«: Media Art. Strategies of Presentation, Mediation and Dissemination",,,pdf,Desk,,,,0.00,0.00,Ursula Frohne | Mona Schieren,

170
+169,"»Presents Continuous Past(s)«: Media Art. Strategies of Presentation, Mediation and Dissemination",,,pdf,Desk,,,,0.00,0.00,Ursula Frohne | Mona Schieren | Jean-François Guiton (eds.),


+ 9
- 0
app/forms.py View File

@@ -0,0 +1,9 @@
1
+from flask_wtf import FlaskForm
2
+from wtforms import TextField, TextAreaField, SubmitField, PasswordField, BooleanField
3
+from wtforms.fields.html5 import EmailField
4
+from wtforms.validators import DataRequired, Length, Email
5
+
6
+
7
+class UploadForm(FlaskForm):
8
+    title = TextField('title', validators=[ DataRequired()])
9
+    writingfield = TextAreaField('writingfield', validators = [DataRequired()])

+ 17
- 0
app/models.py View File

@@ -0,0 +1,17 @@
1
+from flask_sqlalchemy import SQLAlchemy
2
+import datetime
3
+from app import app
4
+
5
+db = SQLAlchemy(app)
6
+
7
+class Posts(db.Model):
8
+    pid = db.Column(db.Integer, primary_key=True, autoincrement=True)
9
+    title = db.Column(db.String(100))
10
+    writingfield = db.Column(db.String(1000))
11
+
12
+    def __init__(self, title, writingfield):
13
+        self.title = title
14
+        self.writingfield = writingfield
15
+
16
+
17
+db.create_all()

+ 371
- 0
app/static/css/style.css View File

@@ -0,0 +1,371 @@
1
+@font-face {
2
+    font-family: 'suisse_works';
3
+    src: url('../font/suisseworks-regular-webfont.woff2') format('woff2'),
4
+         url('../font/suisseworks-regular-webfont.woff') format('woff');
5
+    font-weight: normal;
6
+    font-style: normal;
7
+
8
+}
9
+
10
+@font-face {
11
+    font-family: 'suisse_works';
12
+    src: url('../font/suisseworks-bold-webfont.woff2') format('woff2'),
13
+         url('../font/suisseworks-bold-webfont.woff') format('woff');
14
+    font-weight: bold;
15
+    font-style: normal;
16
+
17
+}
18
+
19
+@font-face {
20
+    font-family: 'suisseintl';
21
+    src: url('../font/suisseintl-book-webfont.woff2') format('woff2'),
22
+         url('../font/suisseintl-book-webfont.woff') format('woff');
23
+    font-weight: normal;
24
+    font-style: normal;
25
+
26
+}
27
+body, html{
28
+    margin:0;
29
+    padding:0;
30
+    clear: both;
31
+}
32
+
33
+body{
34
+  width: 100%;
35
+  padding: 0;
36
+  margin: 0;
37
+  background-color: white;
38
+	font-family: 'suisse_works';
39
+  font-weight: normal;
40
+  background-color: #eeeeee;
41
+}
42
+
43
+h1{
44
+  font-size:15px;
45
+  padding: 10px!important;
46
+  margin-left: 10px!important;
47
+    font-weight: normal;
48
+    font-style:italic;
49
+  	font-family: 'suisseintl';
50
+}
51
+.title{
52
+  position: relative;
53
+text-decoration: none!important;
54
+
55
+}
56
+h2{
57
+  font-family: 'suisse_works'!important;
58
+  font-weight: normal;
59
+  font-size: 40px!important;
60
+  margin:0;
61
+  padding:0;
62
+  }
63
+h3{
64
+    font-weight: normal;
65
+  	font-family: 'suisseintl';
66
+    font-size: 30px;
67
+    padding: 10px;
68
+}
69
+
70
+a{color: black;
71
+margin: 0;
72
+padding: 0;}
73
+
74
+li{
75
+  list-style: none;
76
+}
77
+sub{
78
+  font-size: 14px;
79
+  font-weight: normal;
80
+  font-family: 'suisseintl';
81
+  line-height: 19px!important;
82
+  margin: 0;
83
+  padding: 0;
84
+  display: block;
85
+}
86
+
87
+sub *{
88
+    line-height: 10px!important;
89
+}
90
+
91
+
92
+.container{
93
+  padding: 10px;
94
+  padding-top: 0px;
95
+}
96
+
97
+#writingfield{
98
+  display: none;
99
+}
100
+#writing-field{
101
+  font-size: 25px;
102
+  position:relative;
103
+  top:150px;
104
+  left:10%;
105
+  width: 80%;
106
+  min-height: 1200px;
107
+  background-color: white;
108
+  border: 0;
109
+  padding: 50px;
110
+  padding-bottom: 100px;
111
+  margin: 0;
112
+  margin-bottom: 100px;
113
+  box-sizing: border-box;
114
+  word-wrap: break-word;
115
+  -webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
116
+  -moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
117
+  box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
118
+}
119
+#writing-field:focus{
120
+  border: 2px solid blue;
121
+  outline:none;
122
+}
123
+
124
+#writing-field img{
125
+  width: 100%!important;
126
+  height: auto;
127
+}
128
+
129
+.textimage{
130
+  width: 100%!important;
131
+  height: auto;
132
+}
133
+
134
+#type_log{
135
+  position: fixed;
136
+  bottom: 10px;
137
+  left: 10px;
138
+  max-height: 205px;
139
+  vertical-align:bottom;
140
+  width: 50%;
141
+  overflow: scroll;
142
+  word-wrap: break-word;
143
+  font-size: 12px;
144
+  padding: 0;
145
+  margin: 0;
146
+  scrollbar-width: none;
147
+}
148
+#type_log {
149
+  vertical-align:bottom;
150
+}
151
+.incoming{
152
+  position: relative;
153
+  display: inline-block;
154
+  margin-left: -30px;
155
+  margin-right: 10px;
156
+}
157
+
158
+#autocomplete{
159
+  font-family: sans-serif;
160
+  color: grey;
161
+  font-size: 13px;
162
+  background-color:#f2f2f2 ;
163
+  border: 0.5px solid grey;
164
+
165
+
166
+-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
167
+-moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
168
+box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
169
+}
170
+#autocomplete:empty {
171
+border: none;
172
+}
173
+
174
+#autocomplete div{
175
+padding: 5px;
176
+
177
+}
178
+#autocomplete div:hover{
179
+background-color: blue;
180
+color: white;
181
+cursor:pointer;
182
+}
183
+#autocomplete div:hover .incoming{
184
+background-color: blue;
185
+color: white;
186
+cursor:pointer;
187
+}
188
+
189
+.incoming:hover{
190
+background-color: black!important;
191
+color: white;
192
+cursor:pointer;
193
+}
194
+
195
+#autocomplete div:last-child{
196
+border-bottom: none;
197
+}
198
+
199
+#title{
200
+  background:  #eeeeee;
201
+  padding: 0px;
202
+  border: none;
203
+  font-size: 35px;
204
+  display: inline-block;
205
+margin: 0;
206
+position: relative;
207
+top:5px;
208
+box-sizing: border-box;
209
+}
210
+#submit{
211
+  padding: 10px;
212
+  box-sizing: border-box;
213
+  border:2px solid #d9d9d9;
214
+    display: inline-block;
215
+  cursor: pointer;
216
+  margin: 0;
217
+}
218
+#submit:hover{
219
+  background-color: yellow;
220
+
221
+}
222
+
223
+#topbar{
224
+position: fixed;
225
+top:0;
226
+left: 0;
227
+width: 110%;
228
+box-sizing: border-box;
229
+z-index: 999;
230
+background: white;
231
+}
232
+#topbar form{
233
+margin:10px;
234
+
235
+}
236
+
237
+#toolbar{
238
+
239
+line-height: 30px;
240
+  font-size: 12px;
241
+  z-index: 999999;
242
+margin-top: 10px;
243
+ border-top: 1px solid #AAA;
244
+ border-bottom: 1px solid #AAA;
245
+
246
+}
247
+
248
+#toolbar a{
249
+
250
+  text-decoration: none;
251
+  padding:5px;
252
+
253
+
254
+  margin-left: 10px;
255
+}
256
+
257
+#toolbar a:hover{
258
+  background-color: lightgrey;
259
+}
260
+
261
+
262
+#upload_img{
263
+position:absolute;
264
+top:20px;
265
+left:200px;
266
+z-index: 9999999;
267
+font-family: 'suisseintl';
268
+background-color: yellow;
269
+padding: 20px;
270
+display: none;
271
+  border: 1px solid #AAA;
272
+   background: #FFF;
273
+}
274
+
275
+#code_insert{
276
+  position:absolute;
277
+  top:20px;
278
+  left:200px;
279
+  z-index: 9999999;
280
+  font-family: 'suisseintl';
281
+  background-color: yellow;
282
+  padding: 20px;
283
+display: none;
284
+    border: 1px solid #AAA;
285
+     background: #FFF;
286
+}
287
+
288
+#code_insert pre{
289
+  min-width: 200px;
290
+  min-height: 100px;
291
+  background-color: #AAA;
292
+}
293
+
294
+.post{
295
+  margin: 0;
296
+  padding: 0;
297
+  box-sizing: border-box;
298
+  padding: 10px;
299
+  width: 100%;
300
+  word-wrap: break-word;
301
+  font-family: "suisseintl";
302
+  font-size: 25px;
303
+  line-height: 40px;
304
+}
305
+
306
+.post img{
307
+width: 100%;
308
+}
309
+.post p{
310
+  font-family: "suisseintl";
311
+  font-size: 25px;
312
+  line-height: 40px;
313
+
314
+}
315
+
316
+.post div{
317
+  font-family: "suisseintl";
318
+  font-size: 25px;
319
+  line-height: 40px;
320
+
321
+}
322
+
323
+
324
+.post pre{
325
+  font-size: 12px!important;
326
+  word-wrap: break-word!important;
327
+  font-family: monospace!important;
328
+  background-color: lightgrey;
329
+  width: 100%;
330
+}
331
+
332
+.post code{
333
+  line-height: 12px;
334
+  font-size: 12px!important;
335
+  font-family: monospace!important;
336
+  background-color: lightgrey;
337
+  width: 100%;
338
+  padding: 5px;
339
+
340
+  white-space: pre;
341
+  word-break: normal;
342
+  word-wrap:break-word;
343
+}
344
+
345
+.post *{
346
+  word-wrap: break-word;
347
+}
348
+
349
+.linkTo {
350
+  position: relative;
351
+  font-size: 9px;
352
+  font-family:"suisseintl";
353
+
354
+}
355
+
356
+#index{
357
+  display: block;
358
+margin-top: 20px;
359
+  bottom:10px;
360
+  padding: 20px;
361
+
362
+}
363
+
364
+#secondframe{
365
+  width: 50%;
366
+  position: absolute;
367
+  left: 50%;
368
+  top:0;
369
+ height: 100%;
370
+  border:none;
371
+}

BIN
app/static/font/suisseintl-book-webfont.ttf View File


BIN
app/static/font/suisseintl-book-webfont.woff View File


BIN
app/static/font/suisseintl-book-webfont.woff2 View File


BIN
app/static/font/suisseworks-bold-webfont.woff View File


BIN
app/static/font/suisseworks-bold-webfont.woff2 View File


BIN
app/static/font/suisseworks-regular-webfont.woff View File


BIN
app/static/font/suisseworks-regular-webfont.woff2 View File


+ 155
- 0
app/static/index.js View File

@@ -0,0 +1,155 @@
1
+/* jshint browser: true */
2
+
3
+(function () {
4
+
5
+// We'll copy the properties below into the mirror div.
6
+// Note that some browsers, such as Firefox, do not concatenate properties
7
+// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),
8
+// so we have to list every single property explicitly.
9
+var properties = [
10
+  'direction',  // RTL support
11
+  'boxSizing',
12
+  'width',  // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does
13
+  'height',
14
+  'overflowX',
15
+  'overflowY',  // copy the scrollbar for IE
16
+
17
+  'borderTopWidth',
18
+  'borderRightWidth',
19
+  'borderBottomWidth',
20
+  'borderLeftWidth',
21
+  'borderStyle',
22
+
23
+  'paddingTop',
24
+  'paddingRight',
25
+  'paddingBottom',
26
+  'paddingLeft',
27
+
28
+  // https://developer.mozilla.org/en-US/docs/Web/CSS/font
29
+  'fontStyle',
30
+  'fontVariant',
31
+  'fontWeight',
32
+  'fontStretch',
33
+  'fontSize',
34
+  'fontSizeAdjust',
35
+  'lineHeight',
36
+  'fontFamily',
37
+
38
+  'textAlign',
39
+  'textTransform',
40
+  'textIndent',
41
+  'textDecoration',  // might not make a difference, but better be safe
42
+
43
+  'letterSpacing',
44
+  'wordSpacing',
45
+
46
+  'tabSize',
47
+  'MozTabSize'
48
+
49
+];
50
+
51
+var isBrowser = (typeof window !== 'undefined');
52
+var isFirefox = (isBrowser && window.mozInnerScreenX != null);
53
+
54
+function getCaretCoordinates(element, position, options) {
55
+  if (!isBrowser) {
56
+    throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');
57
+  }
58
+
59
+  var debug = options && options.debug || false;
60
+  if (debug) {
61
+    var el = document.querySelector('#input-textarea-caret-position-mirror-div');
62
+    if (el) el.parentNode.removeChild(el);
63
+  }
64
+
65
+  // The mirror div will replicate the textarea's style
66
+  var div = document.createElement('div');
67
+  div.id = 'input-textarea-caret-position-mirror-div';
68
+  document.body.appendChild(div);
69
+
70
+  var style = div.style;
71
+  var computed = window.getComputedStyle ? window.getComputedStyle(element) : element.currentStyle;  // currentStyle for IE < 9
72
+  var isInput = element.nodeName === 'INPUT';
73
+
74
+  // Default textarea styles
75
+  style.whiteSpace = 'pre-wrap';
76
+  if (!isInput)
77
+    style.wordWrap = 'break-word';  // only for textarea-s
78
+
79
+  // Position off-screen
80
+  style.position = 'absolute';  // required to return coordinates properly
81
+  if (!debug)
82
+    style.visibility = 'hidden';  // not 'display: none' because we want rendering
83
+
84
+  // Transfer the element's properties to the div
85
+  properties.forEach(function (prop) {
86
+    if (isInput && prop === 'lineHeight') {
87
+      // Special case for <input>s because text is rendered centered and line height may be != height
88
+      if (computed.boxSizing === "border-box") {
89
+        var height = parseInt(computed.height);
90
+        var outerHeight =
91
+          parseInt(computed.paddingTop) +
92
+          parseInt(computed.paddingBottom) +
93
+          parseInt(computed.borderTopWidth) +
94
+          parseInt(computed.borderBottomWidth);
95
+        var targetHeight = outerHeight + parseInt(computed.lineHeight);
96
+        if (height > targetHeight) {
97
+          style.lineHeight = height - outerHeight + "px";
98
+        } else if (height === targetHeight) {
99
+          style.lineHeight = computed.lineHeight;
100
+        } else {
101
+          style.lineHeight = 0;
102
+        }
103
+      } else {
104
+        style.lineHeight = computed.height;
105
+      }
106
+    } else {
107
+      style[prop] = computed[prop];
108
+    }
109
+  });
110
+
111
+  if (isFirefox) {
112
+    // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275
113
+    if (element.scrollHeight > parseInt(computed.height))
114
+      style.overflowY = 'scroll';
115
+  } else {
116
+    style.overflow = 'hidden';  // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'
117
+  }
118
+
119
+  div.textContent = element.value.substring(0, position);
120
+  // The second special handling for input type="text" vs textarea:
121
+  // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037
122
+  if (isInput)
123
+    div.textContent = div.textContent.replace(/\s/g, '\u00a0');
124
+
125
+  var span = document.createElement('span');
126
+  // Wrapping must be replicated *exactly*, including when a long word gets
127
+  // onto the next line, with whitespace at the end of the line before (#7).
128
+  // The  *only* reliable way to do that is to copy the *entire* rest of the
129
+  // textarea's content into the <span> created at the caret position.
130
+  // For inputs, just '.' would be enough, but no need to bother.
131
+  span.textContent = element.value.substring(position) || '.';  // || because a completely empty faux span doesn't render at all
132
+  div.appendChild(span);
133
+
134
+  var coordinates = {
135
+    top: span.offsetTop + parseInt(computed['borderTopWidth']),
136
+    left: span.offsetLeft + parseInt(computed['borderLeftWidth']),
137
+    height: parseInt(computed['lineHeight'])
138
+  };
139
+
140
+  if (debug) {
141
+    span.style.backgroundColor = '#aaa';
142
+  } else {
143
+    document.body.removeChild(div);
144
+  }
145
+
146
+  return coordinates;
147
+}
148
+
149
+if (typeof module != 'undefined' && typeof module.exports != 'undefined') {
150
+  module.exports = getCaretCoordinates;
151
+} else if(isBrowser) {
152
+  window.getCaretCoordinates = getCaretCoordinates;
153
+}
154
+
155
+}());

+ 625
- 0
app/static/notify.js View File

@@ -0,0 +1,625 @@
1
+/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
2
+(function (factory) {
3
+	// UMD start
4
+	// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
5
+	if (typeof define === 'function' && define.amd) {
6
+		// AMD. Register as an anonymous module.
7
+		define(['jquery'], factory);
8
+	} else if (typeof module === 'object' && module.exports) {
9
+		// Node/CommonJS
10
+		module.exports = function( root, jQuery ) {
11
+			if ( jQuery === undefined ) {
12
+				// require('jQuery') returns a factory that requires window to
13
+				// build a jQuery instance, we normalize how we use modules
14
+				// that require this pattern but the window provided is a noop
15
+				// if it's defined (how jquery works)
16
+				if ( typeof window !== 'undefined' ) {
17
+					jQuery = require('jquery');
18
+				}
19
+				else {
20
+					jQuery = require('jquery')(root);
21
+				}
22
+			}
23
+			factory(jQuery);
24
+			return jQuery;
25
+		};
26
+	} else {
27
+		// Browser globals
28
+		factory(jQuery);
29
+	}
30
+}(function ($) {
31
+	//IE8 indexOf polyfill
32
+	var indexOf = [].indexOf || function(item) {
33
+		for (var i = 0, l = this.length; i < l; i++) {
34
+			if (i in this && this[i] === item) {
35
+				return i;
36
+			}
37
+		}
38
+		return -1;
39
+	};
40
+
41
+	var pluginName = "notify";
42
+	var pluginClassName = pluginName + "js";
43
+	var blankFieldName = pluginName + "!blank";
44
+
45
+	var positions = {
46
+		t: "top",
47
+		m: "middle",
48
+		b: "bottom",
49
+		l: "left",
50
+		c: "center",
51
+		r: "right"
52
+	};
53
+	var hAligns = ["l", "c", "r"];
54
+	var vAligns = ["t", "m", "b"];
55
+	var mainPositions = ["t", "b", "l", "r"];
56
+	var opposites = {
57
+		t: "b",
58
+		m: null,
59
+		b: "t",
60
+		l: "r",
61
+		c: null,
62
+		r: "l"
63
+	};
64
+
65
+	var parsePosition = function(str) {
66
+		var pos;
67
+		pos = [];
68
+		$.each(str.split(/\W+/), function(i, word) {
69
+			var w;
70
+			w = word.toLowerCase().charAt(0);
71
+			if (positions[w]) {
72
+				return pos.push(w);
73
+			}
74
+		});
75
+		return pos;
76
+	};
77
+
78
+	var styles = {};
79
+
80
+	var coreStyle = {
81
+		name: "core",
82
+		html: "<div class=\"" + pluginClassName + "-wrapper\">\n	<div class=\"" + pluginClassName + "-arrow\"></div>\n	<div class=\"" + pluginClassName + "-container\"></div>\n</div>",
83
+		css: "." + pluginClassName + "-corner {\n	position: fixed;\n	margin: 5px;\n	z-index: 1050;\n}\n\n." + pluginClassName + "-corner ." + pluginClassName + "-wrapper,\n." + pluginClassName + "-corner ." + pluginClassName + "-container {\n	position: relative;\n	display: block;\n	height: inherit;\n	width: inherit;\n	margin: 3px;\n}\n\n." + pluginClassName + "-wrapper {\n	z-index: 1;\n	position: absolute;\n	display: inline-block;\n	height: 0;\n	width: 0;\n}\n\n." + pluginClassName + "-container {\n	display: none;\n	z-index: 1;\n	position: absolute;\n}\n\n." + pluginClassName + "-hidable {\n	cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n	position: relative;\n}\n\n." + pluginClassName + "-arrow {\n	position: absolute;\n	z-index: 2;\n	width: 0;\n	height: 0;\n}"
84
+	};
85
+
86
+	var stylePrefixes = {
87
+		"border-radius": ["-webkit-", "-moz-"]
88
+	};
89
+
90
+	var getStyle = function(name) {
91
+		return styles[name];
92
+	};
93
+
94
+	var removeStyle = function(name) {
95
+		if (!name) {
96
+			throw "Missing Style name";
97
+		}
98
+		if (styles[name]) {
99
+			delete styles[name];
100
+		}
101
+	};
102
+
103
+	var addStyle = function(name, def) {
104
+		if (!name) {
105
+			throw "Missing Style name";
106
+		}
107
+		if (!def) {
108
+			throw "Missing Style definition";
109
+		}
110
+		if (!def.html) {
111
+			throw "Missing Style HTML";
112
+		}
113
+		//remove existing style
114
+		var existing = styles[name];
115
+		if (existing && existing.cssElem) {
116
+			if (window.console) {
117
+				console.warn(pluginName + ": overwriting style '" + name + "'");
118
+			}
119
+			styles[name].cssElem.remove();
120
+		}
121
+		def.name = name;
122
+		styles[name] = def;
123
+		var cssText = "";
124
+		if (def.classes) {
125
+			$.each(def.classes, function(className, props) {
126
+				cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
127
+				$.each(props, function(name, val) {
128
+					if (stylePrefixes[name]) {
129
+						$.each(stylePrefixes[name], function(i, prefix) {
130
+							return cssText += "	" + prefix + name + ": " + val + ";\n";
131
+						});
132
+					}
133
+					return cssText += "	" + name + ": " + val + ";\n";
134
+				});
135
+				return cssText += "}\n";
136
+			});
137
+		}
138
+		if (def.css) {
139
+			cssText += "/* styles for " + def.name + " */\n" + def.css;
140
+		}
141
+		if (cssText) {
142
+			def.cssElem = insertCSS(cssText);
143
+			def.cssElem.attr("id", "notify-" + def.name);
144
+		}
145
+		var fields = {};
146
+		var elem = $(def.html);
147
+		findFields("html", elem, fields);
148
+		findFields("text", elem, fields);
149
+		def.fields = fields;
150
+	};
151
+
152
+	var insertCSS = function(cssText) {
153
+		var e, elem, error;
154
+		elem = createElem("style");
155
+		elem.attr("type", 'text/css');
156
+		$("head").append(elem);
157
+		try {
158
+			elem.html(cssText);
159
+		} catch (_) {
160
+			elem[0].styleSheet.cssText = cssText;
161
+		}
162
+		return elem;
163
+	};
164
+
165
+	var findFields = function(type, elem, fields) {
166
+		var attr;
167
+		if (type !== "html") {
168
+			type = "text";
169
+		}
170
+		attr = "data-notify-" + type;
171
+		return find(elem, "[" + attr + "]").each(function() {
172
+			var name;
173
+			name = $(this).attr(attr);
174
+			if (!name) {
175
+				name = blankFieldName;
176
+			}
177
+			fields[name] = type;
178
+		});
179
+	};
180
+
181
+	var find = function(elem, selector) {
182
+		if (elem.is(selector)) {
183
+			return elem;
184
+		} else {
185
+			return elem.find(selector);
186
+		}
187
+	};
188
+
189
+	var pluginOptions = {
190
+		clickToHide: true,
191
+		autoHide: true,
192
+		autoHideDelay: 5000,
193
+		arrowShow: true,
194
+		arrowSize: 5,
195
+		breakNewLines: true,
196
+		elementPosition: "bottom",
197
+		globalPosition: "top right",
198
+		style: "bootstrap",
199
+		className: "error",
200
+		showAnimation: "slideDown",
201
+		showDuration: 400,
202
+		hideAnimation: "slideUp",
203
+		hideDuration: 200,
204
+		gap: 5
205
+	};
206
+
207
+	var inherit = function(a, b) {
208
+		var F;
209
+		F = function() {};
210
+		F.prototype = a;
211
+		return $.extend(true, new F(), b);
212
+	};
213
+
214
+	var defaults = function(opts) {
215
+		return $.extend(pluginOptions, opts);
216
+	};
217
+
218
+	var createElem = function(tag) {
219
+		return $("<" + tag + "></" + tag + ">");
220
+	};
221
+
222
+	var globalAnchors = {};
223
+
224
+	var getAnchorElement = function(element) {
225
+		var radios;
226
+		if (element.is('[type=radio]')) {
227
+			radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
228
+				return $(e).attr("name") === element.attr("name");
229
+			});
230
+			element = radios.first();
231
+		}
232
+		return element;
233
+	};
234
+
235
+	var incr = function(obj, pos, val) {
236
+		var opp, temp;
237
+		if (typeof val === "string") {
238
+			val = parseInt(val, 10);
239
+		} else if (typeof val !== "number") {
240
+			return;
241
+		}
242
+		if (isNaN(val)) {
243
+			return;
244
+		}
245
+		opp = positions[opposites[pos.charAt(0)]];
246
+		temp = pos;
247
+		if (obj[opp] !== undefined) {
248
+			pos = positions[opp.charAt(0)];
249
+			val = -val;
250
+		}
251
+		if (obj[pos] === undefined) {
252
+			obj[pos] = val;
253
+		} else {
254
+			obj[pos] += val;
255
+		}
256
+		return null;
257
+	};
258
+
259
+	var realign = function(alignment, inner, outer) {
260
+		if (alignment === "l" || alignment === "t") {
261
+			return 0;
262
+		} else if (alignment === "c" || alignment === "m") {
263
+			return outer / 2 - inner / 2;
264
+		} else if (alignment === "r" || alignment === "b") {
265
+			return outer - inner;
266
+		}
267
+		throw "Invalid alignment";
268
+	};
269
+
270
+	var encode = function(text) {
271
+		encode.e = encode.e || createElem("div");
272
+		return encode.e.text(text).html();
273
+	};
274
+
275
+	function Notification(elem, data, options) {
276
+		if (typeof options === "string") {
277
+			options = {
278
+				className: options
279
+			};
280
+		}
281
+		this.options = inherit(pluginOptions, $.isPlainObject(options) ? options : {});
282
+		this.loadHTML();
283
+		this.wrapper = $(coreStyle.html);
284
+		if (this.options.clickToHide) {
285
+			this.wrapper.addClass(pluginClassName + "-hidable");
286
+		}
287
+		this.wrapper.data(pluginClassName, this);
288
+		this.arrow = this.wrapper.find("." + pluginClassName + "-arrow");
289
+		this.container = this.wrapper.find("." + pluginClassName + "-container");
290
+		this.container.append(this.userContainer);
291
+		if (elem && elem.length) {
292
+			this.elementType = elem.attr("type");
293
+			this.originalElement = elem;
294
+			this.elem = getAnchorElement(elem);
295
+			this.elem.data(pluginClassName, this);
296
+			this.elem.before(this.wrapper);
297
+		}
298
+		this.container.hide();
299
+		this.run(data);
300
+	}
301
+
302
+	Notification.prototype.loadHTML = function() {
303
+		var style;
304
+		style = this.getStyle();
305
+		this.userContainer = $(style.html);
306
+		this.userFields = style.fields;
307
+	};
308
+
309
+	Notification.prototype.show = function(show, userCallback) {
310
+		var args, callback, elems, fn, hidden;
311
+		callback = (function(_this) {
312
+			return function() {
313
+				if (!show && !_this.elem) {
314
+					_this.destroy();
315
+				}
316
+				if (userCallback) {
317
+					return userCallback();
318
+				}
319
+			};
320
+		})(this);
321
+		hidden = this.container.parent().parents(':hidden').length > 0;
322
+		elems = this.container.add(this.arrow);
323
+		args = [];
324
+		if (hidden && show) {
325
+			fn = "show";
326
+		} else if (hidden && !show) {
327
+			fn = "hide";
328
+		} else if (!hidden && show) {
329
+			fn = this.options.showAnimation;
330
+			args.push(this.options.showDuration);
331
+		} else if (!hidden && !show) {
332
+			fn = this.options.hideAnimation;
333
+			args.push(this.options.hideDuration);
334
+		} else {
335
+			return callback();
336
+		}
337
+		args.push(callback);
338
+		return elems[fn].apply(elems, args);
339
+	};
340
+
341
+	Notification.prototype.setGlobalPosition = function() {
342
+		var p = this.getPosition();
343
+		var pMain = p[0];
344
+		var pAlign = p[1];
345
+		var main = positions[pMain];
346
+		var align = positions[pAlign];
347
+		var key = pMain + "|" + pAlign;
348
+		var anchor = globalAnchors[key];
349
+		if (!anchor || !document.body.contains(anchor[0])) {
350
+			anchor = globalAnchors[key] = createElem("div");
351
+			var css = {};
352
+			css[main] = 0;
353
+			if (align === "middle") {
354
+				css.top = '45%';
355
+			} else if (align === "center") {
356
+				css.left = '45%';
357
+			} else {
358
+				css[align] = 0;
359
+			}
360
+			anchor.css(css).addClass(pluginClassName + "-corner");
361
+			$("body").append(anchor);
362
+		}
363
+		return anchor.prepend(this.wrapper);
364
+	};
365
+
366
+	Notification.prototype.setElementPosition = function() {
367
+		var arrowColor, arrowCss, arrowSize, color, contH, contW, css, elemH, elemIH, elemIW, elemPos, elemW, gap, j, k, len, len1, mainFull, margin, opp, oppFull, pAlign, pArrow, pMain, pos, posFull, position, ref, wrapPos;
368
+		position = this.getPosition();
369
+		pMain = position[0];
370
+		pAlign = position[1];
371
+		pArrow = position[2];
372
+		elemPos = this.elem.position();
373
+		elemH = this.elem.outerHeight();
374
+		elemW = this.elem.outerWidth();
375
+		elemIH = this.elem.innerHeight();
376
+		elemIW = this.elem.innerWidth();
377
+		wrapPos = this.wrapper.position();
378
+		contH = this.container.height();
379
+		contW = this.container.width();
380
+		mainFull = positions[pMain];
381
+		opp = opposites[pMain];
382
+		oppFull = positions[opp];
383
+		css = {};
384
+		css[oppFull] = pMain === "b" ? elemH : pMain === "r" ? elemW : 0;
385
+		incr(css, "top", elemPos.top - wrapPos.top);
386
+		incr(css, "left", elemPos.left - wrapPos.left);
387
+		ref = ["top", "left"];
388
+		for (j = 0, len = ref.length; j < len; j++) {
389
+			pos = ref[j];
390
+			margin = parseInt(this.elem.css("margin-" + pos), 10);
391
+			if (margin) {
392
+				incr(css, pos, margin);
393
+			}
394
+		}
395
+		gap = Math.max(0, this.options.gap - (this.options.arrowShow ? arrowSize : 0));
396
+		incr(css, oppFull, gap);
397
+		if (!this.options.arrowShow) {
398
+			this.arrow.hide();
399
+		} else {
400
+			arrowSize = this.options.arrowSize;
401
+			arrowCss = $.extend({}, css);
402
+			arrowColor = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
403
+			for (k = 0, len1 = mainPositions.length; k < len1; k++) {
404
+				pos = mainPositions[k];
405
+				posFull = positions[pos];
406
+				if (pos === opp) {
407
+					continue;
408
+				}
409
+				color = posFull === mainFull ? arrowColor : "transparent";
410
+				arrowCss["border-" + posFull] = arrowSize + "px solid " + color;
411
+			}
412
+			incr(css, positions[opp], arrowSize);
413
+			if (indexOf.call(mainPositions, pAlign) >= 0) {
414
+				incr(arrowCss, positions[pAlign], arrowSize * 2);
415
+			}
416
+		}
417
+		if (indexOf.call(vAligns, pMain) >= 0) {
418
+			incr(css, "left", realign(pAlign, contW, elemW));
419
+			if (arrowCss) {
420
+				incr(arrowCss, "left", realign(pAlign, arrowSize, elemIW));
421
+			}
422
+		} else if (indexOf.call(hAligns, pMain) >= 0) {
423
+			incr(css, "top", realign(pAlign, contH, elemH));
424
+			if (arrowCss) {
425
+				incr(arrowCss, "top", realign(pAlign, arrowSize, elemIH));
426
+			}
427
+		}
428
+		if (this.container.is(":visible")) {
429
+			css.display = "block";
430
+		}
431
+		this.container.removeAttr("style").css(css);
432
+		if (arrowCss) {
433
+			return this.arrow.removeAttr("style").css(arrowCss);
434
+		}
435
+	};
436
+
437
+	Notification.prototype.getPosition = function() {
438
+		var pos, ref, ref1, ref2, ref3, ref4, ref5, text;
439
+		text = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition);
440
+		pos = parsePosition(text);
441
+		if (pos.length === 0) {
442
+			pos[0] = "b";
443
+		}
444
+		if (ref = pos[0], indexOf.call(mainPositions, ref) < 0) {
445
+			throw "Must be one of [" + mainPositions + "]";
446
+		}
447
+		if (pos.length === 1 || ((ref1 = pos[0], indexOf.call(vAligns, ref1) >= 0) && (ref2 = pos[1], indexOf.call(hAligns, ref2) < 0)) || ((ref3 = pos[0], indexOf.call(hAligns, ref3) >= 0) && (ref4 = pos[1], indexOf.call(vAligns, ref4) < 0))) {
448
+			pos[1] = (ref5 = pos[0], indexOf.call(hAligns, ref5) >= 0) ? "m" : "l";
449
+		}
450
+		if (pos.length === 2) {
451
+			pos[2] = pos[1];
452
+		}
453
+		return pos;
454
+	};
455
+
456
+	Notification.prototype.getStyle = function(name) {
457
+		var style;
458
+		if (!name) {
459
+			name = this.options.style;
460
+		}
461
+		if (!name) {
462
+			name = "default";
463
+		}
464
+		style = styles[name];
465
+		if (!style) {
466
+			throw "Missing style: " + name;
467
+		}
468
+		return style;
469
+	};
470
+
471
+	Notification.prototype.updateClasses = function() {
472
+		var classes, style;
473
+		classes = ["base"];
474
+		if ($.isArray(this.options.className)) {
475
+			classes = classes.concat(this.options.className);
476
+		} else if (this.options.className) {
477
+			classes.push(this.options.className);
478
+		}
479
+		style = this.getStyle();
480
+		classes = $.map(classes, function(n) {
481
+			return pluginClassName + "-" + style.name + "-" + n;
482
+		}).join(" ");
483
+		return this.userContainer.attr("class", classes);
484
+	};
485
+
486
+	Notification.prototype.run = function(data, options) {
487
+		var d, datas, name, type, value;
488
+		if ($.isPlainObject(options)) {
489
+			$.extend(this.options, options);
490
+		} else if ($.type(options) === "string") {
491
+			this.options.className = options;
492
+		}
493
+		if (this.container && !data) {
494
+			this.show(false);
495
+			return;
496
+		} else if (!this.container && !data) {
497
+			return;
498
+		}
499
+		datas = {};
500
+		if ($.isPlainObject(data)) {
501
+			datas = data;
502
+		} else {
503
+			datas[blankFieldName] = data;
504
+		}
505
+		for (name in datas) {
506
+			d = datas[name];
507
+			type = this.userFields[name];
508
+			if (!type) {
509
+				continue;
510
+			}
511
+			if (type === "text") {
512
+				d = encode(d);
513
+				if (this.options.breakNewLines) {
514
+					d = d.replace(/\n/g, '<br/>');
515
+				}
516
+			}
517
+			value = name === blankFieldName ? '' : '=' + name;
518
+			find(this.userContainer, "[data-notify-" + type + value + "]").html(d);
519
+		}
520
+		this.updateClasses();
521
+		if (this.elem) {
522
+			this.setElementPosition();
523
+		} else {
524
+			this.setGlobalPosition();
525
+		}
526
+		this.show(true);
527
+		if (this.options.autoHide) {
528
+			clearTimeout(this.autohideTimer);
529
+			this.autohideTimer = setTimeout(this.show.bind(this, false), this.options.autoHideDelay);
530
+		}
531
+	};
532
+
533
+	Notification.prototype.destroy = function() {
534
+		this.wrapper.data(pluginClassName, null);
535
+		this.wrapper.remove();
536
+	};
537
+
538
+	$[pluginName] = function(elem, data, options) {
539
+		if ((elem && elem.nodeName) || elem.jquery) {
540
+			$(elem)[pluginName](data, options);
541
+		} else {
542
+			options = data;
543
+			data = elem;
544
+			new Notification(null, data, options);
545
+		}
546
+		return elem;
547
+	};
548
+
549
+	$.fn[pluginName] = function(data, options) {
550
+		$(this).each(function() {
551
+			var prev = getAnchorElement($(this)).data(pluginClassName);
552
+			if (prev) {
553
+				prev.destroy();
554
+			}
555
+			var curr = new Notification($(this), data, options);
556
+		});
557
+		return this;
558
+	};
559
+
560
+	$.extend($[pluginName], {
561
+		defaults: defaults,
562
+		addStyle: addStyle,
563
+		removeStyle: removeStyle,
564
+		pluginOptions: pluginOptions,
565
+		getStyle: getStyle,
566
+		insertCSS: insertCSS
567
+	});
568
+
569
+	//always include the default bootstrap style
570
+	addStyle("bootstrap", {
571
+		html: "<div>\n<span data-notify-text></span>\n</div>",
572
+		classes: {
573
+			base: {
574
+				"font-weight": "bold",
575
+				"padding": "8px 15px 8px 14px",
576
+				"text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
577
+				"background-color": "#fcf8e3",
578
+				"border": "1px solid #fbeed5",
579
+				"border-radius": "4px",
580
+				"white-space": "nowrap",
581
+				"padding-left": "25px",
582
+				"background-repeat": "no-repeat",
583
+				"background-position": "3px 7px"
584
+			},
585
+			error: {
586
+				"color": "#B94A48",
587
+				"background-color": "#F2DEDE",
588
+				"border-color": "#EED3D7",
589
+				"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)"
590
+			},
591
+			success: {
592
+				"color": "#468847",
593
+				"background-color": "#DFF0D8",
594
+				"border-color": "#D6E9C6",
595
+				"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLSQWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)"
596
+			},
597
+			info: {
598
+				"color": "#3A87AD",
599
+				"background-color": "#D9EDF7",
600
+				"border-color": "#BCE8F1",
601
+				"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzgnBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)"
602
+			},
603
+			warn: {
604
+				"color": "#C09853",
605
+				"background-color": "#FCF8E3",
606
+				"border-color": "#FBEED5",
607
+				"background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)"
608
+			}
609
+		}
610
+	});
611
+
612
+	$(function() {
613
+		insertCSS(coreStyle.css).attr("id", "core-notify");
614
+		$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
615
+			$(this).trigger("notify-hide");
616
+		});
617
+		$(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
618
+			var elem = $(this).data(pluginClassName);
619
+			if(elem) {
620
+				elem.show(false);
621
+			}
622
+		});
623
+	});
624
+
625
+}));

+ 15
- 0
app/templates/all.html View File

@@ -0,0 +1,15 @@
1
+{% extends 'base.html' %}
2
+
3
+{% block main %}
4
+
5
+
6
+    {% for post in posts %}
7
+
8
+        <span><a href="{{ post.pid }}"><h2>{{ post.title }}</h2></a>
9
+        <!--  <p>{{ post.writingfield }}<p>--></span>
10
+      {% else %}
11
+        <em>No entries here so far</em>
12
+      {% endfor %}
13
+
14
+
15
+{% endblock %}

+ 127
- 0
app/templates/base.html View File

@@ -0,0 +1,127 @@
1
+<!--
2
+______   ______     ______     ______   __     ______
3
+/\  == \ /\  __ \   /\  ___\   /\__  _\ /\ \   /\  ___\
4
+\ \  _-/ \ \ \/\ \  \ \  __\   \/_/\ \/ \ \ \  \ \ \____
5
+\ \_\    \ \_____\  \ \_____\    \ \_\  \ \_\  \ \_____\
6
+ \/_/     \/_____/   \/_____/     \/_/   \/_/   \/_____/
7
+
8
+   ______     ______     ______   ______   __     __     ______     ______     ______
9
+  /\  ___\   /\  __ \   /\  ___\ /\__  _\ /\ \  _ \ \   /\  __ \   /\  == \   /\  ___\
10
+  \ \___  \  \ \ \/\ \  \ \  __\ \/_/\ \/ \ \ \/ ".\ \  \ \  __ \  \ \  __<   \ \  __\
11
+   \/\_____\  \ \_____\  \ \_\      \ \_\  \ \__/".~\_\  \ \_\ \_\  \ \_\ \_\  \ \_____\
12
+   \/_____/   \/_____/   \/_/       \/_/   \/_/   \/_/   \/_/\/_/   \/_/ /_/   \/_____/
13
+
14
+-->
15
+<!DOCTYPE html>
16
+<html lang="en">
17
+  <head>
18
+    <meta charset="utf-8">
19
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
20
+    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
21
+    <meta name="viewport" content="width=device-width, initial-scale=1">
22
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
23
+    <title>Poetic Software</title>
24
+
25
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
26
+
27
+    <script src="index.js"></script>
28
+      <script src="/static/notify.js"></script>
29
+      <link rel="stylesheet"
30
+            href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/styles/default.min.css">
31
+      <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/highlight.min.js"></script>
32
+
33
+      <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css">
34
+    <link rel="stylesheet" href="/static/css/style.css">
35
+    {% block css %} {% endblock%}
36
+  </head>
37
+  <body>
38
+    {% with messages = get_flashed_messages() %}
39
+      {% if messages %}
40
+        <ul class=flashes>
41
+        {% for message in messages %}
42
+          <li>{{ message }}</li>
43
+        {% endfor %}
44
+        </ul>
45
+      {% endif %}
46
+    {% endwith %}
47
+    <main>
48
+<a href={{ url_for('index') }} class="title" ><h1>Read only, write a bit and make me run!</h1></a>
49
+        <div class="container">
50
+
51
+            {% block main %}{% endblock %}
52
+
53
+        </div>
54
+    </main>
55
+<div id="index"><a href="index">index</a></div>
56
+    {% block js %} {% endblock%}
57
+
58
+<script>
59
+function doSomething() {
60
+  var myArray = ['Are you aware of the software you are using?','Do you feel your dependence?', 'I am not neutral', 'Do you have full control?'];
61
+  $.notify(myArray[Math.floor(Math.random() * myArray.length)], "warn");
62
+
63
+}
64
+
65
+(function loop() {
66
+    var rand = Math.round(Math.random() * (100000 - 500)) + 500;
67
+    setTimeout(function() {
68
+
69
+            doSomething();
70
+            loop();
71
+    }, rand);
72
+}());
73
+
74
+</script>
75
+
76
+{% if "edit" not in request.path and "writer" not in request.path %}
77
+<script>
78
+
79
+function inIframe () {
80
+  try {
81
+      return window.self !== window.top;
82
+  } catch (e) {
83
+      return true;
84
+  }
85
+}
86
+
87
+$('a').click(function(){
88
+  return false;
89
+})
90
+$("a").on("mousedown", function(e){
91
+
92
+if(inIframe()){
93
+    var link = $(this).prop('href');
94
+
95
+  window.parent.location = window.location.href+"?page="+link
96
+
97
+}
98
+    e.preventDefault();
99
+    var iframe = document.createElement('iframe');
100
+  var link = $(this).prop('href');
101
+  console.log(link);
102
+iframe.src = link;
103
+iframe.id = "secondframe";
104
+$('.post').css({'width': '50%'});
105
+document.body.appendChild(iframe);
106
+})
107
+
108
+$("body").ready(function(){
109
+ var url = new URL(window.location.href)
110
+ if(url.searchParams.get("page"))
111
+ {
112
+ var page = url.searchParams.get("page");
113
+ var iframe = document.createElement('iframe');
114
+var link = page;
115
+console.log(link);
116
+iframe.src = link;
117
+iframe.id = "secondframe"
118
+$(".post").css("width", "50%");
119
+document.body.appendChild(iframe);}
120
+
121
+})
122
+
123
+</script>
124
+{% endif %}
125
+
126
+  </body>
127
+</html>

+ 16
- 0
app/templates/index.html View File

@@ -0,0 +1,16 @@
1
+{% extends 'base.html' %}
2
+
3
+{% block main %}
4
+
5
+
6
+    {% for post in posts %}
7
+    {% if "Introduction"|string() == post.title|string() %}
8
+        <div class="post"><!--<a href="{{ post.pid }}"><h2>{{ post.title }}</h2></a>-->
9
+          <p>{{ post.writingfield|safe }}<p></div>
10
+    {% endif %}
11
+      {% else %}
12
+        <em>No entries here so far</em>
13
+      {% endfor %}
14
+
15
+
16
+{% endblock %}

+ 10
- 0
app/templates/singlepost.html View File

@@ -0,0 +1,10 @@
1
+{% extends 'base.html' %}
2
+
3
+{% block main %}
4
+        <div class="post"><h2>{{ post.title }}</h2>
5
+        <p>{{ post.writingfield|safe }}<p></div>
6
+
7
+
8
+
9
+
10
+{% endblock %}

+ 11
- 0
app/templates/turnfilein.html View File

@@ -0,0 +1,11 @@
1
+{% extends 'base.html' %}
2
+
3
+{% block main %}
4
+<h3>Turn in your old binary files and see how software depicts itself<h3>
5
+
6
+<form method=post enctype=multipart/form-data>
7
+     <input type=file name=file>
8
+     <input type=submit value=Upload>
9
+   </form>
10
+
11
+{% endblock %}

+ 554
- 0
app/templates/writer.html View File

@@ -0,0 +1,554 @@
1
+{% extends 'base.html' %}
2
+
3
+{% block main %}
4
+     <!--  <textarea id="writing-field" rows="4" cols="50"></textarea> -->
5
+
6
+     <div id="topbar">
7
+
8
+     <form method="post">
9
+     {{ form.csrf_token }}
10
+     {{ form.title }}
11
+    {{ form.writingfield }}
12
+    <input value="submit" id="submit" type="submit">  <h1 style="display:inline-block;"> PARA .DOX</h1>
13
+  </form>
14
+
15
+     <div id="toolbar">
16
+
17
+     <a href="#" id="insertImg">Insert image</a>
18
+     <a href="#" data-command='insertCode'><i class="fa fa-code"></i></a>
19
+     <a href="#" data-command='undo'><i class='fa fa-undo'></i></a>
20
+  <a href="#" data-command='redo'><i class='fa fa-repeat'></i></a>
21
+  <a href="#" data-command='bold'><i class='fa fa-bold'></i></a>
22
+  <a href="#" data-command='italic'><i class='fa fa-italic'></i></a>
23
+  <a href="#" data-command='underline'><i class='fa fa-underline'></i></a>
24
+  <a href="#" data-command='strikeThrough'><i class='fa fa-strikethrough'></i></a>
25
+  <a href="#" data-command='justifyLeft'><i class='fa fa-align-left'></i></a>
26
+  <a href="#" data-command='justifyCenter'><i class='fa fa-align-center'></i></a>
27
+  <a href="#" data-command='justifyRight'><i class='fa fa-align-right'></i></a>
28
+  <a href="#" data-command='justifyFull'><i class='fa fa-align-justify'></i></a>
29
+  <a href="#" data-command='indent'><i class='fa fa-indent'></i></a>
30
+  <a href="#" data-command='outdent'><i class='fa fa-outdent'></i></a>
31
+  <a href="#" data-command='insertUnorderedList'><i class='fa fa-list-ul'></i></a>
32
+  <a href="#" data-command='insertOrderedList'><i class='fa fa-list-ol'></i></a>
33
+  <!--<a href="#" data-command='h1'>H1</a>
34
+  <a href="#" data-command='h2'>H2</a>-->
35
+  <a href="#" data-command='createlink'><i class='fa fa-link'></i></a>
36
+  <a href="#" data-command='unlink'><i class='fa fa-unlink'></i></a>
37
+  <a href="#" data-command='insertimage'><i class='fa fa-image'></i></a>
38
+  <a href="#" data-command='p'>P</a>
39
+  <a href="#" data-command='subscript'><i class='fa fa-subscript'></i></a>
40
+  <a href="#" data-command='superscript'><i class='fa fa-superscript'></i></a>
41
+
42
+     </div>
43
+   </div>
44
+
45
+  <form id="upload_img" method="post" enctype="multipart/form-data">
46
+    <label for="file">Select a file</label>
47
+    <input name="file" type="file">
48
+    <button id="submit_img" type="button">Upload</button>
49
+    <p>Result Filename:&nbsp;<span id="resultFilename"> here</span></p>
50
+    <p>Result Filesize:&nbsp;<span id="resultFilesize">here</span></p>
51
+</form>
52
+
53
+<div id="code_insert"><pre contenteditable="true">Insert code here</pre><button id="submit_code" type="button">insert</button></div>
54
+
55
+        <div id="writing-field" contenteditable="true"></div>
56
+      <div id="type_log"></div>
57
+  </body>
58
+
59
+<script>
60
+var writing_field = $("#writing-field");
61
+var writing_in_focus = false;
62
+var last_word = "";
63
+var current_word = "";
64
+var number_selected=-1;
65
+var caret_pos = 0;
66
+
67
+writing_field.focusin(function() {
68
+writing_in_focus = true;
69
+})
70
+
71
+writing_field.focusout(function() {
72
+writing_in_focus = false;
73
+})
74
+
75
+writing_field.on('keydown', function (e) {
76
+  if (e.keyCode==40||e.keyCode==38||e.keyCode==13) {
77
+      if(number_selected!=-1) e.preventDefault();
78
+  }
79
+});
80
+//check for typing or click in textfield
81
+writing_field.bind("click keyup" ,function(e) {
82
+
83
+var input = writing_field.text();
84
+if(e.key== " "){
85
+last_word = "";
86
+}
87
+else{
88
+last_word = last_word+e.key;
89
+}
90
+
91
+if (e.keyCode > 36 && e.keyCode < 41)
92
+{
93
+var cursorPos = getCaretPosition(document.getElementById("writing-field"));
94
+}
95
+if(e.keyCode==40)
96
+{
97
+
98
+number_selected++;
99
+console.log(number_selected);
100
+  if($('#autocomplete').children().length > 0){
101
+    $('.proposal').css("background-color", "");
102
+    $('.proposal').css("color", "");
103
+      $('.proposal').eq(number_selected).css("background-color", "blue");
104
+      $('.proposal').eq(number_selected).css("color", "white");
105
+       return false;
106
+  }
107
+
108
+}
109
+else if(e.keyCode==38)
110
+{
111
+number_selected--;
112
+console.log(number_selected);
113
+  if($('#autocomplete').children().length > 0){
114
+    $('.proposal').css("background-color", "");
115
+    $('.proposal').css("color", "");
116
+      $('.proposal').eq(number_selected).css("background-color", "blue");
117
+      $('.proposal').eq(number_selected).css("color", "white");
118
+      return false;
119
+  }
120
+
121
+}
122
+else if(e.keyCode==13 && number_selected!=-1){
123
+var position = getCaretPosition(document.getElementById("writing-field"));
124
+console.log("CARET POSITION:::: "+caret_pos)
125
+console.log("CURRENT WORD:::: "+current_word)
126
+ /*
127
+ var content = writing_field.text();
128
+var newContent = content.slice(0, caret_pos-current_word.length) +  content.slice(caret_pos);
129
+writing_field.text(newContent);*/
130
+setSelectionRange(document.getElementById("writing-field"),caret_pos-current_word.length ,caret_pos);
131
+document.execCommand("delete", false,false);
132
+//  SetCaretPosition(document.getElementById("writing-field"),caret_pos-current_word.length);
133
+pasteHtmlAtCaret($('.proposal').eq(number_selected).find('b').text()+$('.proposal').eq(number_selected).find('span').text()+" <a class='linkTo' href='"+$('.proposal').eq(number_selected).find('.intext').text()+"'>→ "+$('.proposal').eq(number_selected).find('.intextname').text()+"</a>&nbsp;");
134
+//pasteHtmlAtCaret("<a href='"+$('.proposal').eq(number_selected).find('.intext').text()+"'>"+$('.proposal').eq(number_selected).find('b').text()+$('.proposal').eq(number_selected).find('span').text()+"</a>");
135
+
136
+//document.execCommand("insertHTML", false, "<a href='#'>"+$('.proposal').eq(number_selected).text()+"</a>");
137
+
138
+  number_selected=-1;
139
+}
140
+else{
141
+number_selected=-1;
142
+}
143
+caret_pos=getCaretPosition(document.getElementById("writing-field"));
144
+console.log(caret_pos);
145
+current_word = getWordAt(writing_field.text(),getCaretPosition(document.getElementById("writing-field")))
146
+console.log(current_word)
147
+//typeinfo at the bottom
148
+$("#type_log").append(e.key );
149
+updateScroll();
150
+})
151
+function getTextNodesIn(node) {
152
+  var textNodes = [];
153
+  if (node.nodeType == 3) {
154
+      textNodes.push(node);
155
+  } else {
156
+      var children = node.childNodes;
157
+      for (var i = 0, len = children.length; i < len; ++i) {
158
+          textNodes.push.apply(textNodes, getTextNodesIn(children[i]));
159
+      }
160
+  }
161
+  return textNodes;
162
+}
163
+
164
+function setSelectionRange(el, start, end) {
165
+  if (document.createRange && window.getSelection) {
166
+      var range = document.createRange();
167
+      range.selectNodeContents(el);
168
+      var textNodes = getTextNodesIn(el);
169
+      var foundStart = false;
170
+      var charCount = 0, endCharCount;
171
+
172
+      for (var i = 0, textNode; textNode = textNodes[i++]; ) {
173
+          endCharCount = charCount + textNode.length;
174
+          if (!foundStart && start >= charCount
175
+                  && (start < endCharCount ||
176
+                  (start == endCharCount && i <= textNodes.length))) {
177
+              range.setStart(textNode, start - charCount);
178
+              foundStart = true;
179
+          }
180
+          if (foundStart && end <= endCharCount) {
181
+              range.setEnd(textNode, end - charCount);
182
+              break;
183
+          }
184
+          charCount = endCharCount;
185
+      }
186
+
187
+      var sel = window.getSelection();
188
+      sel.removeAllRanges();
189
+      sel.addRange(range);
190
+  } else if (document.selection && document.body.createTextRange) {
191
+      var textRange = document.body.createTextRange();
192
+      textRange.moveToElementText(el);
193
+      textRange.collapse(true);
194
+      textRange.moveEnd("character", end);
195
+      textRange.moveStart("character", start);
196
+      textRange.select();
197
+  }
198
+}
199
+
200
+
201
+
202
+function updateScroll(){
203
+  $('#type_log').scrollTop($('#type_log')[0].scrollHeight);
204
+}
205
+function pasteHtmlAtCaret(html) {
206
+  var sel, range;
207
+  if (window.getSelection) {
208
+      // IE9 and non-IE
209
+      sel = window.getSelection();
210
+      if (sel.getRangeAt && sel.rangeCount) {
211
+          range = sel.getRangeAt(0);
212
+          range.deleteContents();
213
+
214
+          // Range.createContextualFragment() would be useful here but is
215
+          // non-standard and not supported in all browsers (IE9, for one)
216
+          var el = document.createElement("div");
217
+          el.innerHTML = html;
218
+          var frag = document.createDocumentFragment(), node, lastNode;
219
+          while ( (node = el.firstChild) ) {
220
+              lastNode = frag.appendChild(node);
221
+          }
222
+          range.insertNode(frag);
223
+
224
+          // Preserve the selection
225
+          if (lastNode) {
226
+              range = range.cloneRange();
227
+              range.setStartAfter(lastNode);
228
+              range.collapse(true);
229
+              sel.removeAllRanges();
230
+              sel.addRange(range);
231
+          }
232
+      }
233
+  } else if (document.selection && document.selection.type != "Control") {
234
+      // IE < 9
235
+      document.selection.createRange().pasteHTML(html);
236
+  }
237
+}
238
+
239
+
240
+function getWordAt (str, pos) {
241
+
242
+  // Perform type conversions.
243
+  str = String(str);
244
+  pos = Number(pos) >>> 0;
245
+
246
+  // Search for the word's beginning and end.
247
+  var left = str.slice(0, pos + 1).search(/\S+$/),
248
+      right = str.slice(pos).search(/\s/);
249
+
250
+  // The last word in the string is a special case.
251
+  if (right < 0) {
252
+      return str.slice(left);
253
+  }
254
+
255
+  // Return the word, using the located bounds to extract it from the string.
256
+  return str.slice(left, right + pos);
257
+
258
+}
259
+
260
+var ie = (typeof document.selection != "undefined" && document.selection.type != "Control") && true;
261
+var w3 = (typeof window.getSelection != "undefined") && true;
262
+function getCaretPosition(element) {
263
+  var caretOffset = 0;
264
+  if (w3) {
265
+      var range = window.getSelection().getRangeAt(0);
266
+      var preCaretRange = range.cloneRange();
267
+      preCaretRange.selectNodeContents(element);
268
+      preCaretRange.setEnd(range.endContainer, range.endOffset);
269
+      caretOffset = preCaretRange.toString().length;
270
+  } else if (ie) {
271
+      var textRange = document.selection.createRange();
272
+      var preCaretTextRange = document.body.createTextRange();
273
+      preCaretTextRange.moveToElementText(element);
274
+      preCaretTextRange.setEndPoint("EndToEnd", textRange);
275
+      caretOffset = preCaretTextRange.text.length;
276
+  }
277
+  return caretOffset;
278
+}
279
+
280
+
281
+//time between keystrokes
282
+var last;
283
+var output = $('#output');
284
+writing_field.on('input', function() {
285
+  var n = new Date()
286
+  var time = (last - n);
287
+  console.log(time + ' ms');
288
+  last = n;
289
+});
290
+
291
+
292
+
293
+
294
+
295
+
296
+['#writing-field'].forEach(function (selector) {
297
+var element = document.querySelector(selector);
298
+var fontSize = getComputedStyle(element).getPropertyValue('font-size');
299
+
300
+var rect = document.createElement('div');
301
+document.body.appendChild(rect);
302
+rect.id = "autocomplete"
303
+rect.style.position = 'absolute';
304
+rect.style.height = "auto";
305
+rect.style.width = "auto";
306
+
307
+['keyup', 'click', 'scroll'].forEach(function (event) {
308
+ element.addEventListener(event, update);
309
+});
310
+
311
+function update() {
312
+
313
+  if(event.keyCode != 40 && event.keyCode != 38){
314
+  // Set `debug` to true in order to see the mirror div. Default false.
315
+  console.log(getSelectionCoords());
316
+  var coordinates = getSelectionCoords();
317
+  console.log("SCROOOLLL"+document.scrollingElement.scrollTop)
318
+  //console.log('(top, left, height) = (%s, %s, %s)', coordinates.top, coordinates.left, coordinates.height);
319
+  rect.style.top =
320
+    + document.scrollingElement.scrollTop
321
+    + coordinates.y
322
+    + 30
323
+    + 'px';
324
+  rect.style.left =
325
+    - element.scrollLeft
326
+    + coordinates.x
327
+    + 'px';
328
+    getProposals(current_word);
329
+  }
330
+}
331
+});
332
+
333
+function getProposals(input_word){
334
+
335
+var autocomplete = document.getElementById("autocomplete")
336
+while (autocomplete.firstChild) {
337
+  autocomplete.removeChild(autocomplete.firstChild);
338
+}
339
+
340
+var ajaxfinished = true;
341
+var requestProposals
342
+
343
+if(input_word.length>1){
344
+
345
+if(!ajaxfinished) {requestProposals.abort();}
346
+
347
+ajaxfinished = false;
348
+requestProposals = $.ajax({
349
+    url: '/api/beginwith='+current_word+'',
350
+    dataType: 'json',
351
+    success: function (data) {
352
+      ajaxfinished = true;
353
+      data.forEach(function(p){
354
+      var proposal = document.createElement('div');
355
+      autocomplete.appendChild(proposal);
356
+      proposal.className = "proposal";
357
+      var result = p.word;
358
+      proposal.innerHTML = "<div class='incoming'>in</div> <b>"+current_word+"</b>"+"<span>"+result.substring(current_word.length)+"</span><div hidden='True' class='intext'>"+p.intext+"</div><div class='intextname'>"+p.intextname+"</div><div class='context'>"+p.context+"</div><div hidden='True' class='wordnumber'>"+p.wordnumber+"</div>";
359
+
360
+      });
361
+      $(".proposal").on("mousedown",function(e){
362
+        e.preventDefault();
363
+        var position = getCaretPosition(document.getElementById("writing-field"));
364
+        console.log("CARET POSITION:::: "+caret_pos)
365
+      console.log("CURRENT WORD:::: "+current_word)
366
+         /*
367
+         var content = writing_field.text();
368
+        var newContent = content.slice(0, caret_pos-current_word.length) +  content.slice(caret_pos);
369
+        writing_field.text(newContent);*/
370
+      setSelectionRange(document.getElementById("writing-field"),caret_pos-current_word.length ,caret_pos);
371
+      document.execCommand("delete", false,false);
372
+      //  SetCaretPosition(document.getElementById("writing-field"),caret_pos-current_word.length);
373
+      //" <a class='linkTo' href='"+str(link)+"'>→ "+frompost.title+"</a>"
374
+        pasteHtmlAtCaret($(this).find('b').text()+$(this).find('span').text()+" <a class='linkTo' href='"+$(this).find('.intext').text()+"'>→ "+$(this).find('.intextname').text()+"</a>&nbsp;");
375
+        $("#writing-field").get(0).focus();
376
+
377
+        SetCaretPosition(document.getElementById("writing-field"),caret_pos+$(this).find('span').text().length+1);
378
+      })
379
+      $(".incoming").on("mousedown",function(e){
380
+          $(".proposal").unbind('mousedown');
381
+        $.ajax({url: "/api/link={{ post.pid }}+wordnum="+$(this).siblings(".wordnumber").first().text()+"+document="+$(this).siblings(".intext").first().text() , success: function(result){
382
+    $("#div1").html(result);
383
+  }});
384
+
385
+      })
386
+
387
+
388
+    }
389
+});
390
+
391
+
392
+
393
+}
394
+else{
395
+}
396
+}
397
+
398
+// Move caret to a specific point in a DOM element
399
+function SetCaretPosition(el, pos){
400
+
401
+  // Loop through all child nodes
402
+  for(var node of el.childNodes){
403
+      if(node.nodeType == 3){ // we have a text node
404
+          if(node.length >= pos){
405
+              // finally add our range
406
+              var range = document.createRange(),
407
+                  sel = window.getSelection();
408
+              range.setStart(node,pos);
409
+              range.collapse(true);
410
+              sel.removeAllRanges();
411
+              sel.addRange(range);
412
+              return -1; // we are done
413
+          }else{
414
+              pos -= node.length;
415
+          }
416
+      }else{
417
+          pos = SetCaretPosition(node,pos);
418
+          if(pos == -1){
419
+              return -1; // no need to finish the for loop
420
+          }
421
+      }
422
+  }
423
+  return pos; // needed because of recursion stuff
424
+}
425
+
426
+function getSelectionCoords() {
427
+  var sel = document.selection, range, rect;
428
+  var x = 0, y = 0;
429
+  if (sel) {
430
+      if (sel.type != "Control") {
431
+          range = sel.createRange();
432
+          range.collapse(true);
433
+          x = range.boundingLeft;
434
+          y = range.boundingTop;
435
+      }
436
+  } else if (window.getSelection) {
437
+      sel = window.getSelection();
438
+      if (sel.rangeCount) {
439
+          range = sel.getRangeAt(0).cloneRange();
440
+          if (range.getClientRects) {
441
+              range.collapse(true);
442
+              if (range.getClientRects().length>0){
443
+                  rect = range.getClientRects()[0];
444
+                  x = rect.left;
445
+                  y = rect.top;
446
+              }
447
+          }
448
+          // Fall back to inserting a temporary element
449
+          if (x == 0 && y == 0) {
450
+              var span = document.createElement("span");
451
+              if (span.getClientRects) {
452
+                  // Ensure span has dimensions and position by
453
+                  // adding a zero-width space character
454
+                  span.appendChild( document.createTextNode("\u200b") );
455
+                  range.insertNode(span);
456
+                  rect = span.getClientRects()[0];
457
+                  x = rect.left;
458
+                  y = rect.top;
459
+                  var spanParent = span.parentNode;
460
+                  spanParent.removeChild(span);
461
+
462
+                  // Glue any broken text nodes back together
463
+                  spanParent.normalize();
464
+              }
465
+          }
466
+      }
467
+  }
468
+  return { x: x, y: y };
469
+}
470
+
471
+$("#insertImg").click(function (){
472
+
473
+  $("#upload_img").fadeToggle()
474
+
475
+})
476
+
477
+
478
+  function insertCode(){
479
+$("#code_insert").fadeOut();
480
+    $("#writing-field").focus();
481
+    SetCaretPosition(document.getElementById("writing-field"),caret_pos);
482
+    pasteHtmlAtCaret($("#code_insert pre").text());
483
+  }
484
+
485
+function insertImage(filename){
486
+$("#upload_img").fadeOut();
487
+$("#writing-field").focus();
488
+SetCaretPosition(document.getElementById("writing-field"),caret_pos);
489
+
490
+pasteHtmlAtCaret("<img class='textimage' src='/img/"+filename+"'>");
491
+
492
+
493
+}
494
+
495
+$('#submit').click(function () {
496
+        var mysave = $('#writing-field').html();
497
+        $('#writingfield').val(mysave);
498
+    });
499
+$( window ).on( "load", function() {
500
+$('#writing-field').html($('#writingfield').val());
501
+$('.title').hide()
502
+})
503
+
504
+  $('#submit_code').click(function() {
505
+      insertCode();
506
+  })
507
+$(function() {
508
+    $('#submit_img').click(function() {
509
+        event.preventDefault();
510
+        var form_data = new FormData($('#upload_img')[0]);
511
+        $.ajax({
512
+            type: 'POST',
513
+            url: '/uploadajax',
514
+            data: form_data,
515
+            contentType: false,
516
+            processData: false,
517
+            dataType: 'json'
518
+        }).done(function(data, textStatus, jqXHR){
519
+            console.log(data);
520
+            console.log(textStatus);
521
+            console.log(jqXHR);
522
+            console.log('Success!');
523
+            $("#resultFilename").text(data['name']);
524
+            insertImage(data['name']);
525
+            $("#resultFilesize").text(data['size']);
526
+        }).fail(function(data){
527
+            alert('error!');
528
+        });
529
+    });
530
+});
531
+
532
+$('#toolbar a').click(function(e) {
533
+  var command = $(this).data('command');
534
+  if(command == 'insertCode'){
535
+      $("#code_insert").fadeToggle()
536
+  }
537
+  if (command == 'h1' || command == 'h2' || command == 'p') {
538
+    document.execCommand('formatBlock', false, command);
539
+  }
540
+  if (command == 'forecolor' || command == 'backcolor') {
541
+    document.execCommand($(this).data('command'), false, $(this).data('value'));
542
+  }
543
+    if (command == 'createlink' || command == 'insertimage') {
544
+  url = prompt('Enter the link here: ','http:\/\/'); document.execCommand($(this).data('command'), false, url);
545
+  }
546
+  else document.execCommand($(this).data('command'), false, null);
547
+});
548
+
549
+
550
+
551
+</script>
552
+
553
+
554
+{% endblock %}

+ 218
- 0
app/views.py View File

@@ -0,0 +1,218 @@
1
+from flask import Flask, request, session, redirect, url_for, render_template, flash, jsonify, send_from_directory
2
+from . models import Posts, db
3
+from flask_cors import CORS, cross_origin
4
+from app.forms import UploadForm
5
+from app import app
6
+from  sqlalchemy.sql.expression import func, select
7
+from sqlalchemy.sql import except_
8
+import re,string
9
+import os
10
+from werkzeug.utils import secure_filename
11
+import json
12
+from bs4 import BeautifulSoup
13
+
14
+import subprocess
15
+from subprocess import Popen, PIPE
16
+from subprocess import check_output
17
+
18
+basedir = os.path.abspath(os.path.dirname(__file__))
19
+UPLOAD_FOLDER = os.path.join(basedir, 'img')
20
+
21
+ALLOWED_EXTENSIONS = set([ 'png', 'jpg', 'jpeg', 'gif'])
22
+
23
+def allowed_file(filename):
24
+    return '.' in filename and \
25
+           filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
26
+
27
+def cleanhtml(raw_html):
28
+  cleanr = re.compile('<.*?>')
29
+  cleantext = re.sub(cleanr, '', raw_html)
30
+  return cleantext
31
+
32
+@app.route('/')
33
+@cross_origin(origin='*')
34
+def index():
35
+    posts = db.session.query(Posts).all()
36
+    return render_template('index.html', posts=posts)
37
+
38
+@app.route('/index')
39
+def all():
40
+    posts = db.session.query(Posts).all()
41
+    return render_template('all.html', posts=posts)
42
+
43
+@app.route('/<int:pid>')
44
+@cross_origin(origin='*')
45
+def post(pid):
46
+    post = Posts.query.filter_by(pid=pid).first()
47
+    return render_template('singlepost.html', post=post)
48
+
49
+@app.route('/<int:pid>/edit', methods=['GET', 'POST'])
50
+@cross_origin(origin='*')
51
+def edit_post(pid):
52
+    post = Posts.query.filter_by(pid=pid).first()
53
+    user_form = UploadForm(title = post.title, writingfield=post.writingfield)
54
+    if request.method == 'POST':
55
+        if user_form.validate_on_submit():
56
+            # on submit, check fields
57
+            post.title = user_form.title.data
58
+            post.writingfield = user_form.writingfield.data
59
+
60
+            db.session.commit()
61
+            return redirect(url_for('post', pid=pid))
62
+
63
+    return render_template('writer.html', form=user_form, post=post)
64
+
65
+
66
+
67
+@app.route('/writer', methods=['GET', 'POST'])
68
+@cross_origin(origin='*')
69
+def writer():
70
+    post = Posts("unknown", "")
71
+    user_form = UploadForm()
72
+    if request.method == 'POST':
73
+        if user_form.validate_on_submit():
74
+            # on submit, check fields
75
+            title = user_form.title.data
76
+            writingfield = user_form.writingfield.data
77
+            post = Posts(title, writingfield)
78
+            db.session.add(post)
79
+            db.session.commit()
80
+            return redirect(url_for('post', pid=post.pid))
81
+    return render_template('writer.html',form=user_form, post=post )
82
+
83
+
84
+@app.route('/uploadajax', methods=['POST'])
85
+def uploadfile():
86
+    if request.method == 'POST':
87
+        files = request.files['file']
88
+        if files and allowed_file(files.filename):
89
+            filename = secure_filename(files.filename)
90
+            app.logger.info('FileName: ' + filename)
91
+            updir = os.path.join(basedir, 'img/')
92
+            files.save(os.path.join(updir, filename))
93
+            file_size = os.path.getsize(os.path.join(updir, filename))
94
+            return jsonify(name=filename, size=file_size)
95
+
96
+
97
+@app.route('/turninbinary', methods=['POST', 'GET'])
98
+def truninbinary():
99
+    if request.method == 'POST':
100
+        files = request.files['file']
101
+        filename = secure_filename(files.filename)
102
+        app.logger.info('FileName: ' + filename)
103
+        updir = os.path.join(basedir, 'binary/')
104
+        files.save(os.path.join(updir, filename))
105
+
106
+        p = subprocess.Popen(['cp', os.path.join(updir, filename), os.path.join(basedir, 'binary/input.raw')])
107
+        p_status = p.wait()
108
+