Giter VIP home page Giter VIP logo

mzhukov1973 / gogs-creeping-madness-injector Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 61 KB

A script, to be injected into Gogs installation (Gogs ─ https://github.com/gogits/gogs is a "painless self-hosted Git service"), that after a little while begins to screw with your mind. Especially effective after long hours spent in front of the computer: all-night coding sessions, work / academic emergencies, etc.. Not for the fainthearted.

Home Page: https://testbed2.cloud.tilaa.com:7443

License: MIT License

CSS 2.91% JavaScript 97.09%
gogs gogs-api git js injection joke creepy psychedelic mind-games harmless light easy-to-use

gogs-creeping-madness-injector's Introduction

"LongHours" ─ Brain-teasing, Sanity-tilting, Subtle Repository Augmentation

...Gogs Creeping Madness Injector...

Version: 1.0.2+
License: MIT

A script, to be injected into Gogs installation (Gogs is a painless self-hosted Git service), that after a little while begins to screw with your mind. Especially effective during long hours spent in front of the computer: all-night coding sessions, work / academic emergencies, etc.. Not for the fainthearted.

This is a 100% harmless script, (as opposed to a hack) written entirely according to relevant Gogs documentation, namely the Custom Template section, where the proper procedure to inject your own custom header and footer into every page of a working Gogs installation is described.

It doesn't contaminate namespace (apart from a very few globals), doesn't slow down normal work process (it kicks in after a set period of user inactivity, by default - after 40 seconds), installation is trivial (you just copy three files and create or modify another two), all resulting changes are non-breaking and so far no adverse effects on users' work have been detected.

You can fine-tune it to your tastes (parameters and a short description can be found at the top of long_hours.js file), though I sincerely recommend that you at least try it out for a short while with original settings.

Obviously, everyone is different, but I think I've managed to nail down the perfect parameters required for the most psychedelic effect.. )))

Check out the working demo, look around, click Explore, look through the test repository and above all don't forget to leave the page alone for 40 seconds.. )

Effect can be observed anywhere in the repository, regardless of whether you are logged in or not.

Just sit quietly for 40 seconds. )


So, the gist, what does the script do:

Once injected, script scans the current Gogs page (every page, wherever you go inside Gogs, since script gets injected in the footer of every page) for HTML elements, suitable to its task, sets up a (40 second) timer and waits.

Any UI activity during that period (for now it's only mousemove, but I'll add other events soon enough) resets the timer, so it times out only after 40 solid seconds of user inactivity (hopefully it happens at the point where a weary and possibly somewhat sleepy user stops or slows down working for a few moments to stretch the legs/rub tired eyes/spend a few minutes staring dumbly at the monitor with unseeing eyes (truth be told, this last one is my personal favourite :) )).

Once its timer times out, it sets up another listener to capture UI events (again, so far it's only mousemove) so that it can instantly react to any user activity by bringing UI back to its current condition, and starts randomly and veeery slowly rotating (in 3D) and translating (also in 3D) various elements it has found on the page.

Visible changes are miniscule: by default any rotation is limited to ±1° around each axis and translation to ±0.3em along each of the three directions, and also it is very-very slow (by default transitions fire randomly for each element every 4 to 8 seconds and take 4 to 8 seconds to play out), so hopefully user would mistake the suddenly slightly alive UI for his/her failing eyes or assume that they are just seeing things...

If/when any UI action is attempted (i.e. a mouse moves inside Gogs window), script instantly ceases operation, returns page to the state it has found it in initially and starts a new wait for the next 40 seconds of inactivity.

Hopefully, all this will produce a few more smiles for this dreary old world.... )


Installation:

0. Pre-requisites:

  • A working Gogs installation. (If you don't have one - try it out! No, really - it's light, feature rich and a pleasure to work with. It's like your own personal private GitHub, only free.)

1. Installation itself:

  • Copy long_hours.js to your Gogs installation directory tree, namely to public/js subdirectory in Gogs installations' root. (By default, if it was installed according to these) convenient instructions, it should reside in your home directory, like this: /home/${username}/go/src/github.com/gogits/gogs/public/js.
  • Similarly, copy long_hours.css to ${gogs_home_dir}/public/css.
  • Copy javascript.svg to ${gogs_home_dir}/public/img.
  • If you've already done some customisations to your Gogs installation (i.e. if the files ${gogs_home_dir}/custom/templates/inject/footer.tmpl and ${gogs_home_dir}/custom/templates/inject/head.tmpl already exist), then add these lines to each of them:
    • to head.tmpl:
      <link rel='stylesheet' href='/css/long_hours.css'>
    • and to footer.tmpl:
        <script src='/js/long_hours.js'></script>
  • And if you haven't and these files do not yet exist, then create and fill them like this:
    usr@srvr$ cd ${gogs_home_dir}
    usr@srvr$ mkdir -p ./custom/templates/inject
    usr@srvr$ echo "<script src='/js/long_hours.js'></script>" > ./custom/templates/inject/footer.tmpl
    usr@srvr$ echo "<link rel='stylesheet' href='/css/long_hours.css'>" > ./custom/templates/inject/head.tmpl
  • Restart Gogs:
    usr@srvr$ sudo service gogs restart

And you are all set! )

Now if you or any other user of your Gogs installation will idle in front of it longer than 40 seconds in a row, you may (hopefully) spend some quality time, questioning your eyesight and/or sanity... )

Enjoy! ))


RoadMap:

1.0.0 - Initial release: works, doesn't break anything, is configurable via parameters, set inside its main .js file.

1.1.0 - Proper settings page (at .../user/settings)

1.2.0 - Allow creation of separate timer functions (with the same structure, but different parameters) and assigning them to user-definet selectors.

1.3.0 - Settings presets (include several presets as an example, along with the default one), selectable (and editable, and definable) by user via their .../user/settngs page. Allow storing some of the mod's settings inside a repo (a-la GPG mod), owned by user or elsewhere in the system while staying 100% client-side (i.e. avoiding adding/changing any backend functionality, thus keeping this addon an addon).

1.4.0 - Image manipulation as a UI mutation option (CSS filters, etc).

1.5.0 - Performance penalty assesser, to be run once upon first injection, add setting to make some of the configured mutations conditional on users' perforance hit being below set threshold.

ChangeLog:

1.0.0:

  • Initial release

1.0.1:

  • Cleaned up namespace, pushed all parameters and relevant variables into one global object (lHGlobObj).

1.0.2:

  • Added more UI events to trigger user activity detection (focus, blur, reset, submit, compositionstart, compositioupdate, compositionend, resize, scroll, fullscreenchange, cut, copy, paste, keydown, keypress, keyup, mousedown, mouseup, mouseenter, mousemove, mouseover, auxclick, click, contextmenu, wheel, mouseleave, mouseout, select, input, valueChange, RadioStateChange, CheckBoxStateChange)
  • Added a placeholder settings page to .../user/settings (here, at the demo installation).
  • Cleaned up the global object definition, moved its initialisation into constructor
  • Marked settings menu entry with a small JS logo, to indicate that it's a JS injected functionality as opposed to 'native' one, written in Go.
  • Fixed menu styles change semantics at the modified .../user/settings page for the injected content.

1.0.3(currently uncommitted):

  • Fixed the issue with LongHours UI mod menu item in .../user/settings being not clickable if SSH Keys item is currently selected. It works.
  • Included javascript.svg logo icon with the mod installation set, amended installation instructions accordingly.
  • Add a quick-settings menu drop-up into the standard Gogs footer.
  • Fill the settings page itself with properly named and annotated (even if yet unconnected) controls to set mod's parameters. Use either exactly the elements found in other settings pages or use Semantic (for now use version 2.3.1, later - guess it from the active Gogs installation itself).
  • Add a general enable/disable control to the .../user/settings page, to control if LongHours is to run at all upon injection and properly connect it to the data - this one control should be completely functional.
  • Make this JS logo change appearance to further indicate injections' status (i.e. not present, loaded, active, error(?), disabled, waiting to go active, modified settings, original settings) and add the same status as text popup, appearing on hover over the settings item.
  • In order to avoid depending on any external framework or library as well as for general lightness of code implement two-way coupling between settings values stored in object' sproperties and controls for setting them, found on .../user/settings page. Do so, by creating a Proxy for the object, with handler monitoring .set(...) calls and informing all concerned parties of any changes via custom events.

gogs-creeping-madness-injector's People

Contributors

mzhukov1973 avatar

Stargazers

 avatar

Watchers

 avatar

gogs-creeping-madness-injector's Issues

Settings not navigateable to if "SSH Keys" setting page is open

As it says in the title.

It's weird but shouldn't be difficult to fix - for some reason clicking on LongHours UI mod menu item in settings page (.../user/settings, demo) works perfectly unless SSH Keys item has been clicked previously and is currently on display.

Adding it to the 1.0.3 milestone.

ToDo list for 1.0.3.

ToDo for version 1.0.3:

  • Fix the issue with LongHours UI mod menu item in .../user/settings being not clickable if SSH Keys item is currently selected.
  • Include javascript.svg logo icon with the mod installation set, amend installation instructions accordingly.
  • Add a quick-settings menu drop-up into the standard Gogs footer.
  • Fill the settings page itself with properly named and annotated (even if yet unconnected) controls to set mod's parameters. Use either exactly the elements found in other settings pages or use Semantic (for now use version 2.3.1, later - guess it from the active Gogs installation itself).
  • Add a general enable/disable control to the .../user/settings page, to control if LongHours is to run at all upon injection and properly connect it to the data - this one control should be completely functional.
  • Make this JS logo change appearance to further indicate injections' status (i.e. not present, loaded, active, error(?), disabled, waiting to go active, modified settings, original settings) and add the same status as text popup, appearing on hover over the settings item.
  • In order to avoid depending on any external framework or library as well as for general lightness of code implement two-way coupling between settings values stored in global object's properties and UI controls for setting them, as found on .../user/settings page. Do so, by creating a proxy for the object with handler monitoring .set(...) calls and informing all concerned parties of any changes via custom events.
  • Implement some simple client-side storage for mod settings' values (at this point - not necessarily connected to the particular Gogs instalaltion)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.