This is an advanced demo.
- Click the menu icon to open the menu.
For more demos, a tutorial, documentation and support, please visit mmenu.frebsite.nl
-diff --git a/.gitignore b/.gitignore index da577d53..cd5847fe 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ Thumbs.db oldSite packages /packages/* -/public/admin/* \ No newline at end of file +/public/admin/* diff --git a/app/Http/Controllers/Web/ArtworkPageController.php b/app/Http/Controllers/Web/ArtworkPageController.php index 9ad2752e..97b95206 100644 --- a/app/Http/Controllers/Web/ArtworkPageController.php +++ b/app/Http/Controllers/Web/ArtworkPageController.php @@ -80,7 +80,7 @@ final class ArtworkPageController extends Controller } // ── Step 2: full load with all relations ─────────────────────────── - $artwork = Artwork::with(['user.profile', 'categories.contentType', 'categories.parent.contentType', 'tags', 'stats']) + $artwork = Artwork::with(['user.profile', 'categories.contentType', 'categories.parent.contentType', 'tags', 'stats', 'awardStat']) ->where('id', $id) ->public() ->published() diff --git a/app/Http/Resources/ArtworkResource.php b/app/Http/Resources/ArtworkResource.php index 5345a726..8100fe74 100644 --- a/app/Http/Resources/ArtworkResource.php +++ b/app/Http/Resources/ArtworkResource.php @@ -23,17 +23,27 @@ class ArtworkResource extends JsonResource $canonicalSlug = (string) $this->id; } - $followerCount = (int) ($this->user?->profile?->followers_count ?? 0); - if (($followerCount <= 0) && Schema::hasTable('friends_list') && !empty($this->user?->id)) { - $followerCount = (int) DB::table('friends_list') - ->where('friend_id', (int) $this->user->id) - ->count(); + $followerCount = 0; + if (!empty($this->user?->id)) { + if (Schema::hasTable('user_statistics')) { + $followerCount = (int) DB::table('user_statistics') + ->where('user_id', (int) $this->user->id) + ->value('followers_count'); + } + + // Legacy fallback for environments where new tables are unavailable. + if (($followerCount <= 0) && Schema::hasTable('friends_list')) { + $followerCount = (int) DB::table('friends_list') + ->where('friend_id', (int) $this->user->id) + ->count(); + } } $viewerId = (int) optional($request->user())->id; $isLiked = false; $isFavorited = false; $isFollowing = false; + $viewerAward = null; if ($viewerId > 0) { if (Schema::hasTable('artwork_likes')) { @@ -48,11 +58,26 @@ class ArtworkResource extends JsonResource ->where('artwork_id', (int) $this->id) ->exists(); - if (Schema::hasTable('friends_list') && !empty($this->user?->id)) { - $isFollowing = DB::table('friends_list') + if (!empty($this->user?->id)) { + if (Schema::hasTable('user_followers')) { + $isFollowing = DB::table('user_followers') + ->where('user_id', (int) $this->user->id) + ->where('follower_id', $viewerId) + ->exists(); + } elseif (Schema::hasTable('friends_list')) { + // Legacy fallback only. + $isFollowing = DB::table('friends_list') + ->where('user_id', $viewerId) + ->where('friend_id', (int) $this->user->id) + ->exists(); + } + } + + if (Schema::hasTable('artwork_awards')) { + $viewerAward = DB::table('artwork_awards') ->where('user_id', $viewerId) - ->where('friend_id', (int) $this->user->id) - ->exists(); + ->where('artwork_id', (int) $this->id) + ->value('medal'); } } @@ -101,6 +126,13 @@ class ArtworkResource extends JsonResource 'favorites' => (int) ($this->stats?->favorites ?? 0), 'likes' => (int) ($this->stats?->rating_count ?? 0), ], + 'awards' => [ + 'gold' => (int) ($this->awardStat?->gold_count ?? 0), + 'silver' => (int) ($this->awardStat?->silver_count ?? 0), + 'bronze' => (int) ($this->awardStat?->bronze_count ?? 0), + 'score' => (int) ($this->awardStat?->score_total ?? 0), + 'viewer_award' => $viewerAward, + ], 'categories' => $this->categories->map(fn ($category) => [ 'id' => (int) $category->id, 'slug' => (string) $category->slug, diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b13002f7..3569f649 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -64,6 +64,8 @@ class AppServiceProvider extends ServiceProvider $this->configureUploadRateLimiters(); $this->configureMessagingRateLimiters(); $this->configureDownloadRateLimiter(); + $this->configureArtworkRateLimiters(); + $this->configureReactionRateLimiters(); $this->configureSettingsRateLimiters(); $this->configureMailFailureLogging(); @@ -275,6 +277,44 @@ class AppServiceProvider extends ServiceProvider }); } + private function configureArtworkRateLimiters(): void + { + RateLimiter::for('artwork-awards', function (Request $request): array { + $userId = $request->user()?->id; + $artworkId = (int) $request->route('id'); + + return [ + // Prevent burst spam on a single artwork while allowing normal exploration. + Limit::perMinute(20)->by('awards:user:' . ($userId ?? 'guest') . ':art:' . $artworkId), + // Global safety net for user/IP across all artworks. + Limit::perMinute(120)->by('awards:user:' . ($userId ?? 'guest')), + Limit::perMinute(180)->by('awards:ip:' . $request->ip()), + ]; + }); + } + + private function configureReactionRateLimiters(): void + { + RateLimiter::for('reactions-read', function (Request $request): array { + $userId = $request->user()?->id; + + return [ + // Comment-heavy pages can trigger many reaction reads at once. + Limit::perMinute(600)->by('reactions-read:user:' . ($userId ?? 'guest')), + Limit::perMinute(900)->by('reactions-read:ip:' . $request->ip()), + ]; + }); + + RateLimiter::for('reactions-write', function (Request $request): array { + $userId = $request->user()?->id; + + return [ + Limit::perMinute(120)->by('reactions-write:user:' . ($userId ?? 'guest')), + Limit::perMinute(180)->by('reactions-write:ip:' . $request->ip()), + ]; + }); + } + private function configureSettingsRateLimiters(): void { RateLimiter::for('username-check', function (Request $request): Limit { diff --git a/bootstrap/providers.php b/bootstrap/providers.php index bdf4f005..e114dc75 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -4,6 +4,7 @@ return [ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, Klevze\ControlPanel\ServiceProvider::class, + cPad\Plugins\Artworks\ServiceProvider::class, cPad\Plugins\News\ServiceProvider::class, cPad\Plugins\Forum\ServiceProvider::class, ]; diff --git a/docs/legacy-routes-inventory.md b/docs/legacy-routes-inventory.md new file mode 100644 index 00000000..9081b728 --- /dev/null +++ b/docs/legacy-routes-inventory.md @@ -0,0 +1,168 @@ +# Legacy Routes Inventory + +Source analyzed: routes/legacy.php +Date: 2026-03-12 + +This list includes active (non-commented) routes still defined in the legacy compatibility layer. + +Companion execution guide: [docs/legacy-routes-removal-checklist.md](docs/legacy-routes-removal-checklist.md) + +## Avatar and Artwork + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /avatar/{id}/{name?} | legacy.avatar | LegacyAvatarController@show | +| GET, POST | /art/{id}/comment | - | ArtController@show | + +## Categories and Browse + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /categories | legacy.categories | CategoryController@index | +| GET | /sections | sections | SectionsController@index | +| GET | /browse-categories | browse.categories | BrowseCategoriesController@index | +| GET | /category/{group}/{slug?}/{id?} | legacy.category | BrowseGalleryController@legacyCategory | +| GET | /browse | legacy.browse | BrowseGalleryController@browse | +| GET | /browse-redirect | legacy.browse.redirect | 301 -> /explore | +| GET | /wallpapers-redirect | legacy.wallpapers.redirect | 301 -> /explore/wallpapers | +| GET | /featured | legacy.featured | FeaturedArtworksController@index | +| GET | /featured-artworks | legacy.featured_artworks | FeaturedArtworksController@index | +| GET | /daily-uploads | legacy.daily_uploads | DailyUploadsController@index | + +## Community and Listings + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /chat | legacy.chat | ChatController@index | +| POST | /chat_post | legacy.chat.post | ChatController@post | +| GET | /uploads/latest | uploads.latest | LatestController@index | +| GET | /uploads/daily | uploads.daily | DailyUploadsController@index | +| GET | /members/photos | members.photos | MembersController@photos | +| GET | /authors/top | authors.top | TopAuthorsController@index | +| GET | /comments/latest | comments.latest | LatestCommentsController@index | +| GET | /comments/monthly | comments.monthly | MonthlyCommentatorsController@index | +| GET | /downloads/today | downloads.today | TodayDownloadsController@index | +| GET | /latest | legacy.latest | LatestController@index | +| GET | /latest-comments | legacy.latest_comments | LatestCommentsController@index | +| GET | /today-in-history | legacy.today_in_history | TodayInHistoryController@index | +| GET | /today-downloads | legacy.today_downloads | TodayDownloadsController@index | +| GET | /monthly-commentators | legacy.monthly_commentators | MonthlyCommentatorsController@index | +| GET | /members | legacy.members | MembersController@index | +| GET | /top-favourites | legacy.top_favourites | TopFavouritesController@index | + +## Legacy Redirect Endpoints + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /top-authors | legacy.top_authors | 301 -> /creators/top | +| GET | /interviews | legacy.interviews | 301 -> /stories | +| GET | /apply | legacy.apply.redirect | 301 -> /contact | +| GET, POST | /bug-report | bug-report.redirect | 301 -> /contact | + +## Auth-Only Legacy Routes + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /mybuddies.php | legacy.mybuddies.php | MyBuddiesController@index | +| GET | /mybuddies | legacy.mybuddies | MyBuddiesController@index | +| DELETE | /mybuddies/{id} | legacy.mybuddies.delete | MyBuddiesController@destroy | +| GET | /buddies.php | legacy.buddies.php | BuddiesController@index | +| GET | /buddies | legacy.buddies | BuddiesController@index | +| GET | /statistics | legacy.statistics | StatisticsController@index | +| GET, POST | /user | legacy.user.redirect | 301 -> dashboard.profile | + +## Favourites, Gallery, and Profile Legacy URLs + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /favourites/{id?}/{username?} | legacy.favourites | FavouritesController@index | +| POST | /favourites/{userId}/delete/{artworkId} | legacy.favourites.delete | FavouritesController@destroy | +| GET | /gallery/{id}/{username?} | legacy.gallery | GalleryController@show (ensure.onboarding.complete) | +| GET | /user/{username} | legacy.user.profile | ProfileController@legacyByUsername | +| GET | /profile/{id}/{username?} | legacy.profile.id | ProfileController@legacyById | +| GET | /profile/{username} | legacy.profile | ProfileController@legacyByUsername | + +## Legacy RSS Feed URLs + +| Method | Path | Route Name | Handler / Target | +|---|---|---|---| +| GET | /rss/latest-uploads.xml | rss.uploads | RssFeedController@latestUploads | +| GET | /rss/latest-skins.xml | rss.skins | RssFeedController@latestSkins | +| GET | /rss/latest-wallpapers.xml | rss.wallpapers | RssFeedController@latestWallpapers | +| GET | /rss/latest-photos.xml | rss.photos | RssFeedController@latestPhotos | + +## Notes + +- Commented-out legacy blocks (manage pages, received-comments, forum.php redirect) are excluded from this active inventory. +- Several routes are already transitional redirects; these are good early candidates for removal once logs show no meaningful traffic. + +## Deprecation Priority + +### Phase 1: Safe To Remove First (redirect-only) + +These routes already do permanent redirects and typically carry the lowest removal risk once access logs confirm near-zero traffic. + +- /top-authors +- /interviews +- /apply +- /bug-report +- /browse-redirect +- /wallpapers-redirect + +### Phase 2: Low-Risk Alias Pairs (keep canonical, remove duplicates) + +For each pair, keep the cleaner canonical URL and remove the older alias after monitoring. + +- Keep /featured-artworks, remove /featured (or vice versa; pick one canonical) +- Keep /uploads/latest, remove /latest +- Keep /comments/latest, remove /latest-comments +- Keep /downloads/today, remove /today-downloads +- Keep /comments/monthly, remove /monthly-commentators + +### Phase 3: Needs Migration Plan (controller-backed legacy behavior) + +These endpoints are not simple redirects and may have old templates, old query semantics, or SEO dependencies. + +- /browse +- /category/{group}/{slug?}/{id?} +- /browse-categories +- /daily-uploads +- /members +- /members/photos +- /authors/top +- /top-favourites +- /today-in-history +- /chat +- /chat_post +- /favourites/{id?}/{username?} +- /favourites/{userId}/delete/{artworkId} +- /gallery/{id}/{username?} + +### Phase 4: Legacy Profile URL Surface (requires 301 mapping checks) + +These should eventually collapse to canonical @username/profile routes, but require careful redirect and username-edge-case validation. + +- /user/{username} +- /profile/{id}/{username?} +- /profile/{username} +- /user + +### Phase 5: Keep For Compatibility (unless external consumers are migrated) + +These are frequently consumed by feed readers or old clients and should be retired only with explicit migration communication. + +- /rss/latest-uploads.xml +- /rss/latest-skins.xml +- /rss/latest-wallpapers.xml +- /rss/latest-photos.xml + +### Special Case: Auth-only legacy utility pages + +Evaluate usage with auth logs before deprecating. They are likely niche but can still be bookmarked by long-time users. + +- /mybuddies.php +- /mybuddies +- /mybuddies/{id} +- /buddies.php +- /buddies +- /statistics diff --git a/docs/legacy-routes-removal-checklist.md b/docs/legacy-routes-removal-checklist.md new file mode 100644 index 00000000..86f8bb6a --- /dev/null +++ b/docs/legacy-routes-removal-checklist.md @@ -0,0 +1,137 @@ +# Legacy Routes Removal Checklist + +Date: 2026-03-12 +Scope: staged retirement of routes listed in docs/legacy-routes-inventory.md + +## Global Preflight (run before each phase) + +- Confirm canonical replacement routes exist and are healthy. +- Snapshot current route map: + - `php artisan route:list --path=legacy` + - `php artisan route:list --json > storage/logs/routes-before-phase.json` +- Capture 14-30 day usage for each candidate route from access logs / analytics. +- Define rollback rule: restore removed routes immediately if a business-critical endpoint drops or 404 volume spikes. + +## Standard PR Steps (for every phase) + +1. Remove targeted route entries from routes/legacy.php. +2. If needed, add explicit 301 redirects to canonical paths in routes/web.php. +3. Update route-based tests (e2e fixtures and auth guard lists). +4. Run cache clear and verify registration: + - `php artisan optimize:clear` + - `php artisan route:list --json` +5. Add release note entry with removed paths and replacements. + +## SEO Safety Checklist + +- Ensure removed indexed URLs either: + - return 301 to final canonical URL, or + - return 410 only when intentional and approved. +- Keep canonical tags correct on destination pages. +- Re-submit updated sitemap if route removals change indexed URLs. +- Monitor Search Console coverage and soft-404 reports for 2-4 weeks. + +## Monitoring Checklist (post-deploy) + +- Track 404 count by path prefix for removed routes. +- Track 301 volume for newly redirected legacy paths. +- Watch top entry pages for traffic drops. +- Verify no auth redirect loops were introduced on legacy auth-only pages. + +## Phase-by-Phase Execution + +### Phase 1: Redirect-only endpoints (lowest risk) + +Targets: +- /top-authors +- /interviews +- /apply +- /bug-report +- /browse-redirect +- /wallpapers-redirect + +Phase checks: +- Confirm each path still has a valid replacement target. +- Validate 301 status and location header for each route. + +### Phase 2: Alias pair cleanup + +Targets: +- /featured vs /featured-artworks +- /uploads/latest vs /latest +- /comments/latest vs /latest-comments +- /downloads/today vs /today-downloads +- /comments/monthly vs /monthly-commentators + +Phase checks: +- Pick one canonical URL per pair. +- Keep redirects from removed alias to chosen canonical. +- Update internal links to canonical only. + +### Phase 3: Controller-backed legacy pages + +Targets: +- /browse +- /category/{group}/{slug?}/{id?} +- /browse-categories +- /daily-uploads +- /members +- /members/photos +- /authors/top +- /top-favourites +- /today-in-history +- /chat +- /chat_post +- /favourites/{id?}/{username?} +- /favourites/{userId}/delete/{artworkId} +- /gallery/{id}/{username?} + +Phase checks: +- Confirm parity exists in modern endpoints before removal. +- Add temporary 301 map for any high-traffic paths. +- Validate auth and CSRF behavior for migrated POST endpoints. + +### Phase 4: Profile URL legacy surface + +Targets: +- /user/{username} +- /profile/{id}/{username?} +- /profile/{username} +- /user + +Phase checks: +- Validate deterministic mapping to /@username. +- Handle missing username and renamed accounts gracefully. +- Verify no duplicate-content issues remain after redirects. + +### Phase 5: RSS compatibility endpoints (communication required) + +Targets: +- /rss/latest-uploads.xml +- /rss/latest-skins.xml +- /rss/latest-wallpapers.xml +- /rss/latest-photos.xml + +Phase checks: +- Identify external consumers (feed readers, partner integrations). +- Publish migration notice before retirement. +- Keep stable replacement feed URLs live before cutover. + +## Fast QA Matrix + +Test each removed or redirected route for: +- Anonymous user request +- Authenticated user request +- Expected status code (301/200/404/410) +- Correct final destination URL +- No infinite redirect chain + +Suggested command: +- `php artisan test --filter=routes` + +## Rollback Playbook + +- Reintroduce removed route definitions from git history. +- Clear caches: `php artisan optimize:clear`. +- Redeploy hotfix. +- Re-run route smoke tests and check access logs. diff --git a/public/legacy/js/ColladaLoader.js b/public/legacy/js/ColladaLoader.js deleted file mode 100644 index 6118efca..00000000 --- a/public/legacy/js/ColladaLoader.js +++ /dev/null @@ -1,5001 +0,0 @@ -/** -* @author Tim Knip / http://www.floorplanner.com/ / tim at floorplanner.com -* @author Tony Parisi / http://www.tonyparisi.com/ -*/ - -THREE.ColladaLoader = function () { - - var COLLADA = null; - var scene = null; - var daeScene; - - var readyCallbackFunc = null; - - var sources = {}; - var images = {}; - var animations = {}; - var controllers = {}; - var geometries = {}; - var materials = {}; - var effects = {}; - var cameras = {}; - var lights = {}; - - var animData; - var visualScenes; - var baseUrl; - var morphs; - var skins; - - var flip_uv = true; - var preferredShading = THREE.SmoothShading; - - var options = { - // Force Geometry to always be centered at the local origin of the - // containing Mesh. - centerGeometry: false, - - // Axis conversion is done for geometries, animations, and controllers. - // If we ever pull cameras or lights out of the COLLADA file, they'll - // need extra work. - convertUpAxis: false, - - subdivideFaces: true, - - upAxis: 'Y', - - // For reflective or refractive materials we'll use this cubemap - defaultEnvMap: null - - }; - - var colladaUnit = 1.0; - var colladaUp = 'Y'; - var upConversion = null; - - function load ( url, readyCallback, progressCallback ) { - - var length = 0; - - if ( document.implementation && document.implementation.createDocument ) { - - var request = new XMLHttpRequest(); - - request.onreadystatechange = function() { - - if( request.readyState == 4 ) { - - if( request.status == 0 || request.status == 200 ) { - - - if ( request.responseXML ) { - - readyCallbackFunc = readyCallback; - parse( request.responseXML, undefined, url ); - - } else if ( request.responseText ) { - - readyCallbackFunc = readyCallback; - var xmlParser = new DOMParser(); - var responseXML = xmlParser.parseFromString( request.responseText, "application/xml" ); - parse( responseXML, undefined, url ); - - } else { - - console.error( "ColladaLoader: Empty or non-existing file (" + url + ")" ); - - } - - } - - } else if ( request.readyState == 3 ) { - - if ( progressCallback ) { - - if ( length == 0 ) { - - length = request.getResponseHeader( "Content-Length" ); - - } - - progressCallback( { total: length, loaded: request.responseText.length } ); - - } - - } - - } - - request.open( "GET", url, true ); - request.send( null ); - - } else { - - alert( "Don't know how to parse XML!" ); - - } - - } - - function parse( doc, callBack, url ) { - - COLLADA = doc; - callBack = callBack || readyCallbackFunc; - - if ( url !== undefined ) { - - var parts = url.split( '/' ); - parts.pop(); - baseUrl = ( parts.length < 1 ? '.' : parts.join( '/' ) ) + '/'; - - } - - parseAsset(); - setUpConversion(); - images = parseLib( "library_images image", _Image, "image" ); - materials = parseLib( "library_materials material", Material, "material" ); - effects = parseLib( "library_effects effect", Effect, "effect" ); - geometries = parseLib( "library_geometries geometry", Geometry, "geometry" ); - cameras = parseLib( "library_cameras camera", Camera, "camera" ); - lights = parseLib( "library_lights light", Light, "light" ); - controllers = parseLib( "library_controllers controller", Controller, "controller" ); - animations = parseLib( "library_animations animation", Animation, "animation" ); - visualScenes = parseLib( "library_visual_scenes visual_scene", VisualScene, "visual_scene" ); - - morphs = []; - skins = []; - - daeScene = parseScene(); - scene = new THREE.Object3D(); - - for ( var i = 0; i < daeScene.nodes.length; i ++ ) { - - scene.add( createSceneGraph( daeScene.nodes[ i ] ) ); - - } - - // unit conversion - scene.scale.multiplyScalar( colladaUnit ); - - createAnimations(); - - var result = { - - scene: scene, - morphs: morphs, - skins: skins, - animations: animData, - dae: { - images: images, - materials: materials, - cameras: cameras, - lights: lights, - effects: effects, - geometries: geometries, - controllers: controllers, - animations: animations, - visualScenes: visualScenes, - scene: daeScene - } - - }; - - if ( callBack ) { - - callBack( result ); - - } - - return result; - - } - - function setPreferredShading ( shading ) { - - preferredShading = shading; - - } - - function parseAsset () { - - var elements = COLLADA.querySelectorAll('asset'); - - var element = elements[0]; - - if ( element && element.childNodes ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'unit': - - var meter = child.getAttribute( 'meter' ); - - if ( meter ) { - - colladaUnit = parseFloat( meter ); - - } - - break; - - case 'up_axis': - - colladaUp = child.textContent.charAt(0); - break; - - } - - } - - } - - } - - function parseLib ( q, classSpec, prefix ) { - - var elements = COLLADA.querySelectorAll(q); - - var lib = {}; - - var i = 0; - - var elementsLength = elements.length; - - for ( var j = 0; j < elementsLength; j ++ ) { - - var element = elements[j]; - var daeElement = ( new classSpec() ).parse( element ); - - if ( !daeElement.id || daeElement.id.length == 0 ) daeElement.id = prefix + ( i ++ ); - lib[ daeElement.id ] = daeElement; - - } - - return lib; - - } - - function parseScene() { - - var sceneElement = COLLADA.querySelectorAll('scene instance_visual_scene')[0]; - - if ( sceneElement ) { - - var url = sceneElement.getAttribute( 'url' ).replace( /^#/, '' ); - return visualScenes[ url.length > 0 ? url : 'visual_scene0' ]; - - } else { - - return null; - - } - - } - - function createAnimations() { - - animData = []; - - // fill in the keys - recurseHierarchy( scene ); - - } - - function recurseHierarchy( node ) { - - var n = daeScene.getChildById( node.id, true ), - newData = null; - - if ( n && n.keys ) { - - newData = { - fps: 60, - hierarchy: [ { - node: n, - keys: n.keys, - sids: n.sids - } ], - node: node, - name: 'animation_' + node.name, - length: 0 - }; - - animData.push(newData); - - for ( var i = 0, il = n.keys.length; i < il; i++ ) { - - newData.length = Math.max( newData.length, n.keys[i].time ); - - } - - } else { - - newData = { - hierarchy: [ { - keys: [], - sids: [] - } ] - } - - } - - for ( var i = 0, il = node.children.length; i < il; i++ ) { - - var d = recurseHierarchy( node.children[i] ); - - for ( var j = 0, jl = d.hierarchy.length; j < jl; j ++ ) { - - newData.hierarchy.push( { - keys: [], - sids: [] - } ); - - } - - } - - return newData; - - } - - function calcAnimationBounds () { - - var start = 1000000; - var end = -start; - var frames = 0; - var ID; - for ( var id in animations ) { - - var animation = animations[ id ]; - ID = ID || animation.id; - for ( var i = 0; i < animation.sampler.length; i ++ ) { - - var sampler = animation.sampler[ i ]; - - sampler.create(); - - start = Math.min( start, sampler.startTime ); - end = Math.max( end, sampler.endTime ); - frames = Math.max( frames, sampler.input.length ); - - } - - } - - return { start:start, end:end, frames:frames,ID:ID }; - - } - - function createMorph ( geometry, ctrl ) { - - var morphCtrl = ctrl instanceof InstanceController ? controllers[ ctrl.url ] : ctrl; - - if ( !morphCtrl || !morphCtrl.morph ) { - - console.log("could not find morph controller!"); - return; - - } - - var morph = morphCtrl.morph; - - for ( var i = 0; i < morph.targets.length; i ++ ) { - - var target_id = morph.targets[ i ]; - var daeGeometry = geometries[ target_id ]; - - if ( !daeGeometry.mesh || - !daeGeometry.mesh.primitives || - !daeGeometry.mesh.primitives.length ) { - continue; - } - - var target = daeGeometry.mesh.primitives[ 0 ].geometry; - - if ( target.vertices.length === geometry.vertices.length ) { - - geometry.morphTargets.push( { name: "target_1", vertices: target.vertices } ); - - } - - } - - geometry.morphTargets.push( { name: "target_Z", vertices: geometry.vertices } ); - - }; - - function createSkin ( geometry, ctrl, applyBindShape ) { - - var skinCtrl = controllers[ ctrl.url ]; - - if ( !skinCtrl || !skinCtrl.skin ) { - - console.log( "could not find skin controller!" ); - return; - - } - - if ( !ctrl.skeleton || !ctrl.skeleton.length ) { - - console.log( "could not find the skeleton for the skin!" ); - return; - - } - - var skin = skinCtrl.skin; - var skeleton = daeScene.getChildById( ctrl.skeleton[ 0 ] ); - var hierarchy = []; - - applyBindShape = applyBindShape !== undefined ? applyBindShape : true; - - var bones = []; - geometry.skinWeights = []; - geometry.skinIndices = []; - - //createBones( geometry.bones, skin, hierarchy, skeleton, null, -1 ); - //createWeights( skin, geometry.bones, geometry.skinIndices, geometry.skinWeights ); - - /* - geometry.animation = { - name: 'take_001', - fps: 30, - length: 2, - JIT: true, - hierarchy: hierarchy - }; - */ - - if ( applyBindShape ) { - - for ( var i = 0; i < geometry.vertices.length; i ++ ) { - - geometry.vertices[ i ].applyMatrix4( skin.bindShapeMatrix ); - - } - - } - - } - - function setupSkeleton ( node, bones, frame, parent ) { - - node.world = node.world || new THREE.Matrix4(); - node.localworld = node.localworld || new THREE.Matrix4(); - node.world.copy( node.matrix ); - node.localworld.copy( node.matrix ); - - if ( node.channels && node.channels.length ) { - - var channel = node.channels[ 0 ]; - var m = channel.sampler.output[ frame ]; - - if ( m instanceof THREE.Matrix4 ) { - - node.world.copy( m ); - node.localworld.copy(m); - if(frame == 0) - node.matrix.copy(m); - } - - } - - if ( parent ) { - - node.world.multiplyMatrices( parent, node.world ); - - } - - bones.push( node ); - - for ( var i = 0; i < node.nodes.length; i ++ ) { - - setupSkeleton( node.nodes[ i ], bones, frame, node.world ); - - } - - } - - function setupSkinningMatrices ( bones, skin ) { - - // FIXME: this is dumb... - - for ( var i = 0; i < bones.length; i ++ ) { - - var bone = bones[ i ]; - var found = -1; - - if ( bone.type != 'JOINT' ) continue; - - for ( var j = 0; j < skin.joints.length; j ++ ) { - - if ( bone.sid == skin.joints[ j ] ) { - - found = j; - break; - - } - - } - - if ( found >= 0 ) { - - var inv = skin.invBindMatrices[ found ]; - - bone.invBindMatrix = inv; - bone.skinningMatrix = new THREE.Matrix4(); - bone.skinningMatrix.multiplyMatrices(bone.world, inv); // (IBMi * JMi) - bone.animatrix = new THREE.Matrix4(); - - bone.animatrix.copy(bone.localworld); - bone.weights = []; - - for ( var j = 0; j < skin.weights.length; j ++ ) { - - for (var k = 0; k < skin.weights[ j ].length; k ++ ) { - - var w = skin.weights[ j ][ k ]; - - if ( w.joint == found ) { - - bone.weights.push( w ); - - } - - } - - } - - } else { - - console.warn( "ColladaLoader: Could not find joint '" + bone.sid + "'." ); - - bone.skinningMatrix = new THREE.Matrix4(); - bone.weights = []; - - } - } - - } - - //Walk the Collada tree and flatten the bones into a list, extract the position, quat and scale from the matrix - function flattenSkeleton(skeleton) { - - var list = []; - var walk = function(parentid, node, list) { - - var bone = {}; - bone.name = node.sid; - bone.parent = parentid; - bone.matrix = node.matrix; - var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()]; - bone.matrix.decompose(data[0],data[1],data[2]); - - bone.pos = [data[0].x,data[0].y,data[0].z]; - - bone.scl = [data[2].x,data[2].y,data[2].z]; - bone.rotq = [data[1].x,data[1].y,data[1].z,data[1].w]; - list.push(bone); - - for(var i in node.nodes) { - - walk(node.sid,node.nodes[i],list); - - } - - }; - - walk(-1,skeleton,list); - return list; - - } - - //Move the vertices into the pose that is proper for the start of the animation - function skinToBindPose(geometry,skeleton,skinController) { - - var bones = []; - setupSkeleton( skeleton, bones, -1 ); - setupSkinningMatrices( bones, skinController.skin ); - v = new THREE.Vector3(); - var skinned = []; - - for(var i =0; i < geometry.vertices.length; i++) { - - skinned.push(new THREE.Vector3()); - - } - - for ( i = 0; i < bones.length; i ++ ) { - - if ( bones[ i ].type != 'JOINT' ) continue; - - for ( j = 0; j < bones[ i ].weights.length; j ++ ) { - - w = bones[ i ].weights[ j ]; - vidx = w.index; - weight = w.weight; - - o = geometry.vertices[vidx]; - s = skinned[vidx]; - - v.x = o.x; - v.y = o.y; - v.z = o.z; - - v.applyMatrix4( bones[i].skinningMatrix ); - - s.x += (v.x * weight); - s.y += (v.y * weight); - s.z += (v.z * weight); - } - - } - - for(var i =0; i < geometry.vertices.length; i++) { - - geometry.vertices[i] = skinned[i]; - - } - - } - - function applySkin ( geometry, instanceCtrl, frame ) { - - var skinController = controllers[ instanceCtrl.url ]; - - frame = frame !== undefined ? frame : 40; - - if ( !skinController || !skinController.skin ) { - - console.log( 'ColladaLoader: Could not find skin controller.' ); - return; - - } - - if ( !instanceCtrl.skeleton || !instanceCtrl.skeleton.length ) { - - console.log( 'ColladaLoader: Could not find the skeleton for the skin. ' ); - return; - - } - - var animationBounds = calcAnimationBounds(); - var skeleton = daeScene.getChildById( instanceCtrl.skeleton[0], true ) || - daeScene.getChildBySid( instanceCtrl.skeleton[0], true ); - - //flatten the skeleton into a list of bones - var bonelist = flattenSkeleton(skeleton); - var joints = skinController.skin.joints; - - //sort that list so that the order reflects the order in the joint list - var sortedbones = []; - for(var i = 0; i < joints.length; i++) { - - for(var j =0; j < bonelist.length; j++) { - - if(bonelist[j].name == joints[i]) { - - sortedbones[i] = bonelist[j]; - - } - - } - - } - - //hook up the parents by index instead of name - for(var i = 0; i < sortedbones.length; i++) { - - for(var j =0; j < sortedbones.length; j++) { - - if(sortedbones[i].parent == sortedbones[j].name) { - - sortedbones[i].parent = j; - - } - - } - - } - - - var i, j, w, vidx, weight; - var v = new THREE.Vector3(), o, s; - - // move vertices to bind shape - for ( i = 0; i < geometry.vertices.length; i ++ ) { - geometry.vertices[i].applyMatrix4( skinController.skin.bindShapeMatrix ); - } - - var skinIndices = []; - var skinWeights = []; - var weights = skinController.skin.weights; - - //hook up the skin weights - // TODO - this might be a good place to choose greatest 4 weights - for(var i =0; i < weights.length; i++) { - - var indicies = new THREE.Vector4(weights[i][0]?weights[i][0].joint:0,weights[i][1]?weights[i][1].joint:0,weights[i][2]?weights[i][2].joint:0,weights[i][3]?weights[i][3].joint:0); - var weight = new THREE.Vector4(weights[i][0]?weights[i][0].weight:0,weights[i][1]?weights[i][1].weight:0,weights[i][2]?weights[i][2].weight:0,weights[i][3]?weights[i][3].weight:0); - - skinIndices.push(indicies); - skinWeights.push(weight); - - } - - geometry.skinIndices = skinIndices; - geometry.skinWeights = skinWeights; - geometry.bones = sortedbones; - // process animation, or simply pose the rig if no animation - - //create an animation for the animated bones - //NOTE: this has no effect when using morphtargets - var animationdata = {"name":animationBounds.ID,"fps":30,"length":animationBounds.frames/30,"hierarchy":[]}; - - for(var j =0; j < sortedbones.length; j++) { - - animationdata.hierarchy.push({parent:sortedbones[j].parent, name:sortedbones[j].name, keys:[]}); - - } - - console.log( 'ColladaLoader:', animationBounds.ID + ' has ' + sortedbones.length + ' bones.' ); - - - - skinToBindPose(geometry,skeleton,skinController); - - - for ( frame = 0; frame < animationBounds.frames; frame ++ ) { - - var bones = []; - var skinned = []; - // process the frame and setup the rig with a fresh - // transform, possibly from the bone's animation channel(s) - - setupSkeleton( skeleton, bones, frame ); - setupSkinningMatrices( bones, skinController.skin ); - - for(var i = 0; i < bones.length; i ++) { - - for(var j = 0; j < animationdata.hierarchy.length; j ++) { - - if(animationdata.hierarchy[j].name == bones[i].sid) { - - var key = {}; - key.time = (frame/30); - key.matrix = bones[i].animatrix; - - if(frame == 0) - bones[i].matrix = key.matrix; - - var data = [new THREE.Vector3(),new THREE.Quaternion(),new THREE.Vector3()]; - key.matrix.decompose(data[0],data[1],data[2]); - - key.pos = [data[0].x,data[0].y,data[0].z]; - - key.scl = [data[2].x,data[2].y,data[2].z]; - key.rot = data[1]; - - animationdata.hierarchy[j].keys.push(key); - - } - - } - - } - - geometry.animation = animationdata; - - } - - }; - - function createSceneGraph ( node, parent ) { - - var obj = new THREE.Object3D(); - var skinned = false; - var skinController; - var morphController; - var i, j; - - // FIXME: controllers - - for ( i = 0; i < node.controllers.length; i ++ ) { - - var controller = controllers[ node.controllers[ i ].url ]; - - switch ( controller.type ) { - - case 'skin': - - if ( geometries[ controller.skin.source ] ) { - - var inst_geom = new InstanceGeometry(); - - inst_geom.url = controller.skin.source; - inst_geom.instance_material = node.controllers[ i ].instance_material; - - node.geometries.push( inst_geom ); - skinned = true; - skinController = node.controllers[ i ]; - - } else if ( controllers[ controller.skin.source ] ) { - - // urgh: controller can be chained - // handle the most basic case... - - var second = controllers[ controller.skin.source ]; - morphController = second; - // skinController = node.controllers[i]; - - if ( second.morph && geometries[ second.morph.source ] ) { - - var inst_geom = new InstanceGeometry(); - - inst_geom.url = second.morph.source; - inst_geom.instance_material = node.controllers[ i ].instance_material; - - node.geometries.push( inst_geom ); - - } - - } - - break; - - case 'morph': - - if ( geometries[ controller.morph.source ] ) { - - var inst_geom = new InstanceGeometry(); - - inst_geom.url = controller.morph.source; - inst_geom.instance_material = node.controllers[ i ].instance_material; - - node.geometries.push( inst_geom ); - morphController = node.controllers[ i ]; - - } - - console.log( 'ColladaLoader: Morph-controller partially supported.' ); - - default: - break; - - } - - } - - // geometries - - var double_sided_materials = {}; - - for ( i = 0; i < node.geometries.length; i ++ ) { - - var instance_geometry = node.geometries[i]; - var instance_materials = instance_geometry.instance_material; - var geometry = geometries[ instance_geometry.url ]; - var used_materials = {}; - var used_materials_array = []; - var num_materials = 0; - var first_material; - - if ( geometry ) { - - if ( !geometry.mesh || !geometry.mesh.primitives ) - continue; - - if ( obj.name.length == 0 ) { - - obj.name = geometry.id; - - } - - // collect used fx for this geometry-instance - - if ( instance_materials ) { - - for ( j = 0; j < instance_materials.length; j ++ ) { - - var instance_material = instance_materials[ j ]; - var mat = materials[ instance_material.target ]; - var effect_id = mat.instance_effect.url; - var shader = effects[ effect_id ].shader; - var material3js = shader.material; - - if ( geometry.doubleSided ) { - - if ( !( instance_material.symbol in double_sided_materials ) ) { - - var _copied_material = material3js.clone(); - _copied_material.side = THREE.DoubleSide; - double_sided_materials[ instance_material.symbol ] = _copied_material; - - } - - material3js = double_sided_materials[ instance_material.symbol ]; - - } - - material3js.opacity = !material3js.opacity ? 1 : material3js.opacity; - used_materials[ instance_material.symbol ] = num_materials; - used_materials_array.push( material3js ); - first_material = material3js; - first_material.name = mat.name == null || mat.name === '' ? mat.id : mat.name; - num_materials ++; - - } - - } - - var mesh; - var material = first_material || new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading, side: geometry.doubleSided ? THREE.DoubleSide : THREE.FrontSide } ); - var geom = geometry.mesh.geometry3js; - - if ( num_materials > 1 ) { - - material = new THREE.MeshFaceMaterial( used_materials_array ); - - for ( j = 0; j < geom.faces.length; j ++ ) { - - var face = geom.faces[ j ]; - face.materialIndex = used_materials[ face.daeMaterial ] - - } - - } - - if ( skinController !== undefined ) { - - - applySkin( geom, skinController ); - - if(geom.morphTargets.length > 0) { - - material.morphTargets = true; - material.skinning = false; - - } else { - - material.morphTargets = false; - material.skinning = true; - - } - - - mesh = new THREE.SkinnedMesh( geom, material, false ); - - - //mesh.skeleton = skinController.skeleton; - //mesh.skinController = controllers[ skinController.url ]; - //mesh.skinInstanceController = skinController; - mesh.name = 'skin_' + skins.length; - - - - //mesh.animationHandle.setKey(0); - skins.push( mesh ); - - } else if ( morphController !== undefined ) { - - createMorph( geom, morphController ); - - material.morphTargets = true; - - mesh = new THREE.Mesh( geom, material ); - mesh.name = 'morph_' + morphs.length; - - morphs.push( mesh ); - - } else { - - mesh = new THREE.Mesh( geom, material ); - // mesh.geom.name = geometry.id; - - } - - // N.B.: TP says this is not a great default behavior. It's a nice - // optimization to flatten the hierarchy but this should be done - // only if requested by the user via a flag. For now I undid it - // and fixed the character animation example that uses it - // node.geometries.length > 1 ? obj.add( mesh ) : obj = mesh; - obj.add(mesh); - - } - - } - - for ( i = 0; i < node.cameras.length; i ++ ) { - - var instance_camera = node.cameras[i]; - var cparams = cameras[instance_camera.url]; - - var cam = new THREE.PerspectiveCamera(cparams.yfov, parseFloat(cparams.aspect_ratio), - parseFloat(cparams.znear), parseFloat(cparams.zfar)); - - obj.add(cam); - } - - for ( i = 0; i < node.lights.length; i ++ ) { - - var light = null; - var instance_light = node.lights[i]; - var lparams = lights[instance_light.url]; - - if ( lparams && lparams.technique ) { - - var color = lparams.color.getHex(); - var intensity = lparams.intensity; - var distance = lparams.distance; - var angle = lparams.falloff_angle; - var exponent; // Intentionally undefined, don't know what this is yet - - switch ( lparams.technique ) { - - case 'directional': - - light = new THREE.DirectionalLight( color, intensity, distance ); - light.position.set(0, 0, 1); - break; - - case 'point': - - light = new THREE.PointLight( color, intensity, distance ); - break; - - case 'spot': - - light = new THREE.SpotLight( color, intensity, distance, angle, exponent ); - light.position.set(0, 0, 1); - break; - - case 'ambient': - - light = new THREE.AmbientLight( color ); - break; - - } - - } - - if (light) { - obj.add(light); - } - } - - obj.name = node.name || node.id || ""; - obj.id = node.id || ""; - obj.layer = node.layer || ""; - obj.matrix = node.matrix; - obj.matrix.decompose( obj.position, obj.quaternion, obj.scale ); - - if ( options.centerGeometry && obj.geometry ) { - - var delta = obj.geometry.center(); - delta.multiply( obj.scale ); - delta.applyQuaternion( obj.quaternion ); - - obj.position.sub( delta ); - - } - - for ( i = 0; i < node.nodes.length; i ++ ) { - - obj.add( createSceneGraph( node.nodes[i], node ) ); - - } - - return obj; - - }; - - function getJointId( skin, id ) { - - for ( var i = 0; i < skin.joints.length; i ++ ) { - - if ( skin.joints[ i ] == id ) { - - return i; - - } - - } - - }; - - function getLibraryNode( id ) { - - var nodes = COLLADA.querySelectorAll('library_nodes node'); - - for ( var i = 0; i < nodes.length; i++ ) { - - var attObj = nodes[i].attributes.getNamedItem('id'); - if ( attObj && attObj.value === id ) { - return nodes[i]; - } - } - - return undefined; - - }; - - function getChannelsForNode (node ) { - - var channels = []; - var startTime = 1000000; - var endTime = -1000000; - - for ( var id in animations ) { - - var animation = animations[id]; - - for ( var i = 0; i < animation.channel.length; i ++ ) { - - var channel = animation.channel[i]; - var sampler = animation.sampler[i]; - var id = channel.target.split('/')[0]; - - if ( id == node.id ) { - - sampler.create(); - channel.sampler = sampler; - startTime = Math.min(startTime, sampler.startTime); - endTime = Math.max(endTime, sampler.endTime); - channels.push(channel); - - } - - } - - } - - if ( channels.length ) { - - node.startTime = startTime; - node.endTime = endTime; - - } - - return channels; - - }; - - function calcFrameDuration( node ) { - - var minT = 10000000; - - for ( var i = 0; i < node.channels.length; i ++ ) { - - var sampler = node.channels[i].sampler; - - for ( var j = 0; j < sampler.input.length - 1; j ++ ) { - - var t0 = sampler.input[ j ]; - var t1 = sampler.input[ j + 1 ]; - minT = Math.min( minT, t1 - t0 ); - - } - } - - return minT; - - }; - - function calcMatrixAt( node, t ) { - - var animated = {}; - - var i, j; - - for ( i = 0; i < node.channels.length; i ++ ) { - - var channel = node.channels[ i ]; - animated[ channel.sid ] = channel; - - } - - var matrix = new THREE.Matrix4(); - - for ( i = 0; i < node.transforms.length; i ++ ) { - - var transform = node.transforms[ i ]; - var channel = animated[ transform.sid ]; - - if ( channel !== undefined ) { - - var sampler = channel.sampler; - var value; - - for ( j = 0; j < sampler.input.length - 1; j ++ ) { - - if ( sampler.input[ j + 1 ] > t ) { - - value = sampler.output[ j ]; - //console.log(value.flatten) - break; - - } - - } - - if ( value !== undefined ) { - - if ( value instanceof THREE.Matrix4 ) { - - matrix.multiplyMatrices( matrix, value ); - - } else { - - // FIXME: handle other types - - matrix.multiplyMatrices( matrix, transform.matrix ); - - } - - } else { - - matrix.multiplyMatrices( matrix, transform.matrix ); - - } - - } else { - - matrix.multiplyMatrices( matrix, transform.matrix ); - - } - - } - - return matrix; - - }; - - function bakeAnimations ( node ) { - - if ( node.channels && node.channels.length ) { - - var keys = [], - sids = []; - - for ( var i = 0, il = node.channels.length; i < il; i++ ) { - - var channel = node.channels[i], - fullSid = channel.fullSid, - sampler = channel.sampler, - input = sampler.input, - transform = node.getTransformBySid( channel.sid ), - member; - - if ( channel.arrIndices ) { - - member = []; - - for ( var j = 0, jl = channel.arrIndices.length; j < jl; j++ ) { - - member[ j ] = getConvertedIndex( channel.arrIndices[ j ] ); - - } - - } else { - - member = getConvertedMember( channel.member ); - - } - - if ( transform ) { - - if ( sids.indexOf( fullSid ) === -1 ) { - - sids.push( fullSid ); - - } - - for ( var j = 0, jl = input.length; j < jl; j++ ) { - - var time = input[j], - data = sampler.getData( transform.type, j, member ), - key = findKey( keys, time ); - - if ( !key ) { - - key = new Key( time ); - var timeNdx = findTimeNdx( keys, time ); - keys.splice( timeNdx == -1 ? keys.length : timeNdx, 0, key ); - - } - - key.addTarget( fullSid, transform, member, data ); - - } - - } else { - - console.log( 'Could not find transform "' + channel.sid + '" in node ' + node.id ); - - } - - } - - // post process - for ( var i = 0; i < sids.length; i++ ) { - - var sid = sids[ i ]; - - for ( var j = 0; j < keys.length; j++ ) { - - var key = keys[ j ]; - - if ( !key.hasTarget( sid ) ) { - - interpolateKeys( keys, key, j, sid ); - - } - - } - - } - - node.keys = keys; - node.sids = sids; - - } - - }; - - function findKey ( keys, time) { - - var retVal = null; - - for ( var i = 0, il = keys.length; i < il && retVal == null; i++ ) { - - var key = keys[i]; - - if ( key.time === time ) { - - retVal = key; - - } else if ( key.time > time ) { - - break; - - } - - } - - return retVal; - - }; - - function findTimeNdx ( keys, time) { - - var ndx = -1; - - for ( var i = 0, il = keys.length; i < il && ndx == -1; i++ ) { - - var key = keys[i]; - - if ( key.time >= time ) { - - ndx = i; - - } - - } - - return ndx; - - }; - - function interpolateKeys ( keys, key, ndx, fullSid ) { - - var prevKey = getPrevKeyWith( keys, fullSid, ndx ? ndx-1 : 0 ), - nextKey = getNextKeyWith( keys, fullSid, ndx+1 ); - - if ( prevKey && nextKey ) { - - var scale = (key.time - prevKey.time) / (nextKey.time - prevKey.time), - prevTarget = prevKey.getTarget( fullSid ), - nextData = nextKey.getTarget( fullSid ).data, - prevData = prevTarget.data, - data; - - if ( prevTarget.type === 'matrix' ) { - - data = prevData; - - } else if ( prevData.length ) { - - data = []; - - for ( var i = 0; i < prevData.length; ++i ) { - - data[ i ] = prevData[ i ] + ( nextData[ i ] - prevData[ i ] ) * scale; - - } - - } else { - - data = prevData + ( nextData - prevData ) * scale; - - } - - key.addTarget( fullSid, prevTarget.transform, prevTarget.member, data ); - - } - - }; - - // Get next key with given sid - - function getNextKeyWith( keys, fullSid, ndx ) { - - for ( ; ndx < keys.length; ndx++ ) { - - var key = keys[ ndx ]; - - if ( key.hasTarget( fullSid ) ) { - - return key; - - } - - } - - return null; - - }; - - // Get previous key with given sid - - function getPrevKeyWith( keys, fullSid, ndx ) { - - ndx = ndx >= 0 ? ndx : ndx + keys.length; - - for ( ; ndx >= 0; ndx-- ) { - - var key = keys[ ndx ]; - - if ( key.hasTarget( fullSid ) ) { - - return key; - - } - - } - - return null; - - }; - - function _Image() { - - this.id = ""; - this.init_from = ""; - - }; - - _Image.prototype.parse = function(element) { - - this.id = element.getAttribute('id'); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - if ( child.nodeName == 'init_from' ) { - - this.init_from = child.textContent; - - } - - } - - return this; - - }; - - function Controller() { - - this.id = ""; - this.name = ""; - this.type = ""; - this.skin = null; - this.morph = null; - - }; - - Controller.prototype.parse = function( element ) { - - this.id = element.getAttribute('id'); - this.name = element.getAttribute('name'); - this.type = "none"; - - for ( var i = 0; i < element.childNodes.length; i++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'skin': - - this.skin = (new Skin()).parse(child); - this.type = child.nodeName; - break; - - case 'morph': - - this.morph = (new Morph()).parse(child); - this.type = child.nodeName; - break; - - default: - break; - - } - } - - return this; - - }; - - function Morph() { - - this.method = null; - this.source = null; - this.targets = null; - this.weights = null; - - }; - - Morph.prototype.parse = function( element ) { - - var sources = {}; - var inputs = []; - var i; - - this.method = element.getAttribute( 'method' ); - this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); - - for ( i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'source': - - var source = ( new Source() ).parse( child ); - sources[ source.id ] = source; - break; - - case 'targets': - - inputs = this.parseInputs( child ); - break; - - default: - - console.log( child.nodeName ); - break; - - } - - } - - for ( i = 0; i < inputs.length; i ++ ) { - - var input = inputs[ i ]; - var source = sources[ input.source ]; - - switch ( input.semantic ) { - - case 'MORPH_TARGET': - - this.targets = source.read(); - break; - - case 'MORPH_WEIGHT': - - this.weights = source.read(); - break; - - default: - break; - - } - } - - return this; - - }; - - Morph.prototype.parseInputs = function(element) { - - var inputs = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1) continue; - - switch ( child.nodeName ) { - - case 'input': - - inputs.push( (new Input()).parse(child) ); - break; - - default: - break; - } - } - - return inputs; - - }; - - function Skin() { - - this.source = ""; - this.bindShapeMatrix = null; - this.invBindMatrices = []; - this.joints = []; - this.weights = []; - - }; - - Skin.prototype.parse = function( element ) { - - var sources = {}; - var joints, weights; - - this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); - this.invBindMatrices = []; - this.joints = []; - this.weights = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'bind_shape_matrix': - - var f = _floats(child.textContent); - this.bindShapeMatrix = getConvertedMat4( f ); - break; - - case 'source': - - var src = new Source().parse(child); - sources[ src.id ] = src; - break; - - case 'joints': - - joints = child; - break; - - case 'vertex_weights': - - weights = child; - break; - - default: - - console.log( child.nodeName ); - break; - - } - } - - this.parseJoints( joints, sources ); - this.parseWeights( weights, sources ); - - return this; - - }; - - Skin.prototype.parseJoints = function ( element, sources ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - - var input = ( new Input() ).parse( child ); - var source = sources[ input.source ]; - - if ( input.semantic == 'JOINT' ) { - - this.joints = source.read(); - - } else if ( input.semantic == 'INV_BIND_MATRIX' ) { - - this.invBindMatrices = source.read(); - - } - - break; - - default: - break; - } - - } - - }; - - Skin.prototype.parseWeights = function ( element, sources ) { - - var v, vcount, inputs = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - - inputs.push( ( new Input() ).parse( child ) ); - break; - - case 'v': - - v = _ints( child.textContent ); - break; - - case 'vcount': - - vcount = _ints( child.textContent ); - break; - - default: - break; - - } - - } - - var index = 0; - - for ( var i = 0; i < vcount.length; i ++ ) { - - var numBones = vcount[i]; - var vertex_weights = []; - - for ( var j = 0; j < numBones; j++ ) { - - var influence = {}; - - for ( var k = 0; k < inputs.length; k ++ ) { - - var input = inputs[ k ]; - var value = v[ index + input.offset ]; - - switch ( input.semantic ) { - - case 'JOINT': - - influence.joint = value;//this.joints[value]; - break; - - case 'WEIGHT': - - influence.weight = sources[ input.source ].data[ value ]; - break; - - default: - break; - - } - - } - - vertex_weights.push( influence ); - index += inputs.length; - } - - for ( var j = 0; j < vertex_weights.length; j ++ ) { - - vertex_weights[ j ].index = i; - - } - - this.weights.push( vertex_weights ); - - } - - }; - - function VisualScene () { - - this.id = ""; - this.name = ""; - this.nodes = []; - this.scene = new THREE.Object3D(); - - }; - - VisualScene.prototype.getChildById = function( id, recursive ) { - - for ( var i = 0; i < this.nodes.length; i ++ ) { - - var node = this.nodes[ i ].getChildById( id, recursive ); - - if ( node ) { - - return node; - - } - - } - - return null; - - }; - - VisualScene.prototype.getChildBySid = function( sid, recursive ) { - - for ( var i = 0; i < this.nodes.length; i ++ ) { - - var node = this.nodes[ i ].getChildBySid( sid, recursive ); - - if ( node ) { - - return node; - - } - - } - - return null; - - }; - - VisualScene.prototype.parse = function( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - this.nodes = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'node': - - this.nodes.push( ( new Node() ).parse( child ) ); - break; - - default: - break; - - } - - } - - return this; - - }; - - function Node() { - - this.id = ""; - this.name = ""; - this.sid = ""; - this.nodes = []; - this.controllers = []; - this.transforms = []; - this.geometries = []; - this.channels = []; - this.matrix = new THREE.Matrix4(); - - }; - - Node.prototype.getChannelForTransform = function( transformSid ) { - - for ( var i = 0; i < this.channels.length; i ++ ) { - - var channel = this.channels[i]; - var parts = channel.target.split('/'); - var id = parts.shift(); - var sid = parts.shift(); - var dotSyntax = (sid.indexOf(".") >= 0); - var arrSyntax = (sid.indexOf("(") >= 0); - var arrIndices; - var member; - - if ( dotSyntax ) { - - parts = sid.split("."); - sid = parts.shift(); - member = parts.shift(); - - } else if ( arrSyntax ) { - - arrIndices = sid.split("("); - sid = arrIndices.shift(); - - for ( var j = 0; j < arrIndices.length; j ++ ) { - - arrIndices[ j ] = parseInt( arrIndices[ j ].replace( /\)/, '' ) ); - - } - - } - - if ( sid == transformSid ) { - - channel.info = { sid: sid, dotSyntax: dotSyntax, arrSyntax: arrSyntax, arrIndices: arrIndices }; - return channel; - - } - - } - - return null; - - }; - - Node.prototype.getChildById = function ( id, recursive ) { - - if ( this.id == id ) { - - return this; - - } - - if ( recursive ) { - - for ( var i = 0; i < this.nodes.length; i ++ ) { - - var n = this.nodes[ i ].getChildById( id, recursive ); - - if ( n ) { - - return n; - - } - - } - - } - - return null; - - }; - - Node.prototype.getChildBySid = function ( sid, recursive ) { - - if ( this.sid == sid ) { - - return this; - - } - - if ( recursive ) { - - for ( var i = 0; i < this.nodes.length; i ++ ) { - - var n = this.nodes[ i ].getChildBySid( sid, recursive ); - - if ( n ) { - - return n; - - } - - } - } - - return null; - - }; - - Node.prototype.getTransformBySid = function ( sid ) { - - for ( var i = 0; i < this.transforms.length; i ++ ) { - - if ( this.transforms[ i ].sid == sid ) return this.transforms[ i ]; - - } - - return null; - - }; - - Node.prototype.parse = function( element ) { - - var url; - - this.id = element.getAttribute('id'); - this.sid = element.getAttribute('sid'); - this.name = element.getAttribute('name'); - this.type = element.getAttribute('type'); - this.layer = element.getAttribute('layer'); - - this.type = this.type == 'JOINT' ? this.type : 'NODE'; - - this.nodes = []; - this.transforms = []; - this.geometries = []; - this.cameras = []; - this.lights = []; - this.controllers = []; - this.matrix = new THREE.Matrix4(); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'node': - - this.nodes.push( ( new Node() ).parse( child ) ); - break; - - case 'instance_camera': - - this.cameras.push( ( new InstanceCamera() ).parse( child ) ); - break; - - case 'instance_controller': - - this.controllers.push( ( new InstanceController() ).parse( child ) ); - break; - - case 'instance_geometry': - - this.geometries.push( ( new InstanceGeometry() ).parse( child ) ); - break; - - case 'instance_light': - - this.lights.push( ( new InstanceLight() ).parse( child ) ); - break; - - case 'instance_node': - - url = child.getAttribute( 'url' ).replace( /^#/, '' ); - var iNode = getLibraryNode( url ); - - if ( iNode ) { - - this.nodes.push( ( new Node() ).parse( iNode )) ; - - } - - break; - - case 'rotate': - case 'translate': - case 'scale': - case 'matrix': - case 'lookat': - case 'skew': - - this.transforms.push( ( new Transform() ).parse( child ) ); - break; - - case 'extra': - break; - - default: - - console.log( child.nodeName ); - break; - - } - - } - - this.channels = getChannelsForNode( this ); - bakeAnimations( this ); - - this.updateMatrix(); - - return this; - - }; - - Node.prototype.updateMatrix = function () { - - this.matrix.identity(); - - for ( var i = 0; i < this.transforms.length; i ++ ) { - - this.transforms[ i ].apply( this.matrix ); - - } - - }; - - function Transform () { - - this.sid = ""; - this.type = ""; - this.data = []; - this.obj = null; - - }; - - Transform.prototype.parse = function ( element ) { - - this.sid = element.getAttribute( 'sid' ); - this.type = element.nodeName; - this.data = _floats( element.textContent ); - this.convert(); - - return this; - - }; - - Transform.prototype.convert = function () { - - switch ( this.type ) { - - case 'matrix': - - this.obj = getConvertedMat4( this.data ); - break; - - case 'rotate': - - this.angle = THREE.Math.degToRad( this.data[3] ); - - case 'translate': - - fixCoords( this.data, -1 ); - this.obj = new THREE.Vector3( this.data[ 0 ], this.data[ 1 ], this.data[ 2 ] ); - break; - - case 'scale': - - fixCoords( this.data, 1 ); - this.obj = new THREE.Vector3( this.data[ 0 ], this.data[ 1 ], this.data[ 2 ] ); - break; - - default: - console.log( 'Can not convert Transform of type ' + this.type ); - break; - - } - - }; - - Transform.prototype.apply = function () { - - var m1 = new THREE.Matrix4(); - - return function ( matrix ) { - - switch ( this.type ) { - - case 'matrix': - - matrix.multiply( this.obj ); - - break; - - case 'translate': - - matrix.multiply( m1.makeTranslation( this.obj.x, this.obj.y, this.obj.z ) ); - - break; - - case 'rotate': - - matrix.multiply( m1.makeRotationAxis( this.obj, this.angle ) ); - - break; - - case 'scale': - - matrix.scale( this.obj ); - - break; - - } - - }; - - }(); - - Transform.prototype.update = function ( data, member ) { - - var members = [ 'X', 'Y', 'Z', 'ANGLE' ]; - - switch ( this.type ) { - - case 'matrix': - - if ( ! member ) { - - this.obj.copy( data ); - - } else if ( member.length === 1 ) { - - switch ( member[ 0 ] ) { - - case 0: - - this.obj.n11 = data[ 0 ]; - this.obj.n21 = data[ 1 ]; - this.obj.n31 = data[ 2 ]; - this.obj.n41 = data[ 3 ]; - - break; - - case 1: - - this.obj.n12 = data[ 0 ]; - this.obj.n22 = data[ 1 ]; - this.obj.n32 = data[ 2 ]; - this.obj.n42 = data[ 3 ]; - - break; - - case 2: - - this.obj.n13 = data[ 0 ]; - this.obj.n23 = data[ 1 ]; - this.obj.n33 = data[ 2 ]; - this.obj.n43 = data[ 3 ]; - - break; - - case 3: - - this.obj.n14 = data[ 0 ]; - this.obj.n24 = data[ 1 ]; - this.obj.n34 = data[ 2 ]; - this.obj.n44 = data[ 3 ]; - - break; - - } - - } else if ( member.length === 2 ) { - - var propName = 'n' + ( member[ 0 ] + 1 ) + ( member[ 1 ] + 1 ); - this.obj[ propName ] = data; - - } else { - - console.log('Incorrect addressing of matrix in transform.'); - - } - - break; - - case 'translate': - case 'scale': - - if ( Object.prototype.toString.call( member ) === '[object Array]' ) { - - member = members[ member[ 0 ] ]; - - } - - switch ( member ) { - - case 'X': - - this.obj.x = data; - break; - - case 'Y': - - this.obj.y = data; - break; - - case 'Z': - - this.obj.z = data; - break; - - default: - - this.obj.x = data[ 0 ]; - this.obj.y = data[ 1 ]; - this.obj.z = data[ 2 ]; - break; - - } - - break; - - case 'rotate': - - if ( Object.prototype.toString.call( member ) === '[object Array]' ) { - - member = members[ member[ 0 ] ]; - - } - - switch ( member ) { - - case 'X': - - this.obj.x = data; - break; - - case 'Y': - - this.obj.y = data; - break; - - case 'Z': - - this.obj.z = data; - break; - - case 'ANGLE': - - this.angle = THREE.Math.degToRad( data ); - break; - - default: - - this.obj.x = data[ 0 ]; - this.obj.y = data[ 1 ]; - this.obj.z = data[ 2 ]; - this.angle = THREE.Math.degToRad( data[ 3 ] ); - break; - - } - break; - - } - - }; - - function InstanceController() { - - this.url = ""; - this.skeleton = []; - this.instance_material = []; - - }; - - InstanceController.prototype.parse = function ( element ) { - - this.url = element.getAttribute('url').replace(/^#/, ''); - this.skeleton = []; - this.instance_material = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'skeleton': - - this.skeleton.push( child.textContent.replace(/^#/, '') ); - break; - - case 'bind_material': - - var instances = child.querySelectorAll('instance_material'); - - for ( var j = 0; j < instances.length; j ++ ){ - - var instance = instances[j]; - this.instance_material.push( (new InstanceMaterial()).parse(instance) ); - - } - - - break; - - case 'extra': - break; - - default: - break; - - } - } - - return this; - - }; - - function InstanceMaterial () { - - this.symbol = ""; - this.target = ""; - - }; - - InstanceMaterial.prototype.parse = function ( element ) { - - this.symbol = element.getAttribute('symbol'); - this.target = element.getAttribute('target').replace(/^#/, ''); - return this; - - }; - - function InstanceGeometry() { - - this.url = ""; - this.instance_material = []; - - }; - - InstanceGeometry.prototype.parse = function ( element ) { - - this.url = element.getAttribute('url').replace(/^#/, ''); - this.instance_material = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1 ) continue; - - if ( child.nodeName == 'bind_material' ) { - - var instances = child.querySelectorAll('instance_material'); - - for ( var j = 0; j < instances.length; j ++ ) { - - var instance = instances[j]; - this.instance_material.push( (new InstanceMaterial()).parse(instance) ); - - } - - break; - - } - - } - - return this; - - }; - - function Geometry() { - - this.id = ""; - this.mesh = null; - - }; - - Geometry.prototype.parse = function ( element ) { - - this.id = element.getAttribute('id'); - - extractDoubleSided( this, element ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - - switch ( child.nodeName ) { - - case 'mesh': - - this.mesh = (new Mesh(this)).parse(child); - break; - - case 'extra': - - // console.log( child ); - break; - - default: - break; - } - } - - return this; - - }; - - function Mesh( geometry ) { - - this.geometry = geometry.id; - this.primitives = []; - this.vertices = null; - this.geometry3js = null; - - }; - - Mesh.prototype.parse = function( element ) { - - this.primitives = []; - - var i, j; - - for ( i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'source': - - _source( child ); - break; - - case 'vertices': - - this.vertices = ( new Vertices() ).parse( child ); - break; - - case 'triangles': - - this.primitives.push( ( new Triangles().parse( child ) ) ); - break; - - case 'polygons': - - this.primitives.push( ( new Polygons().parse( child ) ) ); - break; - - case 'polylist': - - this.primitives.push( ( new Polylist().parse( child ) ) ); - break; - - default: - break; - - } - - } - - this.geometry3js = new THREE.Geometry(); - - var vertexData = sources[ this.vertices.input['POSITION'].source ].data; - - for ( i = 0; i < vertexData.length; i += 3 ) { - - this.geometry3js.vertices.push( getConvertedVec3( vertexData, i ).clone() ); - - } - - for ( i = 0; i < this.primitives.length; i ++ ) { - - var primitive = this.primitives[ i ]; - primitive.setVertices( this.vertices ); - this.handlePrimitive( primitive, this.geometry3js ); - - } - - this.geometry3js.computeFaceNormals(); - - if ( this.geometry3js.calcNormals ) { - - this.geometry3js.computeVertexNormals(); - delete this.geometry3js.calcNormals; - - } - - // this.geometry3js.computeBoundingBox(); - - return this; - - }; - - Mesh.prototype.handlePrimitive = function( primitive, geom ) { - - var j, k, pList = primitive.p, inputs = primitive.inputs; - var input, index, idx32; - var source, numParams; - var vcIndex = 0, vcount = 3, maxOffset = 0; - var texture_sets = []; - - for ( j = 0; j < inputs.length; j ++ ) { - - input = inputs[ j ]; - - var offset = input.offset + 1; - maxOffset = (maxOffset < offset)? offset : maxOffset; - - switch ( input.semantic ) { - - case 'TEXCOORD': - texture_sets.push( input.set ); - break; - - } - - } - - for ( var pCount = 0; pCount < pList.length; ++pCount ) { - - var p = pList[ pCount ], i = 0; - - while ( i < p.length ) { - - var vs = []; - var ns = []; - var ts = null; - var cs = []; - - if ( primitive.vcount ) { - - vcount = primitive.vcount.length ? primitive.vcount[ vcIndex ++ ] : primitive.vcount; - - } else { - - vcount = p.length / maxOffset; - - } - - - for ( j = 0; j < vcount; j ++ ) { - - for ( k = 0; k < inputs.length; k ++ ) { - - input = inputs[ k ]; - source = sources[ input.source ]; - - index = p[ i + ( j * maxOffset ) + input.offset ]; - numParams = source.accessor.params.length; - idx32 = index * numParams; - - switch ( input.semantic ) { - - case 'VERTEX': - - vs.push( index ); - - break; - - case 'NORMAL': - - ns.push( getConvertedVec3( source.data, idx32 ) ); - - break; - - case 'TEXCOORD': - - ts = ts || { }; - if ( ts[ input.set ] === undefined ) ts[ input.set ] = []; - // invert the V - ts[ input.set ].push( new THREE.Vector2( source.data[ idx32 ], source.data[ idx32 + 1 ] ) ); - - break; - - case 'COLOR': - - cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); - - break; - - default: - - break; - - } - - } - - } - - if ( ns.length == 0 ) { - - // check the vertices inputs - input = this.vertices.input.NORMAL; - - if ( input ) { - - source = sources[ input.source ]; - numParams = source.accessor.params.length; - - for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { - - ns.push( getConvertedVec3( source.data, vs[ ndx ] * numParams ) ); - - } - - } else { - - geom.calcNormals = true; - - } - - } - - if ( !ts ) { - - ts = { }; - // check the vertices inputs - input = this.vertices.input.TEXCOORD; - - if ( input ) { - - texture_sets.push( input.set ); - source = sources[ input.source ]; - numParams = source.accessor.params.length; - - for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { - - idx32 = vs[ ndx ] * numParams; - if ( ts[ input.set ] === undefined ) ts[ input.set ] = [ ]; - // invert the V - ts[ input.set ].push( new THREE.Vector2( source.data[ idx32 ], 1.0 - source.data[ idx32 + 1 ] ) ); - - } - - } - - } - - if ( cs.length == 0 ) { - - // check the vertices inputs - input = this.vertices.input.COLOR; - - if ( input ) { - - source = sources[ input.source ]; - numParams = source.accessor.params.length; - - for ( var ndx = 0, len = vs.length; ndx < len; ndx++ ) { - - idx32 = vs[ ndx ] * numParams; - cs.push( new THREE.Color().setRGB( source.data[ idx32 ], source.data[ idx32 + 1 ], source.data[ idx32 + 2 ] ) ); - - } - - } - - } - - var face = null, faces = [], uv, uvArr; - - if ( vcount === 3 ) { - - faces.push( new THREE.Face3( vs[0], vs[1], vs[2], ns, cs.length ? cs : new THREE.Color() ) ); - - } else if ( vcount === 4 ) { - - faces.push( new THREE.Face3( vs[0], vs[1], vs[3], [ns[0], ns[1], ns[3]], cs.length ? [cs[0], cs[1], cs[3]] : new THREE.Color() ) ); - - faces.push( new THREE.Face3( vs[1], vs[2], vs[3], [ns[1], ns[2], ns[3]], cs.length ? [cs[1], cs[2], cs[3]] : new THREE.Color() ) ); - - } else if ( vcount > 4 && options.subdivideFaces ) { - - var clr = cs.length ? cs : new THREE.Color(), - vec1, vec2, vec3, v1, v2, norm; - - // subdivide into multiple Face3s - - for ( k = 1; k < vcount - 1; ) { - - // FIXME: normals don't seem to be quite right - - faces.push( new THREE.Face3( vs[0], vs[k], vs[k+1], [ ns[0], ns[k++], ns[k] ], clr ) ); - - } - - } - - if ( faces.length ) { - - for ( var ndx = 0, len = faces.length; ndx < len; ndx ++ ) { - - face = faces[ndx]; - face.daeMaterial = primitive.material; - geom.faces.push( face ); - - for ( k = 0; k < texture_sets.length; k++ ) { - - uv = ts[ texture_sets[k] ]; - - if ( vcount > 4 ) { - - // Grab the right UVs for the vertices in this face - uvArr = [ uv[0], uv[ndx+1], uv[ndx+2] ]; - - } else if ( vcount === 4 ) { - - if ( ndx === 0 ) { - - uvArr = [ uv[0], uv[1], uv[3] ]; - - } else { - - uvArr = [ uv[1].clone(), uv[2], uv[3].clone() ]; - - } - - } else { - - uvArr = [ uv[0], uv[1], uv[2] ]; - - } - - if ( geom.faceVertexUvs[k] === undefined ) { - - geom.faceVertexUvs[k] = []; - - } - - geom.faceVertexUvs[k].push( uvArr ); - - } - - } - - } else { - - console.log( 'dropped face with vcount ' + vcount + ' for geometry with id: ' + geom.id ); - - } - - i += maxOffset * vcount; - - } - } - - }; - - function Polygons () { - - this.material = ""; - this.count = 0; - this.inputs = []; - this.vcount = null; - this.p = []; - this.geometry = new THREE.Geometry(); - - }; - - Polygons.prototype.setVertices = function ( vertices ) { - - for ( var i = 0; i < this.inputs.length; i ++ ) { - - if ( this.inputs[ i ].source == vertices.id ) { - - this.inputs[ i ].source = vertices.input[ 'POSITION' ].source; - - } - - } - - }; - - Polygons.prototype.parse = function ( element ) { - - this.material = element.getAttribute( 'material' ); - this.count = _attr_as_int( element, 'count', 0 ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'input': - - this.inputs.push( ( new Input() ).parse( element.childNodes[ i ] ) ); - break; - - case 'vcount': - - this.vcount = _ints( child.textContent ); - break; - - case 'p': - - this.p.push( _ints( child.textContent ) ); - break; - - case 'ph': - - console.warn( 'polygon holes not yet supported!' ); - break; - - default: - break; - - } - - } - - return this; - - }; - - function Polylist () { - - Polygons.call( this ); - - this.vcount = []; - - }; - - Polylist.prototype = Object.create( Polygons.prototype ); - - function Triangles () { - - Polygons.call( this ); - - this.vcount = 3; - - }; - - Triangles.prototype = Object.create( Polygons.prototype ); - - function Accessor() { - - this.source = ""; - this.count = 0; - this.stride = 0; - this.params = []; - - }; - - Accessor.prototype.parse = function ( element ) { - - this.params = []; - this.source = element.getAttribute( 'source' ); - this.count = _attr_as_int( element, 'count', 0 ); - this.stride = _attr_as_int( element, 'stride', 0 ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - if ( child.nodeName == 'param' ) { - - var param = {}; - param[ 'name' ] = child.getAttribute( 'name' ); - param[ 'type' ] = child.getAttribute( 'type' ); - this.params.push( param ); - - } - - } - - return this; - - }; - - function Vertices() { - - this.input = {}; - - }; - - Vertices.prototype.parse = function ( element ) { - - this.id = element.getAttribute('id'); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - if ( element.childNodes[i].nodeName == 'input' ) { - - var input = ( new Input() ).parse( element.childNodes[ i ] ); - this.input[ input.semantic ] = input; - - } - - } - - return this; - - }; - - function Input () { - - this.semantic = ""; - this.offset = 0; - this.source = ""; - this.set = 0; - - }; - - Input.prototype.parse = function ( element ) { - - this.semantic = element.getAttribute('semantic'); - this.source = element.getAttribute('source').replace(/^#/, ''); - this.set = _attr_as_int(element, 'set', -1); - this.offset = _attr_as_int(element, 'offset', 0); - - if ( this.semantic == 'TEXCOORD' && this.set < 0 ) { - - this.set = 0; - - } - - return this; - - }; - - function Source ( id ) { - - this.id = id; - this.type = null; - - }; - - Source.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - - switch ( child.nodeName ) { - - case 'bool_array': - - this.data = _bools( child.textContent ); - this.type = child.nodeName; - break; - - case 'float_array': - - this.data = _floats( child.textContent ); - this.type = child.nodeName; - break; - - case 'int_array': - - this.data = _ints( child.textContent ); - this.type = child.nodeName; - break; - - case 'IDREF_array': - case 'Name_array': - - this.data = _strings( child.textContent ); - this.type = child.nodeName; - break; - - case 'technique_common': - - for ( var j = 0; j < child.childNodes.length; j ++ ) { - - if ( child.childNodes[ j ].nodeName == 'accessor' ) { - - this.accessor = ( new Accessor() ).parse( child.childNodes[ j ] ); - break; - - } - } - break; - - default: - // console.log(child.nodeName); - break; - - } - - } - - return this; - - }; - - Source.prototype.read = function () { - - var result = []; - - //for (var i = 0; i < this.accessor.params.length; i++) { - - var param = this.accessor.params[ 0 ]; - - //console.log(param.name + " " + param.type); - - switch ( param.type ) { - - case 'IDREF': - case 'Name': case 'name': - case 'float': - - return this.data; - - case 'float4x4': - - for ( var j = 0; j < this.data.length; j += 16 ) { - - var s = this.data.slice( j, j + 16 ); - var m = getConvertedMat4( s ); - result.push( m ); - } - - break; - - default: - - console.log( 'ColladaLoader: Source: Read dont know how to read ' + param.type + '.' ); - break; - - } - - //} - - return result; - - }; - - function Material () { - - this.id = ""; - this.name = ""; - this.instance_effect = null; - - }; - - Material.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - if ( element.childNodes[ i ].nodeName == 'instance_effect' ) { - - this.instance_effect = ( new InstanceEffect() ).parse( element.childNodes[ i ] ); - break; - - } - - } - - return this; - - }; - - function ColorOrTexture () { - - this.color = new THREE.Color(); - this.color.setRGB( Math.random(), Math.random(), Math.random() ); - this.color.a = 1.0; - - this.texture = null; - this.texcoord = null; - this.texOpts = null; - - }; - - ColorOrTexture.prototype.isColor = function () { - - return ( this.texture == null ); - - }; - - ColorOrTexture.prototype.isTexture = function () { - - return ( this.texture != null ); - - }; - - ColorOrTexture.prototype.parse = function ( element ) { - - if (element.nodeName == 'transparent') { - - this.opaque = element.getAttribute('opaque'); - - } - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'color': - - var rgba = _floats( child.textContent ); - this.color = new THREE.Color(); - this.color.setRGB( rgba[0], rgba[1], rgba[2] ); - this.color.a = rgba[3]; - break; - - case 'texture': - - this.texture = child.getAttribute('texture'); - this.texcoord = child.getAttribute('texcoord'); - // Defaults from: - // https://collada.org/mediawiki/index.php/Maya_texture_placement_MAYA_extension - this.texOpts = { - offsetU: 0, - offsetV: 0, - repeatU: 1, - repeatV: 1, - wrapU: 1, - wrapV: 1 - }; - this.parseTexture( child ); - break; - - default: - break; - - } - - } - - return this; - - }; - - ColorOrTexture.prototype.parseTexture = function ( element ) { - - if ( ! element.childNodes ) return this; - - // This should be supported by Maya, 3dsMax, and MotionBuilder - - if ( element.childNodes[1] && element.childNodes[1].nodeName === 'extra' ) { - - element = element.childNodes[1]; - - if ( element.childNodes[1] && element.childNodes[1].nodeName === 'technique' ) { - - element = element.childNodes[1]; - - } - - } - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'offsetU': - case 'offsetV': - case 'repeatU': - case 'repeatV': - - this.texOpts[ child.nodeName ] = parseFloat( child.textContent ); - - break; - - case 'wrapU': - case 'wrapV': - - // some dae have a value of true which becomes NaN via parseInt - - if ( child.textContent.toUpperCase() === 'TRUE' ) { - - this.texOpts[ child.nodeName ] = 1; - - } else { - - this.texOpts[ child.nodeName ] = parseInt( child.textContent ); - - } - break; - - default: - - this.texOpts[ child.nodeName ] = child.textContent; - - break; - - } - - } - - return this; - - }; - - function Shader ( type, effect ) { - - this.type = type; - this.effect = effect; - this.material = null; - - }; - - Shader.prototype.parse = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'ambient': - case 'emission': - case 'diffuse': - case 'specular': - case 'transparent': - - this[ child.nodeName ] = ( new ColorOrTexture() ).parse( child ); - break; - - case 'bump': - - // If 'bumptype' is 'heightfield', create a 'bump' property - // Else if 'bumptype' is 'normalmap', create a 'normal' property - // (Default to 'bump') - var bumpType = child.getAttribute( 'bumptype' ); - if ( bumpType ) { - if ( bumpType.toLowerCase() === "heightfield" ) { - this[ 'bump' ] = ( new ColorOrTexture() ).parse( child ); - } else if ( bumpType.toLowerCase() === "normalmap" ) { - this[ 'normal' ] = ( new ColorOrTexture() ).parse( child ); - } else { - console.error( "Shader.prototype.parse: Invalid value for attribute 'bumptype' (" + bumpType + - ") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'" ); - this[ 'bump' ] = ( new ColorOrTexture() ).parse( child ); - } - } else { - console.warn( "Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'" ); - this[ 'bump' ] = ( new ColorOrTexture() ).parse( child ); - } - - break; - - case 'shininess': - case 'reflectivity': - case 'index_of_refraction': - case 'transparency': - - var f = child.querySelectorAll('float'); - - if ( f.length > 0 ) - this[ child.nodeName ] = parseFloat( f[ 0 ].textContent ); - - break; - - default: - break; - - } - - } - - this.create(); - return this; - - }; - - Shader.prototype.create = function() { - - var props = {}; - - var transparent = false; - - if (this['transparency'] !== undefined && this['transparent'] !== undefined) { - // convert transparent color RBG to average value - var transparentColor = this['transparent']; - var transparencyLevel = (this.transparent.color.r + this.transparent.color.g + this.transparent.color.b) / 3 * this.transparency; - - if (transparencyLevel > 0) { - transparent = true; - props[ 'transparent' ] = true; - props[ 'opacity' ] = 1 - transparencyLevel; - - } - - } - - var keys = { - 'diffuse':'map', - 'ambient':'lightMap' , - 'specular':'specularMap', - 'emission':'emissionMap', - 'bump':'bumpMap', - 'normal':'normalMap' - }; - - for ( var prop in this ) { - - switch ( prop ) { - - case 'ambient': - case 'emission': - case 'diffuse': - case 'specular': - case 'bump': - case 'normal': - - var cot = this[ prop ]; - - if ( cot instanceof ColorOrTexture ) { - - if ( cot.isTexture() ) { - - var samplerId = cot.texture; - var surfaceId = this.effect.sampler[samplerId]; - - if ( surfaceId !== undefined && surfaceId.source !== undefined ) { - - var surface = this.effect.surface[surfaceId.source]; - var image = images[surface.init_from]; - - if (image) { - - var url = baseUrl + image.init_from; - - var texture; - var loader = THREE.Loader.Handlers.get( url ); - - if ( loader !== null ) { - - texture = loader.load( url ); - - } else { - - texture = new THREE.Texture(); - loader = new THREE.ImageLoader(); - loader.load( url, function ( image ) { - - texture.image = image; - texture.needsUpdate = true; - - } ); - - } - - texture.wrapS = cot.texOpts.wrapU ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; - texture.wrapT = cot.texOpts.wrapV ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; - texture.offset.x = cot.texOpts.offsetU; - texture.offset.y = cot.texOpts.offsetV; - texture.repeat.x = cot.texOpts.repeatU; - texture.repeat.y = cot.texOpts.repeatV; - props[keys[prop]] = texture; - - // Texture with baked lighting? - if (prop === 'emission') props['emissive'] = 0xffffff; - - } - - } - - } else if ( prop === 'diffuse' || !transparent ) { - - if ( prop === 'emission' ) { - - props[ 'emissive' ] = cot.color.getHex(); - - } else { - - props[ prop ] = cot.color.getHex(); - - } - - } - - } - - break; - - case 'shininess': - - props[ prop ] = this[ prop ]; - break; - - case 'reflectivity': - - props[ prop ] = this[ prop ]; - if( props[ prop ] > 0.0 ) props['envMap'] = options.defaultEnvMap; - props['combine'] = THREE.MixOperation; //mix regular shading with reflective component - break; - - case 'index_of_refraction': - - props[ 'refractionRatio' ] = this[ prop ]; //TODO: "index_of_refraction" becomes "refractionRatio" in shader, but I'm not sure if the two are actually comparable - if ( this[ prop ] !== 1.0 ) props['envMap'] = options.defaultEnvMap; - break; - - case 'transparency': - // gets figured out up top - break; - - default: - break; - - } - - } - - props[ 'shading' ] = preferredShading; - props[ 'side' ] = this.effect.doubleSided ? THREE.DoubleSide : THREE.FrontSide; - - switch ( this.type ) { - - case 'constant': - - if (props.emissive != undefined) props.color = props.emissive; - this.material = new THREE.MeshBasicMaterial( props ); - break; - - case 'phong': - case 'blinn': - - if (props.diffuse != undefined) props.color = props.diffuse; - this.material = new THREE.MeshPhongMaterial( props ); - break; - - case 'lambert': - default: - - if (props.diffuse != undefined) props.color = props.diffuse; - this.material = new THREE.MeshLambertMaterial( props ); - break; - - } - - return this.material; - - }; - - function Surface ( effect ) { - - this.effect = effect; - this.init_from = null; - this.format = null; - - }; - - Surface.prototype.parse = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'init_from': - - this.init_from = child.textContent; - break; - - case 'format': - - this.format = child.textContent; - break; - - default: - - console.log( "unhandled Surface prop: " + child.nodeName ); - break; - - } - - } - - return this; - - }; - - function Sampler2D ( effect ) { - - this.effect = effect; - this.source = null; - this.wrap_s = null; - this.wrap_t = null; - this.minfilter = null; - this.magfilter = null; - this.mipfilter = null; - - }; - - Sampler2D.prototype.parse = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'source': - - this.source = child.textContent; - break; - - case 'minfilter': - - this.minfilter = child.textContent; - break; - - case 'magfilter': - - this.magfilter = child.textContent; - break; - - case 'mipfilter': - - this.mipfilter = child.textContent; - break; - - case 'wrap_s': - - this.wrap_s = child.textContent; - break; - - case 'wrap_t': - - this.wrap_t = child.textContent; - break; - - default: - - console.log( "unhandled Sampler2D prop: " + child.nodeName ); - break; - - } - - } - - return this; - - }; - - function Effect () { - - this.id = ""; - this.name = ""; - this.shader = null; - this.surface = {}; - this.sampler = {}; - - }; - - Effect.prototype.create = function () { - - if ( this.shader == null ) { - - return null; - - } - - }; - - Effect.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - - extractDoubleSided( this, element ); - - this.shader = null; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'profile_COMMON': - - this.parseTechnique( this.parseProfileCOMMON( child ) ); - break; - - default: - break; - - } - - } - - return this; - - }; - - Effect.prototype.parseNewparam = function ( element ) { - - var sid = element.getAttribute( 'sid' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'surface': - - this.surface[sid] = ( new Surface( this ) ).parse( child ); - break; - - case 'sampler2D': - - this.sampler[sid] = ( new Sampler2D( this ) ).parse( child ); - break; - - case 'extra': - - break; - - default: - - console.log( child.nodeName ); - break; - - } - - } - - }; - - Effect.prototype.parseProfileCOMMON = function ( element ) { - - var technique; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'profile_COMMON': - - this.parseProfileCOMMON( child ); - break; - - case 'technique': - - technique = child; - break; - - case 'newparam': - - this.parseNewparam( child ); - break; - - case 'image': - - var _image = ( new _Image() ).parse( child ); - images[ _image.id ] = _image; - break; - - case 'extra': - break; - - default: - - console.log( child.nodeName ); - break; - - } - - } - - return technique; - - }; - - Effect.prototype.parseTechnique= function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'constant': - case 'lambert': - case 'blinn': - case 'phong': - - this.shader = ( new Shader( child.nodeName, this ) ).parse( child ); - break; - case 'extra': - this.parseExtra(child); - break; - default: - break; - - } - - } - - }; - - Effect.prototype.parseExtra = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique': - this.parseExtraTechnique( child ); - break; - default: - break; - - } - - } - - }; - - Effect.prototype.parseExtraTechnique= function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[i]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'bump': - this.shader.parse( element ); - break; - default: - break; - - } - - } - - }; - - function InstanceEffect () { - - this.url = ""; - - }; - - InstanceEffect.prototype.parse = function ( element ) { - - this.url = element.getAttribute( 'url' ).replace( /^#/, '' ); - return this; - - }; - - function Animation() { - - this.id = ""; - this.name = ""; - this.source = {}; - this.sampler = []; - this.channel = []; - - }; - - Animation.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - this.source = {}; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'animation': - - var anim = ( new Animation() ).parse( child ); - - for ( var src in anim.source ) { - - this.source[ src ] = anim.source[ src ]; - - } - - for ( var j = 0; j < anim.channel.length; j ++ ) { - - this.channel.push( anim.channel[ j ] ); - this.sampler.push( anim.sampler[ j ] ); - - } - - break; - - case 'source': - - var src = ( new Source() ).parse( child ); - this.source[ src.id ] = src; - break; - - case 'sampler': - - this.sampler.push( ( new Sampler( this ) ).parse( child ) ); - break; - - case 'channel': - - this.channel.push( ( new Channel( this ) ).parse( child ) ); - break; - - default: - break; - - } - - } - - return this; - - }; - - function Channel( animation ) { - - this.animation = animation; - this.source = ""; - this.target = ""; - this.fullSid = null; - this.sid = null; - this.dotSyntax = null; - this.arrSyntax = null; - this.arrIndices = null; - this.member = null; - - }; - - Channel.prototype.parse = function ( element ) { - - this.source = element.getAttribute( 'source' ).replace( /^#/, '' ); - this.target = element.getAttribute( 'target' ); - - var parts = this.target.split( '/' ); - - var id = parts.shift(); - var sid = parts.shift(); - - var dotSyntax = ( sid.indexOf(".") >= 0 ); - var arrSyntax = ( sid.indexOf("(") >= 0 ); - - if ( dotSyntax ) { - - parts = sid.split("."); - this.sid = parts.shift(); - this.member = parts.shift(); - - } else if ( arrSyntax ) { - - var arrIndices = sid.split("("); - this.sid = arrIndices.shift(); - - for (var j = 0; j < arrIndices.length; j ++ ) { - - arrIndices[j] = parseInt( arrIndices[j].replace(/\)/, '') ); - - } - - this.arrIndices = arrIndices; - - } else { - - this.sid = sid; - - } - - this.fullSid = sid; - this.dotSyntax = dotSyntax; - this.arrSyntax = arrSyntax; - - return this; - - }; - - function Sampler ( animation ) { - - this.id = ""; - this.animation = animation; - this.inputs = []; - this.input = null; - this.output = null; - this.strideOut = null; - this.interpolation = null; - this.startTime = null; - this.endTime = null; - this.duration = 0; - - }; - - Sampler.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.inputs = []; - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - - this.inputs.push( (new Input()).parse( child ) ); - break; - - default: - break; - - } - - } - - return this; - - }; - - Sampler.prototype.create = function () { - - for ( var i = 0; i < this.inputs.length; i ++ ) { - - var input = this.inputs[ i ]; - var source = this.animation.source[ input.source ]; - - switch ( input.semantic ) { - - case 'INPUT': - - this.input = source.read(); - break; - - case 'OUTPUT': - - this.output = source.read(); - this.strideOut = source.accessor.stride; - break; - - case 'INTERPOLATION': - - this.interpolation = source.read(); - break; - - case 'IN_TANGENT': - - break; - - case 'OUT_TANGENT': - - break; - - default: - - console.log(input.semantic); - break; - - } - - } - - this.startTime = 0; - this.endTime = 0; - this.duration = 0; - - if ( this.input.length ) { - - this.startTime = 100000000; - this.endTime = -100000000; - - for ( var i = 0; i < this.input.length; i ++ ) { - - this.startTime = Math.min( this.startTime, this.input[ i ] ); - this.endTime = Math.max( this.endTime, this.input[ i ] ); - - } - - this.duration = this.endTime - this.startTime; - - } - - }; - - Sampler.prototype.getData = function ( type, ndx, member ) { - - var data; - - if ( type === 'matrix' && this.strideOut === 16 ) { - - data = this.output[ ndx ]; - - } else if ( this.strideOut > 1 ) { - - data = []; - ndx *= this.strideOut; - - for ( var i = 0; i < this.strideOut; ++i ) { - - data[ i ] = this.output[ ndx + i ]; - - } - - if ( this.strideOut === 3 ) { - - switch ( type ) { - - case 'rotate': - case 'translate': - - fixCoords( data, -1 ); - break; - - case 'scale': - - fixCoords( data, 1 ); - break; - - } - - } else if ( this.strideOut === 4 && type === 'matrix' ) { - - fixCoords( data, -1 ); - - } - - } else { - - data = this.output[ ndx ]; - - if ( member && type == 'translate' ) { - data = getConvertedTranslation( member, data ); - } - - } - - return data; - - }; - - function Key ( time ) { - - this.targets = []; - this.time = time; - - }; - - Key.prototype.addTarget = function ( fullSid, transform, member, data ) { - - this.targets.push( { - sid: fullSid, - member: member, - transform: transform, - data: data - } ); - - }; - - Key.prototype.apply = function ( opt_sid ) { - - for ( var i = 0; i < this.targets.length; ++i ) { - - var target = this.targets[ i ]; - - if ( !opt_sid || target.sid === opt_sid ) { - - target.transform.update( target.data, target.member ); - - } - - } - - }; - - Key.prototype.getTarget = function ( fullSid ) { - - for ( var i = 0; i < this.targets.length; ++i ) { - - if ( this.targets[ i ].sid === fullSid ) { - - return this.targets[ i ]; - - } - - } - - return null; - - }; - - Key.prototype.hasTarget = function ( fullSid ) { - - for ( var i = 0; i < this.targets.length; ++i ) { - - if ( this.targets[ i ].sid === fullSid ) { - - return true; - - } - - } - - return false; - - }; - - // TODO: Currently only doing linear interpolation. Should support full COLLADA spec. - Key.prototype.interpolate = function ( nextKey, time ) { - - for ( var i = 0, l = this.targets.length; i < l; i ++ ) { - - var target = this.targets[ i ], - nextTarget = nextKey.getTarget( target.sid ), - data; - - if ( target.transform.type !== 'matrix' && nextTarget ) { - - var scale = ( time - this.time ) / ( nextKey.time - this.time ), - nextData = nextTarget.data, - prevData = target.data; - - if ( scale < 0 ) scale = 0; - if ( scale > 1 ) scale = 1; - - if ( prevData.length ) { - - data = []; - - for ( var j = 0; j < prevData.length; ++j ) { - - data[ j ] = prevData[ j ] + ( nextData[ j ] - prevData[ j ] ) * scale; - - } - - } else { - - data = prevData + ( nextData - prevData ) * scale; - - } - - } else { - - data = target.data; - - } - - target.transform.update( data, target.member ); - - } - - }; - - // Camera - function Camera() { - - this.id = ""; - this.name = ""; - this.technique = ""; - - }; - - Camera.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'optics': - - this.parseOptics( child ); - break; - - default: - break; - - } - - } - - return this; - - }; - - Camera.prototype.parseOptics = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - if ( element.childNodes[ i ].nodeName == 'technique_common' ) { - - var technique = element.childNodes[ i ]; - - for ( var j = 0; j < technique.childNodes.length; j ++ ) { - - this.technique = technique.childNodes[ j ].nodeName; - - if ( this.technique == 'perspective' ) { - - var perspective = technique.childNodes[ j ]; - - for ( var k = 0; k < perspective.childNodes.length; k ++ ) { - - var param = perspective.childNodes[ k ]; - - switch ( param.nodeName ) { - - case 'yfov': - this.yfov = param.textContent; - break; - case 'xfov': - this.xfov = param.textContent; - break; - case 'znear': - this.znear = param.textContent; - break; - case 'zfar': - this.zfar = param.textContent; - break; - case 'aspect_ratio': - this.aspect_ratio = param.textContent; - break; - - } - - } - - } else if ( this.technique == 'orthographic' ) { - - var orthographic = technique.childNodes[ j ]; - - for ( var k = 0; k < orthographic.childNodes.length; k ++ ) { - - var param = orthographic.childNodes[ k ]; - - switch ( param.nodeName ) { - - case 'xmag': - this.xmag = param.textContent; - break; - case 'ymag': - this.ymag = param.textContent; - break; - case 'znear': - this.znear = param.textContent; - break; - case 'zfar': - this.zfar = param.textContent; - break; - case 'aspect_ratio': - this.aspect_ratio = param.textContent; - break; - - } - - } - - } - - } - - } - - } - - return this; - - }; - - function InstanceCamera() { - - this.url = ""; - - }; - - InstanceCamera.prototype.parse = function ( element ) { - - this.url = element.getAttribute('url').replace(/^#/, ''); - - return this; - - }; - - // Light - - function Light() { - - this.id = ""; - this.name = ""; - this.technique = ""; - - }; - - Light.prototype.parse = function ( element ) { - - this.id = element.getAttribute( 'id' ); - this.name = element.getAttribute( 'name' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - if ( child.nodeType != 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique_common': - - this.parseCommon( child ); - break; - - case 'technique': - - this.parseTechnique( child ); - break; - - default: - break; - - } - - } - - return this; - - }; - - Light.prototype.parseCommon = function ( element ) { - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - switch ( element.childNodes[ i ].nodeName ) { - - case 'directional': - case 'point': - case 'spot': - case 'ambient': - - this.technique = element.childNodes[ i ].nodeName; - - var light = element.childNodes[ i ]; - - for ( var j = 0; j < light.childNodes.length; j ++ ) { - - var child = light.childNodes[j]; - - switch ( child.nodeName ) { - - case 'color': - - var rgba = _floats( child.textContent ); - this.color = new THREE.Color(0); - this.color.setRGB( rgba[0], rgba[1], rgba[2] ); - this.color.a = rgba[3]; - break; - - case 'falloff_angle': - - this.falloff_angle = parseFloat( child.textContent ); - break; - - case 'quadratic_attenuation': - var f = parseFloat( child.textContent ); - this.distance = f ? Math.sqrt( 1/f ) : 0; - } - - } - - } - - } - - return this; - - }; - - Light.prototype.parseTechnique = function ( element ) { - - this.profile = element.getAttribute( 'profile' ); - - for ( var i = 0; i < element.childNodes.length; i ++ ) { - - var child = element.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'intensity': - - this.intensity = parseFloat(child.textContent); - break; - - } - - } - - return this; - - }; - - function InstanceLight() { - - this.url = ""; - - }; - - InstanceLight.prototype.parse = function ( element ) { - - this.url = element.getAttribute('url').replace(/^#/, ''); - - return this; - - }; - - function _source( element ) { - - var id = element.getAttribute( 'id' ); - - if ( sources[ id ] != undefined ) { - - return sources[ id ]; - - } - - sources[ id ] = ( new Source(id )).parse( element ); - return sources[ id ]; - - }; - - function _nsResolver( nsPrefix ) { - - if ( nsPrefix == "dae" ) { - - return "http://www.collada.org/2005/11/COLLADASchema"; - - } - - return null; - - }; - - function _bools( str ) { - - var raw = _strings( str ); - var data = []; - - for ( var i = 0, l = raw.length; i < l; i ++ ) { - - data.push( (raw[i] == 'true' || raw[i] == '1') ? true : false ); - - } - - return data; - - }; - - function _floats( str ) { - - var raw = _strings(str); - var data = []; - - for ( var i = 0, l = raw.length; i < l; i ++ ) { - - data.push( parseFloat( raw[ i ] ) ); - - } - - return data; - - }; - - function _ints( str ) { - - var raw = _strings( str ); - var data = []; - - for ( var i = 0, l = raw.length; i < l; i ++ ) { - - data.push( parseInt( raw[ i ], 10 ) ); - - } - - return data; - - }; - - function _strings( str ) { - - return ( str.length > 0 ) ? _trimString( str ).split( /\s+/ ) : []; - - }; - - function _trimString( str ) { - - return str.replace( /^\s+/, "" ).replace( /\s+$/, "" ); - - }; - - function _attr_as_float( element, name, defaultValue ) { - - if ( element.hasAttribute( name ) ) { - - return parseFloat( element.getAttribute( name ) ); - - } else { - - return defaultValue; - - } - - }; - - function _attr_as_int( element, name, defaultValue ) { - - if ( element.hasAttribute( name ) ) { - - return parseInt( element.getAttribute( name ), 10) ; - - } else { - - return defaultValue; - - } - - }; - - function _attr_as_string( element, name, defaultValue ) { - - if ( element.hasAttribute( name ) ) { - - return element.getAttribute( name ); - - } else { - - return defaultValue; - - } - - }; - - function _format_float( f, num ) { - - if ( f === undefined ) { - - var s = '0.'; - - while ( s.length < num + 2 ) { - - s += '0'; - - } - - return s; - - } - - num = num || 2; - - var parts = f.toString().split( '.' ); - parts[ 1 ] = parts.length > 1 ? parts[ 1 ].substr( 0, num ) : "0"; - - while( parts[ 1 ].length < num ) { - - parts[ 1 ] += '0'; - - } - - return parts.join( '.' ); - - }; - - function extractDoubleSided( obj, element ) { - - obj.doubleSided = false; - - var node = element.querySelectorAll('extra double_sided')[0]; - - if ( node ) { - - if ( node && parseInt( node.textContent, 10 ) === 1 ) { - - obj.doubleSided = true; - - } - - } - - }; - - // Up axis conversion - - function setUpConversion() { - - if ( options.convertUpAxis !== true || colladaUp === options.upAxis ) { - - upConversion = null; - - } else { - - switch ( colladaUp ) { - - case 'X': - - upConversion = options.upAxis === 'Y' ? 'XtoY' : 'XtoZ'; - break; - - case 'Y': - - upConversion = options.upAxis === 'X' ? 'YtoX' : 'YtoZ'; - break; - - case 'Z': - - upConversion = options.upAxis === 'X' ? 'ZtoX' : 'ZtoY'; - break; - - } - - } - - }; - - function fixCoords( data, sign ) { - - if ( options.convertUpAxis !== true || colladaUp === options.upAxis ) { - - return; - - } - - switch ( upConversion ) { - - case 'XtoY': - - var tmp = data[ 0 ]; - data[ 0 ] = sign * data[ 1 ]; - data[ 1 ] = tmp; - break; - - case 'XtoZ': - - var tmp = data[ 2 ]; - data[ 2 ] = data[ 1 ]; - data[ 1 ] = data[ 0 ]; - data[ 0 ] = tmp; - break; - - case 'YtoX': - - var tmp = data[ 0 ]; - data[ 0 ] = data[ 1 ]; - data[ 1 ] = sign * tmp; - break; - - case 'YtoZ': - - var tmp = data[ 1 ]; - data[ 1 ] = sign * data[ 2 ]; - data[ 2 ] = tmp; - break; - - case 'ZtoX': - - var tmp = data[ 0 ]; - data[ 0 ] = data[ 1 ]; - data[ 1 ] = data[ 2 ]; - data[ 2 ] = tmp; - break; - - case 'ZtoY': - - var tmp = data[ 1 ]; - data[ 1 ] = data[ 2 ]; - data[ 2 ] = sign * tmp; - break; - - } - - }; - - function getConvertedTranslation( axis, data ) { - - if ( options.convertUpAxis !== true || colladaUp === options.upAxis ) { - - return data; - - } - - switch ( axis ) { - case 'X': - data = upConversion == 'XtoY' ? data * -1 : data; - break; - case 'Y': - data = upConversion == 'YtoZ' || upConversion == 'YtoX' ? data * -1 : data; - break; - case 'Z': - data = upConversion == 'ZtoY' ? data * -1 : data ; - break; - default: - break; - } - - return data; - }; - - function getConvertedVec3( data, offset ) { - - var arr = [ data[ offset ], data[ offset + 1 ], data[ offset + 2 ] ]; - fixCoords( arr, -1 ); - return new THREE.Vector3( arr[ 0 ], arr[ 1 ], arr[ 2 ] ); - - }; - - function getConvertedMat4( data ) { - - if ( options.convertUpAxis ) { - - // First fix rotation and scale - - // Columns first - var arr = [ data[ 0 ], data[ 4 ], data[ 8 ] ]; - fixCoords( arr, -1 ); - data[ 0 ] = arr[ 0 ]; - data[ 4 ] = arr[ 1 ]; - data[ 8 ] = arr[ 2 ]; - arr = [ data[ 1 ], data[ 5 ], data[ 9 ] ]; - fixCoords( arr, -1 ); - data[ 1 ] = arr[ 0 ]; - data[ 5 ] = arr[ 1 ]; - data[ 9 ] = arr[ 2 ]; - arr = [ data[ 2 ], data[ 6 ], data[ 10 ] ]; - fixCoords( arr, -1 ); - data[ 2 ] = arr[ 0 ]; - data[ 6 ] = arr[ 1 ]; - data[ 10 ] = arr[ 2 ]; - // Rows second - arr = [ data[ 0 ], data[ 1 ], data[ 2 ] ]; - fixCoords( arr, -1 ); - data[ 0 ] = arr[ 0 ]; - data[ 1 ] = arr[ 1 ]; - data[ 2 ] = arr[ 2 ]; - arr = [ data[ 4 ], data[ 5 ], data[ 6 ] ]; - fixCoords( arr, -1 ); - data[ 4 ] = arr[ 0 ]; - data[ 5 ] = arr[ 1 ]; - data[ 6 ] = arr[ 2 ]; - arr = [ data[ 8 ], data[ 9 ], data[ 10 ] ]; - fixCoords( arr, -1 ); - data[ 8 ] = arr[ 0 ]; - data[ 9 ] = arr[ 1 ]; - data[ 10 ] = arr[ 2 ]; - - // Now fix translation - arr = [ data[ 3 ], data[ 7 ], data[ 11 ] ]; - fixCoords( arr, -1 ); - data[ 3 ] = arr[ 0 ]; - data[ 7 ] = arr[ 1 ]; - data[ 11 ] = arr[ 2 ]; - - } - - return new THREE.Matrix4( - data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], - data[8], data[9], data[10], data[11], - data[12], data[13], data[14], data[15] - ); - - }; - - function getConvertedIndex( index ) { - - if ( index > -1 && index < 3 ) { - - var members = ['X', 'Y', 'Z'], - indices = { X: 0, Y: 1, Z: 2 }; - - index = getConvertedMember( members[ index ] ); - index = indices[ index ]; - - } - - return index; - - }; - - function getConvertedMember( member ) { - - if ( options.convertUpAxis ) { - - switch ( member ) { - - case 'X': - - switch ( upConversion ) { - - case 'XtoY': - case 'XtoZ': - case 'YtoX': - - member = 'Y'; - break; - - case 'ZtoX': - - member = 'Z'; - break; - - } - - break; - - case 'Y': - - switch ( upConversion ) { - - case 'XtoY': - case 'YtoX': - case 'ZtoX': - - member = 'X'; - break; - - case 'XtoZ': - case 'YtoZ': - case 'ZtoY': - - member = 'Z'; - break; - - } - - break; - - case 'Z': - - switch ( upConversion ) { - - case 'XtoZ': - - member = 'X'; - break; - - case 'YtoZ': - case 'ZtoX': - case 'ZtoY': - - member = 'Y'; - break; - - } - - break; - - } - - } - - return member; - - }; - - return { - - load: load, - parse: parse, - setPreferredShading: setPreferredShading, - applySkin: applySkin, - geometries : geometries, - options: options - - }; - -}; diff --git a/public/legacy/js/captify.tiny.js b/public/legacy/js/captify.tiny.js deleted file mode 100644 index 063e6ddb..00000000 --- a/public/legacy/js/captify.tiny.js +++ /dev/null @@ -1,5 +0,0 @@ -jQuery.fn.extend({captify:function(n){var a=$.extend({speedOver:"fast",speedOut:"normal",hideDelay:500,animation:"slide",prefix:"",opacity:"0.45",className:"caption-bottom",position:"bottom",spanWidth:"100%"},n);$(this).each(function(){var c=this;$(this).load(function(){if(c.hasInit)return false;c.hasInit=true;var i=false,k=false,e=$("#"+$(this).attr("rel")),g=!e.length?$(this).attr("alt"):e.html();e.remove();e=this.parent&&this.parent.tagName=="a"?this.parent:$(this);var h=e.wrap("
").parent().css({overflow:"hidden", -padding:0,fontSize:0.1}).addClass("caption-wrapper").width($(this).width()).height($(this).height());$.map(["top","right","bottom","left"],function(f){h.css("margin-"+f,$(c).css("margin-"+f));$.map(["style","width","color"],function(j){j="border-"+f+"-"+j;h.css(j,$(c).css(j))})});$(c).css({border:"0 none"});var b=$("div:last",h.append("")).addClass(a.className),d=$("div:last",h.append("")).addClass(a.className).append(a.prefix).append(g);$("*",h).css({margin:0}).show();g=jQuery.browser.msie? -"static":"relative";b.css({zIndex:1,position:g,opacity:a.animation=="fade"?0:a.opacity,width:a.spanWidth});if(a.position=="bottom"){e=parseInt(b.css("border-top-width").replace("px",""))+parseInt(d.css("padding-top").replace("px",""))-1;d.css("paddingTop",e)}d.css({position:g,zIndex:2,background:"none",border:"0 none",opacity:a.animation=="fade"?0:1,width:a.spanWidth});b.width(d.outerWidth());b.height(d.height());g=a.position=="bottom"&&jQuery.browser.msie?-4:0;var l=a.position=="top"?{hide:-$(c).height()- -b.outerHeight()-1,show:-$(c).height()}:{hide:0,show:-b.outerHeight()+g};d.css("marginTop",-b.outerHeight());b.css("marginTop",l[a.animation=="fade"||a.animation=="always-on"?"show":"hide"]);var m=function(){if(!i&&!k){var f=a.animation=="fade"?{opacity:0}:{marginTop:l.hide};b.animate(f,a.speedOut);a.animation=="fade"&&d.animate({opacity:0},a.speedOver)}};if(a.animation!="always-on"){$(this).hover(function(){k=true;if(!i){var f=a.animation=="fade"?{opacity:a.opacity}:{marginTop:l.show};b.animate(f, -a.speedOver);a.animation=="fade"&&d.animate({opacity:1},a.speedOver/2)}},function(){k=false;window.setTimeout(m,a.hideDelay)});$("div",h).hover(function(){i=true},function(){i=false;window.setTimeout(m,a.hideDelay)})}});if(this.complete||this.naturalWidth>0)$(c).trigger("load")})}}); \ No newline at end of file diff --git a/public/legacy/js/chat.js b/public/legacy/js/chat.js deleted file mode 100644 index 8438806a..00000000 --- a/public/legacy/js/chat.js +++ /dev/null @@ -1,414 +0,0 @@ -/* - -Copyright (c) 2009 Anant Garg (anantgarg.com | inscripts.com) - -This script may be used for non-commercial purposes only. For any -commercial purposes, please contact the author at -anant.garg@inscripts.com - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -*/ - -var windowFocus = true; -var username; -var chatHeartbeatCount = 0; -var minChatHeartbeat = 2000; -var maxChatHeartbeat = 33000; -var chatHeartbeatTime = minChatHeartbeat; -var originalTitle; -var blinkOrder = 0; - -var chatboxFocus = new Array(); -var newMessages = new Array(); -var newMessagesWin = new Array(); -var chatBoxes = new Array(); - -$(document).ready(function(){ - originalTitle = document.title; - startChatSession(); - - $([window, document]).blur(function(){ - windowFocus = false; - }).focus(function(){ - windowFocus = true; - document.title = originalTitle; - }); -}); - -function restructureChatBoxes() { - align = 0; - for (x in chatBoxes) { - chatboxtitle = chatBoxes[x]; - - if ($("#chatbox_"+chatboxtitle).css('display') != 'none') { - if (align == 0) { - $("#chatbox_"+chatboxtitle).css('right', '20px'); - } else { - width = (align)*(225+7)+20; - $("#chatbox_"+chatboxtitle).css('right', width+'px'); - } - align++; - } - } -} - -function chatWith(chatuser) { - createChatBox(chatuser); - $("#chatbox_"+chatuser+" .chatboxtextarea").focus(); -} - -function createChatBox(chatboxtitle,minimizeChatBox) { - if ($("#chatbox_"+chatboxtitle).length > 0) { - if ($("#chatbox_"+chatboxtitle).css('display') == 'none') { - $("#chatbox_"+chatboxtitle).css('display','block'); - restructureChatBoxes(); - } - $("#chatbox_"+chatboxtitle+" .chatboxtextarea").focus(); - return; - } - - $(" " ).attr("id","chatbox_"+chatboxtitle) - .addClass("chatbox") - .html('/gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- var obj = this;
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.obj = this;
- textField.type = "text";
- textField.name = this.options.paramName;
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- textField.className = 'editor_field';
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- if (this.options.submitOnBlur)
- textField.onblur = this.onSubmit.bind(this);
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.obj = this;
- textArea.name = this.options.paramName;
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- textArea.className = 'editor_field';
- if (this.options.submitOnBlur)
- textArea.onblur = this.onSubmit.bind(this);
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- Field.scrollFreeActivate(this.editField);
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- if (this.options.evalScripts) {
- new Ajax.Request(
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this),
- asynchronous:true,
- evalScripts:true
- }, this.options.ajaxOptions));
- } else {
- new Ajax.Updater(
- { success: this.element,
- // don't update on failure (this could be an option)
- failure: null },
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions));
- }
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-Ajax.InPlaceCollectionEditor = Class.create();
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
- createEditField: function() {
- if (!this.cached_selectTag) {
- var selectTag = document.createElement("select");
- var collection = this.options.collection || [];
- var optionTag;
- collection.each(function(e,i) {
- optionTag = document.createElement("option");
- optionTag.value = (e instanceof Array) ? e[0] : e;
- if((typeof this.options.value == 'undefined') &&
- ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true;
- if(this.options.value==optionTag.value) optionTag.selected = true;
- optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
- selectTag.appendChild(optionTag);
- }.bind(this));
- this.cached_selectTag = selectTag;
- }
-
- this.editField = this.cached_selectTag;
- if(this.options.loadTextURL) this.loadExternalText();
- this.form.appendChild(this.editField);
- this.options.callback = function(form, value) {
- return "value=" + encodeURIComponent(value);
- }
- }
-});
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
diff --git a/public/legacy/js/lib/.svn/text-base/dragdrop.js.svn-base b/public/legacy/js/lib/.svn/text-base/dragdrop.js.svn-base
deleted file mode 100644
index 32c91bc3..00000000
--- a/public/legacy/js/lib/.svn/text-base/dragdrop.js.svn-base
+++ /dev/null
@@ -1,944 +0,0 @@
-// script.aculo.us dragdrop.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(typeof Effect == 'undefined')
- throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var affected = [];
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0) {
- drop = Droppables.findDeepestChild(affected);
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- if(draggable.options.delay) {
- this._timeout = setTimeout(function() {
- Draggables._timeout = null;
- window.focus();
- Draggables.activeDraggable = draggable;
- }.bind(this), draggable.options.delay);
- } else {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- }
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
-
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(this._timeout) {
- clearTimeout(this._timeout);
- this._timeout = null;
- }
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable._dragging = {};
-
-Draggable.prototype = {
- initialize: function(element) {
- var defaults = {
- handle: false,
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
- queue: {scope:'_draggable', position:'end'}
- });
- },
- endeffect: function(element) {
- var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0;
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
- queue: {scope:'_draggable', position:'end'},
- afterFinish: function(){
- Draggable._dragging[element] = false
- }
- });
- },
- zindex: 1000,
- revert: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
- delay: 0
- };
-
- if(!arguments[1] || typeof arguments[1].endeffect == 'undefined')
- Object.extend(defaults, {
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- Draggable._dragging[element] = true;
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- }
- });
-
- var options = Object.extend(defaults, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string'))
- this.handle = this.element.down('.'+options.handle, 0);
-
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
- options.scroll = $(options.scroll);
- this._isScrollChild = Element.childOf(this.element, options.scroll);
- }
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(typeof Draggable._dragging[this.element] != 'undefined' &&
- Draggable._dragging[this.element]) return;
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if((tag_name = src.tagName.toUpperCase()) && (
- tag_name=='INPUT' ||
- tag_name=='SELECT' ||
- tag_name=='OPTION' ||
- tag_name=='BUTTON' ||
- tag_name=='TEXTAREA')) return;
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
-
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
-
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft + Position.deltaX;
- p[1] += this.options.scroll.scrollTop + Position.deltaY;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- if(this.options.ghosting) {
- var r = Position.realOffset(this.element);
- pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
- }
-
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
-
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- if(!(speed[0] || speed[1])) return;
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- if (this._isScrollChild) {
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
- }
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
- sortables: {},
-
- _findRootElement: function(element) {
- while (element.tagName.toUpperCase() != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- var s = Sortable.options(element);
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- delay: 0,
- hoverclass: null,
- ghosting: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: this.SERIALIZE_RULE,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- delay: options.delay,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- }
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- $(e).down('.'+options.handle,0) : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Sortable._marker.hide();
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker =
- ($('dropmarker') || Element.extend(document.createElement('DIV'))).
- hide().addClassName('dropmarker').setStyle({position:'absolute'});
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
- else
- Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
- Sortable._marker.show();
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: [],
- position: parent.children.length,
- container: $(children[i]).down(options.treeTag)
- }
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child)
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || {});
-
- var root = {
- id: null,
- parent: null,
- children: [],
- container: element,
- position: 0
- }
-
- return Sortable._tree(element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || {});
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || {});
-
- var nodeMap = {};
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || {});
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "[id]=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-}
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
- if (child.parentNode == element) return true;
- return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
- return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}
diff --git a/public/legacy/js/lib/.svn/text-base/effects.js.svn-base b/public/legacy/js/lib/.svn/text-base/effects.js.svn-base
deleted file mode 100644
index 06f59b47..00000000
--- a/public/legacy/js/lib/.svn/text-base/effects.js.svn-base
+++ /dev/null
@@ -1,1090 +0,0 @@
-// script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-}
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-}
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- element.setStyle({fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- return element;
-}
-
-Element.getOpacity = function(element){
- return $(element).getStyle('opacity');
-}
-
-Element.setOpacity = function(element, value){
- return $(element).setStyle({opacity:value});
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- _elementDoesNotExistError: {
- name: 'ElementDoesNotExistError',
- message: 'The specified DOM element does not exist, but is required for this effect to operate'
- },
- tagifyText: function(element) {
- if(typeof Builder == 'undefined')
- throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
-
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
-
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || {});
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {
- linear: Prototype.K,
- sinoidal: function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
- },
- reverse: function(pos) {
- return 1-pos;
- },
- flicker: function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
- },
- wobble: function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
- },
- pulse: function(pos, pulses) {
- pulses = pulses || 5;
- return (
- Math.round((pos % (1/pulses)) * pulses) == 0 ?
- ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
- 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
- );
- },
- none: function(pos) {
- return 0;
- },
- full: function(pos) {
- return 1;
- }
-};
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create();
-Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = (typeof effect.options.queue == 'string') ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'with-last':
- timestamp = this.effects.pluck('startOn').max() || timestamp;
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 15);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- for(var i=0, len=this.effects.length;i /gi, "");
- },
- createEditField: function() {
- var text;
- if(this.options.loadTextURL) {
- text = this.options.loadingText;
- } else {
- text = this.getText();
- }
-
- var obj = this;
-
- if (this.options.rows == 1 && !this.hasHTMLLineBreaks(text)) {
- this.options.textarea = false;
- var textField = document.createElement("input");
- textField.obj = this;
- textField.type = "text";
- textField.name = this.options.paramName;
- textField.value = text;
- textField.style.backgroundColor = this.options.highlightcolor;
- textField.className = 'editor_field';
- var size = this.options.size || this.options.cols || 0;
- if (size != 0) textField.size = size;
- if (this.options.submitOnBlur)
- textField.onblur = this.onSubmit.bind(this);
- this.editField = textField;
- } else {
- this.options.textarea = true;
- var textArea = document.createElement("textarea");
- textArea.obj = this;
- textArea.name = this.options.paramName;
- textArea.value = this.convertHTMLLineBreaks(text);
- textArea.rows = this.options.rows;
- textArea.cols = this.options.cols || 40;
- textArea.className = 'editor_field';
- if (this.options.submitOnBlur)
- textArea.onblur = this.onSubmit.bind(this);
- this.editField = textArea;
- }
-
- if(this.options.loadTextURL) {
- this.loadExternalText();
- }
- this.form.appendChild(this.editField);
- },
- getText: function() {
- return this.element.innerHTML;
- },
- loadExternalText: function() {
- Element.addClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = true;
- new Ajax.Request(
- this.options.loadTextURL,
- Object.extend({
- asynchronous: true,
- onComplete: this.onLoadedExternalText.bind(this)
- }, this.options.ajaxOptions)
- );
- },
- onLoadedExternalText: function(transport) {
- Element.removeClassName(this.form, this.options.loadingClassName);
- this.editField.disabled = false;
- this.editField.value = transport.responseText.stripTags();
- Field.scrollFreeActivate(this.editField);
- },
- onclickCancel: function() {
- this.onComplete();
- this.leaveEditMode();
- return false;
- },
- onFailure: function(transport) {
- this.options.onFailure(transport);
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- this.oldInnerHTML = null;
- }
- return false;
- },
- onSubmit: function() {
- // onLoading resets these so we need to save them away for the Ajax call
- var form = this.form;
- var value = this.editField.value;
-
- // do this first, sometimes the ajax call returns before we get a chance to switch on Saving...
- // which means this will actually switch on Saving... *after* we've left edit mode causing Saving...
- // to be displayed indefinitely
- this.onLoading();
-
- if (this.options.evalScripts) {
- new Ajax.Request(
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this),
- asynchronous:true,
- evalScripts:true
- }, this.options.ajaxOptions));
- } else {
- new Ajax.Updater(
- { success: this.element,
- // don't update on failure (this could be an option)
- failure: null },
- this.url, Object.extend({
- parameters: this.options.callback(form, value),
- onComplete: this.onComplete.bind(this),
- onFailure: this.onFailure.bind(this)
- }, this.options.ajaxOptions));
- }
- // stop the event to avoid a page refresh in Safari
- if (arguments.length > 1) {
- Event.stop(arguments[0]);
- }
- return false;
- },
- onLoading: function() {
- this.saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- showSaving: function() {
- this.oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- Element.addClassName(this.element, this.options.savingClassName);
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- },
- removeForm: function() {
- if(this.form) {
- if (this.form.parentNode) Element.remove(this.form);
- this.form = null;
- }
- },
- enterHover: function() {
- if (this.saving) return;
- this.element.style.backgroundColor = this.options.highlightcolor;
- if (this.effect) {
- this.effect.cancel();
- }
- Element.addClassName(this.element, this.options.hoverClassName)
- },
- leaveHover: function() {
- if (this.options.backgroundColor) {
- this.element.style.backgroundColor = this.oldBackground;
- }
- Element.removeClassName(this.element, this.options.hoverClassName)
- if (this.saving) return;
- this.effect = new Effect.Highlight(this.element, {
- startcolor: this.options.highlightcolor,
- endcolor: this.options.highlightendcolor,
- restorecolor: this.originalBackground
- });
- },
- leaveEditMode: function() {
- Element.removeClassName(this.element, this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this.originalBackground;
- Element.show(this.element);
- if (this.options.externalControl) {
- Element.show(this.options.externalControl);
- }
- this.editing = false;
- this.saving = false;
- this.oldInnerHTML = null;
- this.onLeaveEditMode();
- },
- onComplete: function(transport) {
- this.leaveEditMode();
- this.options.onComplete.bind(this)(transport, this.element);
- },
- onEnterEditMode: function() {},
- onLeaveEditMode: function() {},
- dispose: function() {
- if (this.oldInnerHTML) {
- this.element.innerHTML = this.oldInnerHTML;
- }
- this.leaveEditMode();
- Event.stopObserving(this.element, 'click', this.onclickListener);
- Event.stopObserving(this.element, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.stopObserving(this.options.externalControl, 'click', this.onclickListener);
- Event.stopObserving(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.stopObserving(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- }
-};
-
-Ajax.InPlaceCollectionEditor = Class.create();
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, Ajax.InPlaceEditor.prototype);
-Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
- createEditField: function() {
- if (!this.cached_selectTag) {
- var selectTag = document.createElement("select");
- var collection = this.options.collection || [];
- var optionTag;
- collection.each(function(e,i) {
- optionTag = document.createElement("option");
- optionTag.value = (e instanceof Array) ? e[0] : e;
- if((typeof this.options.value == 'undefined') &&
- ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true;
- if(this.options.value==optionTag.value) optionTag.selected = true;
- optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
- selectTag.appendChild(optionTag);
- }.bind(this));
- this.cached_selectTag = selectTag;
- }
-
- this.editField = this.cached_selectTag;
- if(this.options.loadTextURL) this.loadExternalText();
- this.form.appendChild(this.editField);
- this.options.callback = function(form, value) {
- return "value=" + encodeURIComponent(value);
- }
- }
-});
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create();
-Form.Element.DelayedObserver.prototype = {
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-};
diff --git a/public/legacy/js/lib/dragdrop.js b/public/legacy/js/lib/dragdrop.js
deleted file mode 100644
index 32c91bc3..00000000
--- a/public/legacy/js/lib/dragdrop.js
+++ /dev/null
@@ -1,944 +0,0 @@
-// script.aculo.us dragdrop.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(typeof Effect == 'undefined')
- throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || {});
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if((typeof containment == 'object') &&
- (containment.constructor == Array)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var affected = [];
-
- if(this.last_active) this.deactivate(this.last_active);
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0) {
- drop = Droppables.findDeepestChild(affected);
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop)
- this.last_active.onDrop(element, this.last_active.element, event);
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-}
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- if(draggable.options.delay) {
- this._timeout = setTimeout(function() {
- Draggables._timeout = null;
- window.focus();
- Draggables.activeDraggable = draggable;
- }.bind(this), draggable.options.delay);
- } else {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- }
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
-
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(this._timeout) {
- clearTimeout(this._timeout);
- this._timeout = null;
- }
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create();
-Draggable._dragging = {};
-
-Draggable.prototype = {
- initialize: function(element) {
- var defaults = {
- handle: false,
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
- queue: {scope:'_draggable', position:'end'}
- });
- },
- endeffect: function(element) {
- var toOpacity = typeof element._opacity == 'number' ? element._opacity : 1.0;
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
- queue: {scope:'_draggable', position:'end'},
- afterFinish: function(){
- Draggable._dragging[element] = false
- }
- });
- },
- zindex: 1000,
- revert: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
- delay: 0
- };
-
- if(!arguments[1] || typeof arguments[1].endeffect == 'undefined')
- Object.extend(defaults, {
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- Draggable._dragging[element] = true;
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- }
- });
-
- var options = Object.extend(defaults, arguments[1] || {});
-
- this.element = $(element);
-
- if(options.handle && (typeof options.handle == 'string'))
- this.handle = this.element.down('.'+options.handle, 0);
-
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
- options.scroll = $(options.scroll);
- this._isScrollChild = Element.childOf(this.element, options.scroll);
- }
-
- Element.makePositioned(this.element); // fix IE
-
- this.delta = this.currentDelta();
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(typeof Draggable._dragging[this.element] != 'undefined' &&
- Draggable._dragging[this.element]) return;
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if((tag_name = src.tagName.toUpperCase()) && (
- tag_name=='INPUT' ||
- tag_name=='SELECT' ||
- tag_name=='OPTION' ||
- tag_name=='BUTTON' ||
- tag_name=='TEXTAREA')) return;
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
-
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
- Position.prepare();
- Droppables.show(pointer, this.element);
- Draggables.notify('onDrag', this, event);
-
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft + Position.deltaX;
- p[1] += this.options.scroll.scrollTop + Position.deltaY;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.ghosting) {
- Position.relativize(this.element);
- Element.remove(this._clone);
- this._clone = null;
- }
-
- if(success) Droppables.fire(event, this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && typeof revert == 'function') revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- if(this.options.ghosting) {
- var r = Position.realOffset(this.element);
- pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
- }
-
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(typeof this.options.snap == 'function') {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(this.options.snap instanceof Array) {
- p = p.map( function(v, i) {
- return Math.round(v/this.options.snap[i])*this.options.snap[i] }.bind(this))
- } else {
- p = p.map( function(v) {
- return Math.round(v/this.options.snap)*this.options.snap }.bind(this))
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
-
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- if(!(speed[0] || speed[1])) return;
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- if (this._isScrollChild) {
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
- }
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create();
-SortableObserver.prototype = {
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-}
-
-var Sortable = {
- SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
- sortables: {},
-
- _findRootElement: function(element) {
- while (element.tagName.toUpperCase() != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- var s = Sortable.options(element);
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- delay: 0,
- hoverclass: null,
- ghosting: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: this.SERIALIZE_RULE,
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || {});
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- delay: options.delay,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- }
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- }
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (this.findElements(element, options) || []).each( function(e) {
- // handles are per-draggable
- var handle = options.handle ?
- $(e).down('.'+options.handle,0) : e;
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Sortable._marker.hide();
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker =
- ($('dropmarker') || Element.extend(document.createElement('DIV'))).
- hide().addClassName('dropmarker').setStyle({position:'absolute'});
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
- else
- Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
- Sortable._marker.show();
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: [],
- position: parent.children.length,
- container: $(children[i]).down(options.treeTag)
- }
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child)
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || {});
-
- var root = {
- id: null,
- parent: null,
- children: [],
- container: element,
- position: 0
- }
-
- return Sortable._tree(element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || {});
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || {});
-
- var nodeMap = {};
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || {});
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "[id]=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-}
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
- if (child.parentNode == element) return true;
- return Element.isParent(child.parentNode, element);
-}
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-}
-
-Element.offsetSize = function (element, type) {
- return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}
diff --git a/public/legacy/js/lib/effects.js b/public/legacy/js/lib/effects.js
deleted file mode 100644
index 06f59b47..00000000
--- a/public/legacy/js/lib/effects.js
+++ /dev/null
@@ -1,1090 +0,0 @@
-// script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if(this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if(this.slice(0,1) == '#') {
- if(this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if(this.length==7) color = this.toLowerCase();
- }
- }
- return(color.length==7 ? color : (arguments[0] || this));
-}
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-}
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-}
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- element.setStyle({fontSize: (percent/100) + 'em'});
- if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
- return element;
-}
-
-Element.getOpacity = function(element){
- return $(element).getStyle('opacity');
-}
-
-Element.setOpacity = function(element, value){
- return $(element).setStyle({opacity:value});
-}
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-}
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Array.prototype.call = function() {
- var args = arguments;
- this.each(function(f){ f.apply(this, args) });
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- _elementDoesNotExistError: {
- name: 'ElementDoesNotExistError',
- message: 'The specified DOM element does not exist, but is required for this effect to operate'
- },
- tagifyText: function(element) {
- if(typeof Builder == 'undefined')
- throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
-
- var tagifyStyle = 'position:relative';
- if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1';
-
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if(child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- Builder.node('span',{style: tagifyStyle},
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if(((typeof element == 'object') ||
- (typeof element == 'function')) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || {});
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || {});
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-var Effect2 = Effect; // deprecated
-
-/* ------------- transitions ------------- */
-
-Effect.Transitions = {
- linear: Prototype.K,
- sinoidal: function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + 0.5;
- },
- reverse: function(pos) {
- return 1-pos;
- },
- flicker: function(pos) {
- return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
- },
- wobble: function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
- },
- pulse: function(pos, pulses) {
- pulses = pulses || 5;
- return (
- Math.round((pos % (1/pulses)) * pulses) == 0 ?
- ((pos * pulses * 2) - Math.floor(pos * pulses * 2)) :
- 1 - ((pos * pulses * 2) - Math.floor(pos * pulses * 2))
- );
- },
- none: function(pos) {
- return 0;
- },
- full: function(pos) {
- return 1;
- }
-};
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create();
-Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = (typeof effect.options.queue == 'string') ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'with-last':
- timestamp = this.effects.pluck('startOn').max() || timestamp;
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if(!this.interval)
- this.interval = setInterval(this.loop.bind(this), 15);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if(this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- for(var i=0, len=this.effects.length;i This is an advanced demo. For more demos, a tutorial, documentation and support, please visit mmenu.frebsite.nl This is a demo. For more demos, a tutorial, documentation and support, please visit mmenu.frebsite.nl This is a demo. The links in the menu link to a section on the same page, some small javascript makes the page scroll smoothly. This is the first section. This is the second section. This is the third section. The best jQuery plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and web-app. Check out the example on the left or play around with the options. For the full documentation please visit: mmenu.frebsite.nl "+u+"' + html.stripScripts() + '
';
- depth = 2;
- break;
- case 'TR':
- div.innerHTML = '
';
- depth = 3;
- break;
- case 'TD':
- div.innerHTML = '' + html.stripScripts() + '
';
- depth = 4;
- }
- $A(element.childNodes).each(function(node){
- element.removeChild(node)
- });
- depth.times(function(){ div = div.firstChild });
-
- $A(div.childNodes).each(
- function(node){ element.appendChild(node) });
- } else {
- element.innerHTML = html.stripScripts();
- }
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- }
-};
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
- var className = 'HTML' + tag + 'Element';
- if(window[className]) return;
- var klass = window[className] = {};
- klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
- });
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- var cache = Element.extend.cache;
- for (var property in methods) {
- var value = methods[property];
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = cache.findOrStore(value);
- }
- }
-
- if (typeof HTMLElement != 'undefined') {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- copy(Form.Methods, HTMLFormElement.prototype);
- [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
- copy(Form.Element.Methods, klass.prototype);
- });
- _nativeExtensions = true;
- }
-}
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toUpperCase();
- if (['TBODY', 'TR'].include(tagName)) {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '' + html.stripScripts() + ' ' + this.content + '
';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
-
- toString: function() {
- return $A(this).join(' ');
- }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.readAttribute("id") == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0, length = clause.length; i < length; i++)
- conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \
- element = $(element); \
- return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0, length = scope.length; i < length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-Object.extend(Selector, {
- matchElements: function(elements, expression) {
- var selector = new Selector(expression);
- return elements.select(selector.match.bind(selector)).map(Element.extend);
- },
-
- findElement: function(elements, expression, index) {
- if (typeof expression == 'number') index = expression, expression = false;
- return Selector.matchElements(elements, expression || '*')[index || 0];
- },
-
- findChildElements: function(element, expressions) {
- return expressions.map(function(expression) {
- return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.inject([], function(elements, result) {
- return elements.concat(selector.findElements(result || element));
- });
- });
- }).flatten();
- }
-});
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
-
- serializeElements: function(elements, getHash) {
- var data = elements.inject({}, function(result, element) {
- if (!element.disabled && element.name) {
- var key = element.name, value = $(element).getValue();
- if (value != undefined) {
- if (result[key]) {
- if (result[key].constructor != Array) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
-
- return getHash ? data : Hash.toQueryString(data);
- }
-};
-
-Form.Methods = {
- serialize: function(form, getHash) {
- return Form.serializeElements(Form.getElements(form), getHash);
- },
-
- getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name) return $A(inputs).map(Element.extend);
-
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
- continue;
- matchingInputs.push(Element.extend(input));
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.blur();
- element.disabled = 'true';
- });
- return form;
- },
-
- enable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.disabled = '';
- });
- return form;
- },
-
- findFirstElement: function(form) {
- return $(form).getElements().find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
- }
-}
-
-Object.extend(Form, Form.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-}
-
-Form.Element.Methods = {
- serialize: function(element) {
- element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = {};
- pair[element.name] = value;
- return Hash.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- clear: function(element) {
- $(element).value = '';
- return element;
- },
-
- present: function(element) {
- return $(element).value != '';
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select && ( element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type) ) )
- element.select();
- return element;
- },
-
- disable: function(element) {
- element = $(element);
- element.disabled = true;
- return element;
- },
-
- enable: function(element) {
- element = $(element);
- element.blur();
- element.disabled = false;
- return element;
- }
-}
-
-Object.extend(Form.Element, Form.Element.Methods);
-var Field = Form.Element;
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- default:
- return Form.Element.Serializers.textarea(element);
- }
- },
-
- inputSelector: function(element) {
- return element.checked ? element.value : null;
- },
-
- textarea: function(element) {
- return element.value;
- },
-
- select: function(element) {
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
- },
-
- selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
- var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
- }
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- var changed = ('string' == typeof this.lastValue && 'string' == typeof value
- ? this.lastValue != value : String(this.lastValue) != String(value));
- if (changed) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback.bind(this));
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- default:
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0, length = Event.observers.length; i < length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- Event._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- try {
- element.detachEvent('on' + name, observer);
- } catch (e) {}
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if(element.tagName=='BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!window.opera || element.tagName=='BODY') {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
-
-Element.addMethods();
\ No newline at end of file
diff --git a/public/legacy/js/lib/.svn/text-base/scriptaculous.js.svn-base b/public/legacy/js/lib/.svn/text-base/scriptaculous.js.svn-base
deleted file mode 100644
index 585313c3..00000000
--- a/public/legacy/js/lib/.svn/text-base/scriptaculous.js.svn-base
+++ /dev/null
@@ -1,51 +0,0 @@
-// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-var Scriptaculous = {
- Version: '1.7.0',
- require: function(libraryName) {
- // inserting via DOM fails in Safari 2.0, so brute force approach
- document.write('');
- },
- load: function() {
- if((typeof Prototype=='undefined') ||
- (typeof Element == 'undefined') ||
- (typeof Element.Methods=='undefined') ||
- parseFloat(Prototype.Version.split(".")[0] + "." +
- Prototype.Version.split(".")[1]) < 1.5)
- throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
-
- $A(document.getElementsByTagName("script")).findAll( function(s) {
- return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
- }).each( function(s) {
- var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
- var includes = s.src.match(/\?.*load=([a-z,]*)/);
- (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
- function(include) { Scriptaculous.require(path+include+'.js') });
- });
- }
-}
-
-Scriptaculous.load();
\ No newline at end of file
diff --git a/public/legacy/js/lib/.svn/text-base/slider.js.svn-base b/public/legacy/js/lib/.svn/text-base/slider.js.svn-base
deleted file mode 100644
index f24f2823..00000000
--- a/public/legacy/js/lib/.svn/text-base/slider.js.svn-base
+++ /dev/null
@@ -1,278 +0,0 @@
-// script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(!Control) var Control = {};
-Control.Slider = Class.create();
-
-// options:
-// axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-// onChange(value)
-// onSlide(value)
-Control.Slider.prototype = {
- initialize: function(handle, track, options) {
- var slider = this;
-
- if(handle instanceof Array) {
- this.handles = handle.collect( function(e) { return $(e) });
- } else {
- this.handles = [$(handle)];
- }
-
- this.track = $(track);
- this.options = options || {};
-
- this.axis = this.options.axis || 'horizontal';
- this.increment = this.options.increment || 1;
- this.step = parseInt(this.options.step || '1');
- this.range = this.options.range || $R(0,1);
-
- this.value = 0; // assure backwards compat
- this.values = this.handles.map( function() { return 0 });
- this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
- this.options.startSpan = $(this.options.startSpan || null);
- this.options.endSpan = $(this.options.endSpan || null);
-
- this.restricted = this.options.restricted || false;
-
- this.maximum = this.options.maximum || this.range.end;
- this.minimum = this.options.minimum || this.range.start;
-
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || '0');
- this.alignY = parseInt(this.options.alignY || '0');
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
-
- this.handleLength = this.isVertical() ?
- (this.handles[0].offsetHeight != 0 ?
- this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
- (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
- this.handles[0].style.width.replace(/px$/,""));
-
- this.active = false;
- this.dragging = false;
- this.disabled = false;
-
- if(this.options.disabled) this.setDisabled();
-
- // Allowed values array
- this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
- if(this.allowedValues) {
- this.minimum = this.allowedValues.min();
- this.maximum = this.allowedValues.max();
- }
-
- this.eventMouseDown = this.startDrag.bindAsEventListener(this);
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.update.bindAsEventListener(this);
-
- // Initialize handles in reverse (make sure first handle is active)
- this.handles.each( function(h,i) {
- i = slider.handles.length-1-i;
- slider.setValue(parseFloat(
- (slider.options.sliderValue instanceof Array ?
- slider.options.sliderValue[i] : slider.options.sliderValue) ||
- slider.range.start), i);
- Element.makePositioned(h); // fix IE
- Event.observe(h, "mousedown", slider.eventMouseDown);
- });
-
- Event.observe(this.track, "mousedown", this.eventMouseDown);
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
-
- this.initialized = true;
- },
- dispose: function() {
- var slider = this;
- Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- this.handles.each( function(h) {
- Event.stopObserving(h, "mousedown", slider.eventMouseDown);
- });
- },
- setDisabled: function(){
- this.disabled = true;
- },
- setEnabled: function(){
- this.disabled = false;
- },
- getNearestValue: function(value){
- if(this.allowedValues){
- if(value >= this.allowedValues.max()) return(this.allowedValues.max());
- if(value <= this.allowedValues.min()) return(this.allowedValues.min());
-
- var offset = Math.abs(this.allowedValues[0] - value);
- var newValue = this.allowedValues[0];
- this.allowedValues.each( function(v) {
- var currentOffset = Math.abs(v - value);
- if(currentOffset <= offset){
- newValue = v;
- offset = currentOffset;
- }
- });
- return newValue;
- }
- if(value > this.range.end) return this.range.end;
- if(value < this.range.start) return this.range.start;
- return value;
- },
- setValue: function(sliderValue, handleIdx){
- if(!this.active) {
- this.activeHandleIdx = handleIdx || 0;
- this.activeHandle = this.handles[this.activeHandleIdx];
- this.updateStyles();
- }
- handleIdx = handleIdx || this.activeHandleIdx || 0;
- if(this.initialized && this.restricted) {
- if((handleIdx>0) && (sliderValue' +
- '
';
- this.logsummary = $('logsummary')
- this.loglines = $('loglines');
- },
- _toHTML: function(txt) {
- return txt.escapeHTML().replace(/\n/g," ' +
- '' +
- 'Status Test Message
");
- },
- addLinksToResults: function(){
- $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
- td.title = "Run only this test"
- Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
- });
- $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
- td.title = "Run all tests"
- Event.observe(td, 'click', function(){ window.location.search = "";});
- });
- }
-}
-
-Test.Unit.Runner = Class.create();
-Test.Unit.Runner.prototype = {
- initialize: function(testcases) {
- this.options = Object.extend({
- testLog: 'testlog'
- }, arguments[1] || {});
- this.options.resultsURL = this.parseResultsURLQueryParameter();
- this.options.tests = this.parseTestsQueryParameter();
- if (this.options.testLog) {
- this.options.testLog = $(this.options.testLog) || null;
- }
- if(this.options.tests) {
- this.tests = [];
- for(var i = 0; i < this.options.tests.length; i++) {
- if(/^test/.test(this.options.tests[i])) {
- this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
- }
- }
- } else {
- if (this.options.test) {
- this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
- } else {
- this.tests = [];
- for(var testcase in testcases) {
- if(/^test/.test(testcase)) {
- this.tests.push(
- new Test.Unit.Testcase(
- this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
- testcases[testcase], testcases["setup"], testcases["teardown"]
- ));
- }
- }
- }
- }
- this.currentTest = 0;
- this.logger = new Test.Unit.Logger(this.options.testLog);
- setTimeout(this.runTests.bind(this), 1000);
- },
- parseResultsURLQueryParameter: function() {
- return window.location.search.parseQuery()["resultsURL"];
- },
- parseTestsQueryParameter: function(){
- if (window.location.search.parseQuery()["tests"]){
- return window.location.search.parseQuery()["tests"].split(',');
- };
- },
- // Returns:
- // "ERROR" if there was an error,
- // "FAILURE" if there was a failure, or
- // "SUCCESS" if there was neither
- getResult: function() {
- var hasFailure = false;
- for(var i=0;i" + ret.join('') + "
";
- }
- }, options || {});
- }
-});
-
-// AJAX in-place editor
-//
-// see documentation on http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-}
-
-Ajax.InPlaceEditor = Class.create();
-Ajax.InPlaceEditor.defaultHighlightColor = "#FFFF99";
-Ajax.InPlaceEditor.prototype = {
- initialize: function(element, url, options) {
- this.url = url;
- this.element = $(element);
-
- this.options = Object.extend({
- paramName: "value",
- okButton: true,
- okText: "ok",
- cancelLink: true,
- cancelText: "cancel",
- savingText: "Saving...",
- clickToEditText: "Click to edit",
- okText: "ok",
- rows: 1,
- onComplete: function(transport, element) {
- new Effect.Highlight(element, {startcolor: this.options.highlightcolor});
- },
- onFailure: function(transport) {
- alert("Error communicating with the server: " + transport.responseText.stripTags());
- },
- callback: function(form) {
- return Form.serialize(form);
- },
- handleLineBreaks: true,
- loadingText: 'Loading...',
- savingClassName: 'inplaceeditor-saving',
- loadingClassName: 'inplaceeditor-loading',
- formClassName: 'inplaceeditor-form',
- highlightcolor: Ajax.InPlaceEditor.defaultHighlightColor,
- highlightendcolor: "#FFFFFF",
- externalControl: null,
- submitOnBlur: false,
- ajaxOptions: {},
- evalScripts: false
- }, options || {});
-
- if(!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + "-inplaceeditor";
- if ($(this.options.formId)) {
- // there's already a form with that name, don't specify an id
- this.options.formId = null;
- }
- }
-
- if (this.options.externalControl) {
- this.options.externalControl = $(this.options.externalControl);
- }
-
- this.originalBackground = Element.getStyle(this.element, 'background-color');
- if (!this.originalBackground) {
- this.originalBackground = "transparent";
- }
-
- this.element.title = this.options.clickToEditText;
-
- this.onclickListener = this.enterEditMode.bindAsEventListener(this);
- this.mouseoverListener = this.enterHover.bindAsEventListener(this);
- this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
- Event.observe(this.element, 'click', this.onclickListener);
- Event.observe(this.element, 'mouseover', this.mouseoverListener);
- Event.observe(this.element, 'mouseout', this.mouseoutListener);
- if (this.options.externalControl) {
- Event.observe(this.options.externalControl, 'click', this.onclickListener);
- Event.observe(this.options.externalControl, 'mouseover', this.mouseoverListener);
- Event.observe(this.options.externalControl, 'mouseout', this.mouseoutListener);
- }
- },
- enterEditMode: function(evt) {
- if (this.saving) return;
- if (this.editing) return;
- this.editing = true;
- this.onEnterEditMode();
- if (this.options.externalControl) {
- Element.hide(this.options.externalControl);
- }
- Element.hide(this.element);
- this.createForm();
- this.element.parentNode.insertBefore(this.form, this.element);
- if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField);
- // stop the event to avoid a page refresh in Safari
- if (evt) {
- Event.stop(evt);
- }
- return false;
- },
- createForm: function() {
- this.form = document.createElement("form");
- this.form.id = this.options.formId;
- Element.addClassName(this.form, this.options.formClassName)
- this.form.onsubmit = this.onSubmit.bind(this);
-
- this.createEditField();
-
- if (this.options.textarea) {
- var br = document.createElement("br");
- this.form.appendChild(br);
- }
-
- if (this.options.okButton) {
- okButton = document.createElement("input");
- okButton.type = "submit";
- okButton.value = this.options.okText;
- okButton.className = 'editor_ok_button';
- this.form.appendChild(okButton);
- }
-
- if (this.options.cancelLink) {
- cancelLink = document.createElement("a");
- cancelLink.href = "#";
- cancelLink.appendChild(document.createTextNode(this.options.cancelText));
- cancelLink.onclick = this.onclickCancel.bind(this);
- cancelLink.className = 'editor_cancel';
- this.form.appendChild(cancelLink);
- }
- },
- hasHTMLLineBreaks: function(string) {
- if (!this.options.handleLineBreaks) return false;
- return string.match(/
/i);
- },
- convertHTMLLineBreaks: function(string) {
- return string.replace(/
/gi, "\n").replace(/
/gi, "\n").replace(/<\/p>/gi, "\n").replace(/' + html.stripScripts() + '
';
- depth = 2;
- break;
- case 'TR':
- div.innerHTML = '
';
- depth = 3;
- break;
- case 'TD':
- div.innerHTML = '' + html.stripScripts() + '
';
- depth = 4;
- }
- $A(element.childNodes).each(function(node){
- element.removeChild(node)
- });
- depth.times(function(){ div = div.firstChild });
-
- $A(div.childNodes).each(
- function(node){ element.appendChild(node) });
- } else {
- element.innerHTML = html.stripScripts();
- }
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- }
-};
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
- var className = 'HTML' + tag + 'Element';
- if(window[className]) return;
- var klass = window[className] = {};
- klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
- });
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- var cache = Element.extend.cache;
- for (var property in methods) {
- var value = methods[property];
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = cache.findOrStore(value);
- }
- }
-
- if (typeof HTMLElement != 'undefined') {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- copy(Form.Methods, HTMLFormElement.prototype);
- [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
- copy(Form.Element.Methods, klass.prototype);
- });
- _nativeExtensions = true;
- }
-}
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toUpperCase();
- if (['TBODY', 'TR'].include(tagName)) {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '' + html.stripScripts() + ' ' + this.content + '
';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
-
- toString: function() {
- return $A(this).join(' ');
- }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.readAttribute("id") == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0, length = clause.length; i < length; i++)
- conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \
- element = $(element); \
- return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0, length = scope.length; i < length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-Object.extend(Selector, {
- matchElements: function(elements, expression) {
- var selector = new Selector(expression);
- return elements.select(selector.match.bind(selector)).map(Element.extend);
- },
-
- findElement: function(elements, expression, index) {
- if (typeof expression == 'number') index = expression, expression = false;
- return Selector.matchElements(elements, expression || '*')[index || 0];
- },
-
- findChildElements: function(element, expressions) {
- return expressions.map(function(expression) {
- return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.inject([], function(elements, result) {
- return elements.concat(selector.findElements(result || element));
- });
- });
- }).flatten();
- }
-});
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
-
- serializeElements: function(elements, getHash) {
- var data = elements.inject({}, function(result, element) {
- if (!element.disabled && element.name) {
- var key = element.name, value = $(element).getValue();
- if (value != undefined) {
- if (result[key]) {
- if (result[key].constructor != Array) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
-
- return getHash ? data : Hash.toQueryString(data);
- }
-};
-
-Form.Methods = {
- serialize: function(form, getHash) {
- return Form.serializeElements(Form.getElements(form), getHash);
- },
-
- getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name) return $A(inputs).map(Element.extend);
-
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
- continue;
- matchingInputs.push(Element.extend(input));
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.blur();
- element.disabled = 'true';
- });
- return form;
- },
-
- enable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.disabled = '';
- });
- return form;
- },
-
- findFirstElement: function(form) {
- return $(form).getElements().find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
- }
-}
-
-Object.extend(Form, Form.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-}
-
-Form.Element.Methods = {
- serialize: function(element) {
- element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = {};
- pair[element.name] = value;
- return Hash.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- clear: function(element) {
- $(element).value = '';
- return element;
- },
-
- present: function(element) {
- return $(element).value != '';
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select && ( element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type) ) )
- element.select();
- return element;
- },
-
- disable: function(element) {
- element = $(element);
- element.disabled = true;
- return element;
- },
-
- enable: function(element) {
- element = $(element);
- element.blur();
- element.disabled = false;
- return element;
- }
-}
-
-Object.extend(Form.Element, Form.Element.Methods);
-var Field = Form.Element;
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- default:
- return Form.Element.Serializers.textarea(element);
- }
- },
-
- inputSelector: function(element) {
- return element.checked ? element.value : null;
- },
-
- textarea: function(element) {
- return element.value;
- },
-
- select: function(element) {
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
- },
-
- selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
- var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
- }
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- var changed = ('string' == typeof this.lastValue && 'string' == typeof value
- ? this.lastValue != value : String(this.lastValue) != String(value));
- if (changed) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback.bind(this));
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- default:
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0, length = Event.observers.length; i < length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- Event._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- try {
- element.detachEvent('on' + name, observer);
- } catch (e) {}
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if(element.tagName=='BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!window.opera || element.tagName=='BODY') {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
-
-Element.addMethods();
\ No newline at end of file
diff --git a/public/legacy/js/lib/scriptaculous.js b/public/legacy/js/lib/scriptaculous.js
deleted file mode 100644
index 585313c3..00000000
--- a/public/legacy/js/lib/scriptaculous.js
+++ /dev/null
@@ -1,51 +0,0 @@
-// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-var Scriptaculous = {
- Version: '1.7.0',
- require: function(libraryName) {
- // inserting via DOM fails in Safari 2.0, so brute force approach
- document.write('');
- },
- load: function() {
- if((typeof Prototype=='undefined') ||
- (typeof Element == 'undefined') ||
- (typeof Element.Methods=='undefined') ||
- parseFloat(Prototype.Version.split(".")[0] + "." +
- Prototype.Version.split(".")[1]) < 1.5)
- throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
-
- $A(document.getElementsByTagName("script")).findAll( function(s) {
- return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
- }).each( function(s) {
- var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
- var includes = s.src.match(/\?.*load=([a-z,]*)/);
- (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
- function(include) { Scriptaculous.require(path+include+'.js') });
- });
- }
-}
-
-Scriptaculous.load();
\ No newline at end of file
diff --git a/public/legacy/js/lib/slider.js b/public/legacy/js/lib/slider.js
deleted file mode 100644
index f24f2823..00000000
--- a/public/legacy/js/lib/slider.js
+++ /dev/null
@@ -1,278 +0,0 @@
-// script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007
-
-// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(!Control) var Control = {};
-Control.Slider = Class.create();
-
-// options:
-// axis: 'vertical', or 'horizontal' (default)
-//
-// callbacks:
-// onChange(value)
-// onSlide(value)
-Control.Slider.prototype = {
- initialize: function(handle, track, options) {
- var slider = this;
-
- if(handle instanceof Array) {
- this.handles = handle.collect( function(e) { return $(e) });
- } else {
- this.handles = [$(handle)];
- }
-
- this.track = $(track);
- this.options = options || {};
-
- this.axis = this.options.axis || 'horizontal';
- this.increment = this.options.increment || 1;
- this.step = parseInt(this.options.step || '1');
- this.range = this.options.range || $R(0,1);
-
- this.value = 0; // assure backwards compat
- this.values = this.handles.map( function() { return 0 });
- this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
- this.options.startSpan = $(this.options.startSpan || null);
- this.options.endSpan = $(this.options.endSpan || null);
-
- this.restricted = this.options.restricted || false;
-
- this.maximum = this.options.maximum || this.range.end;
- this.minimum = this.options.minimum || this.range.start;
-
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || '0');
- this.alignY = parseInt(this.options.alignY || '0');
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
-
- this.handleLength = this.isVertical() ?
- (this.handles[0].offsetHeight != 0 ?
- this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
- (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
- this.handles[0].style.width.replace(/px$/,""));
-
- this.active = false;
- this.dragging = false;
- this.disabled = false;
-
- if(this.options.disabled) this.setDisabled();
-
- // Allowed values array
- this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
- if(this.allowedValues) {
- this.minimum = this.allowedValues.min();
- this.maximum = this.allowedValues.max();
- }
-
- this.eventMouseDown = this.startDrag.bindAsEventListener(this);
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.update.bindAsEventListener(this);
-
- // Initialize handles in reverse (make sure first handle is active)
- this.handles.each( function(h,i) {
- i = slider.handles.length-1-i;
- slider.setValue(parseFloat(
- (slider.options.sliderValue instanceof Array ?
- slider.options.sliderValue[i] : slider.options.sliderValue) ||
- slider.range.start), i);
- Element.makePositioned(h); // fix IE
- Event.observe(h, "mousedown", slider.eventMouseDown);
- });
-
- Event.observe(this.track, "mousedown", this.eventMouseDown);
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
-
- this.initialized = true;
- },
- dispose: function() {
- var slider = this;
- Event.stopObserving(this.track, "mousedown", this.eventMouseDown);
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- this.handles.each( function(h) {
- Event.stopObserving(h, "mousedown", slider.eventMouseDown);
- });
- },
- setDisabled: function(){
- this.disabled = true;
- },
- setEnabled: function(){
- this.disabled = false;
- },
- getNearestValue: function(value){
- if(this.allowedValues){
- if(value >= this.allowedValues.max()) return(this.allowedValues.max());
- if(value <= this.allowedValues.min()) return(this.allowedValues.min());
-
- var offset = Math.abs(this.allowedValues[0] - value);
- var newValue = this.allowedValues[0];
- this.allowedValues.each( function(v) {
- var currentOffset = Math.abs(v - value);
- if(currentOffset <= offset){
- newValue = v;
- offset = currentOffset;
- }
- });
- return newValue;
- }
- if(value > this.range.end) return this.range.end;
- if(value < this.range.start) return this.range.start;
- return value;
- },
- setValue: function(sliderValue, handleIdx){
- if(!this.active) {
- this.activeHandleIdx = handleIdx || 0;
- this.activeHandle = this.handles[this.activeHandleIdx];
- this.updateStyles();
- }
- handleIdx = handleIdx || this.activeHandleIdx || 0;
- if(this.initialized && this.restricted) {
- if((handleIdx>0) && (sliderValue' +
- '
';
- this.logsummary = $('logsummary')
- this.loglines = $('loglines');
- },
- _toHTML: function(txt) {
- return txt.escapeHTML().replace(/\n/g," ' +
- '' +
- 'Status Test Message
");
- },
- addLinksToResults: function(){
- $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
- td.title = "Run only this test"
- Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
- });
- $$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
- td.title = "Run all tests"
- Event.observe(td, 'click', function(){ window.location.search = "";});
- });
- }
-}
-
-Test.Unit.Runner = Class.create();
-Test.Unit.Runner.prototype = {
- initialize: function(testcases) {
- this.options = Object.extend({
- testLog: 'testlog'
- }, arguments[1] || {});
- this.options.resultsURL = this.parseResultsURLQueryParameter();
- this.options.tests = this.parseTestsQueryParameter();
- if (this.options.testLog) {
- this.options.testLog = $(this.options.testLog) || null;
- }
- if(this.options.tests) {
- this.tests = [];
- for(var i = 0; i < this.options.tests.length; i++) {
- if(/^test/.test(this.options.tests[i])) {
- this.tests.push(new Test.Unit.Testcase(this.options.tests[i], testcases[this.options.tests[i]], testcases["setup"], testcases["teardown"]));
- }
- }
- } else {
- if (this.options.test) {
- this.tests = [new Test.Unit.Testcase(this.options.test, testcases[this.options.test], testcases["setup"], testcases["teardown"])];
- } else {
- this.tests = [];
- for(var testcase in testcases) {
- if(/^test/.test(testcase)) {
- this.tests.push(
- new Test.Unit.Testcase(
- this.options.context ? ' -> ' + this.options.titles[testcase] : testcase,
- testcases[testcase], testcases["setup"], testcases["teardown"]
- ));
- }
- }
- }
- }
- this.currentTest = 0;
- this.logger = new Test.Unit.Logger(this.options.testLog);
- setTimeout(this.runTests.bind(this), 1000);
- },
- parseResultsURLQueryParameter: function() {
- return window.location.search.parseQuery()["resultsURL"];
- },
- parseTestsQueryParameter: function(){
- if (window.location.search.parseQuery()["tests"]){
- return window.location.search.parseQuery()["tests"].split(',');
- };
- },
- // Returns:
- // "ERROR" if there was an error,
- // "FAILURE" if there was a failure, or
- // "SUCCESS" if there was neither
- getResult: function() {
- var hasFailure = false;
- for(var i=0;i
- //
- //
- //
- // ' );
- }
- } else {
- el.attr(arr[1], value);
- }
- }
-
- } else {
- template.find(EVENT_NS + '-'+key).html(value);
- }
- });
- },
-
- _getScrollbarSize: function() {
- // thx David
- if(mfp.scrollbarSize === undefined) {
- var scrollDiv = document.createElement("div");
- scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
- document.body.appendChild(scrollDiv);
- mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
- document.body.removeChild(scrollDiv);
- }
- return mfp.scrollbarSize;
- }
-
-}; /* MagnificPopup core prototype end */
-
-
-
-
-/**
- * Public static functions
- */
-$.magnificPopup = {
- instance: null,
- proto: MagnificPopup.prototype,
- modules: [],
-
- open: function(options, index) {
- _checkInstance();
-
- if(!options) {
- options = {};
- } else {
- options = $.extend(true, {}, options);
- }
-
-
- options.isObj = true;
- options.index = index || 0;
- return this.instance.open(options);
- },
-
- close: function() {
- return $.magnificPopup.instance && $.magnificPopup.instance.close();
- },
-
- registerModule: function(name, module) {
- if(module.options) {
- $.magnificPopup.defaults[name] = module.options;
- }
- $.extend(this.proto, module.proto);
- this.modules.push(name);
- },
-
- defaults: {
-
- // Info about options is in docs:
- // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
-
- disableOn: 0,
-
- key: null,
-
- midClick: false,
-
- mainClass: '',
-
- preloader: true,
-
- focus: '', // CSS selector of input to focus after popup is opened
-
- closeOnContentClick: false,
-
- closeOnBgClick: true,
-
- closeBtnInside: true,
-
- showCloseBtn: true,
-
- enableEscapeKey: true,
-
- modal: false,
-
- alignTop: false,
-
- removalDelay: 0,
-
- prependTo: null,
-
- fixedContentPos: 'auto',
-
- fixedBgPos: 'auto',
-
- overflowY: 'auto',
-
- closeMarkup: '',
-
- tClose: 'Close (Esc)',
-
- tLoading: 'Loading...'
-
- }
-};
-
-
-
-$.fn.magnificPopup = function(options) {
- _checkInstance();
-
- var jqEl = $(this);
-
- // We call some API method of first param is a string
- if (typeof options === "string" ) {
-
- if(options === 'open') {
- var items,
- itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
- index = parseInt(arguments[1], 10) || 0;
-
- if(itemOpts.items) {
- items = itemOpts.items[index];
- } else {
- items = jqEl;
- if(itemOpts.delegate) {
- items = items.find(itemOpts.delegate);
- }
- items = items.eq( index );
- }
- mfp._openClick({mfpEl:items}, jqEl, itemOpts);
- } else {
- if(mfp.isOpen)
- mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
- }
-
- } else {
- // clone options obj
- options = $.extend(true, {}, options);
-
- /*
- * As Zepto doesn't support .data() method for objects
- * and it works only in normal browsers
- * we assign "options" object directly to the DOM element. FTW!
- */
- if(_isJQ) {
- jqEl.data('magnificPopup', options);
- } else {
- jqEl[0].magnificPopup = options;
- }
-
- mfp.addGroup(jqEl, options);
-
- }
- return jqEl;
-};
-
-
-//Quick benchmark
-/*
-var start = performance.now(),
- i,
- rounds = 1000;
-
-for(i = 0; i < rounds; i++) {
-
-}
-console.log('Test #1:', performance.now() - start);
-
-start = performance.now();
-for(i = 0; i < rounds; i++) {
-
-}
-console.log('Test #2:', performance.now() - start);
-*/
diff --git a/public/legacy/js/magnific-popup/js/fastclick.js b/public/legacy/js/magnific-popup/js/fastclick.js
deleted file mode 100644
index 188304be..00000000
--- a/public/legacy/js/magnific-popup/js/fastclick.js
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * FastClick event implementation. (removes 300ms delay on touch devices)
- * Based on https://developers.google.com/mobile/articles/fast_buttons
- *
- * You may use it outside the Magnific Popup by calling just:
- *
- * $('.your-el').mfpFastClick(function() {
- * console.log('Clicked!');
- * });
- *
- * To unbind:
- * $('.your-el').destroyMfpFastClick();
- *
- *
- * Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound.
- * If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick
- *
- */
-
-(function() {
- var ghostClickDelay = 1000,
- supportsTouch = 'ontouchstart' in window,
- unbindTouchMove = function() {
- _window.off('touchmove'+ns+' touchend'+ns);
- },
- eName = 'mfpFastClick',
- ns = '.'+eName;
-
-
- // As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way
- $.fn.mfpFastClick = function(callback) {
-
- return $(this).each(function() {
-
- var elem = $(this),
- lock;
-
- if( supportsTouch ) {
-
- var timeout,
- startX,
- startY,
- pointerMoved,
- point,
- numPointers;
-
- elem.on('touchstart' + ns, function(e) {
- pointerMoved = false;
- numPointers = 1;
-
- point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0];
- startX = point.clientX;
- startY = point.clientY;
-
- _window.on('touchmove'+ns, function(e) {
- point = e.originalEvent ? e.originalEvent.touches : e.touches;
- numPointers = point.length;
- point = point[0];
- if (Math.abs(point.clientX - startX) > 10 ||
- Math.abs(point.clientY - startY) > 10) {
- pointerMoved = true;
- unbindTouchMove();
- }
- }).on('touchend'+ns, function(e) {
- unbindTouchMove();
- if(pointerMoved || numPointers > 1) {
- return;
- }
- lock = true;
- e.preventDefault();
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- lock = false;
- }, ghostClickDelay);
- callback();
- });
- });
-
- }
-
- elem.on('click' + ns, function() {
- if(!lock) {
- callback();
- }
- });
- });
- };
-
- $.fn.destroyMfpFastClick = function() {
- $(this).off('touchstart' + ns + ' click' + ns);
- if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns);
- };
-})();
\ No newline at end of file
diff --git a/public/legacy/js/magnific-popup/js/gallery.js b/public/legacy/js/magnific-popup/js/gallery.js
deleted file mode 100644
index 2b855a79..00000000
--- a/public/legacy/js/magnific-popup/js/gallery.js
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * Get looped index depending on number of slides
- */
-var _getLoopedId = function(index) {
- var numSlides = mfp.items.length;
- if(index > numSlides - 1) {
- return index - numSlides;
- } else if(index < 0) {
- return numSlides + index;
- }
- return index;
- },
- _replaceCurrTotal = function(text, curr, total) {
- return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
- };
-
-$.magnificPopup.registerModule('gallery', {
-
- options: {
- enabled: false,
- arrowMarkup: '',
- preload: [0,2],
- navigateByImgClick: true,
- arrows: true,
-
- tPrev: 'Previous (Left arrow key)',
- tNext: 'Next (Right arrow key)',
- tCounter: '%curr% of %total%'
- },
-
- proto: {
- initGallery: function() {
-
- var gSt = mfp.st.gallery,
- ns = '.mfp-gallery',
- supportsFastClick = Boolean($.fn.mfpFastClick);
-
- mfp.direction = true; // true - next, false - prev
-
- if(!gSt || !gSt.enabled ) return false;
-
- _wrapClasses += ' mfp-gallery';
-
- _mfpOn(OPEN_EVENT+ns, function() {
-
- if(gSt.navigateByImgClick) {
- mfp.wrap.on('click'+ns, '.mfp-img', function() {
- if(mfp.items.length > 1) {
- mfp.next();
- return false;
- }
- });
- }
-
- _document.on('keydown'+ns, function(e) {
- if (e.keyCode === 37) {
- mfp.prev();
- } else if (e.keyCode === 39) {
- mfp.next();
- }
- });
- });
-
- _mfpOn('UpdateStatus'+ns, function(e, data) {
- if(data.text) {
- data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
- }
- });
-
- _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
- var l = mfp.items.length;
- values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
- });
-
- _mfpOn('BuildControls' + ns, function() {
- if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
- var markup = gSt.arrowMarkup,
- arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
- arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
-
- var eName = supportsFastClick ? 'mfpFastClick' : 'click';
- arrowLeft[eName](function() {
- mfp.prev();
- });
- arrowRight[eName](function() {
- mfp.next();
- });
-
- // Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b)
- if(mfp.isIE7) {
- _getEl('b', arrowLeft[0], false, true);
- _getEl('a', arrowLeft[0], false, true);
- _getEl('b', arrowRight[0], false, true);
- _getEl('a', arrowRight[0], false, true);
- }
-
- mfp.container.append(arrowLeft.add(arrowRight));
- }
- });
-
- _mfpOn(CHANGE_EVENT+ns, function() {
- if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
-
- mfp._preloadTimeout = setTimeout(function() {
- mfp.preloadNearbyImages();
- mfp._preloadTimeout = null;
- }, 16);
- });
-
-
- _mfpOn(CLOSE_EVENT+ns, function() {
- _document.off(ns);
- mfp.wrap.off('click'+ns);
-
- if(mfp.arrowLeft && supportsFastClick) {
- mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick();
- }
- mfp.arrowRight = mfp.arrowLeft = null;
- });
-
- },
- next: function() {
- mfp.direction = true;
- mfp.index = _getLoopedId(mfp.index + 1);
- mfp.updateItemHTML();
- },
- prev: function() {
- mfp.direction = false;
- mfp.index = _getLoopedId(mfp.index - 1);
- mfp.updateItemHTML();
- },
- goTo: function(newIndex) {
- mfp.direction = (newIndex >= mfp.index);
- mfp.index = newIndex;
- mfp.updateItemHTML();
- },
- preloadNearbyImages: function() {
- var p = mfp.st.gallery.preload,
- preloadBefore = Math.min(p[0], mfp.items.length),
- preloadAfter = Math.min(p[1], mfp.items.length),
- i;
-
- for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
- mfp._preloadItem(mfp.index+i);
- }
- for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
- mfp._preloadItem(mfp.index-i);
- }
- },
- _preloadItem: function(index) {
- index = _getLoopedId(index);
-
- if(mfp.items[index].preloaded) {
- return;
- }
-
- var item = mfp.items[index];
- if(!item.parsed) {
- item = mfp.parseEl( index );
- }
-
- _mfpTrigger('LazyLoad', item);
-
- if(item.type === 'image') {
- item.img = $('
').on('load.mfploader', function() {
- item.hasSize = true;
- }).on('error.mfploader', function() {
- item.hasSize = true;
- item.loadError = true;
- _mfpTrigger('LazyLoadError', item);
- }).attr('src', item.src);
- }
-
-
- item.preloaded = true;
- }
- }
-});
-
-/*
-Touch Support that might be implemented some day
-
-addSwipeGesture: function() {
- var startX,
- moved,
- multipleTouches;
-
- return;
-
- var namespace = '.mfp',
- addEventNames = function(pref, down, move, up, cancel) {
- mfp._tStart = pref + down + namespace;
- mfp._tMove = pref + move + namespace;
- mfp._tEnd = pref + up + namespace;
- mfp._tCancel = pref + cancel + namespace;
- };
-
- if(window.navigator.msPointerEnabled) {
- addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');
- } else if('ontouchstart' in window) {
- addEventNames('touch', 'start', 'move', 'end', 'cancel');
- } else {
- return;
- }
- _window.on(mfp._tStart, function(e) {
- var oE = e.originalEvent;
- multipleTouches = moved = false;
- startX = oE.pageX || oE.changedTouches[0].pageX;
- }).on(mfp._tMove, function(e) {
- if(e.originalEvent.touches.length > 1) {
- multipleTouches = e.originalEvent.touches.length;
- } else {
- //e.preventDefault();
- moved = true;
- }
- }).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) {
- if(moved && !multipleTouches) {
- var oE = e.originalEvent,
- diff = startX - (oE.pageX || oE.changedTouches[0].pageX);
-
- if(diff > 20) {
- mfp.next();
- } else if(diff < -20) {
- mfp.prev();
- }
- }
- });
-},
-*/
diff --git a/public/legacy/js/magnific-popup/js/iframe.js b/public/legacy/js/magnific-popup/js/iframe.js
deleted file mode 100644
index 396c1398..00000000
--- a/public/legacy/js/magnific-popup/js/iframe.js
+++ /dev/null
@@ -1,102 +0,0 @@
-
-var IFRAME_NS = 'iframe',
- _emptyPage = '//about:blank',
-
- _fixIframeBugs = function(isShowing) {
- if(mfp.currTemplate[IFRAME_NS]) {
- var el = mfp.currTemplate[IFRAME_NS].find('iframe');
- if(el.length) {
- // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
- if(!isShowing) {
- el[0].src = _emptyPage;
- }
-
- // IE8 black screen bug fix
- if(mfp.isIE8) {
- el.css('display', isShowing ? 'block' : 'none');
- }
- }
- }
- };
-
-$.magnificPopup.registerModule(IFRAME_NS, {
-
- options: {
- markup: '
-Demos, a tutorial, documentation and support: http://mmenu.frebsite.nl
-
-
-
-**Position and z-position**
-The menu can be positioned at the top, right, bottom or left, at the back, front or next to the page.
-
-**Submenus**
-Use sliding horizontal or expanding vertical submenus.
-
-**Touch-ready**
-Optionally reveal the menu by dragging the page out of the viewport.
-
-**Add-ons**
-Add a search field, headers, labels, counters, toggles and more.
-
-**Extensions**
-Easily add opening and closing effects, change the color scheme or change the size and position.
-
-**Support**
-Plays nicely with jQuery Mobile and works well on all major desktop and mobile browsers.
-
-### Learn more
-+ [Tutorial](http://mmenu.frebsite.nl/tutorial/)
-+ [Options](http://mmenu.frebsite.nl/documentation/options/)
-+ [Custom events](http://mmenu.frebsite.nl/documentation/custom-events.html)
-+ [Extensions](http://mmenu.frebsite.nl/documentation/extensions/)
-+ [Add-ons](http://mmenu.frebsite.nl/documentation/addons/)
-
-### Licence
-The jQuery.mmenu plugin is dual licensed under the MIT license:
-+ http://en.wikipedia.org/wiki/MIT_License
diff --git a/public/legacy/js/mmenu/bower.json b/public/legacy/js/mmenu/bower.json
deleted file mode 100644
index b22326d1..00000000
--- a/public/legacy/js/mmenu/bower.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name" : "jQuery.mmenu",
- "version" : "5.0.4",
- "authors" : "Fred Heusschen
- Click the menu icon to open the menu.
- Click the menu icon to open the menu.
- Click the menu icon to open the menu.
- Notice how the fixed header and footer slide out along with the page.
- You can also drag the page to the right to open the menu.
- Open the menu.mmenu
- ')
- .prependTo( this.$menu )
- .children();
-
- this.bind( 'openPanel', update );
-
-
- // Set correct value onScroll
- this.bind( 'init',
- function( $panels )
- {
- $panels
- .off( _e.scroll + '-dividers ' + _e.touchmove + '-dividers' )
- .on( _e.scroll + '-dividers ' + _e.touchmove + '-dividers',
- function( e )
- {
- update.call( that, $(this) );
- }
- )
- }
- );
-
- }
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'collapsed uncollapsed fixeddivider hasdividers' );
- _e.add( 'scroll' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu )
- {
- if ( this.opts[ _ADDON_ ].collapse && inMenu )
- {
- var $l = $a.parent();
- if ( $l.is( '.' + _c.divider ) )
- {
- var $e = $l.nextUntil( '.' + _c.divider, '.' + _c.collapsed );
-
- $l.toggleClass( _c.opened );
- $e[ $l.hasClass( _c.opened ) ? 'addClass' : 'removeClass' ]( _c.uncollapsed );
-
- return true;
- }
- }
- return false;
- }
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- add : false,
- addTo : 'panels',
- fixed : false,
- collapse : false
- };
- $[ _PLUGIN_ ].configuration.classNames[ _ADDON_ ] = {
- collapsed: 'Collapsed'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.dragopen.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.dragopen.js
deleted file mode 100644
index fe82e45b..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.dragopen.js
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * jQuery mmenu dragOpen addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'dragOpen';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- if ( !this.opts.offCanvas )
- {
- return;
- }
-
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Extend shortcut options
- if ( typeof opts == 'boolean' )
- {
- opts = {
- open: opts
- };
- }
- if ( typeof opts != 'object' )
- {
- opts = {};
- }
- opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
-
-
- // Drag open
- if ( opts.open )
- {
-
- // Set up variables
- var drag = {},
- _stage = 0,
- _direction = false,
- _dimension = false,
- _distance = 0,
- _maxDistance = 0;
-
- var new_distance, drag_distance, css_value,
- doPanstart, getSlideNodes;
-
- switch( this.opts.offCanvas.position )
- {
- case 'left':
- case 'right':
- drag.events = 'panleft panright';
- drag.typeLower = 'x';
- drag.typeUpper = 'X';
-
- _dimension = 'width';
- break;
-
- case 'top':
- case 'bottom':
- drag.events = 'panup pandown';
- drag.typeLower = 'y';
- drag.typeUpper = 'Y';
-
- _dimension = 'height';
- break;
- }
-
- switch( this.opts.offCanvas.position )
- {
- case 'right':
- case 'bottom':
- drag.negative = true;
- doPanstart = function( pos )
- {
- if ( pos >= glbl.$wndw[ _dimension ]() - opts.maxStartPos )
- {
- _stage = 1;
- }
- };
- break;
-
- default:
- drag.negative = false;
- doPanstart = function( pos )
- {
- if ( pos <= opts.maxStartPos )
- {
- _stage = 1;
- }
- }
- break;
- }
-
- switch( this.opts.offCanvas.position )
- {
- case 'left':
- drag.open_dir = 'right';
- drag.close_dir = 'left';
- break;
-
- case 'right':
- drag.open_dir = 'left';
- drag.close_dir = 'right';
- break;
-
- case 'top':
- drag.open_dir = 'down';
- drag.close_dir = 'up';
- break;
-
- case 'bottom':
- drag.open_dir = 'up';
- drag.close_dir = 'down';
- break;
- }
-
- switch ( this.opts.offCanvas.zposition )
- {
- case 'front':
- getSlideNodes = function()
- {
- return this.$menu;
- };
- break;
-
- default:
- getSlideNodes = function()
- {
- return $('.' + _c.slideout);
- };
- break;
- };
-
- var $dragNode = this.__valueOrFn( opts.pageNode, this.$menu, glbl.$page );
-
- if ( typeof $dragNode == 'string' )
- {
- $dragNode = $($dragNode);
- }
-
-
- // Bind events
- var _hammer = new Hammer( $dragNode[ 0 ], opts.vendors.hammer );
-
- _hammer
- .on( 'panstart',
- function( e )
- {
- doPanstart( e.center[ drag.typeLower ] );
- glbl.$slideOutNodes = getSlideNodes();
- _direction = drag.open_dir;
- }
- )
- .on( drag.events + ' panend',
- function( e )
- {
- if ( _stage > 0 )
- {
- e.preventDefault();
- }
- }
- )
- .on( drag.events,
- function( e )
- {
-
- new_distance = e[ 'delta' + drag.typeUpper ];
- if ( drag.negative )
- {
- new_distance = -new_distance;
- }
-
- if ( new_distance != _distance )
- {
- _direction = ( new_distance >= _distance )
- ? drag.open_dir
- : drag.close_dir;
- }
-
- _distance = new_distance;
-
- if ( _distance > opts.threshold )
- {
- if ( _stage == 1 )
- {
- if ( glbl.$html.hasClass( _c.opened ) )
- {
- return;
- }
- _stage = 2;
-
- that._openSetup();
- that.trigger( 'opening' );
- glbl.$html.addClass( _c.dragging );
-
- _maxDistance = minMax(
- glbl.$wndw[ _dimension ]() * conf[ _dimension ].perc,
- conf[ _dimension ].min,
- conf[ _dimension ].max
- );
- }
- }
- if ( _stage == 2 )
- {
- drag_distance = minMax( _distance, 10, _maxDistance ) - ( that.opts.offCanvas.zposition == 'front' ? _maxDistance : 0 );
- if ( drag.negative )
- {
- drag_distance = -drag_distance;
- }
- css_value = 'translate' + drag.typeUpper + '(' + drag_distance + 'px )';
-
- glbl.$slideOutNodes.css({
- '-webkit-transform': '-webkit-' + css_value,
- 'transform': css_value
- });
- }
- }
- )
- .on( 'panend',
- function( e )
- {
- if ( _stage == 2 )
- {
- glbl.$html.removeClass( _c.dragging );
- glbl.$slideOutNodes.css( 'transform', '' );
- that[ _direction == drag.open_dir ? '_openFinish' : 'close' ]();
- }
- _stage = 0;
- }
- );
- }
- },
-
- // add: fired once per page load
- add: function()
- {
- if ( typeof Hammer != 'function' || Hammer.VERSION < 2 )
- {
- $[ _PLUGIN_ ].addons[ _ADDON_ ].setup = function() {};
- return;
- }
-
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'dragging' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- open : false,
-// pageNode : null,
- maxStartPos : 100,
- threshold : 50,
- vendors : {
- hammer : {}
- }
- };
- $[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
- width : {
- perc : 0.8,
- min : 140,
- max : 440
- },
- height : {
- perc : 0.8,
- min : 140,
- max : 880
- }
- };
-
-
- var _c, _d, _e, glbl;
-
-
- function minMax( val, min, max )
- {
- if ( val < min )
- {
- val = min;
- }
- if ( val > max )
- {
- val = max;
- }
- return val;
- }
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.fixedelements.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.fixedelements.js
deleted file mode 100644
index 23cd5b4c..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.fixedelements.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * jQuery mmenu fixedElements addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'fixedElements';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- if ( !this.opts.offCanvas )
- {
- return;
- }
-
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
- var setPage = function( $page )
- {
- // Refactor fixed classes
- var _fixd = this.conf.classNames[ _ADDON_ ].fixed;
-
- this.__refactorClass( $page.find( '.' + _fixd ), _fixd, 'fixed' )
- .appendTo( glbl.$body )
- .addClass( _c.slideout );
- };
- setPage.call( this, glbl.$page );
- this.bind( 'setPage', setPage );
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'fixed' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].configuration.classNames[ _ADDON_ ] = {
- fixed : 'Fixed'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.footer.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.footer.js
deleted file mode 100644
index 6581f7f5..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.footer.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * jQuery mmenu footer addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'footer';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Extend shortcut options
- if ( typeof opts == 'boolean' )
- {
- opts = {
- add : opts,
- update : opts
- };
- }
- if ( typeof opts != 'object' )
- {
- opts = {};
- }
- opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
-
-
- // Add markup
- if ( opts.add )
- {
- var content = opts.content
- ? opts.content
- : opts.title;
-
- $( '' )
- .appendTo( this.$menu )
- .append( content );
-
- this.$menu.addClass( _c.hasfooter );
- }
- this.$footer = this.$menu.children( '.' + _c.footer );
-
-
- // Update content
- if ( opts.update && this.$footer && this.$footer.length )
- {
- var update = function( $panl )
- {
- $panl = $panl || this.$menu.children( '.' + _c.current );
- var _cnt = $('.' + this.conf.classNames[ _ADDON_ ].panelFooter, $panl).html() || opts.title;
-
- this.$footer[ _cnt ? 'removeClass' : 'addClass' ]( _c.hidden );
- this.$footer.html( _cnt );
- };
-
- this.bind( 'openPanel', update );
- this.bind( 'init',
- function()
- {
- update.call( this, this.$menu.children( '.' + _c.current ) );
- }
- );
- }
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'footer hasfooter' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- add : false,
- content : false,
- title : '',
- update : false
- };
- $[ _PLUGIN_ ].configuration.classNames[ _ADDON_ ] = {
- panelFooter: 'Footer'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.header.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.header.js
deleted file mode 100644
index f80d8264..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.header.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * jQuery mmenu header addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'header';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Extend shortcut options
- if ( typeof opts == 'boolean' )
- {
- opts = {
- add : opts,
- update : opts
- };
- }
- if ( typeof opts != 'object' )
- {
- opts = {};
- }
- if ( typeof opts.content == 'undefined' )
- {
- opts.content = [ 'prev', 'title', 'next' ];
- }
- opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
-
-
- // Add markup
- if ( opts.add )
- {
- if ( opts.content instanceof Array )
- {
- var $content = $( '' );
- for ( var c = 0, l = opts.content.length; c < l; c++ )
- {
- switch ( opts.content[ c ] )
- {
- case 'prev':
- case 'next':
- case 'close':
- $content.append( '' );
- break;
-
- case 'title':
- $content.append( '' );
- break;
-
- default:
- $content.append( opts.content[ c ] );
- break;
- }
- }
- $content = $content.html();
- }
- else
- {
- var $content = opts.content;
- }
-
- $( '' )
- .prependTo( this.$menu )
- .append( $content );
-
- this.$menu
- .addClass( _c.hasheader );
-
- this.bind( 'init',
- function( $panel )
- {
- $panel.removeClass( _c.hasheader );
- }
- );
- }
- this.$header = this.$menu.children( '.' + _c.header );
-
-
- // Update content
- if ( opts.update && this.$header && this.$header.length )
- {
- var $titl = this.$header.find( '.' + _c.title ),
- $prev = this.$header.find( '.' + _c.prev ),
- $next = this.$header.find( '.' + _c.next ),
- $clse = this.$header.find( '.' + _c.close );
-
- var update = function( $panl )
- {
- $panl = $panl || this.$menu.children( '.' + _c.current );
-
- // Find title, prev and next
- var $ttl = $panl.find( '.' + this.conf.classNames[ _ADDON_ ].panelHeader ),
- $prv = $panl.find( '.' + this.conf.classNames[ _ADDON_ ].panelPrev ),
- $nxt = $panl.find( '.' + this.conf.classNames[ _ADDON_ ].panelNext ),
- $prt = $panl.data( _d.parent );
-
- var _ttl = $ttl.html(),
- _prv = $prv.attr( 'href' ),
- _nxt = $nxt.attr( 'href' ),
- _prt = false;
-
- var _prv_txt = $prv.html(),
- _nxt_txt = $nxt.html();
-
- if ( !_ttl )
- {
- _ttl = $panl.children( '.' + _c.header ).children( '.' + _c.title ).html();
- }
-
- if ( !_ttl )
- {
- _ttl = opts.title;
- }
- if ( !_prv )
- {
- _prv = $panl.children( '.' + _c.header ).children( '.' + _c.prev ).attr( 'href' );
- }
-
- switch ( opts.titleLink )
- {
- case 'anchor':
- var _prt = ( $prt ) ? $prt.children( 'a' ).not( '.' + _c.next ).attr( 'href' ) : false;
- break;
-
- case 'panel':
- var _prt = _prv;
- break;
- }
-
- $titl[ _prt ? 'attr' : 'removeAttr' ]( 'href', _prt );
- $titl[ _ttl ? 'removeClass' : 'addClass' ]( _c.hidden );
- $titl.html( _ttl );
-
- $prev[ _prv ? 'attr' : 'removeAttr' ]( 'href', _prv );
- $prev[ _prv || _prv_txt ? 'removeClass' : 'addClass' ]( _c.hidden );
- $prev.html( _prv_txt );
-
- $next[ _nxt ? 'attr' : 'removeAttr' ]( 'href', _nxt );
- $next[ _nxt || _nxt_txt ? 'removeClass' : 'addClass' ]( _c.hidden );
- $next.html( _nxt_txt );
- };
-
- this.bind( 'openPanel', update );
- this.bind( 'init',
- function()
- {
- update.call( this, this.$menu.children( '.' + _c.current ) );
- }
- );
-
- if ( this.opts.offCanvas )
- {
- var setPage = function( $page )
- {
- $clse.attr( 'href', '#' + $page.attr( 'id' ) );
- };
- setPage.call( this, glbl.$page );
- this.bind( 'setPage', setPage );
- }
- }
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'close' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- add : false,
-// content : [ 'prev', 'title', 'next' ],
- title : 'Menu',
- titleLink : 'panel',
- update : false
- };
- $[ _PLUGIN_ ].configuration.classNames[ _ADDON_ ] = {
- panelHeader : 'Header',
- panelNext : 'Next',
- panelPrev : 'Prev'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.offcanvas.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.offcanvas.js
deleted file mode 100644
index 9fd8075f..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.offcanvas.js
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * jQuery mmenu offCanvas addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'offCanvas';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- if ( !this.opts[ _ADDON_ ] )
- {
- return;
- }
-
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Add methods to api
- this._api = $.merge( this._api, [ 'open', 'close', 'setPage' ] );
-
-
- // Debug positioning
- if ( opts.position == 'top' || opts.position == 'bottom' )
- {
- opts.zposition = 'front';
- }
-
-
- // Extend configuration
- if ( typeof conf.pageSelector != 'string' )
- {
- conf.pageSelector = '> ' + conf.pageNodetype;
- }
-
-
- glbl.$allMenus = ( glbl.$allMenus || $() ).add( this.$menu );
-
-
- // Setup the menu
- this.vars.opened = false;
-
- var clsn = [ _c.offcanvas ];
-
- if ( opts.position != 'left' )
- {
- clsn.push( _c.mm( opts.position ) );
- }
- if ( opts.zposition != 'back' )
- {
- clsn.push( _c.mm( opts.zposition ) );
- }
-
- this.$menu
- .addClass( clsn.join( ' ' ) )
- .parent()
- .removeClass( _c.wrapper );
-
-
- // Setup the page
- this.setPage( glbl.$page );
-
-
- // Setup the UI blocker and the window
- this._initBlocker();
- this[ '_initWindow_' + _ADDON_ ]();
-
-
- // Append to the body
- this.$menu[ conf.menuInjectMethod + 'To' ]( conf.menuWrapperSelector );
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'offcanvas slideout modal background opening blocker page' );
- _d.add( 'style' );
- _e.add( 'resize' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu )
- {
- if ( !this.opts[ _ADDON_ ] )
- {
- return false;
- }
-
- // Open menu
- var id = this.$menu.attr( 'id' );
- if ( id && id.length )
- {
- if ( this.conf.clone )
- {
- id = _c.umm( id );
- }
- if ( $a.is( '[href="#' + id + '"]' ) )
- {
- this.open();
- return true;
- }
- }
-
- // Close menu
- if ( !glbl.$page )
- {
- return;
- }
- var id = glbl.$page.attr( 'id' );
- if ( id && id.length )
- {
- if ( $a.is( '[href="#' + id + '"]' ) )
- {
- this.close();
- return true;
- }
- }
-
- return false;
- }
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- position : 'left',
- zposition : 'back',
- modal : false,
- moveBackground : true
- };
- $[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
- pageNodetype : 'div',
- pageSelector : null,
- menuWrapperSelector : 'body',
- menuInjectMethod : 'prepend'
- };
-
-
- // Methods
- $[ _PLUGIN_ ].prototype.open = function()
- {
- if ( this.vars.opened )
- {
- return;
- }
-
- var that = this;
-
- this._openSetup();
-
- // Without the timeout, the animation won't work because the element had display: none;
- setTimeout(
- function()
- {
- that._openFinish();
- }, this.conf.openingInterval
- );
- this.trigger( 'open' );
- };
-
- $[ _PLUGIN_ ].prototype._openSetup = function()
- {
- var that = this;
-
- // Close other menus
- this.closeAllOthers();
-
- // Store style and position
- glbl.$page.data( _d.style, glbl.$page.attr( 'style' ) || '' );
-
- // Trigger window-resize to measure height
- glbl.$wndw.trigger( _e.resize + '-offcanvas', [ true ] );
-
- var clsn = [ _c.opened ];
-
- // Add options
- if ( this.opts[ _ADDON_ ].modal )
- {
- clsn.push( _c.modal );
- }
- if ( this.opts[ _ADDON_ ].moveBackground )
- {
- clsn.push( _c.background );
- }
- if ( this.opts[ _ADDON_ ].position != 'left' )
- {
- clsn.push( _c.mm( this.opts[ _ADDON_ ].position ) );
- }
- if ( this.opts[ _ADDON_ ].zposition != 'back' )
- {
- clsn.push( _c.mm( this.opts[ _ADDON_ ].zposition ) );
- }
- if ( this.opts.extensions )
- {
- clsn.push( this.opts.extensions );
- }
- glbl.$html.addClass( clsn.join( ' ' ) );
-
- // Open
- setTimeout(function(){
- that.vars.opened = true;
- },this.conf.openingInterval);
-
- this.$menu.addClass( _c.current + ' ' + _c.opened );
- };
-
- $[ _PLUGIN_ ].prototype._openFinish = function()
- {
- var that = this;
-
- // Callback
- this.__transitionend( glbl.$page,
- function()
- {
- that.trigger( 'opened' );
- }, this.conf.transitionDuration
- );
-
- // Opening
- glbl.$html.addClass( _c.opening );
- this.trigger( 'opening' );
- };
-
- $[ _PLUGIN_ ].prototype.close = function()
- {
- if ( !this.vars.opened )
- {
- return;
- }
-
- var that = this;
-
- // Callback
- this.__transitionend( glbl.$page,
- function()
- {
- that.$menu
- .removeClass( _c.current )
- .removeClass( _c.opened );
-
- glbl.$html
- .removeClass( _c.opened )
- .removeClass( _c.modal )
- .removeClass( _c.background )
- .removeClass( _c.mm( that.opts[ _ADDON_ ].position ) )
- .removeClass( _c.mm( that.opts[ _ADDON_ ].zposition ) );
-
- if ( that.opts.extensions )
- {
- glbl.$html.removeClass( that.opts.extensions );
- }
-
- // Restore style and position
- glbl.$page.attr( 'style', glbl.$page.data( _d.style ) );
-
- that.vars.opened = false;
- that.trigger( 'closed' );
-
- }, this.conf.transitionDuration
- );
-
- // Closing
- glbl.$html.removeClass( _c.opening );
- this.trigger( 'close' );
- this.trigger( 'closing' );
- };
-
- $[ _PLUGIN_ ].prototype.closeAllOthers = function()
- {
- glbl.$allMenus
- .not( this.$menu )
- .each(
- function()
- {
- var api = $(this).data( _PLUGIN_ );
- if ( api && api.close )
- {
- api.close();
- }
- }
- );
- }
-
- $[ _PLUGIN_ ].prototype.setPage = function( $page )
- {
- if ( !$page || !$page.length )
- {
- $page = $(this.conf[ _ADDON_ ].pageSelector, glbl.$body);
- if ( $page.length > 1 )
- {
- $page = $page.wrapAll( '<' + this.conf[ _ADDON_ ].pageNodetype + ' />' ).parent();
- }
- }
-
- $page.attr( 'id', $page.attr( 'id' ) || this.__getUniqueId() );
- $page.addClass( _c.page + ' ' + _c.slideout );
- glbl.$page = $page;
-
- this.trigger( 'setPage', $page );
- };
-
- $[ _PLUGIN_ ].prototype[ '_initWindow_' + _ADDON_ ] = function()
- {
- // Prevent tabbing
- glbl.$wndw
- .off( _e.keydown + '-offcanvas' )
- .on( _e.keydown + '-offcanvas',
- function( e )
- {
- if ( glbl.$html.hasClass( _c.opened ) )
- {
- if ( e.keyCode == 9 )
- {
- e.preventDefault();
- return false;
- }
- }
- }
- );
-
- // Set page min-height to window height
- var _h = 0;
- glbl.$wndw
- .off( _e.resize + '-offcanvas' )
- .on( _e.resize + '-offcanvas',
- function( e, force )
- {
- if ( force || glbl.$html.hasClass( _c.opened ) )
- {
- var nh = glbl.$wndw.height();
- if ( force || nh != _h )
- {
- _h = nh;
- glbl.$page.css( 'minHeight', nh );
- }
- }
- }
- );
- };
-
- $[ _PLUGIN_ ].prototype._initBlocker = function()
- {
- var that = this;
-
- if ( !glbl.$blck )
- {
- glbl.$blck = $( '' );
- }
-
- glbl.$blck
- .appendTo( glbl.$body )
- .off( _e.touchstart + '-offcanvas ' + _e.touchmove + '-offcanvas' )
- .on( _e.touchstart + '-offcanvas ' + _e.touchmove + '-offcanvas',
- function( e )
- {
- e.preventDefault();
- e.stopPropagation();
- glbl.$blck.trigger( _e.mousedown + '-offcanvas' );
- }
- )
- .off( _e.mousedown + '-offcanvas' )
- .on( _e.mousedown + '-offcanvas',
- function( e )
- {
- e.preventDefault();
- if ( !glbl.$html.hasClass( _c.modal ) )
- {
- that.closeAllOthers();
- that.close();
- }
- }
- );
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.searchfield.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.searchfield.js
deleted file mode 100644
index b695a639..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.searchfield.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * jQuery mmenu searchfield addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'searchfield';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Extend shortcut options
- if ( typeof opts == 'boolean' )
- {
- opts = {
- add : opts,
- search : opts
- };
- }
- if ( typeof opts != 'object' )
- {
- opts = {};
- }
- opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
-
-
- // Bind functions to update
- this.bind( 'init',
- function( $panels )
- {
- // Add the searchfield(s)
- if ( opts.add )
- {
- switch( opts.addTo )
- {
- case 'menu':
- var $wrapper = this.$menu;
- break;
-
- case 'panels':
- var $wrapper = $panels;
- break;
-
- default:
- var $wrapper = $(opts.addTo, this.$menu).filter( '.' + _c.panel );
- break;
- }
-
- $wrapper
- .each(
- function()
- {
- // Add the searchfield
- var $panl = $(this);
- if ( $panl.is( '.' + _c.panel ) && $panl.is( '.' + _c.vertical ) )
- {
- return;
- }
-
- if ( !$panl.children( '.' + _c.search ).length )
- {
- var _node = ( conf.form )
- ? 'form'
- : 'div';
-
- var $node = $( '<' + _node + ' class="' + _c.search + '" />' );
-
- if ( conf.form && typeof conf.form == 'object' )
- {
- for ( var f in conf.form )
- {
- $node.attr( f, conf.form[ f ] );
- }
- }
-
- $node.append( '' )
- .prependTo( $panl );
-
- $panl.addClass( _c.hassearch );
- }
-
- if ( opts.noResults )
- {
- if ( $panl.is( '.' + _c.menu ) )
- {
- $panl = $panl.children( '.' + _c.panel ).first();
- }
- if ( !$panl.children( '.' + _c.noresultsmsg ).length )
- {
- var $lst = $panl.children( '.' + _c.listview );
-
- $( '' )
- .append( opts.noResults )
- [ $lst.length ? 'insertBefore' : 'prependTo' ]( $lst.length ? $lst : $panl );
- }
- }
- }
- );
- }
-
-/*
- if ( this.$menu.children( '.' + _c.search ).length )
- {
- this.$menu.addClass( _c.hassearch );
- }
-*/
-
- // Search through list items
- if ( opts.search )
- {
- $('.' + _c.search, this.$menu)
- .each(
- function()
- {
- var $srch = $(this);
-
- if ( opts.addTo == 'menu' )
- {
- var $pnls = $('.' + _c.panel, that.$menu),
- $panl = that.$menu;
- }
- else
- {
- var $pnls = $srch.closest( '.' + _c.panel ),
- $panl = $pnls;
- }
- var $inpt = $srch.children( 'input' ),
- $itms = that.__findAddBack( $pnls, '.' + _c.listview ).children( 'li' ),
- $dvdr = $itms.filter( '.' + _c.divider ),
- $rslt = that.__filterListItems( $itms );
-
- var _anchor = '> a',
- _both = _anchor + ', > span';
-
- var search = function()
- {
-
- var query = $inpt.val().toLowerCase();
-
- // Scroll to top
- $pnls.scrollTop( 0 );
-
- // Search through items
- $rslt
- .add( $dvdr )
- .addClass( _c.hidden )
- .find( '.' + _c.fullsubopensearch )
- .removeClass( _c.fullsubopen )
- .removeClass( _c.fullsubopensearch );
-
- $rslt
- .each(
- function()
- {
- var $item = $(this),
- _search = _anchor;
-
- if ( opts.showTextItems || ( opts.showSubPanels && $item.find( '.' + _c.next ) ) )
- {
- _search = _both;
- }
-
- if ( $(_search, $item).text().toLowerCase().indexOf( query ) > -1 )
- {
- $item.add( $item.prevAll( '.' + _c.divider ).first() ).removeClass( _c.hidden );
- }
- }
- );
-
- // Update sub items
- if ( opts.showSubPanels )
- {
- $pnls.each(
- function( i )
- {
- var $panl = $(this);
- that.__filterListItems( $panl.find( '.' + _c.listview ).children() )
- .each(
- function()
- {
- var $li = $(this),
- $su = $li.data( _d.sub );
-
- $li.removeClass( _c.nosubresults );
- if ( $su )
- {
- $su.find( '.' + _c.listview ).children().removeClass( _c.hidden );
- }
- }
- );
- }
- );
- }
-
- // Update parent for submenus
- $( $pnls.get().reverse() )
- .each(
- function( i )
- {
- var $panl = $(this),
- $prnt = $panl.data( _d.parent );
-
- if ( $prnt )
- {
- if ( that.__filterListItems( $panl.find( '.' + _c.listview ).children() ).length )
- {
- if ( $prnt.hasClass( _c.hidden ) )
- {
- $prnt.children( '.' + _c.next )
- .not( '.' + _c.fullsubopen )
- .addClass( _c.fullsubopen )
- .addClass( _c.fullsubopensearch );
- }
- $prnt
- .removeClass( _c.hidden )
- .removeClass( _c.nosubresults )
- .prevAll( '.' + _c.divider )
- .first()
- .removeClass( _c.hidden );
- }
- else if ( opts.addTo == 'menu' )
- {
- if ( $panl.hasClass( _c.opened ) )
- {
- // Compensate the timeout for the opening animation
- setTimeout(
- function()
- {
- that.openPanel( $prnt.closest( '.' + _c.panel ) );
- }, ( i + 1 ) * ( that.conf.openingInterval * 1.5 )
- );
- }
- $prnt.addClass( _c.nosubresults );
- }
- }
- }
- );
-
- // Show/hide no results message
- $panl[ $rslt.not( '.' + _c.hidden ).length ? 'removeClass' : 'addClass' ]( _c.noresults );
-
- // Update for other addons
- this.update();
- }
-
-
- $inpt
- .off( _e.keyup + '-searchfield ' + _e.change + '-searchfield' )
- .on( _e.keyup + '-searchfield',
- function( e )
- {
- if ( !preventKeypressSearch( e.keyCode ) )
- {
- search.call( that );
- }
- }
- )
- .on( _e.change + '-searchfield',
- function( e )
- {
- search.call( that );
- }
- );
- }
- );
- }
- }
- );
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'search hassearch noresultsmsg noresults nosubresults fullsubopensearch' );
- _e.add( 'change keyup' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- add : false,
- addTo : 'menu',
- search : false,
- placeholder : 'Search',
- noResults : 'No results found.',
- showTextItems : false,
- showSubPanels : true
- };
- $[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
- form : false
- };
-
-
- var _c, _d, _e, glbl;
-
-
- function preventKeypressSearch( c )
- {
- switch( c )
- {
- case 9: // tab
- case 16: // shift
- case 17: // control
- case 18: // alt
- case 37: // left
- case 38: // top
- case 39: // right
- case 40: // bottom
- return true;
- }
- return false;
- }
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.sectionindexer.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.sectionindexer.js
deleted file mode 100644
index 671867c7..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.sectionindexer.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * jQuery mmenu sectionIndexer addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'sectionIndexer';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- // Extend shortcut options
- if ( typeof opts == 'boolean' )
- {
- opts = {
- add: opts
- };
- }
- if ( typeof opts != 'object' )
- {
- opts = {};
- }
- opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
-
-
- this.bind( 'init',
- function( $panels )
- {
- // Set the panel(s)
- if ( opts.add )
- {
- switch( opts.addTo )
- {
- case 'panels':
- var $wrapper = $panels;
- break;
-
- default:
- var $wrapper = $(opts.addTo, this.$menu).filter( '.' + _c.panel );
- break;
- }
-
- $wrapper
- .find( '.' + _c.divider )
- .closest( '.' + _c.panel )
- .addClass( _c.hasindexer );
- }
-
-
- // Add the indexer, only if it does not allready excists
- if ( !this.$indexer &&
- this.$menu.children( '.' + _c.hasindexer ).length
- ) {
- this.$indexer = $( '' )
- .prependTo( this.$menu )
- .append(
- 'a' +
- 'b' +
- 'c' +
- 'd' +
- 'e' +
- 'f' +
- 'g' +
- 'h' +
- 'i' +
- 'j' +
- 'k' +
- 'l' +
- 'm' +
- 'n' +
- 'o' +
- 'p' +
- 'q' +
- 'r' +
- 's' +
- 't' +
- 'u' +
- 'v' +
- 'w' +
- 'x' +
- 'y' +
- 'z' +
- '#' );
-
- // Scroll onMouseOver
- this.$indexer
- .children()
- .on( _e.mouseover + '-searchfield ' + _c.touchmove + '-searchfield',
- function( e )
- {
- var lttr = $(this).attr( 'href' ).slice( 1 ),
- $panl = that.$menu.children( '.' + _c.current ),
- $list = $panl.find( '.' + _c.listview );
-
- var newTop = false,
- oldTop = $panl.scrollTop(),
- lstTop = $list.position().top + parseInt( $list.css( 'margin-top' ), 10 ) + parseInt( $list.css( 'padding-top' ), 10 ) + oldTop;
-
- $panl.scrollTop( 0 );
- $list
- .children( '.' + _c.divider )
- .not( '.' + _c.hidden )
- .each(
- function()
- {
- if ( newTop === false &&
- lttr == $(this).text().slice( 0, 1 ).toLowerCase()
- ) {
- newTop = $(this).position().top + lstTop;
- }
- }
- );
-
- $panl.scrollTop( newTop !== false ? newTop : oldTop );
- }
- );
-
-
- // Show or hide the indexer
- var update = function( $panl )
- {
- that.$menu[ ( $panl.hasClass( _c.hasindexer ) ? 'add' : 'remove' ) + 'Class' ]( _c.hasindexer );
- };
-
- this.bind( 'openPanel', update );
- update.call( this, this.$menu.children( '.' + _c.current ) );
- }
- }
- );
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'indexer hasindexer' );
- _e.add( 'mouseover touchmove' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu )
- {
- if ( $a.parent().is( '.' + _c.indexer ) )
- {
- return true;
- }
- }
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
- add : false,
- addTo : 'panels'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.toggles.js b/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.toggles.js
deleted file mode 100644
index f00198de..00000000
--- a/public/legacy/js/mmenu/src/js/addons/jquery.mmenu.toggles.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * jQuery mmenu toggles addon
- * mmenu.frebsite.nl
- *
- * Copyright (c) Fred Heusschen
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu',
- _ADDON_ = 'toggles';
-
-
- $[ _PLUGIN_ ].addons[ _ADDON_ ] = {
-
- // setup: fired once per menu
- setup: function()
- {
- var that = this,
- opts = this.opts[ _ADDON_ ],
- conf = this.conf[ _ADDON_ ];
-
- glbl = $[ _PLUGIN_ ].glbl;
-
-
- this.bind( 'init',
- function( $panels )
- {
-
- // Refactor toggle classes
- this.__refactorClass( $('input', $panels), this.conf.classNames[ _ADDON_ ].toggle, 'toggle' );
- this.__refactorClass( $('input', $panels), this.conf.classNames[ _ADDON_ ].check, 'check' );
-
-
- // Add markup
- $('input.' + _c.toggle + ', input.' + _c.check, $panels)
- .each(
- function()
- {
- var $inpt = $(this),
- $prnt = $inpt.closest( 'li' ),
- cl = $inpt.hasClass( _c.toggle ) ? 'toggle' : 'check',
- id = $inpt.attr( 'id' ) || that.__getUniqueId();
-
- if ( !$prnt.children( 'label[for="' + id + '"]' ).length )
- {
- $inpt.attr( 'id', id );
- $prnt.prepend( $inpt );
-
- $('')
- .insertBefore( $prnt.children( 'a, span' ).last() );
- }
- }
- );
- }
- );
- },
-
- // add: fired once per page load
- add: function()
- {
- _c = $[ _PLUGIN_ ]._c;
- _d = $[ _PLUGIN_ ]._d;
- _e = $[ _PLUGIN_ ]._e;
-
- _c.add( 'toggle check' );
- },
-
- // clickAnchor: prevents default behavior when clicking an anchor
- clickAnchor: function( $a, inMenu ) {}
- };
-
-
- // Default options and configuration
- $[ _PLUGIN_ ].configuration.classNames[ _ADDON_ ] = {
- toggle : 'Toggle',
- check : 'Check'
- };
-
-
- var _c, _d, _e, glbl;
-
-})( jQuery );
\ No newline at end of file
diff --git a/public/legacy/js/mmenu/src/js/jquery.mmenu.debugger.js b/public/legacy/js/mmenu/src/js/jquery.mmenu.debugger.js
deleted file mode 100644
index 84ae23c6..00000000
--- a/public/legacy/js/mmenu/src/js/jquery.mmenu.debugger.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Debugger for jQuery mmenu
- * Include this file after including the jquery.mmenu plugin to debug your menu.
- */
-
-
-(function( $ ) {
-
- var _PLUGIN_ = 'mmenu';
-
- if ( typeof console == 'undefined' )
- {
- return false;
- }
-
- var _log = document[ _PLUGIN_ + '_debug_log' ] || console.log,
- _warn = document[ _PLUGIN_ + '_debug_warn' ] || console.warn;
-
- var glbl = $[ _PLUGIN_ ].glbl,
- _c = $[ _PLUGIN_ ]._c,
- _d = $[ _PLUGIN_ ]._d,
- _e = $[ _PLUGIN_ ]._e;
-
-
- function debug( msg )
- {
- _log( 'MMENU: ' + msg );
- };
- function deprecated( depr, repl, vers )
- {
- var msg = 'MMENU: ' + depr + 'is deprecated';
-
- if ( vers )
- {
- msg += ' as of version ' + vers;
- }
- if ( repl )
- {
- msg += ', use ' + repl + ' instead.';
- }
- else
- {
- msg += '.';
- }
- _warn( msg );
- };
-
-
- $[ _PLUGIN_ ].prototype.___deprecated = function()
- {
-
- // Options 5.0
- if ( typeof this.opts.labels != 'undefined' )
- {
- deprecated( 'The option "labels"', '"dividers"', '5.0' );
- }
- if ( typeof this.opts.classes != 'undefined' )
- {
- deprecated( 'The option "classes"', '"extensions"', '5.0' );
- }
- if ( typeof this.opts.searchfield != 'undefined' )
- {
- if ( typeof this.opts.searchfield.showLinksOnly != 'undefined' )
- {
- deprecated( 'The option "searchfield.showLinksOnly"', '"!searchfield.showTextItems"', '5.0' );
- }
- }
-
- // Configuration 5.0
- if ( typeof this.conf.classNames.label != 'undefined' )
- {
- deprecated( 'The configuration option "classNames.labels"', '"classNames.dividers"', '5.0' );
- }
-
- // HTML 5.0
- if ( this.$menu.find( '.Label' ).length )
- {
- deprecated( 'The classname "Label"', '"Divider"', '5.0' );
- }
- if ( $( '.FixedTop' ).length )
- {
- deprecated( 'The classname "FixedTop"', '"Fixed"', '5.0' );
- }
- if ( $( '.FixedBottom' ).length )
- {
- deprecated( 'The classname "FixedBottom"', '"Fixed"', '5.0' );
- }
-
- // Custom events 5.0
- this.$menu.on(
- 'setPage setPage.mm setSelected setSelected.mm open open.mm opening opening.mm opened opened.mm close close.mm closing closing.mm closed closed.mm toggle toggle.mm',
- function( e )
- {
- deprecated( 'The custom event "' + e.type + '"', 'the API', '5.0' );
- }
- )
-
-
- // Options 4.6
- if ( this.opts.header )
- {
- if ( this.opts.header.add instanceof Array )
- {
- deprecated( 'An array for the "header.add" option', 'header.content', '4.6' );
- }
- }
-
-
- // Vendors 4.4
- if ( typeof 'Hammer' == 'function' && Hammer.VERSION < 2 )
- {
- deprecated( 'Older version of the Hammer library', 'version 2 or newer', '4.4' );
- return;
- }
-
-
- // Options 4.3
- for ( var a = [ 'position', 'zposition', 'modal', 'moveBackground' ], b = 0, l = a.length; b < l; b++ )
- {
- if ( typeof this.opts[ a[ b ] ] != 'undefined' )
- {
- deprecated( 'The option "' + a[ b ] + '"', 'offCanvas.' + a[ b ], '4.3' );
- }
- }
-
- // Configuration 4.3
- for ( var a = [ 'panel', 'list', 'selected', 'label', 'spacer' ], b = 0, l = a.length; b < l; b++ )
- {
- if ( typeof this.conf[ a[ b ] + 'Class' ] != 'undefined' )
- {
- deprecated( 'The configuration option "' + a[ b ] + 'Class"', 'classNames.' + a[ b ], '4.3' );
- }
- }
- if ( typeof this.conf.counterClass != 'undefined' )
- {
- deprecated( 'The configuration option "counterClass"', 'classNames.counters.counter', '4.3' );
- }
- if ( typeof this.conf.collapsedClass != 'undefined' )
- {
- deprecated( 'The configuration option "collapsedClass"', 'classNames.labels.collapsed', '4,3' );
- }
- if ( typeof this.conf.header != 'undefined' )
- {
- for ( var a = [ 'panelHeader', 'panelNext', 'panelPrev' ], b = 0, l = a.length; b < l; b++ )
- {
- if ( typeof this.conf.header[ a[ b ] + 'Class' ] != 'undefined' )
- {
- deprecated( 'The configuration option "header.' + a[ b ] + 'Class"', 'classNames.header.' + a[ b ], '4.3' );
- }
- }
- }
- for ( var a = [ 'pageNodetype', 'pageSelector', 'menuWrapperSelector', 'menuInjectMethod' ], b = 0, l = a.length; b < l; b++ )
- {
- if ( typeof this.conf[ a[ b ] ] != 'undefined' )
- {
- deprecated( 'The configuration option "' + a[ b ] + '"', 'offCanvas.' + a[ b ], '4.3' );
- }
- }
-
-
- // Options 4.2
- if ( this.opts.offCanvas )
- {
- if ( this.opts.offCanvas.position == 'top' || this.opts.offCanvas.position == 'bottom' )
- {
- if ( this.opts.offCanvas.zposition == 'back' || this.opts.offCanvas.zposition == 'next' )
- {
- deprecated( 'Using offCanvas.position "' + this.opts.offCanvas.position + '" in combination with offCanvas.zposition "' + this.opts.offCanvas.zposition + '"', 'offCanvas.zposition "front"', '4.2' );
- }
- }
- }
-
-
- // Options 4.1
- if ( this.opts.onClick && typeof this.opts.onClick.setLocationHref != 'undefined' )
- {
- deprecated( 'The option "onClick.setLocationHref"', '!onClick.preventDefault', '4.1' );
- }
-
- // Configuration 4.1
- if ( typeof this.conf.panelNodeType != 'undefined' )
- {
- deprecated( 'panelNodeType configuration option', 'panelNodetype' );
- }
- };
-
-
-
- $[ _PLUGIN_ ].prototype.___debug = function()
- {
-
- // non-available add-ons
- var addons = [ 'autoHeight', 'backButton', 'buttonbars', 'counters', 'dividers', 'dragOpen', 'footer', 'header', 'offCanvas', 'searchfield', 'sectionIndexer', 'toggles' ];
- for ( var a in addons )
- {
- if ( typeof this.opts[ addons[ a ] ] != 'undefined' )
- {
- if ( typeof $[ _PLUGIN_ ].addons[ addons[ a ] ] == 'undefined' )
- {
- debug( 'The "' + addons[ a ] + '" add-on is not available.' );
- }
- }
- }
-
- var position = false,
- zposition = false;
-
- if ( this.opts.offCanvas )
- {
- position = this.opts.offCanvas.position;
- zposition = this.opts.offCanvas.zposition;
- }
-
- // background color
- if ( zposition == 'back' )
- {
- var bg = $('body').css( 'background-color' );
- if ( typeof bg == 'undefined' || bg == '' || bg == 'transparent' )
- {
- debug( 'Set a background-color for the
' + html.stripScripts() + '
';
- depth = 2;
- break;
- case 'TR':
- div.innerHTML = '
';
- depth = 3;
- break;
- case 'TD':
- div.innerHTML = '' + html.stripScripts() + '
';
- depth = 4;
- }
- $A(element.childNodes).each(function(node){
- element.removeChild(node)
- });
- depth.times(function(){ div = div.firstChild });
-
- $A(div.childNodes).each(
- function(node){ element.appendChild(node) });
- } else {
- element.innerHTML = html.stripScripts();
- }
- setTimeout(function() {html.evalScripts()}, 10);
- return element;
- }
-};
-
-Object.extend(Element, Element.Methods);
-
-var _nativeExtensions = false;
-
-if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) {
- var className = 'HTML' + tag + 'Element';
- if(window[className]) return;
- var klass = window[className] = {};
- klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__;
- });
-
-Element.addMethods = function(methods) {
- Object.extend(Element.Methods, methods || {});
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- var cache = Element.extend.cache;
- for (var property in methods) {
- var value = methods[property];
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = cache.findOrStore(value);
- }
- }
-
- if (typeof HTMLElement != 'undefined') {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- copy(Form.Methods, HTMLFormElement.prototype);
- [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) {
- copy(Form.Element.Methods, klass.prototype);
- });
- _nativeExtensions = true;
- }
-}
-
-var Toggle = new Object();
-Toggle.display = Element.toggle;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.Insertion = function(adjacency) {
- this.adjacency = adjacency;
-}
-
-Abstract.Insertion.prototype = {
- initialize: function(element, content) {
- this.element = $(element);
- this.content = content.stripScripts();
-
- if (this.adjacency && this.element.insertAdjacentHTML) {
- try {
- this.element.insertAdjacentHTML(this.adjacency, this.content);
- } catch (e) {
- var tagName = this.element.tagName.toUpperCase();
- if (['TBODY', 'TR'].include(tagName)) {
- this.insertContent(this.contentFromAnonymousTable());
- } else {
- throw e;
- }
- }
- } else {
- this.range = this.element.ownerDocument.createRange();
- if (this.initializeRange) this.initializeRange();
- this.insertContent([this.range.createContextualFragment(this.content)]);
- }
-
- setTimeout(function() {content.evalScripts()}, 10);
- },
-
- contentFromAnonymousTable: function() {
- var div = document.createElement('div');
- div.innerHTML = '' + html.stripScripts() + ' ' + this.content + '
';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
-
- toString: function() {
- return $A(this).join(' ');
- }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Selector = Class.create();
-Selector.prototype = {
- initialize: function(expression) {
- this.params = {classNames: []};
- this.expression = expression.toString().strip();
- this.parseExpression();
- this.compileMatcher();
- },
-
- parseExpression: function() {
- function abort(message) { throw 'Parse error in selector: ' + message; }
-
- if (this.expression == '') abort('empty expression');
-
- var params = this.params, expr = this.expression, match, modifier, clause, rest;
- while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) {
- params.attributes = params.attributes || [];
- params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''});
- expr = match[1];
- }
-
- if (expr == '*') return this.params.wildcard = true;
-
- while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) {
- modifier = match[1], clause = match[2], rest = match[3];
- switch (modifier) {
- case '#': params.id = clause; break;
- case '.': params.classNames.push(clause); break;
- case '':
- case undefined: params.tagName = clause.toUpperCase(); break;
- default: abort(expr.inspect());
- }
- expr = rest;
- }
-
- if (expr.length > 0) abort(expr.inspect());
- },
-
- buildMatchExpression: function() {
- var params = this.params, conditions = [], clause;
-
- if (params.wildcard)
- conditions.push('true');
- if (clause = params.id)
- conditions.push('element.readAttribute("id") == ' + clause.inspect());
- if (clause = params.tagName)
- conditions.push('element.tagName.toUpperCase() == ' + clause.inspect());
- if ((clause = params.classNames).length > 0)
- for (var i = 0, length = clause.length; i < length; i++)
- conditions.push('element.hasClassName(' + clause[i].inspect() + ')');
- if (clause = params.attributes) {
- clause.each(function(attribute) {
- var value = 'element.readAttribute(' + attribute.name.inspect() + ')';
- var splitValueBy = function(delimiter) {
- return value + ' && ' + value + '.split(' + delimiter.inspect() + ')';
- }
-
- switch (attribute.operator) {
- case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break;
- case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break;
- case '|=': conditions.push(
- splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect()
- ); break;
- case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break;
- case '':
- case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break;
- default: throw 'Unknown operator ' + attribute.operator + ' in selector';
- }
- });
- }
-
- return conditions.join(' && ');
- },
-
- compileMatcher: function() {
- this.match = new Function('element', 'if (!element.tagName) return false; \
- element = $(element); \
- return ' + this.buildMatchExpression());
- },
-
- findElements: function(scope) {
- var element;
-
- if (element = $(this.params.id))
- if (this.match(element))
- if (!scope || Element.childOf(element, scope))
- return [element];
-
- scope = (scope || document).getElementsByTagName(this.params.tagName || '*');
-
- var results = [];
- for (var i = 0, length = scope.length; i < length; i++)
- if (this.match(element = scope[i]))
- results.push(Element.extend(element));
-
- return results;
- },
-
- toString: function() {
- return this.expression;
- }
-}
-
-Object.extend(Selector, {
- matchElements: function(elements, expression) {
- var selector = new Selector(expression);
- return elements.select(selector.match.bind(selector)).map(Element.extend);
- },
-
- findElement: function(elements, expression, index) {
- if (typeof expression == 'number') index = expression, expression = false;
- return Selector.matchElements(elements, expression || '*')[index || 0];
- },
-
- findChildElements: function(element, expressions) {
- return expressions.map(function(expression) {
- return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) {
- var selector = new Selector(expr);
- return results.inject([], function(elements, result) {
- return elements.concat(selector.findElements(result || element));
- });
- });
- }).flatten();
- }
-});
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
-
- serializeElements: function(elements, getHash) {
- var data = elements.inject({}, function(result, element) {
- if (!element.disabled && element.name) {
- var key = element.name, value = $(element).getValue();
- if (value != undefined) {
- if (result[key]) {
- if (result[key].constructor != Array) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
-
- return getHash ? data : Hash.toQueryString(data);
- }
-};
-
-Form.Methods = {
- serialize: function(form, getHash) {
- return Form.serializeElements(Form.getElements(form), getHash);
- },
-
- getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name) return $A(inputs).map(Element.extend);
-
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
- continue;
- matchingInputs.push(Element.extend(input));
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.blur();
- element.disabled = 'true';
- });
- return form;
- },
-
- enable: function(form) {
- form = $(form);
- form.getElements().each(function(element) {
- element.disabled = '';
- });
- return form;
- },
-
- findFirstElement: function(form) {
- return $(form).getElements().find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
- }
-}
-
-Object.extend(Form, Form.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-}
-
-Form.Element.Methods = {
- serialize: function(element) {
- element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = {};
- pair[element.name] = value;
- return Hash.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- clear: function(element) {
- $(element).value = '';
- return element;
- },
-
- present: function(element) {
- return $(element).value != '';
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select && ( element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type) ) )
- element.select();
- return element;
- },
-
- disable: function(element) {
- element = $(element);
- element.disabled = true;
- return element;
- },
-
- enable: function(element) {
- element = $(element);
- element.blur();
- element.disabled = false;
- return element;
- }
-}
-
-Object.extend(Form.Element, Form.Element.Methods);
-var Field = Form.Element;
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- default:
- return Form.Element.Serializers.textarea(element);
- }
- },
-
- inputSelector: function(element) {
- return element.checked ? element.value : null;
- },
-
- textarea: function(element) {
- return element.value;
- },
-
- select: function(element) {
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
- },
-
- selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
- var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
- }
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- var changed = ('string' == typeof this.lastValue && 'string' == typeof value
- ? this.lastValue != value : String(this.lastValue) != String(value));
- if (changed) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback.bind(this));
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- default:
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0, length = Event.observers.length; i < length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- Event._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- try {
- element.detachEvent('on' + name, observer);
- } catch (e) {}
- }
- }
-});
-
-/* prevent memory leaks in IE */
-if (navigator.appVersion.match(/\bMSIE\b/))
- Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if(element.tagName=='BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!window.opera || element.tagName=='BODY') {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
-
-Element.addMethods();
\ No newline at end of file
diff --git a/public/legacy/js/prototype_1.40.js b/public/legacy/js/prototype_1.40.js
deleted file mode 100644
index e9ccd3c8..00000000
--- a/public/legacy/js/prototype_1.40.js
+++ /dev/null
@@ -1,1785 +0,0 @@
-/* Prototype JavaScript framework, version 1.4.0
- * (c) 2005 Sam Stephenson ' + this.content + '
';
- return $A(div.childNodes[0].childNodes[0].childNodes);
- }
-}
-
-var Insertion = new Object();
-
-Insertion.Before = Class.create();
-Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
- initializeRange: function() {
- this.range.setStartBefore(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment, this.element);
- }).bind(this));
- }
-});
-
-Insertion.Top = Class.create();
-Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(true);
- },
-
- insertContent: function(fragments) {
- fragments.reverse(false).each((function(fragment) {
- this.element.insertBefore(fragment, this.element.firstChild);
- }).bind(this));
- }
-});
-
-Insertion.Bottom = Class.create();
-Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
- initializeRange: function() {
- this.range.selectNodeContents(this.element);
- this.range.collapse(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.appendChild(fragment);
- }).bind(this));
- }
-});
-
-Insertion.After = Class.create();
-Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
- initializeRange: function() {
- this.range.setStartAfter(this.element);
- },
-
- insertContent: function(fragments) {
- fragments.each((function(fragment) {
- this.element.parentNode.insertBefore(fragment,
- this.element.nextSibling);
- }).bind(this));
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set(this.toArray().concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set(this.select(function(className) {
- return className != classNameToRemove;
- }).join(' '));
- },
-
- toString: function() {
- return this.toArray().join(' ');
- }
-}
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-var Field = {
- clear: function() {
- for (var i = 0; i < arguments.length; i++)
- $(arguments[i]).value = '';
- },
-
- focus: function(element) {
- $(element).focus();
- },
-
- present: function() {
- for (var i = 0; i < arguments.length; i++)
- if ($(arguments[i]).value == '') return false;
- return true;
- },
-
- select: function(element) {
- $(element).select();
- },
-
- activate: function(element) {
- element = $(element);
- element.focus();
- if (element.select)
- element.select();
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var Form = {
- serialize: function(form) {
- var elements = Form.getElements($(form));
- var queryComponents = new Array();
-
- for (var i = 0; i < elements.length; i++) {
- var queryComponent = Form.Element.serialize(elements[i]);
- if (queryComponent)
- queryComponents.push(queryComponent);
- }
-
- return queryComponents.join('&');
- },
-
- getElements: function(form) {
- form = $(form);
- var elements = new Array();
-
- for (tagName in Form.Element.Serializers) {
- var tagElements = form.getElementsByTagName(tagName);
- for (var j = 0; j < tagElements.length; j++)
- elements.push(tagElements[j]);
- }
- return elements;
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name)
- return inputs;
-
- var matchingInputs = new Array();
- for (var i = 0; i < inputs.length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) ||
- (name && input.name != name))
- continue;
- matchingInputs.push(input);
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.blur();
- element.disabled = 'true';
- }
- },
-
- enable: function(form) {
- var elements = Form.getElements(form);
- for (var i = 0; i < elements.length; i++) {
- var element = elements[i];
- element.disabled = '';
- }
- },
-
- findFirstElement: function(form) {
- return Form.getElements(form).find(function(element) {
- return element.type != 'hidden' && !element.disabled &&
- ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- Field.activate(Form.findFirstElement(form));
- },
-
- reset: function(form) {
- $(form).reset();
- }
-}
-
-Form.Element = {
- serialize: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter) {
- var key = encodeURIComponent(parameter[0]);
- if (key.length == 0) return;
-
- if (parameter[1].constructor != Array)
- parameter[1] = [parameter[1]];
-
- return parameter[1].map(function(value) {
- return key + '=' + encodeURIComponent(value);
- }).join('&');
- }
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- var parameter = Form.Element.Serializers[method](element);
-
- if (parameter)
- return parameter[1];
- }
-}
-
-Form.Element.Serializers = {
- input: function(element) {
- switch (element.type.toLowerCase()) {
- case 'submit':
- case 'hidden':
- case 'password':
- case 'text':
- return Form.Element.Serializers.textarea(element);
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element);
- }
- return false;
- },
-
- inputSelector: function(element) {
- if (element.checked)
- return [element.name, element.value];
- },
-
- textarea: function(element) {
- return [element.name, element.value];
- },
-
- select: function(element) {
- return Form.Element.Serializers[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- },
-
- selectOne: function(element) {
- var value = '', opt, index = element.selectedIndex;
- if (index >= 0) {
- opt = element.options[index];
- value = opt.value;
- if (!value && !('value' in opt))
- value = opt.text;
- }
- return [element.name, value];
- },
-
- selectMany: function(element) {
- var value = new Array();
- for (var i = 0; i < element.length; i++) {
- var opt = element.options[i];
- if (opt.selected) {
- var optValue = opt.value;
- if (!optValue && !('value' in opt))
- optValue = opt.text;
- value.push(optValue);
- }
- }
- return [element.name, value];
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-var $F = Form.Element.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = function() {}
-Abstract.TimedObserver.prototype = {
- initialize: function(element, frequency, callback) {
- this.frequency = frequency;
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- this.registerCallback();
- },
-
- registerCallback: function() {
- setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- onTimerEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-}
-
-Form.Element.Observer = Class.create();
-Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create();
-Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = function() {}
-Abstract.EventObserver.prototype = {
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- var elements = Form.getElements(this.element);
- for (var i = 0; i < elements.length; i++)
- this.registerCallback(elements[i]);
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- case 'password':
- case 'text':
- case 'textarea':
- case 'select-one':
- case 'select-multiple':
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-}
-
-Form.Element.EventObserver = Class.create();
-Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create();
-Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) {
- var Event = new Object();
-}
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
-
- element: function(event) {
- return event.target || event.srcElement;
- },
-
- isLeftClick: function(event) {
- return (((event.which) && (event.which == 1)) ||
- ((event.button) && (event.button == 1)));
- },
-
- pointerX: function(event) {
- return event.pageX || (event.clientX +
- (document.documentElement.scrollLeft || document.body.scrollLeft));
- },
-
- pointerY: function(event) {
- return event.pageY || (event.clientY +
- (document.documentElement.scrollTop || document.body.scrollTop));
- },
-
- stop: function(event) {
- if (event.preventDefault) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.returnValue = false;
- event.cancelBubble = true;
- }
- },
-
- // find the first node with the given tagName, starting from the
- // node the event was triggered on; traverses the DOM upwards
- findElement: function(event, tagName) {
- var element = Event.element(event);
- while (element.parentNode && (!element.tagName ||
- (element.tagName.toUpperCase() != tagName.toUpperCase())))
- element = element.parentNode;
- return element;
- },
-
- observers: false,
-
- _observeAndCache: function(element, name, observer, useCapture) {
- if (!this.observers) this.observers = [];
- if (element.addEventListener) {
- this.observers.push([element, name, observer, useCapture]);
- element.addEventListener(name, observer, useCapture);
- } else if (element.attachEvent) {
- this.observers.push([element, name, observer, useCapture]);
- element.attachEvent('on' + name, observer);
- }
- },
-
- unloadCache: function() {
- if (!Event.observers) return;
- for (var i = 0; i < Event.observers.length; i++) {
- Event.stopObserving.apply(this, Event.observers[i]);
- Event.observers[i][0] = null;
- }
- Event.observers = false;
- },
-
- observe: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.attachEvent))
- name = 'keydown';
-
- this._observeAndCache(element, name, observer, useCapture);
- },
-
- stopObserving: function(element, name, observer, useCapture) {
- var element = $(element);
- useCapture = useCapture || false;
-
- if (name == 'keypress' &&
- (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
- || element.detachEvent))
- name = 'keydown';
-
- if (element.removeEventListener) {
- element.removeEventListener(name, observer, useCapture);
- } else if (element.detachEvent) {
- element.detachEvent('on' + name, observer);
- }
- }
-});
-
-/* prevent memory leaks in IE */
-Event.observe(window, 'unload', Event.unloadCache, false);
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- realOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return [valueL, valueT];
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return [valueL, valueT];
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- p = Element.getStyle(element, 'position');
- if (p == 'relative' || p == 'absolute') break;
- }
- } while (element);
- return [valueL, valueT];
- },
-
- offsetParent: function(element) {
- if (element.offsetParent) return element.offsetParent;
- if (element == document.body) return element;
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return element;
-
- return document.body;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = this.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = this.realOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = this.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- clone: function(source, target) {
- source = $(source);
- target = $(target);
- target.style.position = 'absolute';
- var offsets = this.cumulativeOffset(source);
- target.style.top = offsets[1] + 'px';
- target.style.left = offsets[0] + 'px';
- target.style.width = source.offsetWidth + 'px';
- target.style.height = source.offsetHeight + 'px';
- },
-
- page: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent==document.body)
- if (Element.getStyle(element,'position')=='absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- } while (element = element.parentNode);
-
- return [valueL, valueT];
- },
-
- clone: function(source, target) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || {})
-
- // find page position of source
- source = $(source);
- var p = Position.page(source);
-
- // find coordinate system to use
- target = $(target);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(target,'position') == 'absolute') {
- parent = Position.offsetParent(target);
- delta = Position.page(parent);
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if(options.setWidth) target.style.width = source.offsetWidth + 'px';
- if(options.setHeight) target.style.height = source.offsetHeight + 'px';
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.style.position == 'absolute') return;
- Position.prepare();
-
- var offsets = Position.positionedOffset(element);
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';;
- element.style.left = left + 'px';;
- element.style.width = width + 'px';;
- element.style.height = height + 'px';;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.style.position == 'relative') return;
- Position.prepare();
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- }
-}
-
-// Safari returns margins on body which is incorrect if the child is absolutely
-// positioned. For performance reasons, redefine Position.cumulativeOffset for
-// KHTML/WebKit only.
-if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) {
- Position.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return [valueL, valueT];
- }
-}
\ No newline at end of file
diff --git a/public/legacy/js/sample_data.js b/public/legacy/js/sample_data.js
deleted file mode 100644
index 0dc493ba..00000000
--- a/public/legacy/js/sample_data.js
+++ /dev/null
@@ -1,625 +0,0 @@
-
-// QuickMenu Pro, Copyright (c) - 2002, OpenCube Inc. - http://www.opencube.com
-//
-//
-//
-// QuickMenu Pro - (QuickMenu v3.0) Works With....
-//
-// IE4, IE5.x, IE6 (Win 95, 98, ME, 2000, NT, XP)
-// IE4, IE5.x, &up (Mac)
-// NS4.x (All Platforms)
-// NS5/6.x (All Platforms)
-// NS7 (All Platforms)
-// Opera 5,6,7 (All Platforms)
-// Mozilla 1.0 & up (All Platforms)
-// Konqueror 3.0 & up (Linux)
-//
-//
-//
-// To customize QuickMenu Pro open this file in a simple text
-// editor (Notepad or similar). Modify and add parameters (all
-// customizable parameters start with 'DQM_'), save this file,
-// and open 'sample.htm' in a browser to view your menu. View
-// the source for sample.htm for information on connecting
-// sub menus to HTML images or build your page around the
-// included sample.htm file.
-//
-// QuickMenu conditionally loads the necessary JavaScript
-// files (.js) depending on the browser and platform the user
-// is viewing the menu on. The total file size for each
-// browser / platform scenario is no larger than 12K.
-//
-// This sample data file contains comments and help information
-// to assist in the initial customization of your drop down
-// menu. If you base your implementation on this documented template
-// we recommend the removal of the comments before using on the web, as
-// to optimize the overall file size and load time of the menu for
-// the end user. With the comments removed, this sample data files
-// size may be reduced by as much as 70%. Note: To simplify comment
-// removal there is a uncommented version of this sample template
-// offered in the 'samples' folder.
-//
-//
-// NOTE: Parameters with an appended '//' are commented out,
-// delete the '//' to activate the parameter.
-//
-// Commenting out required parameters will cause errors.
-//
-// Text values, except TRUE and FALSE statements, must be
-// enclosed by double quotes (").
-//
-// Each parameter value should appear on its own line.
-//
-// This data file may also be placed within your HTML page
-// by enclosing between JavaScript tags.
-//
-// Due to browser limitations, DHTML menus will not appear
-// on top of Flash objects, across frames, or over certain
-// form field elements. A hide and show workaround for form
-// fields is included with this menu (see the 'Menu event
-// triggered custom function calls' section below).
-
-
-
-
-/*-------------------------------------------
-Copyright Notice - The following parameter is
-required in order for the menu to function.
---------------------------------------------*/
-
-
- DQM_Notice = "DHTML QuickMenu, Copyright (c) - 2002, OpenCube Inc. - www.opencube.com"
-
-
-
-/*-------------------------------------------
-required menu Settings
---------------------------------------------*/
-
-
- DQM_sub_menu_width = 130 //default sub menu widths
- DQM_sub_xy = "0,0" //default sub x,y coordinates
-
-
- DQM_codebase = "" //relative location of .js files
- DQM_urltarget = "_self" //set to: _self, _parent, _new, or "my frame name"
-
- DQM_border_width = 1
- DQM_divider_height = 0
-
- DQM_border_color = "#666666" //Hex color value or 'transparent'
- DQM_menu_bgcolor = "#e6e6e6" //Hex color value or 'transparent'
- DQM_hl_bgcolor = "#e6e6e6" //Hex color value
-
-
- /*---The following parameter defines the delay
- -----time between the mouse moving outside of
- -----a sub menu and the sub menu actually closing.
- -----In all browsers except Netscape 4.x this time
- -----period starts after the mouse leaves the sub
- -----menu and the user stops moving the mouse.
- -----This setting is useful for reducing end-user
- -----error in the selection of sub menus. Defined
- -----in milliseconds (1/1000s)---*/
-
- DQM_mouse_off_delay = 100
-
-
- /*---Internet Explorer Mac Offset Fix - The following
- -----parameters correct position reporting bugs in
- -----ie4.x and ie5.x on the Mac OS9 and OSX platforms.
- -----Adjust the offsets below until the first level
- -----sub menus pop up in the correct location.*/
-
- DQM_os9_ie5mac_offset_X = 10
- DQM_os9_ie5mac_offset_Y = 15
-
- DQM_osx_ie5mac_offset_X = 0
- DQM_osx_ie5mac_offset_Y = 0
-
- DQM_ie4mac_offset_X = -8
- DQM_ie4mac_offset_Y = -50
-
-
- /*---Netscape 4.x fix option - bugs in Netscape 4.x
- -----can cause layers (sub menus) to be rendered
- -----incorrectly upon resizing the browser window.
- -----The only way to work around this issue is to reload
- -----the page after a resize. The following parameters allow
- -----the menu to automatically reload the page for the user
- -----after a resize, prompts the user to reload the page
- -----manually after resize, or attempts to correct the menu
- -----after a resize without reloading.-----*/
-
- DQM_nn4_reaload_after_resize = true
-
- DQM_nn4_resize_prompt_user = false
- DQM_nn4_resize_prompt_message = "To reinitialize the navigation menu please click the 'Reload' button."
-
-
- /*---Opera 4 & up fix - The following parameter option
- -----corrects div mouse detection bugs on Opera. Set the
- -----parameter value to true if your sub menus are located
- -----at the lowest point on the HTML page.---*/
-
- DQM_use_opera_div_detect_fix = true;
-
-
-/*-------------------------------------------
-Internet Explorer Transition Effects - IE5.5 & UP
-
-Note: All non supporting browsers will ignore
-the effect settings below while retaining the
-complete sub menu functionality and look.
---------------------------------------------*/
-
-
- /*----Options include - none | fade | pixelate |
- ------iris | slide | gradientwipe | checkerboard |
- ------radialwipe | randombars | randomdissolve |stretch */
-
- DQM_sub_menu_effect = "fade"
- DQM_sub_item_effect = "fade"
-
-
- /*----Define the effect duration in seconds below---*/
-
- DQM_sub_menu_effect_duration = .4
- DQM_sub_item_effect_duration = .4
-
-
- /*----Customization option settings for the various effect
- ------transitions may be defined below---*/
-
- DQM_effect_pixelate_maxsqare = 25
- DQM_effect_iris_irisstyle = "CIRCLE" //CROSS, CIRCLE, PLUS, SQUARE, or STAR
- DQM_effect_checkerboard_squaresx = 14
- DQM_effect_checkerboard_squaresY = 14
- DQM_effect_checkerboard_direction = "RIGHT" //UP, DOWN, LEFT, RIGHT
-
-
- /*----Note: Due to browser limitations, when using a
- ------drop shadow effect or sub menu opacity values
- ------less than 100, combined with sub menu and or
- ------sub menu item transitions, undesirable transition
- ------results may occur. To remedy the issue use
- ------semi transparent sub menus or borders without
- ------transition effects or use transition effects without
- ------borders and set the sub menu opacity value to 100.---*/
-
- /*----Opacity is defined with a value between
- ------1 and 100 with 100 being opaque---*/
-
- DQM_sub_menu_opacity = 100
-
- DQM_dropshadow_color = "none" //Hex color value or 'none'
- DQM_dropshadow_offx = 5 //drop shadow width
- DQM_dropshadow_offy = 5 //drop shadow height
-
-
-
-/*---------------------------------------------
-Optional event triggered custom function calls
-----------------------------------------------*/
-
-
- /*----This menu uses the documents onload event to
- ------initially generate the menus. If your HTML page requires
- ------the onload statement for calling other script functions
- ------or statements you may execute your code using the
- ------parameter below------*/
-
- //DQM_onload_code = "alert('custom function - onload')"
-
-
- /*----the following parameters may be used to execute
- ------custom code upon menu pop-up and hide.
- ------These are useful for hiding drop down boxes which
- ------may not be displayed under the menus due to
- ------browser limitations with certain form fields.---*/
-
- //DQM_showmenu_code0 = "status = 'custom show menu function call - menu0'"
- //DQM_showmenu_code1 = "status = 'custom show menu function call - menu1'"
-
- //DQM_hidemenu_code0 = "status = 'custom hide menu function call - menu0'"
- //DQM_hidemenu_code1 = "status = 'custom hide menu function call - menu1'"
-
-
- /*----the following parameters may be used to execute
- ------custom code upon clicking a menu item. If a URL link
- ------and custom code are both defined the code will be
- ------executed first, then the URL link will be loaded. This
- ------parameter option is useful for opening custom pop up windows.---*/
-
- //DQM_clickitem_code0_0 = "alert('custom Function - Menu Item 0_0')"
- //DQM_clickitem_code1_0 = "alert('custom Function - Menu Item 1_0')"
-
-
-
-/*-------------------------------------------
-Required font Settings
---------------------------------------------*/
-
-
- DQM_textcolor = "#333333"
- DQM_fontfamily = "Verdana" //Any available system font
- DQM_fontsize = 11 //Defined with pixel sizing
- DQM_fontsize_ie4 = 9 //Defined with point sizing
- DQM_textdecoration = "normal" //set to: 'normal', or 'underline'
- DQM_fontweight = "normal" //set to: 'normal', or 'bold'
- DQM_fontstyle = "normal" //set to: 'normal', or 'italic'
- DQM_hl_textcolor = "#000000"
- DQM_hl_textdecoration = "underline" //set to: 'normal', or 'underline'
-
- DQM_margin_top = 2
- DQM_margin_bottom = 3
- DQM_margin_left = 5
- DQM_margin_right = 4
-
- DQM_text_alignment = "left" //set to: 'left', 'center' or 'right'
-
-
-
-
-/*---------------------------------------------
-Optional Icon Images - Relative Positioning
-
-The relative positioned icon images are automatically
-placed directly before or after the sub menu items
-text (placement is determined by text alignment).
-By adding transparent space to the left or right
-of the icon image itself, a custom image to text gap
-may be obtained (Note: The gap space between icon
-images and text may also be achieved by using the
-menus optional 2nd icon image, see the 'optional 2nd
-icon images' section for more information). The
-relative positioned icons are useful for creating
-text bullets for aesthetic purposes or symbolic icons
-for different sub menu items.
------------------------------------------------*/
-
-
- /*----Unlimited icon images may be defined and associated with any sub menu
- ------item by specifying the icons index with the 'DQM_icon_index' parameter
- ------see the 'sub menu customization' section below for examples---------*/
-
-
- DQM_icon_image0 = "sample_images/bullet.gif"
- DQM_icon_rollover0 = "sample_images/bullet_hl.gif"
- DQM_icon_image_wh0 = "13,8"
-
- DQM_icon_image1 = "sample_images/arrow.gif"
- DQM_icon_rollover1 = "sample_images/arrow.gif"
- DQM_icon_image_wh1 = "13,10"
-
-
-/*---------------------------------------------
-Optional 2nd Icon Images - Absolute Positioning
-
-The 2nd absolute positioned icons may be positioned
-anywhere within the sub menu items bounding area.
-These icon images are useful for creating arrows
-or other symbols which indicate the existence of a
-child sub menu. Sub menu text alignment or length
-will not affect the images placement. If your images
-undesirably appear over the top of sub menu text
-items then adjust the icons coordinates, sub menu
-widths, or margins accordingly.
-
-Note: Icon image coordinates are defined relative to
-the top right corner of the sub menu item when the
-sub menu text is left aligned, or relative to the
-top left corner when the sub menus text is right
-aligned.
------------------------------------------------*/
-
-
- /*----Unlimited icon images may be defined and associated with any sub menu
- ------item by specifying the icons index with the 'DQM_2nd_icon_index' parameter
- ------see the 'sub menu customization' section below for examples---------*/
-
- DQM_2nd_icon_image0 = "sample_images/arrow.gif"
- DQM_2nd_icon_rollover0 = "sample_images/arrow.gif"
- DQM_2nd_icon_image_wh0 = "13,10"
- DQM_2nd_icon_image_xy0 = "0,4"
-
-
-/*---------------------------------------------
-Optional Status Bar Text
-
-Note: Custom defined status bar text for a menu item
-will be displayed in place of the URL when the
-'DQM_show_urls_statusbar' parameter is set to true.
------------------------------------------------*/
-
- DQM_show_urls_statusbar = false
-
- //DQM_status_text0 = "Sample text - Main Menu Item 0"
- //DQM_status_text1 = "Sample text - Main Menu Item 1"
-
- //DQM_status_text1_0 = "Sample text - Main Menu Item 1, Sub Item 0"
- //DQM_status_text1_0 = "Sample text - Main Menu Item 1, Sub Item 1"
-
-
-
-
-/*********************************************************************/
-/* */
-/* MAIN MENU CUSTOMIZATION */
-/* */
-/*********************************************************************/
-
-/*--------------------------------------------------------------------
-
-The following parameters define the main menu items rollover images and
-URL's. Each rollover image is connected to a pre-defined HTML image within
-your web page by matching the rollover parameters index to the defined
-index of your html pages menu image (See the documentation or view the
-source of 'sample.htm' for information on setting up HTML image tags
-as menu items). The rollover image parameters are provided as an optional
-effect and are not required in order for the menu to function.
-
-Note: To define URL links for a main menu image, define both a URL link
- parameter below (i.e. "DQM_url0 = 'myurl.htm'") and attach a
- hyperlink tag (...) to the menu's associated
- image within your HTML page. This redundancy is required for
- complete cross browser functionality of main menu URL links.
-
- Specific main menu image URL targets may also be defined by defining
- a 'DQM_urltargetX' parameter, where X is the the associated main
- menu items index number. Allowable 'DQM_urltarget' param values
- include... _self, _parent, _new, or "my frame name".
-
----------------------------------------------------------------------*/
-
-
- /************************************************
- *********-------Main Menu 0--------**************
- ************************************************/
-
- DQM_rollover_image0 = "sample_images/quickmenu_hl.gif"
- DQM_rollover_wh0 = "75,22"
- //DQM_url0 = "my_url.html";
-
-
- /************************************************
- *********-------Main Menu 1--------**************
- ************************************************/
-
- DQM_rollover_image1 = "sample_images/products_hl.gif"
- DQM_rollover_wh1 = "65,22"
- //DQM_url1 = "my_url.html";
-
-
- /************************************************
- *********-------Main Menu 2--------**************
- ************************************************/
-
- DQM_rollover_image2 = "sample_images/downloads_hl.gif"
- DQM_rollover_wh2 = "76,22"
- //DQM_url2 = "my_url.html";
-
-
- /************************************************
- *********-------Main Menu 3--------***************
- ************************************************/
-
- DQM_rollover_image3 = "sample_images/contact_hl.gif"
- DQM_rollover_wh3 = "55,22"
- //DQM_url3 = "my_url.html";
-
-
-
-/*********************************************************************/
-/* */
-/* SUB MENU CUSTOMIZATION */
-/* */
-/*********************************************************************/
-
-/*--------------------------------------------------------------------
-
-The parameters below define the menus tree structure, text descriptions,
-associated icon images, URL links, and sub menu positioning. An infinite
-number of sub menu items and levels may be defined for each main menu item
-by appending the appropriate index values to the 'DQM_subdesc' parameter.
-The included sample menus ('sample.htm') tree structure is defined below and
-may be used as a simple guide for how to index your items.
-
-The sub menu items text descriptions may be defined using plain text or
-HTML. To use HTML simply place the entire string on one line and replace
-all double quotes with single quotes.
-
-
-
-ADDITIONAL SUB MENU CUSTOMIZATION OPTIONS:
-
-The following parameters are referenced for documentation purposes and are
-additional customizable features which may be included as part of the sample
-sub menus defined below. (Note: to use these parameters add them to the sub
-menu sections below, they are not active when inside this comment field.)
-
-
-Sub Menu Group Options:
-
-The following setting apply to individual sub menu groups. Reference a sub
-menu group within the parameter by appending the index value of the group
-to the parameter name.
-
- 1---The following parameters define unique colors, highlight colors
- border sizes, and divider heights for a sub menu. The X at the end
- of the parameter name represents the index of the sub menu. Child sub
- menus may also be referenced, i.e. 'DQM_menu_bgcolor1_0' refers to the
- 2nd main menus, 1st sub menu items, child sub menu.
-
- DQM_border_widthX = 10;
- DQM_divider_heightX = 5;
-
- DQM_border_colorX = "#0000ff";
- DQM_menu_bgcolorX = "#ff0000"
- DQM_hl_bgcolorX = "#00ff00"
- DQM_textcolorX = "#00ff00"
- DQM_hl_textcolorX = "#ff0000"
-
- 2---For more information on the following two parameter options see the
- section above labeled 'Optional event triggered custom function calls'
-
- DQM_showmenu_codeX = "status = 'custom show menu function call'"
- DQM_hidemenu_codeX = "status = 'custom hide menu function call'"
-
- 3---Define the text alignment of the sub menu as 'left', 'center', or 'right'
-
- DQM_text_alignmentX = "left"
-
-
-
-Sub Menu Item Options:
-
-The following settings apply to individual sub menu items, reference a sub
-menu item within the parameter by appending the index value of the item
-to the parameter name.
-
- 1---The following parameter creates custom highlight text, any html tags
- may also be used to create formatted text and images. (Note: when using
- HTML convert all double quotes to single quotes and keep to one line.)
- Any number of 'DQM_hl_subdescX' parameters may be defined so long as there
- is a corresponding 'DQM_subdescX' parameter. The X at the end of the
- parameters name is variable and represents the index of the sub menu item.
-
- DQM_hl_subdescX = "custom highlight text"
-
- 2---For more information on the following parameter option see the
- section above labeled 'Optional event triggered custom function calls'
-
- DQM_clickitem_codeX = "alert('Sample onclick function call.')"
-
- 3---Unique sub menu item URL targets may be defined with the
- following parameter option. Allowable 'DQM_urltargetX' param values
- include... _self, _parent, _new, or "my frame name".
-
- DQM_urltargetX = "_new"
-
-
----------------------------------------------------------------------*/
-
-
-/************************************************
-*********-------Sub Menu 0--------***************
-************************************************/
-
-DQM_sub_xy0 = "-62,22"
-DQM_sub_menu_width0 = 150
-
-DQM_subdesc0_0 = "DHTML QuickMenu
Open sample_data.js in a text editor to modify the menus settings."
-DQM_icon_index0_0 = 0
-DQM_url0_0 = "documents/sample_link.htm"
-
-
-
-/************************************************
-*********-------Sub Menu 1--------***************
-************************************************/
-
-DQM_sub_xy1 = "-49,22"
-DQM_sub_menu_width1 = 145
-
-DQM_subdesc1_0 = "New Effects"
-DQM_subdesc1_1 = "Implementations"
-DQM_subdesc1_2 = "QuickMenu Pro"
-DQM_subdesc1_3 = "DHTML Effects"
-DQM_subdesc1_4 = "Applet Composer"
-DQM_subdesc1_5 = "Applet Effects"
-DQM_icon_index1_0 = 0
-DQM_icon_index1_1 = 0
-DQM_icon_index1_2 = 0
-DQM_icon_index1_3 = 0
-DQM_icon_index1_4 = 0
-DQM_icon_index1_5 = 0
-DQM_2nd_icon_index1_0 = 0
-DQM_2nd_icon_index1_1 = 0
-DQM_url1_2 = "http://www.opencube.com/prod_quickmenupro.html"
-DQM_url1_3 = "http://www.opencube.com/prod_wedhtml.html"
-DQM_url1_4 = "http://www.opencube.com/prod_composer.html"
-DQM_url1_5 = "http://www.opencube.com/prod_wejava.html"
-
-
-
-/************************************************
-****-------Sub 1 - Item 1 Sub Menu--------*******
-************************************************/
-
-DQM_sub_xy1_0 = "-4,2"
-DQM_sub_menu_width1_0 = 120
-
-DQM_subdesc1_0_0 = "DHTML Menu"
-DQM_subdesc1_0_1 = "DHTML Tree"
-DQM_subdesc1_0_2 = "Vertical Scroll"
-DQM_subdesc1_0_3 = "Scroll Window"
-DQM_icon_index1_0_0 = 0
-DQM_icon_index1_0_1 = 0
-DQM_icon_index1_0_2 = 0
-DQM_icon_index1_0_3 = 0
-DQM_url1_0_0 = "http://www.opencube.com/effect_dqm.html"
-DQM_url1_0_1 = "http://www.opencube.com/effect_stm.html"
-DQM_url1_0_2 = "http://www.opencube.com/effect_dvs.html"
-DQM_url1_0_3 = "http://www.opencube.com/effect_vsw.html"
-
-
-
-/************************************************
-****-------Sub 1 - Item 2 Sub Menu--------*******
-************************************************/
-
-DQM_sub_xy1_1 = "-4,2"
-DQM_sub_menu_width1_1 = 100
-
-DQM_subdesc1_1_0 = "J & J"
-DQM_subdesc1_1_1 = "Memorex"
-DQM_subdesc1_1_2 = "Ouidad"
-DQM_icon_index1_1_0 = 0
-DQM_icon_index1_1_1 = 0
-DQM_icon_index1_1_2 = 0
-DQM_url1_1_0 = "http://www.loral.com"
-DQM_url1_1_1 = "http://www.memcorpinc.com/"
-DQM_url1_1_2 = "http://www.ouidad.com/"
-
-
-
-/************************************************
-*********-------Sub Menu 2--------***************
-************************************************/
-
-DQM_sub_xy2 = "-62,22"
-DQM_sub_menu_width2 = 145
-
-DQM_subdesc2_0 = "QuickMenu Pro"
-DQM_subdesc2_1 = "Web Effects DHTML"
-DQM_subdesc2_2 = "Applet Composer"
-DQM_subdesc2_3 = "Web Effects Java"
-DQM_icon_index2_0 = 0
-DQM_icon_index2_1 = 0
-DQM_icon_index2_2 = 0
-DQM_icon_index2_3 = 0
-DQM_url2_0 = "http://www.opencube.com/prod_quickmenupro.html"
-DQM_url2_1 = "http://www.opencube.com/prod_wehtml.html"
-DQM_url2_2 = "http://www.opencube.com/prod_composer.html"
-DQM_url2_3 = "http://www.opencube.com/prod_wejava.html"
-
-
-
-/************************************************
-*********-------Sub Menu 3--------***************
-************************************************/
-
-DQM_sub_xy3 = "-42,22"
-DQM_sub_menu_width3 = 120
-
-DQM_subdesc3_0 = "Cust. Service"
-DQM_subdesc3_1 = "Tech. Support"
-DQM_subdesc3_2 = "Product Sales"
-DQM_icon_index3_0 = 0
-DQM_icon_index3_1 = 0
-DQM_icon_index3_2 = 0
-DQM_url3_0 = "http://www.opencube.com/contact.htm"
-DQM_url3_1 = "http://www.opencube.com/contact.htm"
-DQM_url3_2 = "http://www.opencube.com/contact.htm"
-
diff --git a/public/legacy/js/sb_scripts.js b/public/legacy/js/sb_scripts.js
deleted file mode 100644
index 51dadd0a..00000000
--- a/public/legacy/js/sb_scripts.js
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*! NProgress (c) 2013, Rico Sta. Cruz
- * http://ricostacruz.com/nprogress */
-
-;(function(factory) {
-
- if (typeof module === 'function') {
- module.exports = factory(this.jQuery || require('jquery'));
- } else if (typeof define === 'function' && define.amd) {
- define(['jquery'], function($) {
- return factory($);
- });
- } else {
- this.NProgress = factory(this.jQuery);
- }
-
-})(function($) {
- var NProgress = {};
-
- NProgress.version = '0.1.2';
-
- var Settings = NProgress.settings = {
- minimum: 0.08,
- easing: 'ease',
- positionUsing: '',
- speed: 200,
- trickle: true,
- trickleRate: 0.02,
- trickleSpeed: 800,
- showSpinner: true,
- template: ''):i.attr(o[1],n)}}else t.find(v+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.id="mfp-sbm",e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("
').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto);!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){var c,d,e=this.length>>>0,f=!1;for(1
",v=function(a){return k(a)?a.nodeValue.length:a.childNodes.length},w=function(a){l(a)||v(a)||(a.innerHTML=u)},x=function(a,c){for(;a;){if(c(a))return a;if(b(a))break;a=a.parentNode}return null},y=function(a,c){c=c||f.fail;var d=[];return x(a,function(a){return b(a)||d.push(a),c(a)}),d},z=function(b,c){for(var d=y(b),e=c;e;e=e.parentNode)if(a.inArray(e,d)>-1)return e;return null},A=function(a,b){var c=[],d=!1,e=!1;return function f(g){if(g){if(g===a&&(d=!0),d&&!e&&c.push(g),g===b)return void(e=!0);for(var h=0,i=g.childNodes.length;i>h;h++)f(g.childNodes[h])}}(z(a,b)),c},B=function(a,b){b=b||f.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.previousSibling;return c},C=function(a,b){b=b||f.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.nextSibling;return c},D=function(a,b){var c=[];return b=b||f.ok,function d(e){a!==e&&b(e)&&c.push(e);for(var f=0,g=e.childNodes.length;g>f;f++)d(e.childNodes[f])}(a),c},E=function(b,c){var d=b.parentNode,e=a("<"+c+">")[0];return d.insertBefore(e,b),e.appendChild(b),e},F=function(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a},G=function(b,c){return a.each(c,function(a,c){b.appendChild(c)}),b},H=function(a){return 0===a.offset},I=function(a){return a.offset===v(a.node)},J=function(a){return 0===a.offset||I(a)},K=function(a,b){for(;a&&a!==b;){if(L(a)!==v(a.parentNode)-1)return!1;a=a.parentNode}return!0},L=function(a){for(var b=0;a=a.previousSibling;)b+=1;return b},M=function(a){return a&&a.childNodes&&a.childNodes.length},N=function(a,c){var d,e;if(0===a.offset){if(b(a.node))return null;d=a.node.parentNode,e=L(a.node)}else M(a.node)?(d=a.node.childNodes[e-1],e=v(d)):(d=a.node,e=c?0:a.offset-1);return{node:d,offset:e}},O=function(a,c){var d,e;if(v(a.node)===a.offset){if(b(a.node))return null;d=a.node.parentNode,e=L(a.node)+1}else M(a.node)?(d=a.node.childNodes[a.offset],e=0):(d=a.node,e=c?v(a.node):a.offset+1);return{node:d,offset:e}},P=function(a,b){return a.node===b.node&&a.offset===b.offset},Q=function(a,b){for(;a;){if(b(a))return a;a=N(a)}return null},R=function(a,b,c,d){for(var e=a;e&&(c(e),!P(e,b));){var f=d&&a.node!==e.node;e=O(e,f)}},S=function(b,c){var d=g.initial(y(c,f.eq(b)));return a.map(d,L).reverse()},T=function(a,b){for(var c=a,d=0,e=b.length;e>d;d++)c=c.childNodes[b[d]];return c},U=function(a){if(k(a.node))return H(a)?a.node:I(a)?a.node.nextSibling:a.node.splitText(a.offset);var b=a.node.childNodes[a.offset],c=F(a.node.cloneNode(!1),a.node);return G(c,C(b)),w(a.node),w(c),c},V=function(a,b){var c=y(b.node,f.eq(a));return c.length?1===c.length?U(b):c.reduce(function(a,c){var d=F(c.cloneNode(!1),c);return a===b.node&&(a=U(b)),G(d,C(a)),w(c),w(d),d}):null},W=function(a){return document.createTextNode(a)},X=function(a,b){if(a&&a.parentNode){if(a.removeNode)return a.removeNode(b);var c=a.parentNode;if(!b){var d,e,f=[];for(d=0,e=a.childNodes.length;e>d;d++)f.push(a.childNodes[d]);for(d=0,e=f.length;e>d;d++)c.insertBefore(f[d],a)}c.removeChild(a)}},Y=j("TEXTAREA"),Z=function(a){return Y(a[0])?a.val():a.html()};return{NBSP_CHAR:h,ZERO_WIDTH_NBSP_CHAR:i,blank:u,emptyPara:"").one("load",function(){d.resolve(a(this))}).one("error abort",function(){d.reject(a(this))}).css({display:"none"}).appendTo(document.body).attr("src",b).attr("data-filename",c)}).promise()};return{readFileAsDataURL:b,createImage:c}}(),m={isEdit:function(a){return-1!==[8,9,13,32].indexOf(a)},nameFromCode:{8:"BACKSPACE",9:"TAB",13:"ENTER",32:"SPACE",48:"NUM0",49:"NUM1",50:"NUM2",51:"NUM3",52:"NUM4",53:"NUM5",54:"NUM6",55:"NUM7",56:"NUM8",66:"B",69:"E",73:"I",74:"J",75:"K",76:"L",82:"R",83:"S",85:"U",89:"Y",90:"Z",191:"SLASH",219:"LEFTBRACKET",220:"BACKSLASH",221:"RIGHTBRACKET"}},n=function(){var b=function(b,c){if(e.jqueryVersion<1.9){var d={};return a.each(c,function(a,c){d[c]=b.css(c)}),d}return b.css.call(b,c)};this.stylePara=function(b,c){a.each(b.nodes(j.isPara,{includeAncestor:!0}),function(b,d){a(d).css(c)})},this.current=function(c,d){var e=a(j.isText(c.sc)?c.sc.parentNode:c.sc),f=["font-family","font-size","text-align","list-style-type","line-height"],g=b(e,f)||{};if(g["font-size"]=parseInt(g["font-size"],10),g["font-bold"]=document.queryCommandState("bold")?"bold":"normal",g["font-italic"]=document.queryCommandState("italic")?"italic":"normal",g["font-underline"]=document.queryCommandState("underline")?"underline":"normal",g["font-strikethrough"]=document.queryCommandState("strikeThrough")?"strikethrough":"normal",g["font-superscript"]=document.queryCommandState("superscript")?"superscript":"normal",g["font-subscript"]=document.queryCommandState("subscript")?"subscript":"normal",c.isOnList()){var h=["circle","disc","disc-leading-zero","square"],i=a.inArray(g["list-style-type"],h)>-1;g["list-style"]=i?"unordered":"ordered"}else g["list-style"]="none";var k=j.ancestor(c.sc,j.isPara);if(k&&k.style["line-height"])g["line-height"]=k.style.lineHeight;else{var l=parseInt(g["line-height"],10)/parseInt(g["font-size"],10);g["line-height"]=l.toFixed(1)}return g.image=j.isImg(d)&&d,g.anchor=c.isOnAnchor()&&j.ancestor(c.sc,j.isAnchor),g.ancestors=j.listAncestor(c.sc,j.isEditable),g.range=c,g}},o=function(){var b=function(a,b){var c,d,e=a.parentElement(),f=document.body.createTextRange(),h=g.from(e.childNodes);for(c=0;c
"+j.blank+" ");d=e.join("");for(var g,h=[],i=0;c>i;i++)h.push(""+d+" ");return g=h.join(""),a(''+g+"
")[0]}},q=function(){var b=new n,c=new p;this.saveRange=function(a){a.focus(),a.data("range",o.create())},this.restoreRange=function(a){var b=a.data("range");b&&(b.select(),a.focus())},this.currentStyle=function(a){var c=o.create();return c?c.isOnEditable()&&b.current(c,a):!1},this.undo=function(a){a.data("NoteHistory").undo(a)},this.redo=function(a){a.data("NoteHistory").redo(a)};for(var d=this.recordUndo=function(a){a.data("NoteHistory").recordUndo(a)},f=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","insertOrderedList","insertUnorderedList","indent","outdent","formatBlock","removeFormat","backColor","foreColor","insertHorizontalRule","fontName"],h=0,i=f.length;i>h;h++)this[f[h]]=function(a){return function(b,c){d(b),document.execCommand(a,!1,c)}}(f[h]);var k=function(a,b,c){d(a);var e=j.createText(new Array(c+1).join(j.NBSP_CHAR));b=b.deleteContents(),b.insertNode(e,!0),b=o.create(e,c),b.select()};this.tab=function(a,b){var d=o.create();d.isCollapsed()&&d.isOnCell()?c.tab(d):k(a,d,b.tabsize)},this.untab=function(){var a=o.create();a.isCollapsed()&&a.isOnCell()&&c.tab(a,!0)},this.insertParagraph=function(a){d(a);var b=o.create();b=b.deleteContents(),b=b.wrapBodyInlineWithPara();var c=j.ancestor(b.sc,j.isPara),e=j.splitTree(c,b.getStartPoint());o.create(e,0).select()},this.insertImage=function(a,b,c){l.createImage(b,c).then(function(b){d(a),b.css({display:"",width:Math.min(a.width(),b.width())}),o.create().insertNode(b[0])}).fail(function(){var b=a.data("callbacks");b.onImageUploadError&&b.onImageUploadError()})},this.insertVideo=function(b,c){d(b);var e,f=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,g=c.match(f),h=/\/\/instagram.com\/p\/(.[a-zA-Z0-9]*)/,i=c.match(h),j=/\/\/vine.co\/v\/(.[a-zA-Z0-9]*)/,k=c.match(j),l=/\/\/(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/,m=c.match(l),n=/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/,p=c.match(n),q=/\/\/v\.youku\.com\/v_show\/id_(\w+)\.html/,r=c.match(q);if(g&&11===g[2].length){var s=g[2];e=a("