Coder Social home page Coder Social logo

whump's Introduction

WHUMP v0.x
Web HTML Universal Music Player 
Copyright (C) 2015 Cockos Inc
License: GPL

To use, option 1:

Make a file whump_config.js and put it with whump.html:

	// can override pl_fntitle, db_fntitle, or fntourl() definitions

	function whump_init() {
		document.title = "test";
		document.getElementById("thdr").innerHTML = "WHUMP-test";
		document.getElementById("foot").innerHTML = "Powered by WHUMP";
		request_db("database-file.txt"); // can include multiple lines of these if you like
	};


To use, option 2:

(if you want search-engines getting your page and don't want the additional javascript file)

Search and replace, e.g. in PHP:

	$init_code = 'request_db("database-file.txt");' // can include multiple statements

	echo str_replace('<title>WHUMP</title>','<title>test</title>',
		str_replace('<div id="thdr"></div>', '<div id="thdr">WHUMP-test</div>',
		str_replace('<script src="whump_config.js"></script>','',
		str_replace('<div id="foot"></div>', '<div id="foot">Powered by WHUMP</div>', 
		str_replace('whump_init();', $init_code,
		file_get_contents("whump.html"))))));


--------

database-file.txt can be a URL, and the contents of which should be zero or more lines of (tab delimited):

  ; Prepopulated playlist item:
  pre	URL

  ; Item in database:
  item	URL	length_in_seconds



--------

BONUS: want to modify the CSS without having to modify the .html file? Use the following javascript:

function getcssrule(name) {
	if (!document.styleSheets) return false;
	var ss=document.styleSheets[0],c=0;
	for (;;) {
		for (var i = 0; i < ss.cssRules.length; i ++) {
			var r = ss.cssRules ? ss.cssRules[i] : ss.rules[i];
			if (r && r.selectorText.toLowerCase()==name) return r;
		}
		if (c++) return false;
		if (ss.addRule) ss.addRule(name, null,0);
	        else ss.insertRule(name+" { }", 0);
	}
}

Example:

	getcssrule("#foot a").style.color = "black";


whump's People

Contributors

justinfrankel avatar

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.