first commit
commit
d4cc58c9c3
@ -0,0 +1,5 @@
|
||||
*.DS_Store
|
||||
*.pyc
|
||||
*.db
|
||||
blogger/_pycache_
|
||||
app/img/*
|
@ -0,0 +1,18 @@
|
||||
# Flask Sqlalchemy Blogger Example
|
||||
|
||||
|
||||
A Simple Blogger application with user authentication, Using Flask, sqlalchemy connected to sqlite Database.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
- Frist clone the project and move to current working directory.
|
||||
- Install the required packages using requirements.txt file by the command ```pip install -r requirements.txt```
|
||||
- Run server by using ```python app.py```
|
||||
|
||||
|
||||
## Requirements
|
||||
- Python 2.7.x Python 3.x.x
|
||||
- Flask
|
||||
- Flask-SQLAlchemy
|
||||
- flask-WTF
|
@ -0,0 +1,4 @@
|
||||
from app import app
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0',debug=True)
|
@ -0,0 +1,17 @@
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
import os
|
||||
from flask import Flask, flash, request, redirect, url_for
|
||||
from werkzeug.utils import secure_filename
|
||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||
app = Flask(__name__)
|
||||
CORS(app)
|
||||
UPLOAD_FOLDER = os.path.join(basedir, 'img')
|
||||
|
||||
app.secret_key = 'poeticsoftware'
|
||||
app.config.from_object(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'
|
||||
app.config['CORS_HEADERS'] = 'Content-Type'
|
||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||
from app import models
|
||||
from app import views
|
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
@ -0,0 +1,106 @@
|
||||
Detailed change history is available from subversion https://www.assembla.com/code/chdk/subversion/commits
|
||||
|
||||
=1.4=
|
||||
Current stable, released Nov 29 2015 as 1.4.1.
|
||||
|
||||
Compatibility with 1.3:
|
||||
* Scripts are generally compatible.
|
||||
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.
|
||||
See https://subversion.assembla.com/svn/chdk/trunk/CHDK/LUALIB/wrap13.lua for a list of functions with changed return values
|
||||
* 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
|
||||
* CFG files: CHDK 1.4 uses the same CFG files as 1.3.
|
||||
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.
|
||||
* Modules and language files are NOT compatible. You must update these when you update your build.
|
||||
|
||||
Significant changes:
|
||||
* long file name support in script, file browser / selector.
|
||||
Discussion http://chdk.setepontos.com/index.php?topic=10833.0
|
||||
* enhanced script @parameter header including compact format, Boolean values, table support, and full variable names in Lua.
|
||||
Documentation: http://chdk.wikia.com/wiki/CHDK_Script_Header#Lua_Shorthand_Parameter_Syntax
|
||||
Discussion: http://chdk.setepontos.com/index.php?topic=12121.0
|
||||
* upper and lower case single characters can now be used as @param variables in uBASIC
|
||||
* script header now supports @subtitle for better organization in script that use many parameters
|
||||
* Lua scripts now "compile" when loaded to reduce memory needed (original script text no longer stored in memory)
|
||||
Discussion: http://chdk.setepontos.com/index.php?topic=12117.msg118923#msg118923
|
||||
* Added @chdk_version parameter to specify version of CHDK script was written for, 1.3 assumed if none present.
|
||||
Discussion: http://chdk.setepontos.com/index.php?topic=12138.0
|
||||
* Made Lua script API use of boolean values more consistent, (@chdk_version 1.3 provides backward compatible behavior)
|
||||
Development thread http://chdk.setepontos.com/index.php?topic=12138.0
|
||||
* enhanced UI functions for touchscreen equipped cameras - touching menu areas and window buttons directly now works
|
||||
Discussion: http://chdk.setepontos.com/index.php?topic=12090.msg118468#msg118468
|
||||
* rework of CHDK color palette handling to allow separate palette definitions for each camera model - transparent grey color defined for OSD background use
|
||||
Discussion http://chdk.setepontos.com/index.php?topic=12046.msg118169#msg118169
|
||||
* updates to GPS functionality for cameras with built-in GPS
|
||||
* improvements in console handling when script running including console not timing out and console reset to "on" state when script errors are encountered.
|
||||
* upgrades to Lua RAW shooting hooks to allow analysis and modification of RAW buffer during shooting
|
||||
Documentation: http://chdk.wikia.com/wiki/Lua/Raw_Hook_Operations
|
||||
Discussion: http://chdk.setepontos.com/index.php?topic=11081.10
|
||||
* 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.
|
||||
* usb_force_active now available on almost all cameras
|
||||
* filewrite / remote capture support for many more cameras
|
||||
* development support for digic 6 / thumb2 cameras
|
||||
* Improved focus overrides
|
||||
Discussion http://chdk.setepontos.com/index.php?topic=12103.10
|
||||
* Convert shot histogram code to a module.
|
||||
|
||||
=1.3=
|
||||
Obsolete, released Dec 18 2014. Implemented new features are listed below :
|
||||
* Address some of the longstanding issues with focus overrides - especially in scripts. Discussion: http://chdk.setepontos.com/index.php?topic=11078.0
|
||||
* Hooks to allow Lua to run at specific points in the shooting process. Discussion: http://chdk.setepontos.com/index.php?topic=11081.0
|
||||
* Increase available memory, allow CHDK to allocate from multiple pools. Discussion: http://chdk.setepontos.com/index.php?topic=10886.0
|
||||
* Eye-fi support
|
||||
* Splitting the CHDK configuration files into 4 parts for better management
|
||||
* Improved Lua cfg access from lua
|
||||
* Allow scripts to configure script interrupt key
|
||||
* Improved script control of OSD via set_draw_title_line()
|
||||
* Various clean-ups to which OSD icons get displayed and when
|
||||
* Improved script functions for working with APEX96 exposure values
|
||||
* Allow scripts to set shooting exposure parameters inside half shoot
|
||||
* Added font scaling to Lua draw_string() function
|
||||
* Added OSD font scaling and OSD editor upgrade to support it
|
||||
* Added option to launch the current script on entry to <ALT> mode
|
||||
* Added script function that locks out Canon automatic exposure adjustments
|
||||
* Added support for > 64 second exposures all cameras (thanks koshy and nafraf)
|
||||
* Added support for USB remote capture on many more cameras (thanks koshy and nafraf)
|
||||
* Added os.idir, iterates over directory listings without loading the whole list in memory.
|
||||
* Fix long standing FsIoNotify crash issues http://chdk.setepontos.com/index.php?topic=6179.msg111410#msg111410
|
||||
* 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
|
||||
* added choice of DNG crop (full, active, JPG)
|
||||
* added ability to enable a high speed timer to improve USB remote timing precision and accuracy
|
||||
* added battery third terminal remote trigger capability (enabled for selected cameras only)
|
||||
* added hotshoe control capability (for cameras with hotshoes of course)
|
||||
|
||||
=1.2=
|
||||
Obsolete, released July 30 2013. The following major features were implemented for 1.2.
|
||||
* intermittent Lua crashing bug fixed (finally. Also backported to 1.1)
|
||||
* Improved UI - discussion thread http://chdk.setepontos.com/index.php?topic=8151.0
|
||||
** menu items renamed and sometimes moved for clarity
|
||||
** input of numeric values simplified
|
||||
** the "Disable Overrides" menu item is now understandable
|
||||
** Tv override input value can be in Ev step, seconds or HHMMSS format
|
||||
* Remote capture over USB
|
||||
* Improved DNG performance, now very close to framebuffer raw
|
||||
* Support raw operations on DNG
|
||||
* Improved memory usage by moving more code to modules
|
||||
* Fast integer based trigonometric functions for Lua
|
||||
* new editor for User Menu
|
||||
* scripts can be added to the User Menu
|
||||
* menu option to enable Lua native calls
|
||||
* menu option to disable keyboard shortcuts
|
||||
* improve console mode with menu options to extend the visibility time of console or review (scroll back) console output
|
||||
* loadable palette values allow a better range of colors in the UI (not implemented on all cameras)
|
||||
* auto operation of internal / external flash enabled when other exposure values are in "M" mode
|
||||
* enhanced UI for script parameters : @value allows use of named input values rather than just numeric
|
||||
* scripts can be set to always use the default parameter values in the code rather than stored parameters
|
||||
* ISO input for override, bracketing and auto-ISO now use approximately the same units as Canon UI ("market" ISO)
|
||||
* 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
|
||||
|
||||
=1.1=
|
||||
Obsolete, released July 25 2012. Major features added in this release include
|
||||
* Loadable binary modules
|
||||
* Re-write of USB remote code
|
||||
* "Live view" over the CHDK PTP Extension
|
||||
* Integration of chdkde features (actually got added to previous stable too)
|
||||
|
||||
=1.0=
|
||||
Previous stable, no further changes. Released Feb 2012.
|
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE1=$1
|
||||
|
||||
#to raw
|
||||
yes | cp -rf $1 input.raw
|
||||
|
||||
#to audio
|
||||
sox -r 22050 -b 8 -c 1 -e signed input.raw audio.wav
|
||||
|
||||
#to mp3
|
||||
ffmpeg -y -i audio.wav -vn -ar 44100 -ac 2 -b:a 192k -f mp3 output.mp3
|
||||
|
||||
#to video
|
||||
ffmpeg -y -f rawvideo -s 32x18 -i input.raw video.mp4
|
||||
|
||||
#scale up
|
||||
ffmpeg -y -i video.mp4 -vf scale=320:240 output.mp4
|
||||
|
||||
#combine both
|
||||
ffmpeg -y -i output.mp4 -i output.mp3 -c copy -map 0:v:0 -map 1:a:0 output_both.mp4
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE1=$1
|
||||
|
||||
#to raw
|
||||
yes | cp -rf $1 input.raw
|
||||
|
||||
#to audio
|
||||
sox -r 22050 -b 8 -c 1 -e signed input.raw audio.wav
|
||||
|
||||
#to mp3
|
||||
ffmpeg -y -i audio.wav -vn -ar 44100 -ac 2 -f mp3 output.mp3
|
||||
|
||||
#to video
|
||||
ffmpeg -y -f rawvideo -s 32x18 -i input.raw video.mp4
|
||||
|
||||
#scale up
|
||||
ffmpeg -y -i video.mp4 -vf scale=320:240 output.mp4
|
||||
|
||||
#combine both
|
||||
#ffmpeg -y -i output.mp4 -i output.mp3 -c copy -map 0:v:0 -map 1:a:0 output_both.mp4
|
Binary file not shown.
@ -0,0 +1,170 @@
|
||||
id,title,file,cover,fileformat,category,year_published,description,html,scapeX,scapeY,authors,stacks
|
||||
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,
|
||||
2,A Preface to Plato,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Eric Havelock,
|
||||
3,A Prehistory of the Cloud,,,pdf,Media Studies (Femke Trim 3),,,,0.00,0.00,Tung-Hui Hu,
|
||||
4,A Thousand Years of Nonlinear History,,,pdf,Philosophy,,,,0.00,0.00,Manuel De Landa,
|
||||
5,Actionscript for Flash MX: The Definitive Guide,,,pdf,Technical,,,,0.00,0.00,Colin Moock,
|
||||
6,Adorno,,,,Philosophy,,,,0.00,0.00,Martin Jay,
|
||||
7,Age of the Extremes: The Short Twentieth Century 1914-1991,,,pdf,Science/History,,,,0.00,0.00,Eric Hobsbawm,
|
||||
8,An Atlas of Typeforms,,,,design / writing / publishing,,,,0.00,0.00,James Sutton | Alan Bartram,
|
||||
9,An Introduction to Western Philosophy,,,,Philosophy,,,,0.00,0.00,Antony Flew,
|
||||
10,Anti-Media,,,,Media studies,,,,0.00,0.00,Florian Cramer,
|
||||
11,Apache 2 Pocket Reference,,,,Technical,,,,0.00,0.00,Andrew Ford,
|
||||
12,Archaeology,,,,Science/History,,,,0.00,0.00,Olsen | Shanks | Webmoor | Witmore,
|
||||
13,Art and Electronic Media,,,,Art,,,,0.00,0.00,Edward A. Shanken,
|
||||
14,Ashes and Broken Brickwork of a Logical Theory,,,,Art,,,,0.00,0.00,Susanne Kriemann,
|
||||
15,Barthes: Selected Writings,,,,Philosophy,,,,0.00,0.00,Roland Barthes,
|
||||
16,Bastard Culture!: How User Participation Transforms Cultural Production,,,pdf,Media studies,,,,0.00,0.00,Mirko Tobias Schäfer,
|
||||
17,Beginning Game Development with Python and Pygame,,,pdf,Technical,,,,0.00,0.00,Will McGugan,
|
||||
18,CSS Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Eric A. Meyer,
|
||||
19,Camera Lucida: Reflections on Photography,,,pdf,Philosophy,,,,0.00,0.00,Roland Barthes,
|
||||
20,Cocoa Programming for Mac OS X Second Edition,,,pdf,Technical,,,,0.00,0.00,Aaron Hillegaas,
|
||||
21,Control and Freedom: Power and Paranoia in the Age of Fiber Optics,,,pdf,desk,,,,0.00,0.00,Wendy Hui Kyong Chun,
|
||||
22,Convergence culture,,,pdf,Media studies,,,,0.00,0.00,Henry Jenkins,
|
||||
23,Convergence: The International Journal of Research into New Media Technologies - Volume 12 Number 3 August 2004,,,,Computer culture,,,,0.00,0.00,,
|
||||
24,Cybernetics & Ghosts,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Italo Calvino,
|
||||
25,Cyburbia,,,,Media studies,,,,0.00,0.00,James Harkin,
|
||||
26,DATA browser 01: Economising Culture,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa | Geoff Cox (editors),
|
||||
27,DATA browser 02: Engineering Culture,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa | Geoff Cox (editors),
|
||||
28,DATA browser 3: Curating Immateriality,,,pdf,Computer culture,,,,0.00,0.00,Joasia Krysa (editor),
|
||||
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,
|
||||
30,Data Modeling for Everyone,,,,Technical,,,,0.00,0.00,Sharon Allen,
|
||||
31,Debt: The First 5000 Years,,,,Science/History,,,,0.00,0.00,David Graeber,
|
||||
32,Derrida For Beginners,,,pdf,Philosophy,,,,0.00,0.00,Jim Powell | Van Howell,
|
||||
33,DiY Survival // There is No Subculture Only Subversion,,,pdf,Computer culture,,,,0.00,0.00,Betti Marenko | Leon C6,
|
||||
34,Dialectic of Enlightenment,,,pdf,Philosophy,,,,0.00,0.00,Max Horkheimer | Theodor Adorno | Gunzelin Noeri | Edmund Jephcott,
|
||||
35,Digital Culture,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Charlie Gere,
|
||||
36,Digital Labor,,,pdf,Media studies,,,,0.00,0.00,Trebor Scholz,
|
||||
37,Digital Prohibition,,,pdf,Computer culture,,,,0.00,0.00,Carolyn Guertin,
|
||||
38,Discipline and Punish,,,pdf,Philosophy,,,,0.00,0.00,Michel Foucault,
|
||||
39,Distinction: A Social Critique of the Judgement of Taste,,,,Science/History,,,,0.00,0.00,Pierre Bourdieu,
|
||||
40,Ethics Subjectivity and Truth,,,pdf,Media studies,,,,0.00,0.00,Michel Foucault,
|
||||
41,Exploring Humans,,,,Philosophy,,,,0.00,0.00,H. Dooremalen | H. de Regt | MP Schouten,
|
||||
42,False Dawn: The Delusions of Global Capitalism,,,epub,Science/History,,,,0.00,0.00,John Gray,
|
||||
43,Formen interaktiver Medienkunst,,,pdf,Computer culture,,,,0.00,0.00,Gendolla | Schmirz | Schneider | Spangenberg (Hg),
|
||||
44,GNU Emacs Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Debra Cameron,
|
||||
45,"Game Programming with Python, Lua, and Ruby 1 edition",,,pdf,Technical,,,,0.00,0.00,Gutschmidt T.,
|
||||
46,Georges Bataille: An Intellectual Biography,,,,Science/History,,,,0.00,0.00,Michel Surya,
|
||||
47,Getting Gread Sounds: The Microphone Book,,,,Technical,,,,0.00,0.00,Tom Lubin,
|
||||
48,"Gramophone, Film, Typewriter",,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Friedrich Kittler,
|
||||
49,Guide to Open Content Licenses,,,pdf,Computer culture,,,,0.00,0.00,Lawrence Liang,
|
||||
50,Guy Debord and the Situationists International,,,,Art,,,,0.00,0.00,Tom McDonough,
|
||||
51,HTML Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Jennifer Niederst Robbins,
|
||||
52,Hardening Network Infrastructure: Bulletproof Your Systems Before You Are Hacked!,,,"chm, pdf",Technical,,,,0.00,0.00,Wes Noonan,
|
||||
53,Holding On to Reality: The Nature of Information at the Turn of the Millennium,,,pdf,Media studies,,,,0.00,0.00,Albert Borgman,
|
||||
54,How to Think Like a Computer Scientist,,,pdf,Technical,,,,0.00,0.00,Allen B. Downey | Jeffrey Elkner | Chris Meyers,
|
||||
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),
|
||||
56,Identity and Difference,,,pdf,Media studies,,,,0.00,0.00,Martin Heidegger,
|
||||
57,Ideology,,,pdf,Philosophy,,,,0.00,0.00,Terry Eagleton,
|
||||
58,Information - Documents of Contemporary Art,,,,Media studies,,,,0.00,0.00,Sarah Cook,
|
||||
59,Instruments and the Imagination,,,,Science/History,,,,0.00,0.00,Hankins & Silverman,
|
||||
60,Intensive Science and Virtual Philosophy,,,pdf,Philosophy,,,,0.00,0.00,Manuel DeLanda,
|
||||
61,Interface Culture,,,pdf,Media studies,,,,0.00,0.00,Steven Johnson,
|
||||
62,Interference: A Grand Scientific Musical Theory,,,,Science/History,,,,0.00,0.00,Richard Merrick,
|
||||
63,International Picture Language,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Otto Neurath,
|
||||
64,Introducing Baudrillard,,,pdf,Philosophy,,,,0.00,0.00,Chris Horrocks | Zoran Jevtic,
|
||||
65,Introducing Foucault,,,pdf,Philosophy,,,,0.00,0.00,Chris Horrocks | Zoran Jevtic,
|
||||
66,Introducing Kant,,,Philosophy, Andrzej Klimowski,,,,0.00,0.00,Christopher Want,
|
||||
67,Inventing The Victorians,,,,Science/History,,,,0.00,0.00,Matthew Sweet,
|
||||
68,Jean Paul A Reader,,,,Media studies,,,,0.00,0.00,Timothy J. Casey (ed.),
|
||||
69,Kant and the Platypus: Essays on Language and Cognition,,,pdf,Philosophy,,,,0.00,0.00,Umberto Eco | Alastair McEwen,
|
||||
70,LDAP System Administration,,,pdf,Technical,,,,0.00,0.00,Gerald Carter,
|
||||
71,Lacan For Beginners,,,pdf,Philosophy,,,,0.00,0.00,Phillip Hill | David Leach,
|
||||
72,Late Marxism,,,,Philosophy,,,,0.00,0.00,Frederic Jameson,
|
||||
73,Learning PHP and MYSQL,,,Technical, Jon A Phillips,,,,0.00,0.00,Michele E Davis,
|
||||
74,Learning Unix for Mac OS X,,,pdf,Technical,,,,0.00,0.00,Dave Taylor | Jerry Peek,
|
||||
75,Learning the Bash Shell,,,pdf,Technical,,,,0.00,0.00,Cameron Newham | Bill Rosenblatt,
|
||||
76,Linux System Administration,,,pdf,Technical,,,,0.00,0.00,Tom Adelstein | Bill Lubanovic,
|
||||
77,Lipstick Traces,,,,Science/History,,,,0.00,0.00,Greil Marcus,
|
||||
78,Literature Media,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Friedrich Kittler,
|
||||
79,Logic of Scientific Discovery,,,pdf,Philosophy,,,,0.00,0.00,Popper K.,
|
||||
80,Loving Big Brother: Surveillance Culture and Performance Space,,,pdf,Media studies,,,,0.00,0.00,John McGrath,
|
||||
81,Ludwig Wittgenstein,,,pdf,Philosophy,,,,0.00,0.00,Ray Monk,
|
||||
82,MYSQL In a Nutshell,,,pdf,Technical,,,,0.00,0.00,Russell Dyer,
|
||||
83,Mac OS X Leopard Edition,,,pdf,Technical,,,,0.00,0.00,David Pogue,
|
||||
84,Mac OS X Panther for Unix Geeks,,,"chm, pdf",Technical,,,,0.00,0.00,Brian Jepson | Ernest E. Rothman,
|
||||
85,Managing and Using MYSQL,,,"chm, pdf",Technical,,,,0.00,0.00,Tim King | George Reese | Randy Yarger | Hugh E. Williams | Randy Jay Yarger,
|
||||
86,Media Ecologies: Materialist Energies in Art and Technoculture,,,pdf,Media studies,,,,0.00,0.00,Matthew Fuller,
|
||||
87,Media Virus! Hidden Agendas in Popular Culture,,,pdf,Media studies,,,,0.00,0.00,Douglas Rushkoff,
|
||||
88,"Mind, Machines and Human Consciousness",,,,Science/History,,,,0.00,0.00,Robert Nadeau,
|
||||
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,
|
||||
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,
|
||||
91,New Media Art,,,,Computer culture,,,,0.00,0.00,Mark Tribe | Reena Jana,
|
||||
92,On Wine and Hishish,,,,Philosophy,,,,0.00,0.00,Charles Baudelaire,
|
||||
93,On revolution,,,pdf,Philosophy,,,,0.00,0.00,Hannah Arendt,
|
||||
94,Orality and Literacy,,,epub,Digital (Steve Trim 2 reading),,,,0.00,0.00,Walter Ong,
|
||||
95,Organized Networks,,,pdf,Media studies,,,,0.00,0.00,Ned Rossiter,
|
||||
96,Oulipo Compendium,,,,design / writing / publishing,,,,0.00,0.00,Harry Mathews | Alastair Brotchie,
|
||||
97,Over Mediatheorie,,,,Media studies,,,,0.00,0.00,Arjen Mulder,
|
||||
98,Pandora's Hope,,,pdf,Science/History,,,,0.00,0.00,Bruno Latour,
|
||||
99,Paratexts: Thresholds of Interpretation,,,pdf,"Literature, Culture, Theory ",,,,0.00,0.00,,
|
||||
100,Perl for Web Site Management,,,,Computer culture,,,,0.00,0.00,,
|
||||
101,Post Truth,,,,Media studies,,,,0.00,0.00,Matthew d'Ancona,
|
||||
102,Postscript on the Societies of Control ,,,pdf,Media studies,,,,0.00,0.00,Gilles Deleuze,
|
||||
103,Present Shock: When Everything Happens Now,,,EPUB,Media studies,,,,0.00,0.00,Douglas Rushkoff,
|
||||
104,Programming Firefox,,,pdf,Technical,,,,0.00,0.00,Kenneth C Feldt,
|
||||
105,Protocol,,,pdf,Media studies,,,,0.00,0.00,Alexander R. Galloway,
|
||||
106,Python Pocket Reference,,,pdf,Technical,,,,0.00,0.00,Mark Lutz,
|
||||
107,Regular Expression Pocket Reference,,,"chm, pdf",Technical,,,,0.00,0.00,Tony Stubblebine,
|
||||
108,Rethinking Media Pluralism,,,,Science/History,,,,0.00,0.00,Karppinen,
|
||||
109,SQL Pocket Guide,,,pdf,Technical,,,,0.00,0.00,Jonathan Gennick,
|
||||
110,Save and Forget,,,pdf,Media studies,,,,0.00,0.00,Thomas Walskaar,
|
||||
111,Selections from Cultural Writings,,,,Media studies,,,,0.00,0.00,Antonio Gramsci,
|
||||
112,Seven Hundred Penguins,,,,design / writing / publishing,,,,0.00,0.00,,
|
||||
113,Software Studies \ a lexicon,,,pdf,Desk,,,,0.00,0.00,Matthew Fuller,
|
||||
114,Statements on Appropriation (London Version),,,,Media studies,,,,0.00,0.00,Michaelis Pichler,
|
||||
115,Structure of the Visual Book,,,,design / writing / publishing,,,,0.00,0.00,Keith Smith,
|
||||
116,Surrealist Painters and Poets: An Anthology,,,,Art,,,,0.00,0.00,Mary Ann Caws,
|
||||
117,System and Writing in the Philosophy of Jacques Derrida,,,pdf,Philosophy,,,,0.00,0.00,Christopher Johnson,
|
||||
118,The Absolute Report: Time Space Code Memory,,,,Art,,,,0.00,0.00,,
|
||||
119,The Book of Inkscape,,,pdf,Technical,,,,0.00,0.00,Dmitry Kirsanov,
|
||||
120,The Cathedral & The Bazaar,,,pdf,Computer culture,,,,0.00,0.00,Eric Raymond,
|
||||
121,The Century,,,pdf,Science/History,,,,0.00,0.00,Alain Badiou,
|
||||
122,The Chomsky Reader,,,epub,Science/History,,,,0.00,0.00,Noam Chomsky | James Peck (Editor),
|
||||
123,The Code Book,,,pdf,Computer culture,,,,0.00,0.00,Simon Singh,
|
||||
124,The Dustbin of History,,,,Science/History,,,,0.00,0.00,Greil Marcus,
|
||||
125,The Ear of the Other,,,pdf,Media studies,,,,0.00,0.00,Jaques Derrida,
|
||||
126,The Electronic Revolution,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,William Burroughs,
|
||||
127,The Enlightenment Reader,,,,Science/History,,,,0.00,0.00,,
|
||||
128,The Human Condition,,,pdf,Philosophy,,,,0.00,0.00,Hannah Arendt,
|
||||
129,The Infinite Conversation,,,pdf,Media studies,,,,0.00,0.00,Maurice Blanchot,
|
||||
130,The Interface Effect,,,pdf,Media studies,,,,0.00,0.00,Alexander R. Galloway,
|
||||
131,The Internet Is Not The Answer,,,pdf,Media studies,,,,0.00,0.00,Andrew Keen,
|
||||
132,The Invisible Generation,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,William Burroughs,
|
||||
133,The Lives of Michel Foucault,,,pdf,Philosophy,,,,0.00,0.00,David Mcey,
|
||||
134,"The Mag.net reader 3, Processual Publishing. Actual Gesture",,,pdf,Computer culture,,,,0.00,0.00,Alessandro Ludovico | Nat Muller (editors),
|
||||
135,The New Media Reader,,,pdf,desk,,,,0.00,0.00,Noah Wardrip-Fruin | Nick Montfort (editors),
|
||||
136,The New Spirit of Capitalism,,,pdf,Science/History,,,,0.00,0.00,Luc Boltanski & Eve Chiapello,
|
||||
137,The Perfect Crime,,,pdf,Philosophy,,,,0.00,0.00,Jean Baudrillard,
|
||||
138,The Philosophy of Symbolic Forms,,,pdf,Science/History,,,,0.00,0.00,Ernst Cassirer,
|
||||
139,"The Political Economy of Media: Enduring Issues, Emerging Dilemmas",,,,Science/History,,,,0.00,0.00,Robert W. McChesney,
|
||||
140,The Postmodern Turn,,,,Philosophy,,,,0.00,0.00,Best Kellner,
|
||||
141,The Psychopath Test,,,pdf,Science/History,,,,0.00,0.00,Jon Ronson,
|
||||
142,The Qmail Handbook,,,pdf,Technical,,,,0.00,0.00,Dave Sill,
|
||||
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,
|
||||
144,The Selfish Gene,,,pdf,Science/History,,,,0.00,0.00,Richard Dawkins,
|
||||
145,The Situationist City,,,pdf,Art,,,,0.00,0.00,Simon Sadler,
|
||||
146,The Society of Mind,,,pdf,Science/History,,,,0.00,0.00,Marvin Minsky,
|
||||
147,The Ultimate Guide to the Vi and Ex Text Editors,,,,Technical,,,,0.00,0.00,Hewlett-Packard,
|
||||
148,The Uses of Literacy,,,pdf,design / writing / publishing,,,,0.00,0.00,Richard Hoggart,
|
||||
149,The World Explained,,,,Media studies,,,,0.00,0.00,Erick Beltran,
|
||||
150,The World Turned Upside Down: Radical Ideas During the English Revolution,,,pdf,Philosophy,,,,0.00,0.00,Christopher Hill,
|
||||
151,The culture of connectivity,,,pdf,Media studies,,,,0.00,0.00,Jose van Dijck,
|
||||
152,The structure of scientific revolutions,,,pdf,Philosophy,,,,0.00,0.00,Thomas S. Kuhn,
|
||||
153,Things That Talk,,,,Science/History,,,,0.00,0.00,Lorraine Daston (Editor),
|
||||
154,Travels in hyper reality : essays,,,pdf,Philosophy,,,,0.00,0.00,Umberto Eco | William Weave,
|
||||
155,Turning Back the Clock,,,,Philosophy,,,,0.00,0.00,Umberto Eco,
|
||||
156,Uncreative Writing,,,epub,Digital (Steve Trim 2 reading),,,,0.00,0.00,Kenneth Goldsmith,
|
||||
157,Understanding media economics,,,pdf,Media studies,,,,0.00,0.00,Gillian Doyle,
|
||||
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.),
|
||||
159,Walter Benjamin for beginners,,,,Media studies,,,,0.00,0.00,Howard Caygill | Alex Coles | Richard Appignanesi,
|
||||
160,Walter Benjamin: A Biography,,,,Philosophy,,,,0.00,0.00,Momme Brodersen,
|
||||
161,Weapons of Math Destruction,,,EPUB,Media studies,,,,0.00,0.00,Cathy O'Neil,
|
||||
162,Wired for war - Robotics revolution and conflict in the 21st century,,,EPUB,Media studies,,,,0.00,0.00,P. W. Singer,
|
||||
163,Working with Mediawiki,,,pdf,Technical,,,,0.00,0.00,Yaron Koren,
|
||||
164,Writing Machines,,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Katherine Hayles,
|
||||
165,exquisite_code,,,book,Desk,,,,0.00,0.00,exquisite_code collective,
|
||||
166,"iSpace: Printed English after Joyce, Shannon, Derrida",,,pdf,Digital (Steve Trim 2 reading),,,,0.00,0.00,Lydia Liu,
|
||||
167,vi Editor Pocket Reference,,,"epub, pdf",Technical,,,,0.00,0.00,Arnold Robbins,
|
||||
168,"»Present Continuous Past(s)«: Media Art. Strategies of Presentation, Mediation and Dissemination",,,pdf,Desk,,,,0.00,0.00,Ursula Frohne | Mona Schieren,
|
||||
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.),
|
|
@ -0,0 +1,9 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import TextField, TextAreaField, SubmitField, PasswordField, BooleanField
|
||||
from wtforms.fields.html5 import EmailField
|
||||
from wtforms.validators import DataRequired, Length, Email
|
||||
|
||||
|
||||
class UploadForm(FlaskForm):
|
||||
title = TextField('title', validators=[ DataRequired()])
|
||||
writingfield = TextAreaField('writingfield', validators = [DataRequired()])
|
@ -0,0 +1,17 @@
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
import datetime
|
||||
from app import app
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
class Posts(db.Model):
|
||||
pid = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
title = db.Column(db.String(100))
|
||||
writingfield = db.Column(db.String(1000))
|
||||
|
||||
def __init__(self, title, writingfield):
|
||||
self.title = title
|
||||
self.writingfield = writingfield
|
||||
|
||||
|
||||
db.create_all()
|
@ -0,0 +1,371 @@
|
||||
@font-face {
|
||||
font-family: 'suisse_works';
|
||||
src: url('../font/suisseworks-regular-webfont.woff2') format('woff2'),
|
||||
url('../font/suisseworks-regular-webfont.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'suisse_works';
|
||||
src: url('../font/suisseworks-bold-webfont.woff2') format('woff2'),
|
||||
url('../font/suisseworks-bold-webfont.woff') format('woff');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'suisseintl';
|
||||
src: url('../font/suisseintl-book-webfont.woff2') format('woff2'),
|
||||
url('../font/suisseintl-book-webfont.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
body, html{
|
||||
margin:0;
|
||||
padding:0;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
body{
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background-color: white;
|
||||
font-family: 'suisse_works';
|
||||
font-weight: normal;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
h1{
|
||||
font-size:15px;
|
||||
padding: 10px!important;
|
||||
margin-left: 10px!important;
|
||||
font-weight: normal;
|
||||
font-style:italic;
|
||||
font-family: 'suisseintl';
|
||||
}
|
||||
.title{
|
||||
position: relative;
|
||||
text-decoration: none!important;
|
||||
|
||||
}
|
||||
h2{
|
||||
font-family: 'suisse_works'!important;
|
||||
font-weight: normal;
|
||||
font-size: 40px!important;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
h3{
|
||||
font-weight: normal;
|
||||
font-family: 'suisseintl';
|
||||
font-size: 30px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
a{color: black;
|
||||
margin: 0;
|
||||
padding: 0;}
|
||||
|
||||
li{
|
||||
list-style: none;
|
||||
}
|
||||
sub{
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
font-family: 'suisseintl';
|
||||
line-height: 19px!important;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
sub *{
|
||||
line-height: 10px!important;
|
||||
}
|
||||
|
||||
|
||||
.container{
|
||||
padding: 10px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
#writingfield{
|
||||
display: none;
|
||||
}
|
||||
#writing-field{
|
||||
font-size: 25px;
|
||||
position:relative;
|
||||
top:150px;
|
||||
left:10%;
|
||||
width: 80%;
|
||||
min-height: 1200px;
|
||||
background-color: white;
|
||||
border: 0;
|
||||
padding: 50px;
|
||||
padding-bottom: 100px;
|
||||
margin: 0;
|
||||
margin-bottom: 100px;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
-moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
}
|
||||
#writing-field:focus{
|
||||
border: 2px solid blue;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
#writing-field img{
|
||||
width: 100%!important;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.textimage{
|
||||
width: 100%!important;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#type_log{
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
max-height: 205px;
|
||||
vertical-align:bottom;
|
||||
width: 50%;
|
||||
overflow: scroll;
|
||||
word-wrap: break-word;
|
||||
font-size: 12px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
#type_log {
|
||||
vertical-align:bottom;
|
||||
}
|
||||
.incoming{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin-left: -30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#autocomplete{
|
||||
font-family: sans-serif;
|
||||
color: grey;
|
||||
font-size: 13px;
|
||||
background-color:#f2f2f2 ;
|
||||
border: 0.5px solid grey;
|
||||
|
||||
|
||||
-webkit-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
-moz-box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
box-shadow: 2px 2px 5px 0px rgba(0,0,0,0.24);
|
||||
}
|
||||
#autocomplete:empty {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#autocomplete div{
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
#autocomplete div:hover{
|
||||
background-color: blue;
|
||||
color: white;
|
||||
cursor:pointer;
|
||||
}
|
||||
#autocomplete div:hover .incoming{
|
||||
background-color: blue;
|
||||
color: white;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.incoming:hover{
|
||||
background-color: black!important;
|
||||
color: white;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#autocomplete div:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#title{
|
||||
background: #eeeeee;
|
||||
padding: 0px;
|
||||
border: none;
|
||||
font-size: 35px;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
top:5px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#submit{
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
border:2px solid #d9d9d9;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
}
|
||||
#submit:hover{
|
||||
background-color: yellow;
|
||||
|
||||
}
|
||||
|
||||
#topbar{
|
||||
position: fixed;
|
||||
top:0;
|
||||
left: 0;
|
||||
width: 110%;
|
||||
box-sizing: border-box;
|
||||
z-index: 999;
|
||||
background: white;
|
||||
}
|
||||
#topbar form{
|
||||
margin:10px;
|
||||
|
||||
}
|
||||
|
||||
#toolbar{
|
||||
|
||||
line-height: 30px;
|
||||
font-size: 12px;
|
||||
z-index: 999999;
|
||||
margin-top: 10px;
|
||||
border-top: 1px solid #AAA;
|
||||
border-bottom: 1px solid #AAA;
|
||||
|
||||
}
|
||||
|
||||
#toolbar a{
|
||||
|
||||
text-decoration: none;
|
||||
padding:5px;
|
||||
|
||||
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#toolbar a:hover{
|
||||
background-color: lightgrey;
|
||||
}
|
||||
|
||||
|
||||
#upload_img{
|
||||
position:absolute;
|
||||
top:20px;
|
||||
left:200px;
|
||||
z-index: 9999999;
|
||||
font-family: 'suisseintl';
|
||||
background-color: yellow;
|
||||
padding: 20px;
|
||||
display: none;
|
||||
border: 1px solid #AAA;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
#code_insert{
|
||||
position:absolute;
|
||||
top:20px;
|
||||
left:200px;
|
||||
z-index: 9999999;
|
||||
font-family: 'suisseintl';
|
||||
background-color: yellow;
|
||||
padding: 20px;
|
||||
display: none;
|
||||
border: 1px solid #AAA;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
#code_insert pre{
|
||||
min-width: 200px;
|
||||
min-height: 100px;
|
||||
background-color: #AAA;
|
||||
}
|
||||
|
||||
.post{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
font-family: "suisseintl";
|
||||
font-size: 25px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.post img{
|
||||
width: 100%;
|
||||
}
|
||||
.post p{
|
||||
font-family: "suisseintl";
|
||||
font-size: 25px;
|
||||
line-height: 40px;
|
||||
|
||||
}
|
||||
|
||||
.post div{
|
||||
font-family: "suisseintl";
|
||||
font-size: 25px;
|
||||
line-height: 40px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.post pre{
|
||||
font-size: 12px!important;
|
||||
word-wrap: break-word!important;
|
||||
font-family: monospace!important;
|
||||
background-color: lightgrey;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.post code{
|
||||
line-height: 12px;
|
||||
font-size: 12px!important;
|
||||
font-family: monospace!important;
|
||||
background-color: lightgrey;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
|
||||
white-space: pre;
|
||||
word-break: normal;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
.post *{
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.linkTo {
|
||||
position: relative;
|
||||
font-size: 9px;
|
||||
font-family:"suisseintl";
|
||||
|
||||
}
|
||||
|
||||
#index{
|
||||
display: block;
|
||||
margin-top: 20px;
|
||||
bottom:10px;
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
|
||||
#secondframe{
|
||||
width: 50%;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top:0;
|
||||
height: 100%;
|
||||
border:none;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,155 @@
|
||||
/* jshint browser: true */
|
||||
|
||||
(function () {
|
||||
|
||||
// We'll copy the properties below into the mirror div.
|
||||
// Note that some browsers, such as Firefox, do not concatenate properties
|
||||
// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),
|
||||
// so we have to list every single property explicitly.
|
||||
var properties = [
|
||||
'direction', // RTL support
|
||||
'boxSizing',
|
||||
'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does
|
||||
'height',
|
||||
'overflowX',
|
||||
'overflowY', // copy the scrollbar for IE
|
||||
|
||||
'borderTopWidth',
|
||||
'borderRightWidth',
|
||||
'borderBottomWidth',
|
||||
'borderLeftWidth',
|
||||
'borderStyle',
|
||||
|
||||
'paddingTop',
|
||||
'paddingRight',
|
||||
'paddingBottom',
|
||||
'paddingLeft',
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/font
|
||||
'fontStyle',
|
||||
'fontVariant',
|
||||
'fontWeight',
|
||||
'fontStretch',
|
||||
'fontSize',
|
||||
'fontSizeAdjust',
|
||||
'lineHeight',
|
||||
'fontFamily',
|
||||
|
||||
'textAlign',
|
||||
'textTransform',
|
||||
'textIndent',
|
||||
'textDecoration', // might not make a difference, but better be safe
|
||||
|
||||
'letterSpacing',
|
||||
'wordSpacing',
|
||||
|
||||
'tabSize',
|
||||
'MozTabSize'
|
||||
|
||||
];
|
||||
|
||||
var isBrowser = (typeof window !== 'undefined');
|
||||
var isFirefox = (isBrowser && window.mozInnerScreenX != null);
|
||||
|
||||
function getCaretCoordinates(element, position, options) {
|
||||
if (!isBrowser) {
|
||||
throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');
|
||||
}
|
||||
|
||||
var debug = options && options.debug || false;
|
||||
if (debug) {
|
||||
var el = document.querySelector('#input-textarea-caret-position-mirror-div');
|
||||
if (el) el.parentNode.removeChild(el);
|
||||
}
|
||||
|
||||
// The mirror div will replicate the textarea's style
|
||||
var div = document.createElement('div');
|
||||
div.id = 'input-textarea-caret-position-mirror-div';
|
||||
document.body.appendChild(div);
|
||||
|
||||
var style = div.style;
|
||||
var computed = window.getComputedStyle ? window.getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9
|
||||
var isInput = element.nodeName === 'INPUT';
|
||||
|
||||
// Default textarea styles
|
||||
style.whiteSpace = 'pre-wrap';
|
||||
if (!isInput)
|
||||
style.wordWrap = 'break-word'; // only for textarea-s
|
||||
|
||||
// Position off-screen
|
||||
style.position = 'absolute'; // required to return coordinates properly
|
||||
if (!debug)
|
||||
style.visibility = 'hidden'; // not 'display: none' because we want rendering
|
||||
|
||||
// Transfer the element's properties to the div
|
||||
properties.forEach(function (prop) {
|
||||
if (isInput && prop === 'lineHeight') {
|
||||
// Special case for <input>s because text is rendered centered and line height may be != height
|
||||
if (computed.boxSizing === "border-box") {
|
||||
var height = parseInt(computed.height);
|
||||
var outerHeight =
|
||||
parseInt(computed.paddingTop) +
|
||||
parseInt(computed.paddingBottom) +
|
||||
parseInt(computed.borderTopWidth) +
|
||||
parseInt(computed.borderBottomWidth);
|
||||
var targetHeight = outerHeight + parseInt(computed.lineHeight);
|
||||
if (height > targetHeight) {
|
||||
style.lineHeight = height - outerHeight + "px";
|
||||
} else if (height === targetHeight) {
|
||||
style.lineHeight = computed.lineHeight;
|
||||
} else {
|
||||
style.lineHeight = 0;
|
||||
}
|
||||
} else {
|
||||
style.lineHeight = computed.height;
|
||||
}
|
||||
} else {
|
||||
style[prop] = computed[prop];
|
||||
}
|
||||
});
|
||||
|
||||
if (isFirefox) {
|
||||
// Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275
|
||||
if (element.scrollHeight > parseInt(computed.height))
|
||||
style.overflowY = 'scroll';
|
||||
} else {
|
||||
style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'
|
||||
}
|
||||
|
||||
div.textContent = element.value.substring(0, position);
|
||||
// The second special handling for input type="text" vs textarea:
|
||||
// spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037
|
||||
if (isInput)
|
||||
div.textContent = div.textContent.replace(/\s/g, '\u00a0');
|
||||
|
||||
var span = document.createElement('span');
|
||||
// Wrapping must be replicated *exactly*, including when a long word gets
|
||||
// onto the next line, with whitespace at the end of the line before (#7).
|
||||
// The *only* reliable way to do that is to copy the *entire* rest of the
|
||||
// textarea's content into the <span> created at the caret position.
|
||||
// For inputs, just '.' would be enough, but no need to bother.
|
||||
span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all
|
||||
div.appendChild(span);
|
||||
|
||||
var coordinates = {
|
||||
top: span.offsetTop + parseInt(computed['borderTopWidth']),
|
||||
left: span.offsetLeft + parseInt(computed['borderLeftWidth']),
|
||||
height: parseInt(computed['lineHeight'])
|
||||
};
|
||||
|
||||
if (debug) {
|
||||
span.style.backgroundColor = '#aaa';
|
||||
} else {
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
if (typeof module != 'undefined' && typeof module.exports != 'undefined') {
|
||||
module.exports = getCaretCoordinates;
|
||||
} else if(isBrowser) {
|
||||
window.getCaretCoordinates = getCaretCoordinates;
|
||||
}
|
||||
|
||||
}());
|
@ -0,0 +1,625 @@
|
||||
/* Notify.js - http://notifyjs.com/ Copyright (c) 2015 MIT */
|
||||
(function (factory) {
|
||||
// UMD start
|
||||
// https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node/CommonJS
|
||||
module.exports = function( root, jQuery ) {
|
||||
if ( jQuery === undefined ) {
|
||||
// require('jQuery') returns a factory that requires window to
|
||||
// build a jQuery instance, we normalize how we use modules
|
||||
// that require this pattern but the window provided is a noop
|
||||
// if it's defined (how jquery works)
|
||||
if ( typeof window !== 'undefined' ) {
|
||||
jQuery = require('jquery');
|
||||
}
|
||||
else {
|
||||
jQuery = require('jquery')(root);
|
||||
}
|
||||
}
|
||||
factory(jQuery);
|
||||
return jQuery;
|
||||
};
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
//IE8 indexOf polyfill
|
||||
var indexOf = [].indexOf || function(item) {
|
||||
for (var i = 0, l = this.length; i < l; i++) {
|
||||
if (i in this && this[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
var pluginName = "notify";
|
||||
var pluginClassName = pluginName + "js";
|
||||
var blankFieldName = pluginName + "!blank";
|
||||
|
||||
var positions = {
|
||||
t: "top",
|
||||
m: "middle",
|
||||
b: "bottom",
|
||||
l: "left",
|
||||
c: "center",
|
||||
r: "right"
|
||||
};
|
||||
var hAligns = ["l", "c", "r"];
|
||||
var vAligns = ["t", "m", "b"];
|
||||
var mainPositions = ["t", "b", "l", "r"];
|
||||
var opposites = {
|
||||
t: "b",
|
||||
m: null,
|
||||
b: "t",
|
||||
l: "r",
|
||||
c: null,
|
||||
r: "l"
|
||||
};
|
||||
|
||||
var parsePosition = function(str) {
|
||||
var pos;
|
||||
pos = [];
|
||||
$.each(str.split(/\W+/), function(i, word) {
|
||||
var w;
|
||||
w = word.toLowerCase().charAt(0);
|
||||
if (positions[w]) {
|
||||
return pos.push(w);
|
||||
}
|
||||
});
|
||||
return pos;
|
||||
};
|
||||
|
||||
var styles = {};
|
||||
|
||||
var coreStyle = {
|
||||
name: "core",
|
||||
html: "<div class=\"" + pluginClassName + "-wrapper\">\n <div class=\"" + pluginClassName + "-arrow\"></div>\n <div class=\"" + pluginClassName + "-container\"></div>\n</div>",
|
||||
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}"
|
||||
};
|
||||
|
||||
var stylePrefixes = {
|
||||
"border-radius": ["-webkit-", "-moz-"]
|
||||
};
|
||||
|
||||
var getStyle = function(name) {
|
||||
return styles[name];
|
||||
};
|
||||
|
||||
var removeStyle = function(name) {
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (styles[name]) {
|
||||
delete styles[name];
|
||||
}
|
||||
};
|
||||
|
||||
var addStyle = function(name, def) {
|
||||
if (!name) {
|
||||
throw "Missing Style name";
|
||||
}
|
||||
if (!def) {
|
||||
throw "Missing Style definition";
|
||||
}
|
||||
if (!def.html) {
|
||||
throw "Missing Style HTML";
|
||||
}
|
||||
//remove existing style
|
||||
var existing = styles[name];
|
||||
if (existing && existing.cssElem) {
|
||||
if (window.console) {
|
||||
console.warn(pluginName + ": overwriting style '" + name + "'");
|
||||
}
|
||||
styles[name].cssElem.remove();
|
||||
}
|
||||
def.name = name;
|
||||
styles[name] = def;
|
||||
var cssText = "";
|
||||
if (def.classes) {
|
||||
$.each(def.classes, function(className, props) {
|
||||
cssText += "." + pluginClassName + "-" + def.name + "-" + className + " {\n";
|
||||
$.each(props, function(name, val) {
|
||||
if (stylePrefixes[name]) {
|
||||
$.each(stylePrefixes[name], function(i, prefix) {
|
||||
return cssText += " " + prefix + name + ": " + val + ";\n";
|
||||
});
|
||||
}
|
||||
return cssText += " " + name + ": " + val + ";\n";
|
||||
});
|
||||
return cssText += "}\n";
|
||||
});
|
||||
}
|
||||
if (def.css) {
|
||||
cssText += "/* styles for " + def.name + " */\n" + def.css;
|
||||
}
|
||||
if (cssText) {
|
||||
def.cssElem = insertCSS(cssText);
|
||||
def.cssElem.attr("id", "notify-" + def.name);
|
||||
}
|
||||
var fields = {};
|
||||
var elem = $(def.html);
|
||||
findFields("html", elem, fields);
|
||||
findFields("text", elem, fields);
|
||||
def.fields = fields;
|
||||
};
|
||||
|
||||
var insertCSS = function(cssText) {
|
||||
var e, elem, error;
|
||||
elem = createElem("style");
|
||||
elem.attr("type", 'text/css');
|
||||
$("head").append(elem);
|
||||
try {
|
||||
elem.html(cssText);
|
||||
} catch (_) {
|
||||
elem[0].styleSheet.cssText = cssText;
|
||||
}
|
||||
return elem;
|
||||
};
|
||||
|
||||
var findFields = function(type, elem, fields) {
|
||||
var attr;
|
||||
if (type !== "html") {
|
||||
type = "text";
|
||||
}
|
||||
attr = "data-notify-" + type;
|
||||
return find(elem, "[" + attr + "]").each(function() {
|
||||
var name;
|
||||
name = $(this).attr(attr);
|
||||
if (!name) {
|
||||
name = blankFieldName;
|
||||
}
|
||||
fields[name] = type;
|
||||
});
|
||||
};
|
||||
|
||||
var find = function(elem, selector) {
|
||||
if (elem.is(selector)) {
|
||||
return elem;
|
||||
} else {
|
||||
return elem.find(selector);
|
||||
}
|
||||
};
|
||||
|
||||
var pluginOptions = {
|
||||
clickToHide: true,
|
||||
autoHide: true,
|
||||
autoHideDelay: 5000,
|
||||
arrowShow: true,
|
||||
arrowSize: 5,
|
||||
breakNewLines: true,
|
||||
elementPosition: "bottom",
|
||||
globalPosition: "top right",
|
||||
style: "bootstrap",
|
||||
className: "error",
|
||||
showAnimation: "slideDown",
|
||||
showDuration: 400,
|
||||
hideAnimation: "slideUp",
|
||||
hideDuration: 200,
|
||||
gap: 5
|
||||
};
|
||||
|
||||
var inherit = function(a, b) {
|
||||
var F;
|
||||
F = function() {};
|
||||
F.prototype = a;
|
||||
return $.extend(true, new F(), b);
|
||||
};
|
||||
|
||||
var defaults = function(opts) {
|
||||
return $.extend(pluginOptions, opts);
|
||||
};
|
||||
|
||||
var createElem = function(tag) {
|
||||
return $("<" + tag + "></" + tag + ">");
|
||||
};
|
||||
|
||||
var globalAnchors = {};
|
||||
|
||||
var getAnchorElement = function(element) {
|
||||
var radios;
|
||||
if (element.is('[type=radio]')) {
|
||||
radios = element.parents('form:first').find('[type=radio]').filter(function(i, e) {
|
||||
return $(e).attr("name") === element.attr("name");
|
||||
});
|
||||
element = radios.first();
|
||||
}
|
||||
return element;
|
||||
};
|
||||
|
||||
var incr = function(obj, pos, val) {
|
||||
var opp, temp;
|
||||
if (typeof val === "string") {
|
||||
val = parseInt(val, 10);
|
||||
} else if (typeof val !== "number") {
|
||||
return;
|
||||
}
|
||||
if (isNaN(val)) {
|
||||
return;
|
||||
}
|
||||
opp = positions[opposites[pos.charAt(0)]];
|
||||
temp = pos;
|
||||
if (obj[opp] !== undefined) {
|
||||
pos = positions[opp.charAt(0)];
|
||||
val = -val;
|
||||
}
|
||||
if (obj[pos] === undefined) {
|
||||
obj[pos] = val;
|
||||
} else {
|
||||
obj[pos] += val;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var realign = function(alignment, inner, outer) {
|
||||
if (alignment === "l" || alignment === "t") {
|
||||
return 0;
|
||||
} else if (alignment === "c" || alignment === "m") {
|
||||
return outer / 2 - inner / 2;
|
||||
} else if (alignment === "r" || alignment === "b") {
|
||||
return outer - inner;
|
||||
}
|
||||
throw "Invalid alignment";
|
||||
};
|
||||
|
||||
var encode = function(text) {
|
||||
encode.e = encode.e || createElem("div");
|
||||
return encode.e.text(text).html();
|
||||
};
|
||||
|
||||
function Notification(elem, data, options) {
|
||||
if (typeof options === "string") {
|
||||
options = {
|
||||
className: options
|
||||
};
|
||||
}
|
||||
this.options = inherit(pluginOptions, $.isPlainObject(options) ? options : {});
|
||||
this.loadHTML();
|
||||
this.wrapper = $(coreStyle.html);
|
||||
if (this.options.clickToHide) {
|
||||
this.wrapper.addClass(pluginClassName + "-hidable");
|
||||
}
|
||||
this.wrapper.data(pluginClassName, this);
|
||||
this.arrow = this.wrapper.find("." + pluginClassName + "-arrow");
|
||||
this.container = this.wrapper.find("." + pluginClassName + "-container");
|
||||
this.container.append(this.userContainer);
|
||||
if (elem && elem.length) {
|
||||
this.elementType = elem.attr("type");
|
||||
this.originalElement = elem;
|
||||
this.elem = getAnchorElement(elem);
|
||||
this.elem.data(pluginClassName, this);
|
||||
this.elem.before(this.wrapper);
|
||||
}
|
||||
this.container.hide();
|
||||
this.run(data);
|
||||
}
|
||||
|
||||
Notification.prototype.loadHTML = function() {
|
||||
var style;
|
||||
style = this.getStyle();
|
||||
this.userContainer = $(style.html);
|
||||
this.userFields = style.fields;
|
||||
};
|
||||
|
||||
Notification.prototype.show = function(show, userCallback) {
|
||||
var args, callback, elems, fn, hidden;
|
||||
callback = (function(_this) {
|
||||
return function() {
|
||||
if (!show && !_this.elem) {
|
||||
_this.destroy();
|
||||
}
|
||||
if (userCallback) {
|
||||
return userCallback();
|
||||
}
|
||||
};
|
||||
})(this);
|
||||
hidden = this.container.parent().parents(':hidden').length > 0;
|
||||
elems = this.container.add(this.arrow);
|
||||
args = [];
|
||||
if (hidden && show) {
|
||||
fn = "show";
|
||||
} else if (hidden && !show) {
|
||||
fn = "hide";
|
||||
} else if (!hidden && show) {
|
||||
fn = this.options.showAnimation;
|
||||
args.push(this.options.showDuration);
|
||||
} else if (!hidden && !show) {
|
||||
fn = this.options.hideAnimation;
|
||||
args.push(this.options.hideDuration);
|
||||
} else {
|
||||
return callback();
|
||||
}
|
||||
args.push(callback);
|
||||
return elems[fn].apply(elems, args);
|
||||
};
|
||||
|
||||
Notification.prototype.setGlobalPosition = function() {
|
||||
var p = this.getPosition();
|
||||
var pMain = p[0];
|
||||
var pAlign = p[1];
|
||||
var main = positions[pMain];
|
||||
var align = positions[pAlign];
|
||||
var key = pMain + "|" + pAlign;
|
||||
var anchor = globalAnchors[key];
|
||||
if (!anchor || !document.body.contains(anchor[0])) {
|
||||
anchor = globalAnchors[key] = createElem("div");
|
||||
var css = {};
|
||||
css[main] = 0;
|
||||
if (align === "middle") {
|
||||
css.top = '45%';
|
||||
} else if (align === "center") {
|
||||
css.left = '45%';
|
||||
} else {
|
||||
css[align] = 0;
|
||||
}
|
||||
anchor.css(css).addClass(pluginClassName + "-corner");
|
||||
$("body").append(anchor);
|
||||
}
|
||||
return anchor.prepend(this.wrapper);
|
||||
};
|
||||
|
||||
Notification.prototype.setElementPosition = function() {
|
||||
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;
|
||||
position = this.getPosition();
|
||||
pMain = position[0];
|
||||
pAlign = position[1];
|
||||
pArrow = position[2];
|
||||
elemPos = this.elem.position();
|
||||
elemH = this.elem.outerHeight();
|
||||
elemW = this.elem.outerWidth();
|
||||
elemIH = this.elem.innerHeight();
|
||||
elemIW = this.elem.innerWidth();
|
||||
wrapPos = this.wrapper.position();
|
||||
contH = this.container.height();
|
||||
contW = this.container.width();
|
||||
mainFull = positions[pMain];
|
||||
opp = opposites[pMain];
|
||||
oppFull = positions[opp];
|
||||
css = {};
|
||||
css[oppFull] = pMain === "b" ? elemH : pMain === "r" ? elemW : 0;
|
||||
incr(css, "top", elemPos.top - wrapPos.top);
|
||||
incr(css, "left", elemPos.left - wrapPos.left);
|
||||
ref = ["top", "left"];
|
||||
for (j = 0, len = ref.length; j < len; j++) {
|
||||
pos = ref[j];
|
||||
margin = parseInt(this.elem.css("margin-" + pos), 10);
|
||||
if (margin) {
|
||||
incr(css, pos, margin);
|
||||
}
|
||||
}
|
||||
gap = Math.max(0, this.options.gap - (this.options.arrowShow ? arrowSize : 0));
|
||||
incr(css, oppFull, gap);
|
||||
if (!this.options.arrowShow) {
|
||||
this.arrow.hide();
|
||||
} else {
|
||||
arrowSize = this.options.arrowSize;
|
||||
arrowCss = $.extend({}, css);
|
||||
arrowColor = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
|
||||
for (k = 0, len1 = mainPositions.length; k < len1; k++) {
|
||||
pos = mainPositions[k];
|
||||
posFull = positions[pos];
|
||||
if (pos === opp) {
|
||||
continue;
|
||||
}
|
||||
color = posFull === mainFull ? arrowColor : "transparent";
|
||||
arrowCss["border-" + posFull] = arrowSize + "px solid " + color;
|
||||
}
|
||||
incr(css, positions[opp], arrowSize);
|
||||
if (indexOf.call(mainPositions, pAlign) >= 0) {
|
||||
incr(arrowCss, positions[pAlign], arrowSize * 2);
|
||||
}
|
||||
}
|
||||
if (indexOf.call(vAligns, pMain) >= 0) {
|
||||
incr(css, "left", realign(pAlign, contW, elemW));
|
||||
if (arrowCss) {
|
||||
incr(arrowCss, "left", realign(pAlign, arrowSize, elemIW));
|
||||
}
|
||||
} else if (indexOf.call(hAligns, pMain) >= 0) {
|
||||
incr(css, "top", realign(pAlign, contH, elemH));
|
||||
if (arrowCss) {
|
||||
incr(arrowCss, "top", realign(pAlign, arrowSize, elemIH));
|
||||
}
|
||||
}
|
||||
if (this.container.is(":visible")) {
|
||||
css.display = "block";
|
||||
}
|
||||
this.container.removeAttr("style").css(css);
|
||||
if (arrowCss) {
|
||||
return this.arrow.removeAttr("style").css(arrowCss);
|
||||
}
|
||||
};
|
||||
|
||||
Notification.prototype.getPosition = function() {
|
||||
var pos, ref, ref1, ref2, ref3, ref4, ref5, text;
|
||||
text = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition);
|
||||
pos = parsePosition(text);
|
||||
if (pos.length === 0) {
|
||||
pos[0] = "b";
|
||||
}
|
||||
if (ref = pos[0], indexOf.call(mainPositions, ref) < 0) {
|
||||
throw "Must be one of [" + mainPositions + "]";
|
||||
}
|
||||
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))) {
|
||||
pos[1] = (ref5 = pos[0], indexOf.call(hAligns, ref5) >= 0) ? "m" : "l";
|
||||
}
|
||||
if (pos.length === 2) {
|
||||
pos[2] = pos[1];
|
||||
}
|
||||
return pos;
|
||||
};
|
||||
|
||||
Notification.prototype.getStyle = function(name) {
|
||||
var style;
|
||||
if (!name) {
|
||||
name = this.options.style;
|
||||
}
|
||||
if (!name) {
|
||||
name = "default";
|
||||
}
|
||||
style = styles[name];
|
||||
if (!style) {
|
||||
throw "Missing style: " + name;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
Notification.prototype.updateClasses = function() {
|
||||
var classes, style;
|
||||
classes = ["base"];
|
||||
if ($.isArray(this.options.className)) {
|
||||
classes = classes.concat(this.options.className);
|
||||
} else if (this.options.className) {
|
||||
classes.push(this.options.className);
|
||||
}
|
||||
style = this.getStyle();
|
||||
classes = $.map(classes, function(n) {
|
||||
return pluginClassName + "-" + style.name + "-" + n;
|
||||
}).join(" ");
|
||||
return this.userContainer.attr("class", classes);
|
||||
};
|
||||
|
||||
Notification.prototype.run = function(data, options) {
|
||||
var d, datas, name, type, value;
|
||||
if ($.isPlainObject(options)) {
|
||||
$.extend(this.options, options);
|
||||
} else if ($.type(options) === "string") {
|
||||
this.options.className = options;
|
||||
}
|
||||
if (this.container && !data) {
|
||||
this.show(false);
|
||||
return;
|
||||
} else if (!this.container && !data) {
|
||||
return;
|
||||
}
|
||||
datas = {};
|
||||
if ($.isPlainObject(data)) {
|
||||
datas = data;
|
||||
} else {
|
||||
datas[blankFieldName] = data;
|
||||
}
|
||||
for (name in datas) {
|
||||
d = datas[name];
|
||||
type = this.userFields[name];
|
||||
if (!type) {
|
||||
continue;
|
||||
}
|
||||
if (type === "text") {
|
||||
d = encode(d);
|
||||
if (this.options.breakNewLines) {
|
||||
d = d.replace(/\n/g, '<br/>');
|
||||
}
|
||||
}
|
||||
value = name === blankFieldName ? '' : '=' + name;
|
||||
find(this.userContainer, "[data-notify-" + type + value + "]").html(d);
|
||||
}
|
||||
this.updateClasses();
|
||||
if (this.elem) {
|
||||
this.setElementPosition();
|
||||
} else {
|
||||
this.setGlobalPosition();
|
||||
}
|
||||
this.show(true);
|
||||
if (this.options.autoHide) {
|
||||
clearTimeout(this.autohideTimer);
|
||||
this.autohideTimer = setTimeout(this.show.bind(this, false), this.options.autoHideDelay);
|
||||
}
|
||||
};
|
||||
|
||||
Notification.prototype.destroy = function() {
|
||||
this.wrapper.data(pluginClassName, null);
|
||||
this.wrapper.remove();
|
||||
};
|
||||
|
||||
$[pluginName] = function(elem, data, options) {
|
||||
if ((elem && elem.nodeName) || elem.jquery) {
|
||||
$(elem)[pluginName](data, options);
|
||||
} else {
|
||||
options = data;
|
||||
data = elem;
|
||||
new Notification(null, data, options);
|
||||
}
|
||||
return elem;
|
||||
};
|
||||
|
||||
$.fn[pluginName] = function(data, options) {
|
||||
$(this).each(function() {
|
||||
var prev = getAnchorElement($(this)).data(pluginClassName);
|
||||
if (prev) {
|
||||
prev.destroy();
|
||||
}
|
||||
var curr = new Notification($(this), data, options);
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
$.extend($[pluginName], {
|
||||
defaults: defaults,
|
||||
addStyle: addStyle,
|
||||
removeStyle: removeStyle,
|
||||
pluginOptions: pluginOptions,
|
||||
getStyle: getStyle,
|
||||
insertCSS: insertCSS
|
||||
});
|
||||
|
||||
//always include the default bootstrap style
|
||||
addStyle("bootstrap", {
|
||||
html: "<div>\n<span data-notify-text></span>\n</div>",
|
||||
classes: {
|
||||
base: {
|
||||
"font-weight": "bold",
|
||||
"padding": "8px 15px 8px 14px",
|
||||
"text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
|
||||
"background-color": "#fcf8e3",
|
||||
"border": "1px solid #fbeed5",
|
||||
"border-radius": "4px",
|
||||
"white-space": "nowrap",
|
||||
"padding-left": "25px",
|
||||
"background-repeat": "no-repeat",
|
||||
"background-position": "3px 7px"
|
||||
},
|
||||
error: {
|
||||
"color": "#B94A48",
|
||||
"background-color": "#F2DEDE",
|
||||
"border-color": "#EED3D7",
|
||||
"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=)"
|
||||
},
|
||||
success: {
|
||||
"color": "#468847",
|
||||
"background-color": "#DFF0D8",
|
||||
"border-color": "#D6E9C6",
|
||||
"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==)"
|
||||
},
|
||||
info: {
|
||||
"color": "#3A87AD",
|
||||
"background-color": "#D9EDF7",
|
||||
"border-color": "#BCE8F1",
|
||||
"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=)"
|
||||
},
|
||||
warn: {
|
||||
"color": "#C09853",
|
||||
"background-color": "#FCF8E3",
|
||||
"border-color": "#FBEED5",
|
||||
"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)"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
insertCSS(coreStyle.css).attr("id", "core-notify");
|
||||
$(document).on("click", "." + pluginClassName + "-hidable", function(e) {
|
||||
$(this).trigger("notify-hide");
|
||||
});
|
||||
$(document).on("notify-hide", "." + pluginClassName + "-wrapper", function(e) {
|
||||
var elem = $(this).data(pluginClassName);
|
||||
if(elem) {
|
||||
elem.show(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}));
|
@ -0,0 +1,15 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
|
||||
{% for post in posts %}
|
||||
|
||||
<span><a href="{{ post.pid }}"><h2>{{ post.title }}</h2></a>
|
||||
<!-- <p>{{ post.writingfield }}<p>--></span>
|
||||
{% else %}
|
||||
<em>No entries here so far</em>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,127 @@
|
||||
<!--
|
||||
______ ______ ______ ______ __ ______
|
||||
/\ == \ /\ __ \ /\ ___\ /\__ _\ /\ \ /\ ___\
|
||||
\ \ _-/ \ \ \/\ \ \ \ __\ \/_/\ \/ \ \ \ \ \ \____
|
||||
\ \_\ \ \_____\ \ \_____\ \ \_\ \ \_\ \ \_____\
|
||||
\/_/ \/_____/ \/_____/ \/_/ \/_/ \/_____/
|
||||
|
||||
______ ______ ______ ______ __ __ ______ ______ ______
|
||||
/\ ___\ /\ __ \ /\ ___\ /\__ _\ /\ \ _ \ \ /\ __ \ /\ == \ /\ ___\
|
||||
\ \___ \ \ \ \/\ \ \ \ __\ \/_/\ \/ \ \ \/ ".\ \ \ \ __ \ \ \ __< \ \ __\
|
||||
\/\_____\ \ \_____\ \ \_\ \ \_\ \ \__/".~\_\ \ \_\ \_\ \ \_\ \_\ \ \_____\
|
||||
\/_____/ \/_____/ \/_/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/ /_/ \/_____/
|
||||
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||
<title>Poetic Software</title>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||
|
||||
<script src="index.js"></script>
|
||||
<script src="/static/notify.js"></script>
|
||||
<link rel="stylesheet"
|
||||
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/styles/default.min.css">
|
||||
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/highlight.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
{% block css %} {% endblock%}
|
||||
</head>
|
||||
<body>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul class=flashes>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<main>
|
||||
<a href={{ url_for('index') }} class="title" ><h1>Read only, write a bit and make me run!</h1></a>
|
||||
<div class="container">
|
||||
|
||||
{% block main %}{% endblock %}
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<div id="index"><a href="index">index</a></div>
|
||||
{% block js %} {% endblock%}
|
||||
|
||||
<script>
|
||||
function doSomething() {
|
||||
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?'];
|
||||
$.notify(myArray[Math.floor(Math.random() * myArray.length)], "warn");
|
||||
|
||||
}
|
||||
|
||||
(function loop() {
|
||||
var rand = Math.round(Math.random() * (100000 - 500)) + 500;
|
||||
setTimeout(function() {
|
||||
|
||||
doSomething();
|
||||
loop();
|
||||
}, rand);
|
||||
}());
|
||||
|
||||
</script>
|
||||
|
||||
{% if "edit" not in request.path and "writer" not in request.path %}
|
||||
<script>
|
||||
|
||||
function inIframe () {
|
||||
try {
|
||||
return window.self !== window.top;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$('a').click(function(){
|
||||
return false;
|
||||
})
|
||||
$("a").on("mousedown", function(e){
|
||||
|
||||
if(inIframe()){
|
||||
var link = $(this).prop('href');
|
||||
|
||||
window.parent.location = window.location.href+"?page="+link
|
||||
|
||||
}
|
||||
e.preventDefault();
|
||||
var iframe = document.createElement('iframe');
|
||||
var link = $(this).prop('href');
|
||||
console.log(link);
|
||||
iframe.src = link;
|
||||
iframe.id = "secondframe";
|
||||
$('.post').css({'width': '50%'});
|
||||
document.body.appendChild(iframe);
|
||||
})
|
||||
|
||||
$("body").ready(function(){
|
||||
var url = new URL(window.location.href)
|
||||
if(url.searchParams.get("page"))
|
||||
{
|
||||
var page = url.searchParams.get("page");
|
||||
var iframe = document.createElement('iframe');
|
||||
var link = page;
|
||||
console.log(link);
|
||||
iframe.src = link;
|
||||
iframe.id = "secondframe"
|
||||
$(".post").css("width", "50%");
|
||||
document.body.appendChild(iframe);}
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,16 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
|
||||
{% for post in posts %}
|
||||
{% if "Introduction"|string() == post.title|string() %}
|
||||
<div class="post"><!--<a href="{{ post.pid }}"><h2>{{ post.title }}</h2></a>-->
|
||||
<p>{{ post.writingfield|safe }}<p></div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em>No entries here so far</em>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,10 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<div class="post"><h2>{{ post.title }}</h2>
|
||||
<p>{{ post.writingfield|safe }}<p></div>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,11 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<h3>Turn in your old binary files and see how software depicts itself<h3>
|
||||
|
||||
<form method=post enctype=multipart/form-data>
|
||||
<input type=file name=file>
|
||||
<input type=submit value=Upload>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,554 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
<!-- <textarea id="writing-field" rows="4" cols="50"></textarea> -->
|
||||
|
||||
<div id="topbar">
|
||||
|
||||
<form method="post">
|
||||
{{ form.csrf_token }}
|
||||
{{ form.title }}
|
||||
{{ form.writingfield }}
|
||||
<input value="submit" id="submit" type="submit"> <h1 style="display:inline-block;"> PARA .DOX</h1>
|
||||
</form>
|
||||
|
||||
<div id="toolbar">
|
||||
|
||||
<a href="#" id="insertImg">Insert image</a>
|
||||
<a href="#" data-command='insertCode'><i class="fa fa-code"></i></a>
|
||||
<a href="#" data-command='undo'><i class='fa fa-undo'></i></a>
|
||||
<a href="#" data-command='redo'><i class='fa fa-repeat'></i></a>
|
||||
<a href="#" data-command='bold'><i class='fa fa-bold'></i></a>
|
||||
<a href="#" data-command='italic'><i class='fa fa-italic'></i></a>
|
||||
<a href="#" data-command='underline'><i class='fa fa-underline'></i></a>
|
||||
<a href="#" data-command='strikeThrough'><i class='fa fa-strikethrough'></i></a>
|
||||
<a href="#" data-command='justifyLeft'><i class='fa fa-align-left'></i></a>
|
||||
<a href="#" data-command='justifyCenter'><i class='fa fa-align-center'></i></a>
|
||||
<a href="#" data-command='justifyRight'><i class='fa fa-align-right'></i></a>
|
||||
<a href="#" data-command='justifyFull'><i class='fa fa-align-justify'></i></a>
|
||||
<a href="#" data-command='indent'><i class='fa fa-indent'></i></a>
|
||||
<a href="#" data-command='outdent'><i class='fa fa-outdent'></i></a>
|
||||
<a href="#" data-command='insertUnorderedList'><i class='fa fa-list-ul'></i></a>
|
||||
<a href="#" data-command='insertOrderedList'><i class='fa fa-list-ol'></i></a>
|
||||
<!--<a href="#" data-command='h1'>H1</a>
|
||||
<a href="#" data-command='h2'>H2</a>-->
|
||||
<a href="#" data-command='createlink'><i class='fa fa-link'></i></a>
|
||||
<a href="#" data-command='unlink'><i class='fa fa-unlink'></i></a>
|
||||
<a href="#" data-command='insertimage'><i class='fa fa-image'></i></a>
|
||||
<a href="#" data-command='p'>P</a>
|
||||
<a href="#" data-command='subscript'><i class='fa fa-subscript'></i></a>
|
||||
<a href="#" data-command='superscript'><i class='fa fa-superscript'></i></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="upload_img" method="post" enctype="multipart/form-data">
|
||||
<label for="file">Select a file</label>
|
||||
<input name="file" type="file">
|
||||
<button id="submit_img" type="button">Upload</button>
|
||||
<p>Result Filename: <span id="resultFilename"> here</span></p>
|
||||
<p>Result Filesize: <span id="resultFilesize">here</span></p>
|
||||
</form>
|
||||
|
||||
<div id="code_insert"><pre contenteditable="true">Insert code here</pre><button id="submit_code" type="button">insert</button></div>
|
||||
|
||||
<div id="writing-field" contenteditable="true"></div>
|
||||
<div id="type_log"></div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
var writing_field = $("#writing-field");
|
||||
var writing_in_focus = false;
|
||||
var last_word = "";
|
||||
var current_word = "";
|
||||
var number_selected=-1;
|
||||
var caret_pos = 0;
|
||||
|
||||
writing_field.focusin(function() {
|
||||
writing_in_focus = true;
|
||||
})
|
||||
|
||||
writing_field.focusout(function() {
|
||||
writing_in_focus = false;
|
||||
})
|
||||
|
||||
writing_field.on('keydown', function (e) {
|
||||
if (e.keyCode==40||e.keyCode==38||e.keyCode==13) {
|
||||
if(number_selected!=-1) e.preventDefault();
|
||||
}
|
||||
});
|
||||
//check for typing or click in textfield
|
||||
writing_field.bind("click keyup" ,function(e) {
|
||||
|
||||
var input = writing_field.text();
|
||||
if(e.key== " "){
|
||||
last_word = "";
|
||||
}
|
||||
else{
|
||||
last_word = last_word+e.key;
|
||||
}
|
||||
|
||||
if (e.keyCode > 36 && e.keyCode < 41)
|
||||
{
|
||||
var cursorPos = getCaretPosition(document.getElementById("writing-field"));
|
||||
}
|
||||
if(e.keyCode==40)
|
||||
{
|
||||
|
||||
number_selected++;
|
||||
console.log(number_selected);
|
||||
if($('#autocomplete').children().length > 0){
|
||||
$('.proposal').css("background-color", "");
|
||||
$('.proposal').css("color", "");
|
||||
$('.proposal').eq(number_selected).css("background-color", "blue");
|
||||
$('.proposal').eq(number_selected).css("color", "white");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else if(e.keyCode==38)
|
||||
{
|
||||
number_selected--;
|
||||
console.log(number_selected);
|
||||
if($('#autocomplete').children().length > 0){
|
||||
$('.proposal').css("background-color", "");
|
||||
$('.proposal').css("color", "");
|
||||
$('.proposal').eq(number_selected).css("background-color", "blue");
|
||||
$('.proposal').eq(number_selected).css("color", "white");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else if(e.keyCode==13 && number_selected!=-1){
|
||||
var position = getCaretPosition(document.getElementById("writing-field"));
|
||||
console.log("CARET POSITION:::: "+caret_pos)
|
||||
console.log("CURRENT WORD:::: "+current_word)
|
||||
/*
|
||||
var content = writing_field.text();
|
||||
var newContent = content.slice(0, caret_pos-current_word.length) + content.slice(caret_pos);
|
||||
writing_field.text(newContent);*/
|
||||
setSelectionRange(document.getElementById("writing-field"),caret_pos-current_word.length ,caret_pos);
|
||||
document.execCommand("delete", false,false);
|
||||
// SetCaretPosition(document.getElementById("writing-field"),caret_pos-current_word.length);
|
||||
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> ");
|
||||
//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>");
|
||||
|
||||
//document.execCommand("insertHTML", false, "<a href='#'>"+$('.proposal').eq(number_selected).text()+"</a>");
|
||||
|
||||
number_selected=-1;
|
||||
}
|
||||
else{
|
||||
number_selected=-1;
|
||||
}
|
||||
caret_pos=getCaretPosition(document.getElementById("writing-field"));
|
||||
console.log(caret_pos);
|
||||
current_word = getWordAt(writing_field.text(),getCaretPosition(document.getElementById("writing-field")))
|
||||
console.log(current_word)
|
||||
//typeinfo at the bottom
|
||||
$("#type_log").append(e.key );
|
||||
updateScroll();
|
||||
})
|
||||
function getTextNodesIn(node) {
|
||||
var textNodes = [];
|
||||
if (node.nodeType == 3) {
|
||||
textNodes.push(node);
|
||||
} else {
|
||||
var children = node.childNodes;
|
||||
for (var i = 0, len = children.length; i < len; ++i) {
|
||||
textNodes.push.apply(textNodes, getTextNodesIn(children[i]));
|
||||
}
|
||||
}
|
||||
return textNodes;
|
||||
}
|
||||
|
||||
function setSelectionRange(el, start, end) {
|
||||
if (document.createRange && window.getSelection) {
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(el);
|
||||
var textNodes = getTextNodesIn(el);
|
||||
var foundStart = false;
|
||||
var charCount = 0, endCharCount;
|
||||
|
||||
for (var i = 0, textNode; textNode = textNodes[i++]; ) {
|
||||
endCharCount = charCount + textNode.length;
|
||||
if (!foundStart && start >= charCount
|
||||
&& (start < endCharCount ||
|
||||
(start == endCharCount && i <= textNodes.length))) {
|
||||
range.setStart(textNode, start - charCount);
|
||||
foundStart = true;
|
||||
}
|
||||
if (foundStart && end <= endCharCount) {
|
||||
range.setEnd(textNode, end - charCount);
|
||||
break;
|
||||
}
|
||||
charCount = endCharCount;
|
||||
}
|
||||
|
||||
var sel = window.getSelection();
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
} else if (document.selection && document.body.createTextRange) {
|
||||
var textRange = document.body.createTextRange();
|
||||
textRange.moveToElementText(el);
|
||||
textRange.collapse(true);
|
||||
textRange.moveEnd("character", end);
|
||||
textRange.moveStart("character", start);
|
||||
textRange.select();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateScroll(){
|
||||
$('#type_log').scrollTop($('#type_log')[0].scrollHeight);
|
||||
}
|
||||
function pasteHtmlAtCaret(html) {
|
||||
var sel, range;
|
||||
if (window.getSelection) {
|
||||
// IE9 and non-IE
|
||||
sel = window.getSelection();
|
||||
if (sel.getRangeAt && sel.rangeCount) {
|
||||
range = sel.getRangeAt(0);
|
||||
range.deleteContents();
|
||||
|
||||
// Range.createContextualFragment() would be useful here but is
|
||||
// non-standard and not supported in all browsers (IE9, for one)
|
||||
var el = document.createElement("div");
|
||||
el.innerHTML = html;
|
||||
var frag = document.createDocumentFragment(), node, lastNode;
|
||||
while ( (node = el.firstChild) ) {
|
||||
lastNode = frag.appendChild(node);
|
||||
}
|
||||
range.insertNode(frag);
|
||||
|
||||
// Preserve the selection
|
||||
if (lastNode) {
|
||||
range = range.cloneRange();
|
||||
range.setStartAfter(lastNode);
|
||||
range.collapse(true);
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}
|
||||
}
|
||||
} else if (document.selection && document.selection.type != "Control") {
|
||||
// IE < 9
|
||||
document.selection.createRange().pasteHTML(html);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getWordAt (str, pos) {
|
||||
|
||||
// Perform type conversions.
|
||||
str = String(str);
|
||||
pos = Number(pos) >>> 0;
|
||||
|
||||
// Search for the word's beginning and end.
|
||||
var left = str.slice(0, pos + 1).search(/\S+$/),
|
||||
right = str.slice(pos).search(/\s/);
|
||||
|
||||
// The last word in the string is a special case.
|
||||
if (right < 0) {
|
||||
return str.slice(left);
|
||||
}
|
||||
|
||||
// Return the word, using the located bounds to extract it from the string.
|
||||
return str.slice(left, right + pos);
|
||||
|
||||
}
|
||||
|
||||
var ie = (typeof document.selection != "undefined" && document.selection.type != "Control") && true;
|
||||
var w3 = (typeof window.getSelection != "undefined") && true;
|
||||
function getCaretPosition(element) {
|
||||
var caretOffset = 0;
|
||||
if (w3) {
|
||||
var range = window.getSelection().getRangeAt(0);
|
||||
var preCaretRange = range.cloneRange();
|
||||
preCaretRange.selectNodeContents(element);
|
||||
preCaretRange.setEnd(range.endContainer, range.endOffset);
|
||||
caretOffset = preCaretRange.toString().length;
|
||||
} else if (ie) {
|
||||
var textRange = document.selection.createRange();
|
||||
var preCaretTextRange = document.body.createTextRange();
|
||||
preCaretTextRange.moveToElementText(element);
|
||||
preCaretTextRange.setEndPoint("EndToEnd", textRange);
|
||||
caretOffset = preCaretTextRange.text.length;
|
||||
}
|
||||
return caretOffset;
|
||||
}
|
||||
|
||||
|
||||
//time between keystrokes
|
||||
var last;
|
||||
var output = $('#output');
|
||||
writing_field.on('input', function() {
|
||||
var n = new Date()
|
||||
var time = (last - n);
|
||||
console.log(time + ' ms');
|
||||
last = n;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
['#writing-field'].forEach(function (selector) {
|
||||
var element = document.querySelector(selector);
|
||||
var fontSize = getComputedStyle(element).getPropertyValue('font-size');
|
||||
|
||||
var rect = document.createElement('div');
|
||||
document.body.appendChild(rect);
|
||||
rect.id = "autocomplete"
|
||||
rect.style.position = 'absolute';
|
||||
rect.style.height = "auto";
|
||||
rect.style.width = "auto";
|
||||
|
||||
['keyup', 'click', 'scroll'].forEach(function (event) {
|
||||
element.addEventListener(event, update);
|
||||
});
|
||||
|
||||
function update() {
|
||||
|
||||
if(event.keyCode != 40 && event.keyCode != 38){
|
||||
// Set `debug` to true in order to see the mirror div. Default false.
|
||||
console.log(getSelectionCoords());
|
||||
var coordinates = getSelectionCoords();
|
||||
console.log("SCROOOLLL"+document.scrollingElement.scrollTop)
|
||||
//console.log('(top, left, height) = (%s, %s, %s)', coordinates.top, coordinates.left, coordinates.height);
|
||||
rect.style.top =
|
||||
+ document.scrollingElement.scrollTop
|
||||
+ coordinates.y
|
||||
+ 30
|
||||
+ 'px';
|
||||
rect.style.left =
|
||||
- element.scrollLeft
|
||||
+ coordinates.x
|
||||
+ 'px';
|
||||
getProposals(current_word);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function getProposals(input_word){
|
||||
|
||||
var autocomplete = document.getElementById("autocomplete")
|
||||
while (autocomplete.firstChild) {
|
||||
autocomplete.removeChild(autocomplete.firstChild);
|
||||
}
|
||||
|
||||
var ajaxfinished = true;
|
||||
var requestProposals
|
||||
|
||||
if(input_word.length>1){
|
||||
|
||||
if(!ajaxfinished) {requestProposals.abort();}
|
||||
|
||||
ajaxfinished = false;
|
||||
requestProposals = $.ajax({
|
||||
url: '/api/beginwith='+current_word+'',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
ajaxfinished = true;
|
||||
data.forEach(function(p){
|
||||
var proposal = document.createElement('div');
|
||||
autocomplete.appendChild(proposal);
|
||||
proposal.className = "proposal";
|
||||
var result = p.word;
|
||||
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>";
|
||||
|
||||
});
|
||||
$(".proposal").on("mousedown",function(e){
|
||||
e.preventDefault();
|
||||
var position = getCaretPosition(document.getElementById("writing-field"));
|
||||
console.log("CARET POSITION:::: "+caret_pos)
|
||||
console.log("CURRENT WORD:::: "+current_word)
|
||||
/*
|
||||
var content = writing_field.text();
|
||||
var newContent = content.slice(0, caret_pos-current_word.length) + content.slice(caret_pos);
|
||||
writing_field.text(newContent);*/
|
||||
setSelectionRange(document.getElementById("writing-field"),caret_pos-current_word.length ,caret_pos);
|
||||
document.execCommand("delete", false,false);
|
||||
// SetCaretPosition(document.getElementById("writing-field"),caret_pos-current_word.length);
|
||||
//" <a class='linkTo' href='"+str(link)+"'>→ "+frompost.title+"</a>"
|
||||
pasteHtmlAtCaret($(this).find('b').text()+$(this).find('span').text()+" <a class='linkTo' href='"+$(this).find('.intext').text()+"'>→ "+$(this).find('.intextname').text()+"</a> ");
|
||||
$("#writing-field").get(0).focus();
|
||||
|
||||
SetCaretPosition(document.getElementById("writing-field"),caret_pos+$(this).find('span').text().length+1);
|
||||
})
|
||||
$(".incoming").on("mousedown",function(e){
|
||||
$(".proposal").unbind('mousedown');
|
||||
$.ajax({url: "/api/link={{ post.pid }}+wordnum="+$(this).siblings(".wordnumber").first().text()+"+document="+$(this).siblings(".intext").first().text() , success: function(result){
|
||||
$("#div1").html(result);
|
||||
}});
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
}
|
||||
}
|
||||
|
||||
// Move caret to a specific point in a DOM element
|
||||
function SetCaretPosition(el, pos){
|
||||
|
||||
// Loop through all child nodes
|
||||
for(var node of el.childNodes){
|
||||
if(node.nodeType == 3){ // we have a text node
|
||||
if(node.length >= pos){
|
||||
// finally add our range
|
||||
var range = document.createRange(),
|
||||
sel = window.getSelection();
|
||||
range.setStart(node,pos);
|
||||
range.collapse(true);
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
return -1; // we are done
|
||||
}else{
|
||||
pos -= node.length;
|
||||
}
|
||||
}else{
|
||||
pos = SetCaretPosition(node,pos);
|
||||
if(pos == -1){
|
||||
return -1; // no need to finish the for loop
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos; // needed because of recursion stuff
|
||||
}
|
||||
|
||||
function getSelectionCoords() {
|
||||
var sel = document.selection, range, rect;
|
||||
var x = 0, y = 0;
|
||||
if (sel) {
|
||||
if (sel.type != "Control") {
|
||||
range = sel.createRange();
|
||||
range.collapse(true);
|
||||
x = range.boundingLeft;
|
||||
y = range.boundingTop;
|
||||
}
|
||||
} else if (window.getSelection) {
|
||||
sel = window.getSelection();
|
||||
if (sel.rangeCount) {
|
||||
range = sel.getRangeAt(0).cloneRange();
|
||||
if (range.getClientRects) {
|
||||
range.collapse(true);
|
||||
if (range.getClientRects().length>0){
|
||||
rect = range.getClientRects()[0];
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
}
|
||||
}
|
||||
// Fall back to inserting a temporary element
|
||||
if (x == 0 && y == 0) {
|
||||
var span = document.createElement("span");
|
||||
if (span.getClientRects) {
|
||||
// Ensure span has dimensions and position by
|
||||
// adding a zero-width space character
|
||||
span.appendChild( document.createTextNode("\u200b") );
|
||||
range.insertNode(span);
|
||||
rect = span.getClientRects()[0];
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
var spanParent = span.parentNode;
|
||||
spanParent.removeChild(span);
|
||||
|
||||
// Glue any broken text nodes back together
|
||||
spanParent.normalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return { x: x, y: y };
|
||||
}
|
||||
|
||||
$("#insertImg").click(function (){
|
||||
|
||||
$("#upload_img").fadeToggle()
|
||||
|
||||
})
|
||||
|
||||
|
||||
function insertCode(){
|
||||
$("#code_insert").fadeOut();
|
||||
$("#writing-field").focus();
|
||||
SetCaretPosition(document.getElementById("writing-field"),caret_pos);
|
||||
pasteHtmlAtCaret($("#code_insert pre").text());
|
||||
}
|
||||
|
||||
function insertImage(filename){
|
||||
$("#upload_img").fadeOut();
|
||||
$("#writing-field").focus();
|
||||
SetCaretPosition(document.getElementById("writing-field"),caret_pos);
|
||||
|
||||
pasteHtmlAtCaret("<img class='textimage' src='/img/"+filename+"'>");
|
||||
|
||||
|
||||
}
|
||||
|
||||
$('#submit').click(function () {
|
||||
var mysave = $('#writing-field').html();
|
||||
$('#writingfield').val(mysave);
|
||||
});
|
||||
$( window ).on( "load", function() {
|
||||
$('#writing-field').html($('#writingfield').val());
|
||||
$('.title').hide()
|
||||
})
|
||||
|
||||
$('#submit_code').click(function() {
|
||||
insertCode();
|
||||
})
|
||||
$(function() {
|
||||
$('#submit_img').click(function() {
|
||||
event.preventDefault();
|
||||
var form_data = new FormData($('#upload_img')[0]);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/uploadajax',
|
||||
data: form_data,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
dataType: 'json'
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
console.log(data);
|
||||
console.log(textStatus);
|
||||
console.log(jqXHR);
|
||||
console.log('Success!');
|
||||
$("#resultFilename").text(data['name']);
|
||||
insertImage(data['name']);
|
||||
$("#resultFilesize").text(data['size']);
|
||||
}).fail(function(data){
|
||||
alert('error!');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#toolbar a').click(function(e) {
|
||||
var command = $(this).data('command');
|
||||
if(command == 'insertCode'){
|
||||
$("#code_insert").fadeToggle()
|
||||
}
|
||||
if (command == 'h1' || command == 'h2' || command == 'p') {
|
||||
document.execCommand('formatBlock', false, command);
|
||||
}
|
||||
if (command == 'forecolor' || command == 'backcolor') {
|
||||
document.execCommand($(this).data('command'), false, $(this).data('value'));
|
||||
}
|
||||
if (command == 'createlink' || command == 'insertimage') {
|
||||
url = prompt('Enter the link here: ','http:\/\/'); document.execCommand($(this).data('command'), false, url);
|
||||
}
|
||||
else document.execCommand($(this).data('command'), false, null);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,218 @@
|
||||
from flask import Flask, request, session, redirect, url_for, render_template, flash, jsonify, send_from_directory
|
||||
from . models import Posts, db
|
||||
from flask_cors import CORS, cross_origin
|
||||
from app.forms import UploadForm
|
||||
from app import app
|
||||
from sqlalchemy.sql.expression import func, select
|
||||
from sqlalchemy.sql import except_
|
||||
import re,string
|
||||
import os
|
||||
from werkzeug.utils import secure_filename
|
||||
import json
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
from subprocess import check_output
|
||||
|
||||
basedir = os.path.abspath(os.path.dirname(__file__))
|
||||
UPLOAD_FOLDER = os.path.join(basedir, 'img')
|
||||
|
||||
ALLOWED_EXTENSIONS = set([ 'png', 'jpg', 'jpeg', 'gif'])
|
||||
|
||||
def allowed_file(filename):
|
||||
return '.' in filename and \
|
||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
|
||||
def cleanhtml(raw_html):
|
||||
cleanr = re.compile('<.*?>')
|
||||
cleantext = re.sub(cleanr, '', raw_html)
|
||||
return cleantext
|
||||
|
||||
@app.route('/')
|
||||
@cross_origin(origin='*')
|
||||
def index():
|
||||
posts = db.session.query(Posts).all()
|
||||
return render_template('index.html', posts=posts)
|
||||
|
||||
@app.route('/index')
|
||||
def all():
|
||||
posts = db.session.query(Posts).all()
|
||||
return render_template('all.html', posts=posts)
|
||||
|
||||
@app.route('/<int:pid>')
|
||||
@cross_origin(origin='*')
|
||||
def post(pid):
|
||||
post = Posts.query.filter_by(pid=pid).first()
|
||||
return render_template('singlepost.html', post=post)
|
||||
|
||||
@app.route('/<int:pid>/edit', methods=['GET', 'POST'])
|
||||
@cross_origin(origin='*')
|
||||
def edit_post(pid):
|
||||
post = Posts.query.filter_by(pid=pid).first()
|
||||
user_form = UploadForm(title = post.title, writingfield=post.writingfield)
|
||||
if request.method == 'POST':
|
||||
if user_form.validate_on_submit():
|
||||
# on submit, check fields
|
||||
post.title = user_form.title.data
|
||||
post.writingfield = user_form.writingfield.data
|
||||
|
||||
db.session.commit()
|
||||
return redirect(url_for('post', pid=pid))
|
||||
|
||||
return render_template('writer.html', form=user_form, post=post)
|
||||
|
||||
|
||||
|
||||
@app.route('/writer', methods=['GET', 'POST'])
|
||||
@cross_origin(origin='*')
|
||||
def writer():
|
||||
post = Posts("unknown", "")
|
||||
user_form = UploadForm()
|
||||
if request.method == 'POST':
|
||||
if user_form.validate_on_submit():
|
||||
# on submit, check fields
|
||||
title = user_form.title.data
|
||||
writingfield = user_form.writingfield.data
|
||||
post = Posts(title, writingfield)
|
||||
db.session.add(post)
|
||||
db.session.commit()
|
||||
return redirect(url_for('post', pid=post.pid))
|
||||
return render_template('writer.html',form=user_form, post=post )
|
||||
|
||||
|
||||
@app.route('/uploadajax', methods=['POST'])
|
||||
def uploadfile():
|
||||
if request.method == 'POST':
|
||||
files = request.files['file']
|
||||
if files and allowed_file(files.filename):
|
||||
filename = secure_filename(files.filename)
|
||||
app.logger.info('FileName: ' + filename)
|
||||
updir = os.path.join(basedir, 'img/')
|
||||
files.save(os.path.join(updir, filename))
|
||||
file_size = os.path.getsize(os.path.join(updir, filename))
|
||||
return jsonify(name=filename, size=file_size)
|
||||
|
||||
|
||||
@app.route('/turninbinary', methods=['POST', 'GET'])
|
||||
def truninbinary():
|
||||
if request.method == 'POST':
|
||||
files = request.files['file']
|
||||
filename = secure_filename(files.filename)
|
||||
app.logger.info('FileName: ' + filename)
|
||||
updir = os.path.join(basedir, 'binary/')
|
||||
files.save(os.path.join(updir, filename))
|
||||
|
||||
p = subprocess.Popen(['cp', os.path.join(updir, filename), os.path.join(basedir, 'binary/input.raw')])
|
||||
p_status = p.wait()
|
||||
|
||||
p = subprocess.Popen(['sox', '-r','22050', '-b','8', '-c','1', '-e','signed', os.path.join(basedir, 'binary/input.raw'),os.path.join(basedir, 'binary/audio.wav')])
|
||||
p_status = p.wait()
|
||||
|
||||
p = subprocess.Popen(['ffmpeg','-y','-i',os.path.join(basedir, 'binary/audio.wav'),'-vn','-ar','44100','-ac','2','-f','mp3',os.path.join(basedir, 'binary/output.mp3')])
|
||||
p_status = p.wait()
|
||||
|
||||
p = subprocess.Popen(['ffmpeg','-y','-f','rawvideo','-s','32x18','-i', os.path.join(basedir, 'binary/input.raw'), os.path.join(basedir, 'binary/video.mp4')])
|
||||
p_status = p.wait()
|
||||
|
||||
p = subprocess.Popen(['ffmpeg','-y','-i', os.path.join(basedir, 'binary/video.mp4'),'-vf','scale=320:240', os.path.join(basedir, 'binary/output.mp4')])
|
||||
p_status = p.wait()
|
||||
|
||||
p = subprocess.Popen(['ffmpeg','-y','-i',os.path.join(basedir, 'binary/output.mp4'),'-i',os.path.join(basedir, 'binary/output.mp3'),'-c','copy','-map','0:v:0','-map','1:a:0',os.path.join(basedir, 'binary/output_both.mp4')])
|
||||
p_status = p.wait()
|
||||
|
||||
return send_from_directory(os.path.join(basedir, 'binary'), 'output_both.mp4')
|
||||
#subprocess.call(['cp', os.path.join(basedir, 'binary/file'), 'input.raw'])
|
||||
|
||||
return render_template('turnfilein.html', )
|
||||
|
||||
@app.route('/img/<filename>')
|
||||
def send_file(filename):
|
||||
return send_from_directory(UPLOAD_FOLDER, filename)
|
||||
|
||||
@app.route('/database')
|
||||
def send_database():
|
||||
return send_from_directory(basedir, 'data.db')
|
||||
|
||||
|
||||
###
|
||||
# The API
|
||||
###
|
||||
|
||||
@app.route('/api/beginwith=<query>', methods=['GET'])
|
||||
def get_words(query):
|
||||
posts = Posts.query.all()
|
||||
data = []
|
||||
for post in posts:
|
||||
text = post.writingfield
|
||||
#text = cleanhtml(text)
|
||||
regex = re.compile('[%s]' % re.escape(string.punctuation))
|
||||
#text = regex.sub('', text)
|
||||
soup = BeautifulSoup(text,"lxml")
|
||||
for id, word in enumerate(soup.prettify().split()):
|
||||
if "<" not in word or ">" not in word or "=" not in word:
|
||||
word = regex.sub('', word)
|
||||
query = regex.sub('', query)
|
||||
if word.lower().startswith(query.lower()):
|
||||
a = {}
|
||||
a['word'] = word
|
||||
a['intext'] = post.pid
|
||||
a['intextname'] = post.title
|
||||
a['wordnumber'] = id
|
||||
try:
|
||||
context = [
|
||||
soup.prettify().split()[id-2],
|
||||
soup.prettify().split()[id-1],
|
||||
soup.prettify().split()[id],
|
||||
soup.prettify().split()[id+1],
|
||||
soup.prettify().split()[id+2]
|
||||
]
|
||||
except:
|
||||
context = [
|
||||
"no", "context"
|
||||
]
|
||||
a['context'] = ' '.join(context)
|
||||
data.append(a)
|
||||
text = post.title
|
||||
#text = cleanhtml(text)
|
||||
#regex = re.compile('[%s]' % re.escape(string.punctuation))
|
||||
#text = regex.sub('', text)
|
||||
soup = BeautifulSoup(text,"lxml")
|
||||
for id, word in enumerate(soup.prettify().split()):
|
||||
if word.startswith(query) and ("<" not in word or ">" not in word or "=" not in word):
|
||||
a = {}
|
||||
a['word'] = word
|
||||
a['intext'] = post.pid
|
||||
a['intextname'] = post.title
|
||||
a['wordnumber'] = id
|
||||
context = [
|
||||
soup.prettify().split()[id-2],
|
||||
soup.prettify().split()[id-1],
|
||||
soup.prettify().split()[id],
|
||||
soup.prettify().split()[id+1],
|
||||
soup.prettify().split()[id+2]
|
||||
]
|
||||
a['context'] = ' '.join(context)
|
||||
data.append(a)
|
||||
|
||||
#print(errors)
|
||||
return jsonify(data)
|
||||
|
||||
@app.route('/api/link=<int:link>+wordnum=<int:n>+document=<int:pid>', methods=['GET'])
|
||||
def replace_with(link, n, pid):
|
||||
post = Posts.query.filter_by(pid=pid).first()
|
||||
frompost = Posts.query.filter_by(pid=link).first()
|
||||
html = post.writingfield
|
||||
soup = BeautifulSoup(html,"lxml")
|
||||
words = soup.prettify().split()
|
||||
words[n] = words[n]+" <a class='linkTo' href='"+str(link)+"'>→ "+frompost.title+"</a>"
|
||||
print(words)
|
||||
post.writingfield = ' '.join(words)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
return redirect(url_for('post', pid=pid))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
@ -0,0 +1,3 @@
|
||||
flask==0.12
|
||||
Flask-SQLAlchemy==2.1
|
||||
Flask_WTF==0.14.2
|
Loading…
Reference in New Issue