Welcome guest, is this your first visit? Create Account now to join.
Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 50

This is a discussion on Mouse Gesture UserScript within the Chrome Plugins section, part of the Google Chrome category: Originally Posted by Kyrax Meow! Nice. Originally Posted by Kyrax Maybe we should get someone to work on a mouse ...


  1. #21
    rock_galore is offline Junior Member
    Join Date
    May 2009
    Posts
    23

    Default

    Quote Originally Posted by Kyrax View Post
    Meow!
    Nice.

    Quote Originally Posted by Kyrax View Post
    Maybe we should get someone to work on a mouse gesture extension (instead of a userscript).
    What would you like it to do?
    This would make a working extension out of the content script:
    manifest.json
    Code:
    {
      "content_scripts": [
        {
          "js": [
            "content_script.js"
          ], 
          "matches": [
            "http://*/*",
            "https://*/*"
          ]
        }
      ], 
      "description": "Mouse gestures for chrome", 
      "name": "mouse-gestures", 
      "toolstrips": [
        "toolstrip.html"
      ],
      "version": "0.1"
    }
    toolstrip.html
    Code:
    <html>
    	<body>
    		<div id="button" class="toolstrip-button">
    		  Waiting for input
    		</div>
    	</body>
    </html>
    content_script.js
    Code:
    // ==UserScript==
    // @name Mouse Gestures for Google Chrome
    // @author vhanla
    // @namespace http://www.codigobit.net/ 
    // @version 1.0
    // @description Allows to use mouse gestures for navigating through pages
    // @include *
    // @exclude
    // ==/UserScript==
    
    var posx = 0;
    var posy = 0;
    var estado = false; 
    var gestdown = function(event) {
    if (event.which)
    button = (event.which < 2) ? "LEFT" :
    ((event.which == 2) ? "MIDDLE" : "RIGHT");
    if (button =="RIGHT"){ 
    estado=true;
    posx=event.clientX;
    posy=event.clientY;
    document.oncontextmenu = new Function("return false")
    }
    }
    var gestup = function(event) { 
    if (estado){
    estado=false;
    if(event.clientX+25<posx){ 
    window.history.back(); 
    }
    else if(event.clientX-25>posx){ 
    window.history.forward();
    }
    else if(event.clientY-25>posy){
    window.open();
    }
    else if(event.clientY+25<posy){
    window.close();
    }
    else void(document.oncontextmenu=null)
    }
    
    }
    window.addEventListener("mousedown", gestdown, false);
    window.addEventListener("mouseup", gestup, false);
    That was easy, but probably not what you meant. ;-)

  2. #22
    Kyrax is offline Senior Member
    Join Date
    Apr 2009
    Location
    Qc, Canada
    Posts
    495

    Default

    Yea a meant with a little more features.
    My favorite mouse gesture extension is firegestures [ http://www.xuldev.org/firegestures/ ]

    You can even code your own jscript functions and bind them to a movement.

    The only part about making a "firegesture clone" that i'm not sure about would be the green line that is traced on screen..

    Overall.. sounds like an interesting challenge !

  3. #23
    rock_galore is offline Junior Member
    Join Date
    May 2009
    Posts
    23

    Default

    Well, you could, but you don`t want to ;-), add a JS-Vector-Library, inject a canvas element an draw on it.

    For binding user-functions to the content script we`ll need localstorage i think.

  4. #24
    Kyrax is offline Senior Member
    Join Date
    Apr 2009
    Location
    Qc, Canada
    Posts
    495

    Default

    Let's make it a community project !

    But yeah.. we'll need local storage for any sort of configuration.
    I don't want to ask users to copy and paste XML anymore.

  5. #25
    rock_galore is offline Junior Member
    Join Date
    May 2009
    Posts
    23

    Default

    Quote Originally Posted by Kyrax View Post
    we'll need local storage for any sort of configuration.
    I don't want to ask users to copy and paste XML anymore.
    It will come via HTML5-integration, we have a video-tag now so it won`t take that long i think.

  6. #26
    Kyrax is offline Senior Member
    Join Date
    Apr 2009
    Location
    Qc, Canada
    Posts
    495

    Default

    Let's hope it's not limited to gears and that it respects HTML5 standards.

  7. #27
    rock_galore is offline Junior Member
    Join Date
    May 2009
    Posts
    23

  8. #28
    sam.forry is offline Junior Member
    Join Date
    Jun 2009
    Posts
    1

    Default

    Great! The lack of gestures has caused me to shun Chrome... Shunned no more!

    Does anyone have ideas for creating a gesture to open a clicked link in a new tab? This is probably my most used gesture, but I can't figure out how to get the url from the clicked link...

  9. #29
    alinescoo is offline Member
    Join Date
    May 2009
    Posts
    83

    Default

    Did someone improve/pack this into a crx file ?

  10. #30
    devilslackey is offline Moderator
    Join Date
    May 2009
    Location
    Orange County
    Posts
    330

    Default

    I've packaged it. Although I'm wondering what the toolstrip portion was for because it works just fine without (I hate the toolstrip ). Credit goes to rock_galore for posting the manifest and content script...all I did was package it.

    http://sharesend.com/fqvr5

Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Chrome Mouse Gestures?
    By Wisher in forum Chrome Plugins
    Replies: 40
    Last Post: 12-28-2010, 08:33 PM
  2. Back / forward buttons on mouse
    By Illway in forum Bugs and Vulnerabilities
    Replies: 1
    Last Post: 03-26-2009, 11:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •