From a371aba5322f98438ec6e21253bf24a004081b73 Mon Sep 17 00:00:00 2001 From: Tancre Date: Mon, 30 Aug 2021 13:19:33 +0200 Subject: [PATCH] refactoring + hover on close --- index.html | 4 +- scripts/App.js | 203 +++++++++++++++++++++++++---------------------- styles/style.css | 56 +++++-------- 3 files changed, 131 insertions(+), 132 deletions(-) diff --git a/index.html b/index.html index 49bc104..7ed6e2d 100644 --- a/index.html +++ b/index.html @@ -23,8 +23,7 @@
- -
+

10 Sept 21

  • 12:00-17:00:
    • XPUB Bookshop
    @@ -38,6 +37,7 @@
      Lingo Bingo (offline)
      Civil Entertainment Sirensยฎ
  • Oh, look at the wifi: words fly around!
  • +
    diff --git a/scripts/App.js b/scripts/App.js index 567ff18..29c204c 100644 --- a/scripts/App.js +++ b/scripts/App.js @@ -10,112 +10,125 @@ // Open window icon (on background 'desktop') // Close window button (on 'window' itself) -$(document).ready(function(){ - +let corpi = { + 0: { + id:'xpub', + glyph: '๐Ÿ–จ๏ธ', + title: 'var xpub', + content: 'window.open() at PNF will be an interface for our XPUB program to speak/communicate to/with the public inside and outside of the physical space. We adjust, using windows in the street and in the browser in order to be able to communicate. This frames it as a "discursive/dialogical interface" through which attitudes, perspectives, backgrounds and situations are explored together in a program consisting of: presentations, workshops, publication launches, conversations and performances; both online and offline.' + }, + + 1: { + id:'interface', + glyph: '๐Ÿ“€', + title: 'const interface', + content: 'A window is a framing device, an interface through which we can look inside, to spaces where small groups meet, and outside to the world beyond. Screens and windows delineate boundaries between public and private. Working with(in) a limitation, a frame(work), a situation, a context means adjusting our work to the state of affairs; it changes our way of thinking/framing it. We adjust, in order to be able to communicate within a temporary window of time, reframing our intentions and seeking opportunities to share some real-time realness.' + }, + + 2: { + id:'greetings', + glyph: '๐Ÿ“Œ', + title: 'let greetings', + content: 'We are pleased to invite you to window.open(), a day-long festival, held by students and alumni of the Master of Experimental Publishing (XPUB) at Page Not Found.' + }, +} - - let corpi = { - 0: { - id:'xpub', - glyph: '๐Ÿ–จ๏ธ', - title: 'var xpub', - content: 'window.open() at PNF will be an interface for our XPUB program to speak/communicate to/with the public inside and outside of the physical space. We adjust, using windows in the street and in the browser in order to be able to communicate. This frames it as a "discursive/dialogical interface" through which attitudes, perspectives, backgrounds and situations are explored together in a program consisting of: presentations, workshops, publication launches, conversations and performances; both online and offline.' - }, - - 1: { - id:'interface', - glyph: '๐Ÿ“€', - title: 'const interface', - content: 'A window is a framing device, an interface through which we can look inside, to spaces where small groups meet, and outside to the world beyond. Screens and windows delineate boundaries between public and private. Working with(in) a limitation, a frame(work), a situation, a context means adjusting our work to the state of affairs; it changes our way of thinking/framing it. We adjust, in order to be able to communicate within a temporary window of time, reframing our intentions and seeking opportunities to share some real-time realness.' - }, - - 2: { - id:'greetings', - glyph: '๐Ÿ“Œ', - title: 'let greetings', - content: 'We are pleased to invite you to window.open(), a day-long festival, held by students and alumni of the Master of Experimental Publishing (XPUB) at Page Not Found.' - }, - - } +$(document).ready(function(){ // generate divs - Object.values(corpi).forEach(corpus => { - $('#boxes' ).append(`

    ${corpus['title']}

    ${corpus['content']}

    `) - $("#icons").append(``) + $('#boxes' ).append(` +
    +

    ${corpus['title']}

    +

    ${corpus['content']}

    + +
    + `) + $('#icons').append(``) }); - //size window - function getWidth() { - return Math.max( - document.body.scrollWidth, - document.documentElement.scrollWidth, - document.body.offsetWidth, - document.documentElement.offsetWidth, - document.documentElement.clientWidth - ); - } - - var widthDrag = (getWidth())/2; - - function getHeight() { - return Math.max( - document.body.scrollHeight, - document.documentElement.scrollHeight, - document.body.offsetHeight, - document.documentElement.offsetHeight, - document.documentElement.clientHeight - ); - } - - var heightDrag = (getHeight())/2; - - - // random - function getRndInteger(min, max) { - return Math.floor(Math.random() * (max - min + 1) ) + min; - } - - - // DRAG and Z-INDEX priorities handler - var a = 3; - $( '.draggable' ).draggable({ containment: "window" },{ // Setup dragging and containment - start: function(event, ui) { $(this).css("z-index", a++); } // Initialize z-index for handelr - }); - - $('#dragZone div').click(function() { // Setup z-index handler - $(this).addClass('top').removeClass('bottom'); - $(this).siblings().removeClass('top').addClass('bottom'); - $(this).css("z-index", a++); - }); - - // CURSOR MOUSE DOWN - $('.draggable').on("mousedown", function(){ - $('.draggable').css('cursor', 'grabbing'); - }).on("mouseup mouseleave", function(){ - $('.draggable').css('cursor', 'grab'); - }); - - // RESIZE with aspect ratio - $( ".resizable" ).resizable({ aspectRatio:true, maxHeight:900, minHeight:200 }); - $( ".resizableOriz" ).resizable({ aspectRatio:true, maxHeight:500, minHeight:200 }); + const dragResize = new DragResizeClose(); +}); +class DragResizeClose { + constructor() { + this.zIndex = 3; + this.drag(); + this.setDraggables(); + this.setZindex(); + this.handleCursor(); + this.closeBtn(); + } - // settings draggables - $( ".draggable" ).each(function() { + drag() { + $('.draggable').draggable({ containment: "window" }, { // Setup dragging and containment + start: (event, ui) => $(this).css("z-index", this.zIndex++) // Initialize z-index + }); + } - let rw = getRndInteger(widthDrag-500,widthDrag) - let rh = getRndInteger(heightDrag-200, heightDrag) + setDraggables() { + //size window + const getWidth = () => { + return Math.max( + document.body.scrollWidth, + document.documentElement.scrollWidth, + document.body.offsetWidth, + document.documentElement.offsetWidth, + document.documentElement.clientWidth + ); + } + + //let widthDrag = (getWidth())/2; + + // function getHeight() { + // return Math.max( + // document.body.scrollHeight, + // document.documentElement.scrollHeight, + // document.body.offsetHeight, + // document.documentElement.offsetHeight, + // document.documentElement.clientHeight + // ); + // } + + // let heightDrag = (getHeight())/2; + + const getRndInteger = (min, max) => Math.floor(Math.random() * (max - min + 1) ) + min; + + $( ".draggable" ).each(function() { + let rw = getRndInteger((getWidth())/2-500,(getWidth())/2) + //let rh = getRndInteger(heightDrag-200, heightDrag) + $( this ).css("width",rw); + $( this ).css("height", 'auto'); + }); + } - $( this ).css("width",rw); - $( this ).css("height",rh) + setZindex() { + $('#dragZone div').click(() => { // Setup z-index handler + $(this).addClass('top').removeClass('bottom'); + $(this).siblings().removeClass('top').addClass('bottom'); + $(this).css("z-index", this.zIndex++); + }); + } - }); + handleCursor() { + $('.draggable') + .on("mousedown", () => $('.draggable').css('cursor', 'grabbing')) + .on("mouseup mouseleave", () => $('.draggable').css('cursor', 'grab')); + } - // close window - $(".closable").click(function() { - $( this ).parent().fadeOut(); - }); + resize() { + $(".resizable").resizable({ aspectRatio: true, maxHeight: 900, minHeight: 10 }); + $(".resizableOriz").resizable({ aspectRatio: true, maxHeight: 500, minHeight: 10 }); + } + closeBtn() { + $(".closable").click(function() { + $(this).parent().fadeOut(); + }) + .hover( + function() { $( this ).addClass( "hover" ); }, + function() { $( this ).removeClass( "hover");} + ); + } +} -}); diff --git a/styles/style.css b/styles/style.css index b184b2d..a8d9084 100644 --- a/styles/style.css +++ b/styles/style.css @@ -3,58 +3,43 @@ src: url(../fonts/AC1-SemiLightDots.ttf); } - - -html{ - -} - -body{ +body { background-color: blue; color: white; font-family: Arial, Helvetica, sans-serif; } -h1{ +h1 { font-family: points; font-size: 60px; color: white; } -button{ +button { user-select: none; display: inline-block; padding: 3px 1em; color: currentColor; - font-weight: var(--regular); + font-weight: var(--bold); text-decoration: none; margin-bottom: 4px; - background-color: rgba(0,0,0,0); + background-color: rgba(0, 0, 0, 0); } .draggable { position: absolute; - z-index: 2; - cursor: grab; border: 2px white solid; background: black; } -.draggable p{ - color: white; -} - -.draggable li{ +.draggable p, +.draggable li, +.draggable ul { color: white; list-style: none; - /* line-height: 7px; */ } -.draggable ul{ - color: white; -} - -.draggable li::before{ +.draggable li::before { content: "๐Ÿ’พ "; } @@ -64,30 +49,33 @@ button{ padding: 0.5em 1.5em; } -.resizable p{ +.resizable p { font-size: 18px; } -.resizable h1{ +.resizable h1 { font-size: 35px; } -.closable{ +.closable { position: absolute; top: 0; right: 0; + cursor: pointer; + width: 38px; } -.closable button{ - width: 30px; +/* +.closable button { + width: 35px; height: 30px; +} */ - +.hover { + font-weight: bolder; } - - -.icon{ +.icon { width: 70px; height: 70px; border: white solid 2px; @@ -95,5 +83,3 @@ button{ z-index: 1; /* font-size: 50px ; */ } - -