code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
package org.moyakarta.rest; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class PlaceServiceBootstrap implements ServletContextListener { static final String PLACE_STORAGE_NAME = PlaceStorage.class.getName(); public void contextDestroyed(ServletContextEvent sce) { ServletContext sctx = sce.getServletContext(); sctx.removeAttribute(PLACE_STORAGE_NAME); } public void contextInitialized(ServletContextEvent sce) { ServletContext sctx = sce.getServletContext(); sctx.setAttribute(PLACE_STORAGE_NAME, new PlaceStorage()); } }
10100ckua
trunk/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceServiceBootstrap.java
Java
lgpl
659
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>EverRest Example</title> </head> <body> <h1>EverRest Example</h1> <p>This is sample of using EverRest to launch JAX-RS services.</p> <p>We will create simple places service. It should be able give access to places by id, get list all available places and add new place in storage. Service supports JSON format for transfer data to/from client.</p> </body> <ul> <li>Add required <i>contex-param</i>. <pre> &lt;context-param&gt; &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt; &lt;param-value&gt;org.moyakarta.rest.PlaceApplication&lt;/param-value&gt; &lt;/context-param&gt; </pre> <table border="1"> <tbody> <tr> <th>Parameter</th> <th>Description</th> </tr> <tr> <td>javax.ws.rs.Application</td> <td>This is FQN of Java class that extends <i>javax.ws.rs.core.Application</i> and provides set of classes and(or) instances of JAX-RS components.</td> </tr> </tbody> </table></li> <li>Add bootstrap listeners. <p>Need add two listeners. First one initializes PlaceStorage and adds it to servlet context. The second one initializes common components of EverRest frameworks.</p> <pre> &lt;listener&gt; &lt;listener-class&gt;org.moyakarta.rest.PlaceServiceBootstrap&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.everrest.core.servlet.EverrestInitializedListener&lt;/listener-class&gt; &lt;/listener&gt; </pre></li> <li>Add EverrestServlet. <pre> &lt;servlet&gt; &lt;servlet-name&gt;EverrestServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.everrest.core.servlet.EverrestServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;EverrestServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </pre></li> <li>EverRest components. <p><i>org.moyakarta.rest.PlaceApplication</i> - application deployer.</p> <pre> public class PlaceApplication extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; cls = new HashSet&lt;Class&lt;?&gt;&gt;(1); cls.add(PlaceService.class); return cls; } @Override public Set&lt;Object&gt; getSingletons() { Set&lt;Object&gt; objs = new HashSet&lt;Object&gt;(1); objs.add(new PlaceNotFoundExceptionMapper()); return objs; } } </pre> <p><i>org.moyakarta.rest.Place</i> - simple Java Bean that will be used to transfer data via JSON.</p> <p><i>org.moyakarta.rest.PlaceNotFoundException</i> - exception that will be thrown by <i>org.moyakarta.rest.PlaceService</i> if client requested place that does not exist in storage.</p> <p><i>org.moyakarta.rest.PlaceNotFoundExceptionMapper</i> - JAX-RS component that intercepts <i>org.moyakarta.rest.PlaceNotFoundException</i> and send correct response to client.</p> <pre> @Provider public class PlaceNotFoundExceptionMapper implements ExceptionMapper&lt;PlaceNotFoundException&gt; { Response toResponse(PlaceNotFoundException exception) { return Response.status(404).entity(exception.getMessage()).type("text/plain").build(); } } </pre> <p><i>org.moyakarta.rest.PlaceService</i> - JAX-RS service that process client's requests. Instance of <i>PlaceStorage</i> will be injected automatically thanks to <i>org.everrest.core.Inject</i> annotation</p> <pre> @Path("places") public class PlaceService { @Inject private PlaceStorage placeStorage; @Path("{id}") @GET @Produces("application/json") public Place get(@PathParam("id") String id) throws PlaceNotFoundException { Place place = placeStorage.getPlace(id); if (place == null) throw new PlaceNotFoundException(id); return place; } @GET @Produces("application/json") public Collection&lt;Place&gt; getAll() { return placeStorage.getAll(); } @PUT @Consumes("application/json") public Response put(Place place, @Context UriInfo uriInfo) { String id = placeStorage.putPlace(place); URI location = uriInfo.getBaseUriBuilder().path(getClass()).path(id).build(); return Response.created(location).entity(location.toString()).type("text/plain").build(); } } </pre> <p><i>org.moyakarta.rest.PlaceStorage</i> - storage of Places.</p> <pre> public class PlaceStorage { private static int idCounter = 100; public synchronized String generateId() { idCounter++; return Integer.toString(idCounter); } private Map&lt;String, Place&gt; books = new ConcurrentHashMap&lt;String, Place&gt;(); public PlaceStorage() { init(); } private void init() { Place book = new Place(); book.setTitle("JUnit in Action"); book.setAuthor("Vincent Masson"); book.setPages(386); book.setPrice(19.37); putPlace(book); } public Place getPlace(String id) { return books.get(id); } public String putPlace(Place book) { String id = book.getId(); if (id == null || id.trim().length() == 0) { id = generateId(); place.setId(id); } places.put(id, place); return id; } public Collection&lt;Place&gt; getAll() { return places.values(); } public int numberOfPlaces() { return places.size(); } } </pre></li> <li>Request mapping. <table border="1"><tbody> <tr> <th>Relative Path</th> <th>HTTP Method</th> <th>Description</th> </tr> <tr> <td>rest/places/{id}</td> <td>GET</td> <td>Get places with specified id. Just after server start only one place in storage and it can be accessed via id <i>101</i></td> </tr> <tr> <td>rest/places/</td> <td>GET</td> <td>Get all places from storage.</td> </tr> <tr> <td>rest/places/</td> <td>PUT</td> <td>Add new place in storage. The body of request must contains place's description in JSON format. The <i>Content-type</i> header must be set to <i>application/json</i></td> </tr> </tbody></table> </li> <li>How to try. <p>Build project.</p> <pre>mvn clean install</pre> <p>Run it with Jetty server.</p> <pre>mvn jetty:run</pre> <p>Point you web browser to <a href="http://localhost:8080/rest/places/101">http://localhost:8080/rest/places/101</a></p> <p>If you are under linux or other unix like OS the you can use <i>curl</i> utility (often it is already installed). Binary build of this utility available for windows also at <a href="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</a>. With <i>curl</i> you able to add new place in storage via command</p> <pre> curl -X PUT \ -H "Content-type:application/json" \ -d '{"author":"My Author","title":"My Title","price":1.00,"pages":100}' \ http://localhost:8080/rest/places/ </pre> </li> </ul> </html>
10100ckua
trunk/mk-rest-war/README.html
HTML
lgpl
8,222
#!/bin/sh # Build and run the tomcat. mvn clean install -Passembly rm -rf ./target/war-unzipped unzip ./target/lib-mk-standalone-tomcat-resources.dir/mk-maps-war-0.3-SNAPSHOT.war -d ./target/war-unzipped #cp ./target/war-unzipped/WEB-INF/lib/slf4j-api-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/slf4j-log4j12-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/log4j-1.2.14.jar ./target/mk-tomcat/lib/ cd ./target/mk-tomcat/bin chmod +x *.sh
10100ckua
trunk/mk-server-tomcat/.svn/text-base/mk-tomcat-build.sh.svn-base
Shell
lgpl
499
#!/bin/sh # Build and run the tomcat. mvn clean install -Passembly rm -rf ./target/war-unzipped unzip ./target/lib-mk-standalone-tomcat-resources.dir/mk-maps-war-0.3-SNAPSHOT.war -d ./target/war-unzipped #cp ./target/war-unzipped/WEB-INF/lib/slf4j-api-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/slf4j-log4j12-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/log4j-1.2.14.jar ./target/mk-tomcat/lib/ cd ./target/mk-tomcat/bin chmod +x *.sh
10100ckua
trunk/mk-server-tomcat/mk-tomcat-build.sh
Shell
lgpl
499
#!/bin/sh # Build and run the tomcat. cd ./mk-maps-war mvn clean install cd .. cd ./mk-server-tomcat mvn clean install -Passembly rm -rf ./target/war-unzipped unzip ./target/lib-mk-standalone-tomcat-resources.dir/mk-maps-war-0.3-SNAPSHOT.war -d ./target/war-unzipped #cp ./target/war-unzipped/WEB-INF/lib/slf4j-api-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/slf4j-log4j12-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/log4j-1.2.14.jar ./target/mk-tomcat/lib/ cd ./target/mk-tomcat/bin chmod +x *.sh
10100ckua
trunk/mk-build.sh
Shell
lgpl
564
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { marker.setPosition(map.getCenter()); var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function UpControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to UP the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = '&nbsp;&nbsp;UP&nbsp;&nbsp;'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, -panOffset); fillUrls(); }); } function DownControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Down the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'DOWN'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, panOffset); fillUrls(); }); } function LeftControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Left the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'LEFT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(-panOffset, 0); fillUrls(); }); } function RightControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Right the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'RIGHT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(panOffset, 0); fillUrls(); }); } function ZoomInControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom In'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() + 1); fillUrls(); }); } function ZoomOutControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom Out'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() - 1); fillUrls(); }); } function RoadmapControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Roadmap In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Roadmap'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); fillUrls(); }); } function HybridControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Hybrid the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Hybrid'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); fillUrls(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { lng = mlng; lat = mlat; markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: false, panControl: false, zoomControl: false, streetViewControl: false, disableDoubleClickZoom: true, draggable: false, scrollwheel: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create the DIV to hold the control and call the UpControl() constructor // passing in this DIV. var upControlDiv = document.createElement('DIV'); var upControl = new UpControl(upControlDiv, map); upControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(upControlDiv); // Create the DIV to hold the control and call the DownControl() constructor // passing in this DIV. var downControlDiv = document.createElement('DIV'); var downControl = new DownControl(downControlDiv, map); downControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(downControlDiv); // Create the DIV to hold the control and call the LeftControl() constructor // passing in this DIV. var leftControlDiv = document.createElement('DIV'); var leftControl = new LeftControl(leftControlDiv, map); leftControlDiv.index = 2; map.controls[google.maps.ControlPosition.LEFT_CENTER].push(leftControlDiv); // Create the DIV to hold the control and call the RightControl() constructor // passing in this DIV. var rightControlDiv = document.createElement('DIV'); var rightControl = new RightControl(rightControlDiv, map); rightControlDiv.index = 3; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(rightControlDiv); // Create the DIV to hold the control and call the ZoomInControl() constructor // passing in this DIV. var zoomInControlDiv = document.createElement('DIV'); var zoomInControl = new ZoomInControl(zoomInControlDiv, map); zoomInControlDiv.index = 4; map.controls[google.maps.ControlPosition.TOP_LEFT].push(zoomInControlDiv); // Create the DIV to hold the control and call the ZoomOutControl() constructor // passing in this DIV. var zoomOutControlDiv = document.createElement('DIV'); var zoomOutControl = new ZoomOutControl(zoomOutControlDiv, map); zoomOutControlDiv.index = 5; map.controls[google.maps.ControlPosition.LEFT_TOP].push(zoomOutControlDiv); // Create the DIV to hold the control and call the RoadmapControl() constructor // passing in this DIV. var roadmapControlDiv = document.createElement('DIV'); var roadmapControl = new RoadmapControl(roadmapControlDiv, map); roadmapControlDiv.index = 5; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(roadmapControlDiv); // Create the DIV to hold the control and call the HybridControl() constructor // passing in this DIV. var hybridControlDiv = document.createElement('DIV'); var hybridControl = new HybridControl(hybridControlDiv, map); hybridControlDiv.index = 5; map.controls[google.maps.ControlPosition.RIGHT_TOP].push(hybridControlDiv); // MARKER marker = new google.maps.Marker({ map: map, draggable: false, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); fillUrls(); initMarkerButtons(marker.getVisible()); //initStyleButtons(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
trunk/website/google-maps-mobile.html
HTML
lgpl
17,946
var def_lat = 49.44; var def_lng = 32.06; var def_zoom = 13; var panOffset = 100; var def_w = '640px'; var def_h = '360px'; var size0_w = '320px'; var size0_h = '200px'; var sizeA_w = def_w; var sizeA_h = def_h; var sizeB_w = '854px'; var sizeB_h = '480px'; var map; var marker; function getParameter(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return null; else return results[1]; } function fillUrlsCommon(maplat, maplng, mapzoom, maptype, markerlat, markerlng) { var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; if (isMarkerVisible()) { params += '&mlat=' + markerlat + '&mlng=' + markerlng; } //if (document.getElementById("map_canvas").style.width != def_w) { params += '&w=' + document.getElementById("map_canvas").style.width; params += '&h=' + document.getElementById("map_canvas").style.height; //} fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); fillTextLinkUrl(); } function fillTheUrl(params, urlname) { var a_elem = document.getElementById(urlname); if (a_elem.href.indexOf('?') > 0) { a_elem.href = a_elem.href.substring(0, a_elem.href.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; } function fillTextLinkUrl() { var a_elem = location.href; var currentLink = null; if (a_elem.indexOf('google-maps-mobile') > 0) { currentLink = document.getElementById('google-maps-mobile').href; } else if (a_elem.indexOf('google-maps') > 0) { currentLink = document.getElementById('google-maps').href; } else if (a_elem.indexOf('yandex-maps') > 0) { currentLink = document.getElementById('yandex-maps').href; } else if (a_elem.indexOf('visicom-maps') > 0) { currentLink = document.getElementById('visicom-maps').href; } else { // default alert('There is no Map Service in the page location.'); return; } document.getElementById('textlink').value = currentLink; document.getElementById('refresh').href = currentLink; } function markerButtons() { if (document.getElementById("setmarker").style.display == "none") { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } else { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } } function initStyleButtons() { styleButtons(); } function styleButtons() { if (document.getElementById("newstyle").style.display != "none") { // get new style document.getElementById("newstyle").style.display = "none"; document.getElementById("oldstyle").style.display = "block"; document.getElementById("map_links").style.display = "block"; document.getElementById("map_links_old").style.display = "none"; } else { // get old style document.getElementById("newstyle").style.display = "block"; document.getElementById("oldstyle").style.display = "none"; document.getElementById("map_links").style.display = "none"; document.getElementById("map_links_old").style.display = "block"; } } function initMarkerButtons(visibleMarker) { if (visibleMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } } function resizeMapCanvas(w, h) { document.getElementById("map_canvas").style.width = w; document.getElementById("map_canvas").style.height = h; document.getElementById("div_url").style.width = w; document.getElementById("map_links").style.width = w; } function initMapCanvasSize() { var w = getParameter('w'); var h = getParameter('h'); if (w != null || h != null) { if (w == null) w = def_w; if (h == null) h = def_h; resizeMapCanvas(w, h); } } function viewPort() { var h = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; var w = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; return { width : w , height : h } } function resizeMap0() { resizeMapCanvas(size0_w, size0_h); resizeMap(); } function resizeMapA() { resizeMapCanvas(sizeA_w, sizeA_h); resizeMap(); } function resizeMapB() { resizeMapCanvas(sizeB_w, sizeB_h); resizeMap(); } function resizeMapMax() { resizeMapCanvas(viewPort().width + 'px', viewPort().height + 'px'); resizeMap(); }
10100ckua
trunk/website/10100ckua-0.3.js
JavaScript
lgpl
5,066
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.visicom.ua/api/2.0.0/map/world_ru.js"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.visible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.coords()[0].lat; markerlng = marker.coords()[0].lng; } var maptype = 'map'; fillUrlsCommon(map.center().lat, map.center().lng, map.zoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.visible()) { marker.visible(false); } else { marker.coords(map.center()); marker.visible(true); } fillUrls(); markerButtons(); map.repaint(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapCenter = {lng: lng, lat: lat}; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = {lng: mlng, lat: mlat}; } map = new VMap(document.getElementById('map_canvas')); map.center(mapCenter, z); // Create marker marker = new VMarker(markerCoordinates); marker.visible(markerCoordinates != null ? true : false); // Set draggable option marker.draggable(true); // The hint //marker.hint('Hint'); // Set header and description of information window //marker.info('header', 'Description'); // Add a marker on the map map.add(marker); // Repaint the map map.repaint(); marker.enddrag(fillUrls); fillUrls(); initMarkerButtons(marker.visible()); //initStyleButtons(); map.enddrag(fillUrls); map.onzoomchange(fillUrls); } function resizeMap() { map.repaint(); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
trunk/website/visicom-maps.html
HTML
lgpl
5,631
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: true, panControl: true, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM, style: google.maps.ZoomControlStyle.LARGE }, rotateControl: true, rotateControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, }, streetViewControl: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addDomListener(map, 'zoom_changed', fillUrls); google.maps.event.addDomListener(map, 'center_changed', fillUrls); google.maps.event.addDomListener(map, 'maptypeid_changed', fillUrls); // MARKER marker = new google.maps.Marker({ map: map, draggable: true, animation: google.maps.Animation.DROP, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); google.maps.event.addListener(marker, 'position_changed', fillUrls); fillUrls(); initMarkerButtons(marker.getVisible()); initStyleButtons(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
trunk/website/google-maps.html
HTML
lgpl
6,810
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("10100ckua-0.3.js"); })();
10100ckua
trunk/website/10100ckua.js
JavaScript
lgpl
208
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://api-maps.yandex.ru/1.1/index.xml?key=AJy6-U0BAAAAJr_5MgIAbUmUfURJX0QfQef4pLZO5vNlHjsAAAAAAAAAAACsZenVuLEihxbcpybjyqyczHDMyA=="></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker != null); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getCoordPoint().getY(); markerlng = marker.getCoordPoint().getX(); } var maptype = (map.getType().getName() == 'Схема' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().getY(), map.getCenter().getX(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } else { var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(),map.getCenter().getY()); addMarker(markerCoordinates); } fillUrls(); markerButtons(); } function addMarker(markerCoordinates) { marker = new YMaps.Placemark(markerCoordinates, {draggable: true}); map.addOverlay(marker); YMaps.Events.observe(marker, marker.Events.DragEnd, fillUrls); YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () { marker.closeBalloon(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = YMaps.MapType.MAP; else if (mapType == 'sat') mapType = YMaps.MapType.HYBRID; else mapType = YMaps.MapType.MAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new YMaps.GeoPoint(mlng,mlat); } var mapCenter = new YMaps.GeoPoint(lng,lat); map = new YMaps.Map(document.getElementById("map_canvas")); map.setCenter(mapCenter, z, mapType); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.enableScrollZoom(); YMaps.Events.observe(map, map.Events.Update, fillUrls); YMaps.Events.observe(map, map.Events.MoveEnd, fillUrls); YMaps.Events.observe(map, map.Events.DragEnd, fillUrls); YMaps.Events.observe(map, map.Events.MultiTouchEnd, fillUrls); YMaps.Events.observe(map, map.Events.SmoothZoomEnd, fillUrls); YMaps.Events.observe(map, map.Events.TypeChange, fillUrls); // MARKER if (markerCoordinates != null) { addMarker(markerCoordinates); } fillUrls(); initMarkerButtons(isMarkerVisible()); //initStyleButtons(); } function resizeMap() { map.redraw(true, null); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
trunk/website/yandex-maps.html
HTML
lgpl
6,626
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://moyakarta.com:81/" : "http://moyakarta.com:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <noscript><p><img src="http://moyakarta.com:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
trunk/website/index.html
HTML
lgpl
2,438
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Моя карта</title> <meta http-equiv="REFRESH" content="0;url=http://moyakarta.com/maps/"> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://moyakarta.com:81/" : "http://moyakarta.com:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <noscript><p><img src="http://moyakarta.com:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
trunk/mk-root-war/root/index.html
HTML
lgpl
1,568
#!/bin/sh # Build the ROOT.war cd ./root echo "= Changed ./root dir" zip -r ROOT.war * echo "= Zipped files to the ROOT.war" rm -rf ../ROOT.war echo "= Removed old ../ROOT.war" mv ROOT.war ../ROOT.war echo "= Moved new ROOT.war to the ../ dir" cd .. echo "= Changed ../ dir" echo "= Finished."
10100ckua
trunk/mk-root-war/.svn/text-base/root-war-build.sh.svn-base
Shell
lgpl
300
#!/bin/sh # Build the ROOT.war cd ./root echo "= Changed ./root dir" zip -r ROOT.war * echo "= Zipped files to the ROOT.war" rm -rf ../ROOT.war echo "= Removed old ../ROOT.war" mv ROOT.war ../ROOT.war echo "= Moved new ROOT.war to the ../ dir" cd .. echo "= Changed ../ dir" echo "= Finished."
10100ckua
trunk/mk-root-war/root-war-build.sh
Shell
lgpl
300
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100.ck.ua Maps</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { marker.setPosition(map.getCenter()); var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function UpControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to UP the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = '&nbsp;&nbsp;UP&nbsp;&nbsp;'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, -panOffset); fillUrls(); }); } function DownControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Down the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'DOWN'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, panOffset); fillUrls(); }); } function LeftControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Left the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'LEFT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(-panOffset, 0); fillUrls(); }); } function RightControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Right the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'RIGHT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(panOffset, 0); fillUrls(); }); } function ZoomInControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom In'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() + 1); fillUrls(); }); } function ZoomOutControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom Out'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() - 1); fillUrls(); }); } function RoadmapControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Roadmap In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Roadmap'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); fillUrls(); }); } function HybridControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Hybrid the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Hybrid'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); fillUrls(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { lng = mlng; lat = mlat; markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: false, panControl: false, zoomControl: false, streetViewControl: false, disableDoubleClickZoom: true, draggable: false, scrollwheel: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create the DIV to hold the control and call the UpControl() constructor // passing in this DIV. var upControlDiv = document.createElement('DIV'); var upControl = new UpControl(upControlDiv, map); upControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(upControlDiv); // Create the DIV to hold the control and call the DownControl() constructor // passing in this DIV. var downControlDiv = document.createElement('DIV'); var downControl = new DownControl(downControlDiv, map); downControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(downControlDiv); // Create the DIV to hold the control and call the LeftControl() constructor // passing in this DIV. var leftControlDiv = document.createElement('DIV'); var leftControl = new LeftControl(leftControlDiv, map); leftControlDiv.index = 2; map.controls[google.maps.ControlPosition.LEFT_CENTER].push(leftControlDiv); // Create the DIV to hold the control and call the RightControl() constructor // passing in this DIV. var rightControlDiv = document.createElement('DIV'); var rightControl = new RightControl(rightControlDiv, map); rightControlDiv.index = 3; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(rightControlDiv); // Create the DIV to hold the control and call the ZoomInControl() constructor // passing in this DIV. var zoomInControlDiv = document.createElement('DIV'); var zoomInControl = new ZoomInControl(zoomInControlDiv, map); zoomInControlDiv.index = 4; map.controls[google.maps.ControlPosition.TOP_LEFT].push(zoomInControlDiv); // Create the DIV to hold the control and call the ZoomOutControl() constructor // passing in this DIV. var zoomOutControlDiv = document.createElement('DIV'); var zoomOutControl = new ZoomOutControl(zoomOutControlDiv, map); zoomOutControlDiv.index = 5; map.controls[google.maps.ControlPosition.LEFT_TOP].push(zoomOutControlDiv); // Create the DIV to hold the control and call the RoadmapControl() constructor // passing in this DIV. var roadmapControlDiv = document.createElement('DIV'); var roadmapControl = new RoadmapControl(roadmapControlDiv, map); roadmapControlDiv.index = 5; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(roadmapControlDiv); // Create the DIV to hold the control and call the HybridControl() constructor // passing in this DIV. var hybridControlDiv = document.createElement('DIV'); var hybridControl = new HybridControl(hybridControlDiv, map); hybridControlDiv.index = 5; map.controls[google.maps.ControlPosition.RIGHT_TOP].push(hybridControlDiv); // MARKER marker = new google.maps.Marker({ map: map, draggable: false, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); fillUrls(); initMarkerButtons(marker.getVisible()); //initStyleButtons(); } function resizeMapA() { resizeMapCanvas('500px', '300px'); google.maps.event.trigger(map, 'resize'); fillUrls(); } function resizeMapB() { resizeMapCanvas('800px', '600px'); google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <a href="" id="refresh" >Обновить</a> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resize500" type="button" value="Размер 500" name="button1" onClick="resizeMapA()"> <input id="resize800" type="button" value="Размер 800" name="button2" onClick="resizeMapB()"> </form> </body> </html>
10100ckua
tags/0.2/website/google-maps-mobile.html
HTML
lgpl
17,798
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>10100.ck.ua</title> <meta http-equiv="REFRESH" content="0;url=http://10100.ck.ua/maps/"> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://pdahelp.info:81/" : "http://pdahelp.info:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src="http://pdahelp.info:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
tags/0.2/website/main_site_page/index.html
HTML
lgpl
1,503
var def_lat = 49.44; var def_lng = 32.06; var def_zoom = 13; var panOffset = 100; var def_w = '500px'; var def_h = '300px'; var map; var marker; function getParameter(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return null; else return results[1]; } function fillUrlsCommon(maplat, maplng, mapzoom, maptype, markerlat, markerlng) { var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; if (isMarkerVisible()) { params += '&mlat=' + markerlat + '&mlng=' + markerlng; } //if (document.getElementById("map_canvas").style.width != def_w) { params += '&w=' + document.getElementById("map_canvas").style.width; params += '&h=' + document.getElementById("map_canvas").style.height; //} fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); fillTextLinkUrl(); } function fillTheUrl(params, urlname) { var a_elem = document.getElementById(urlname); if (a_elem.href.indexOf('?') > 0) { a_elem.href = a_elem.href.substring(0, a_elem.href.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; } function fillTextLinkUrl() { var a_elem = location.href; var currentLink = null; if (a_elem.indexOf('google-maps-mobile') > 0) { currentLink = document.getElementById('google-maps-mobile').href; } else if (a_elem.indexOf('google-maps') > 0) { currentLink = document.getElementById('google-maps').href; } else if (a_elem.indexOf('yandex-maps') > 0) { currentLink = document.getElementById('yandex-maps').href; } else if (a_elem.indexOf('visicom-maps') > 0) { currentLink = document.getElementById('visicom-maps').href; } else { // default alert('There is no Map Service in the page location.'); return; } document.getElementById('textlink').value = currentLink; document.getElementById('refresh').href = currentLink; } function markerButtons() { if (document.getElementById("setmarker").style.display == "none") { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } else { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } } function initStyleButtons() { styleButtons(); } function styleButtons() { if (document.getElementById("newstyle").style.display != "none") { // get new style document.getElementById("newstyle").style.display = "none"; document.getElementById("oldstyle").style.display = "block"; document.getElementById("map_links").style.display = "block"; document.getElementById("map_links_old").style.display = "none"; } else { // get old style document.getElementById("newstyle").style.display = "block"; document.getElementById("oldstyle").style.display = "none"; document.getElementById("map_links").style.display = "none"; document.getElementById("map_links_old").style.display = "block"; } } function initMarkerButtons(visibleMarker) { if (visibleMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } } function resizeMapCanvas(w, h) { document.getElementById("map_canvas").style.width = w; document.getElementById("map_canvas").style.height = h; document.getElementById("div_url").style.width = w; document.getElementById("map_links").style.width = w; } function initMapCanvasSize() { var w = getParameter('w'); var h = getParameter('h'); if (w != null || h != null) { if (w == null) w = def_w; if (h == null) h = def_h; resizeMapCanvas(w, h); } }
10100ckua
tags/0.2/website/10100ckua-0.2.js
JavaScript
lgpl
4,256
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100.ck.ua Maps</title> <script type="text/javascript" src="http://maps.visicom.ua/api/2.0.0/map/world_ru.js"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.visible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.coords()[0].lat; markerlng = marker.coords()[0].lng; } var maptype = 'map'; fillUrlsCommon(map.center().lat, map.center().lng, map.zoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.visible()) { marker.visible(false); } else { marker.coords(map.center()); marker.visible(true); } fillUrls(); markerButtons(); map.repaint(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapCenter = {lng: lng, lat: lat}; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = {lng: mlng, lat: mlat}; } map = new VMap(document.getElementById('map_canvas')); map.center(mapCenter, z); // Create marker marker = new VMarker(markerCoordinates); marker.visible(markerCoordinates != null ? true : false); // Set draggable option marker.draggable(true); // The hint //marker.hint('Hint'); // Set header and description of information window //marker.info('header', 'Description'); // Add a marker on the map map.add(marker); // Repaint the map map.repaint(); marker.enddrag(fillUrls); fillUrls(); initMarkerButtons(marker.visible()); //initStyleButtons(); map.enddrag(fillUrls); map.onzoomchange(fillUrls); } function resizeMapA() { resizeMapCanvas('500px', '300px'); map.repaint(); fillUrls(); } function resizeMapB() { resizeMapCanvas('800px', '600px'); map.repaint(); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <a href="" id="refresh" >Обновить</a> <div id="map_canvas" style="width: 500px; height: 300px;"> <a id="visicom_copyright_link" href="http://maps.visicom.ua/">карта</a> </div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resize500" type="button" value="Размер 500" name="button1" onClick="resizeMapA()"> <input id="resize800" type="button" value="Размер 800" name="button2" onClick="resizeMapB()"> </form> </body> </html>
10100ckua
tags/0.2/website/visicom-maps.html
HTML
lgpl
5,533
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100.ck.ua Maps</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: true, panControl: true, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM, style: google.maps.ZoomControlStyle.LARGE }, rotateControl: true, rotateControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, }, streetViewControl: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addDomListener(map, 'zoom_changed', fillUrls); google.maps.event.addDomListener(map, 'center_changed', fillUrls); google.maps.event.addDomListener(map, 'maptypeid_changed', fillUrls); // MARKER marker = new google.maps.Marker({ map: map, draggable: true, animation: google.maps.Animation.DROP, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); google.maps.event.addListener(marker, 'position_changed', fillUrls); fillUrls(); initMarkerButtons(marker.getVisible()); initStyleButtons(); } function resizeMapA() { resizeMapCanvas('500px', '300px'); google.maps.event.trigger(map, 'resize'); fillUrls(); } function resizeMapB() { resizeMapCanvas('800px', '600px'); google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <a href="" id="refresh" >Обновить</a> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resize500" type="button" value="Размер 500" name="button1" onClick="resizeMapA()"> <input id="resize800" type="button" value="Размер 800" name="button2" onClick="resizeMapB()"> </form> </body> </html>
10100ckua
tags/0.2/website/google-maps.html
HTML
lgpl
6,662
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("10100ckua-0.2.js"); })();
10100ckua
tags/0.2/website/10100ckua.js
JavaScript
lgpl
208
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100.ck.ua Maps</title> <script type="text/javascript" src="http://api-maps.yandex.ru/1.1/index.xml?key=AEhNj0wBAAAA7BsdKQMAlGEKbVsN-14cI6Lo6t2YdVJhxEgAAAAAAAAAAABQgxnxNpT7r_9T_F_zgRNtZxrOIw=="></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker != null); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getCoordPoint().getY(); markerlng = marker.getCoordPoint().getX(); } var maptype = (map.getType().getName() == 'Схема' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().getY(), map.getCenter().getX(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } else { var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(),map.getCenter().getY()); addMarker(markerCoordinates); } fillUrls(); markerButtons(); } function addMarker(markerCoordinates) { marker = new YMaps.Placemark(markerCoordinates, {draggable: true}); map.addOverlay(marker); YMaps.Events.observe(marker, marker.Events.DragEnd, fillUrls); YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () { marker.closeBalloon(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = YMaps.MapType.MAP; else if (mapType == 'sat') mapType = YMaps.MapType.HYBRID; else mapType = YMaps.MapType.MAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new YMaps.GeoPoint(mlng,mlat); } var mapCenter = new YMaps.GeoPoint(lng,lat); map = new YMaps.Map(document.getElementById("map_canvas")); map.setCenter(mapCenter, z, mapType); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.enableScrollZoom(); YMaps.Events.observe(map, map.Events.Update, fillUrls); YMaps.Events.observe(map, map.Events.MoveEnd, fillUrls); YMaps.Events.observe(map, map.Events.DragEnd, fillUrls); YMaps.Events.observe(map, map.Events.MultiTouchEnd, fillUrls); YMaps.Events.observe(map, map.Events.SmoothZoomEnd, fillUrls); YMaps.Events.observe(map, map.Events.TypeChange, fillUrls); // MARKER if (markerCoordinates != null) { addMarker(markerCoordinates); } fillUrls(); initMarkerButtons(isMarkerVisible()); //initStyleButtons(); } function resizeMapA() { resizeMapCanvas('500px', '300px'); map.redraw(true, null); fillUrls(); } function resizeMapB() { resizeMapCanvas('800px', '600px'); map.redraw(true, null); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <a href="" id="refresh" >Обновить</a> <div id="map_canvas" style="width:500px;height:300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resize500" type="button" value="Размер 500" name="button1" onClick="resizeMapA()"> <input id="resize800" type="button" value="Размер 800" name="button2" onClick="resizeMapB()"> </form> </body> </html>
10100ckua
tags/0.2/website/yandex-maps.html
HTML
lgpl
6,435
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100.ck.ua Maps</title> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://pdahelp.info:81/" : "http://pdahelp.info:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src="http://pdahelp.info:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
tags/0.2/website/index.html
HTML
lgpl
2,378
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100 Maps</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function setCoordinates() { marker.setPosition(map.getCenter()); var params = 'lat=' + map.getCenter().lat() + '&lng=' + map.getCenter().lng() + '&zoom=' + map.getZoom() + '&type=' + (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); if (marker.getVisible()) { params += '&mlat=' + marker.getPosition().lat() + '&mlng=' + marker.getPosition().lng(); } fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); setLinkUrl(); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } setCoordinates(); markerButtons(); } function UpControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to UP the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = '&nbsp;&nbsp;UP&nbsp;&nbsp;'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, -panOffset); setCoordinates(); }); } function DownControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Down the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'DOWN'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, panOffset); setCoordinates(); }); } function LeftControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Left the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'LEFT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(-panOffset, 0); setCoordinates(); }); } function RightControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Right the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'RIGHT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(panOffset, 0); setCoordinates(); }); } function ZoomInControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom In'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() + 1); setCoordinates(); }); } function ZoomOutControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom Out'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() - 1); setCoordinates(); }); } function RoadmapControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Roadmap In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Roadmap'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); setCoordinates(); }); } function HybridControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Hybrid the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Hybrid'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); setCoordinates(); }); } function initialize() { var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('zoom')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('type'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { lng = mlng; lat = mlat; markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: false, panControl: false, zoomControl: false, streetViewControl: false, disableDoubleClickZoom: true, draggable: false, scrollwheel: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create the DIV to hold the control and call the UpControl() constructor // passing in this DIV. var upControlDiv = document.createElement('DIV'); var upControl = new UpControl(upControlDiv, map); upControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(upControlDiv); // Create the DIV to hold the control and call the DownControl() constructor // passing in this DIV. var downControlDiv = document.createElement('DIV'); var downControl = new DownControl(downControlDiv, map); downControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(downControlDiv); // Create the DIV to hold the control and call the LeftControl() constructor // passing in this DIV. var leftControlDiv = document.createElement('DIV'); var leftControl = new LeftControl(leftControlDiv, map); leftControlDiv.index = 2; map.controls[google.maps.ControlPosition.LEFT_CENTER].push(leftControlDiv); // Create the DIV to hold the control and call the RightControl() constructor // passing in this DIV. var rightControlDiv = document.createElement('DIV'); var rightControl = new RightControl(rightControlDiv, map); rightControlDiv.index = 3; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(rightControlDiv); // Create the DIV to hold the control and call the ZoomInControl() constructor // passing in this DIV. var zoomInControlDiv = document.createElement('DIV'); var zoomInControl = new ZoomInControl(zoomInControlDiv, map); zoomInControlDiv.index = 4; map.controls[google.maps.ControlPosition.TOP_LEFT].push(zoomInControlDiv); // Create the DIV to hold the control and call the ZoomOutControl() constructor // passing in this DIV. var zoomOutControlDiv = document.createElement('DIV'); var zoomOutControl = new ZoomOutControl(zoomOutControlDiv, map); zoomOutControlDiv.index = 5; map.controls[google.maps.ControlPosition.LEFT_TOP].push(zoomOutControlDiv); // Create the DIV to hold the control and call the RoadmapControl() constructor // passing in this DIV. var roadmapControlDiv = document.createElement('DIV'); var roadmapControl = new RoadmapControl(roadmapControlDiv, map); roadmapControlDiv.index = 5; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(roadmapControlDiv); // Create the DIV to hold the control and call the HybridControl() constructor // passing in this DIV. var hybridControlDiv = document.createElement('DIV'); var hybridControl = new HybridControl(hybridControlDiv, map); hybridControlDiv.index = 5; map.controls[google.maps.ControlPosition.RIGHT_TOP].push(hybridControlDiv); // MARKER marker = new google.maps.Marker({ map: map, draggable: false, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); //google.maps.event.addListener(marker, 'position_changed', function dragMarker() { // if (marker.getPosition() != map.getCenter()) // map.setCenter(marker.getPosition()); // }); setCoordinates(); initMarkerButtons(marker.getVisible()); initStyleButtons(); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="map_links_old" style="width: 500px; height: 120px;"> <a href="google-maps.html" id="google-maps">google</a><br/> <a href="visicom-maps.html" id="visicom-maps" >visicom</a><br/> <a href="yandex-maps.html" id="yandex-maps" >yandex</a><br/> <a href="google-maps-mobile.html" id="google-maps-mobile">google mobile</a><br/> </div> <form> <input id="setmarker" type="button" value="Set Marker" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Remove Marker" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="newstyle" type="button" value="New style" name="buttonNewStyle" onClick="styleButtons()"> <input id="oldstyle" type="button" value="Old style" name="buttonOldStyle" onClick="styleButtons()"> </form> </body> </html>
10100ckua
tags/0.1/website/google-maps-mobile.html
HTML
lgpl
17,591
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- <meta http-equiv="imagetoolbar" content="no" />--> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100 Maps</title> <script type="text/javascript" src="http://maps.visicom.ua/api/2.0.0/map/world_ru.js"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function setCoordinates() { var params = 'lat=' + map.center().lat + '&lng=' + map.center().lng + '&zoom=' + map.zoom() + '&type=' + 'map'; if (marker.visible()) { params += '&mlat=' + marker.coords()[0].lat + '&mlng=' + marker.coords()[0].lng; } fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); setLinkUrl(); } function processMarker() { if (marker.visible()) { marker.visible(false); } else { marker.coords(map.center()); marker.visible(true); } setCoordinates(); markerButtons(); map.repaint(); } function initialize() { var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('zoom')); if (z == null || isNaN(z)) z = def_zoom; var mapCenter = {lng: lng, lat: lat}; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = {lng: mlng, lat: mlat}; } map = new VMap(document.getElementById('map_canvas')); map.center(mapCenter, z); // Create marker marker = new VMarker(markerCoordinates); marker.visible(markerCoordinates != null ? true : false); // Set draggable option marker.draggable(true); // The hint //marker.hint('Hint'); // Set header and description of information window //marker.info('header', 'Description'); // Add a marker on the map map.add(marker); // Repaint the map map.repaint(); marker.enddrag(setCoordinates); setCoordinates(); initMarkerButtons(marker.visible()); initStyleButtons(); map.enddrag(setCoordinates); map.onzoomchange(setCoordinates); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px;"> <a id="visicom_copyright_link" href="http://maps.visicom.ua/">карта</a> </div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="map_links_old" style="width: 500px; height: 120px;"> <a href="google-maps.html" id="google-maps">google</a><br/> <a href="visicom-maps.html" id="visicom-maps" >visicom</a><br/> <a href="yandex-maps.html" id="yandex-maps" >yandex</a><br/> <a href="google-maps-mobile.html" id="google-maps-mobile">google mobile</a><br/> </div> <form> <input id="setmarker" type="button" value="Set Marker" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Remove Marker" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="newstyle" type="button" value="New style" name="buttonNewStyle" onClick="styleButtons()"> <input id="oldstyle" type="button" value="Old style" name="buttonOldStyle" onClick="styleButtons()"> </form> </body> </html>
10100ckua
tags/0.1/website/visicom-maps.html
HTML
lgpl
5,179
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100 Maps</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function setCoordinates() { var params = 'lat=' + map.getCenter().lat() + '&lng=' + map.getCenter().lng() + '&zoom=' + map.getZoom() + '&type=' + (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); if (marker.getVisible()) { params += '&mlat=' + marker.getPosition().lat() + '&mlng=' + marker.getPosition().lng(); } fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); setLinkUrl(); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } setCoordinates(); markerButtons(); } function initialize() { var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('zoom')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('type'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: true, panControl: true, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM, style: google.maps.ZoomControlStyle.LARGE }, rotateControl: true, rotateControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, }, streetViewControl: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addDomListener(map, 'zoom_changed', setCoordinates); google.maps.event.addDomListener(map, 'center_changed', setCoordinates); google.maps.event.addDomListener(map, 'maptypeid_changed', setCoordinates); // MARKER marker = new google.maps.Marker({ map: map, draggable: true, animation: google.maps.Animation.DROP, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); google.maps.event.addListener(marker, 'position_changed', setCoordinates); setCoordinates(); initMarkerButtons(marker.getVisible()); initStyleButtons(); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="map_links_old" style="width: 500px; height: 120px;"> <a href="google-maps.html" id="google-maps">google</a><br/> <a href="visicom-maps.html" id="visicom-maps" >visicom</a><br/> <a href="yandex-maps.html" id="yandex-maps" >yandex</a><br/> <a href="google-maps-mobile.html" id="google-maps-mobile">google mobile</a><br/> </div> <form> <input id="setmarker" type="button" value="Set Marker" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Remove Marker" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="newstyle" type="button" value="New style" name="buttonNewStyle" onClick="styleButtons()"> <input id="oldstyle" type="button" value="Old style" name="buttonOldStyle" onClick="styleButtons()"> </form> </body> </html>
10100ckua
tags/0.1/website/google-maps.html
HTML
lgpl
6,190
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("10100ckua-0.1.js"); })();
10100ckua
tags/0.1/website/10100ckua.js
JavaScript
lgpl
208
var def_lat = 49.44; var def_lng = 32.06; var def_zoom = 13; var panOffset = 100; var map; var marker; function getParameter(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return null; else return results[1]; } function fillTheUrl(params, urlname) { var a_elem = document.getElementById(urlname); if (a_elem.href.indexOf('?') > 0) { a_elem.href = a_elem.href.substring(0, a_elem.href.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; } function setLinkUrl() { var a_elem = location.href; if (a_elem.indexOf('google-maps-mobile') > 0) { document.getElementById('textlink').value = document.getElementById('google-maps-mobile').href; } else if (a_elem.indexOf('google-maps') > 0) { document.getElementById('textlink').value = document.getElementById('google-maps').href; } else if (a_elem.indexOf('yandex-maps') > 0) { document.getElementById('textlink').value = document.getElementById('yandex-maps').href; } else if (a_elem.indexOf('visicom-maps') > 0) { document.getElementById('textlink').value = document.getElementById('visicom-maps').href; } else { // default alert('There is no Map Service in the page location.'); } } function markerButtons() { if (document.getElementById("setmarker").style.display == "none") { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } else { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } } function initStyleButtons() { styleButtons(); } function styleButtons() { if (document.getElementById("newstyle").style.display != "none") { // get new style document.getElementById("newstyle").style.display = "none"; document.getElementById("oldstyle").style.display = "block"; document.getElementById("map_links").style.display = "block"; document.getElementById("map_links_old").style.display = "none"; } else { // get old style document.getElementById("newstyle").style.display = "block"; document.getElementById("oldstyle").style.display = "none"; document.getElementById("map_links").style.display = "none"; document.getElementById("map_links_old").style.display = "block"; } } function initMarkerButtons(visibleMarker) { if (visibleMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } }
10100ckua
tags/0.1/website/10100ckua-0.1.js
JavaScript
lgpl
2,913
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100 Maps</title> <script type="text/javascript" src="http://api-maps.yandex.ru/1.1/index.xml?key=AEhNj0wBAAAA7BsdKQMAlGEKbVsN-14cI6Lo6t2YdVJhxEgAAAAAAAAAAABQgxnxNpT7r_9T_F_zgRNtZxrOIw=="></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker != null); } function setCoordinates() { var params = 'lat=' + map.getCenter().getY() + '&lng=' + map.getCenter().getX() + '&zoom=' + map.getZoom() + '&type=' + (map.getType().getName() == 'Схема' ? 'map' : 'sat'); if (isMarkerVisible()) { params += '&mlat=' + marker.getCoordPoint().getY() + '&mlng=' + marker.getCoordPoint().getX() } fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); setLinkUrl(); } function processMarker() { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } else { var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(),map.getCenter().getY()); addMarker(markerCoordinates); } setCoordinates(); markerButtons(); } function addMarker(markerCoordinates) { marker = new YMaps.Placemark(markerCoordinates, {draggable: true}); map.addOverlay(marker); YMaps.Events.observe(marker, marker.Events.DragEnd, setCoordinates); YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () { marker.closeBalloon(); }); } function initialize() { var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('zoom')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('type'); if (mapType == null) mapType = YMaps.MapType.MAP; else if (mapType == 'sat') mapType = YMaps.MapType.HYBRID; else mapType = YMaps.MapType.MAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new YMaps.GeoPoint(mlng,mlat); } var mapCenter = new YMaps.GeoPoint(lng,lat); map = new YMaps.Map(document.getElementById("map_canvas")); map.setCenter(mapCenter, z, mapType); //map.setType(mapType); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.enableScrollZoom(); YMaps.Events.observe(map, map.Events.Update, setCoordinates); YMaps.Events.observe(map, map.Events.MoveEnd, setCoordinates); YMaps.Events.observe(map, map.Events.DragEnd, setCoordinates); YMaps.Events.observe(map, map.Events.MultiTouchEnd, setCoordinates); YMaps.Events.observe(map, map.Events.SmoothZoomEnd, setCoordinates); YMaps.Events.observe(map, map.Events.TypeChange, setCoordinates); // MARKER if (markerCoordinates != null) { addMarker(markerCoordinates); } setCoordinates(); initMarkerButtons(isMarkerVisible()); initStyleButtons(); } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:500px;height:300px"></div> <div id="div_url" style="width: 500px; height: 30px"> <input id="textlink" value="" title="линк" size="60" type="text" maxlength="2048" spellcheck="false" /><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="map_links_old" style="width: 500px; height: 120px;"> <a href="google-maps.html" id="google-maps">google</a><br/> <a href="visicom-maps.html" id="visicom-maps" >visicom</a><br/> <a href="yandex-maps.html" id="yandex-maps" >yandex</a><br/> <a href="google-maps-mobile.html" id="google-maps-mobile">google mobile</a><br/> </div> <form> <input id="setmarker" type="button" value="Set Marker" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Remove Marker" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="newstyle" type="button" value="New style" name="buttonNewStyle" onClick="styleButtons()"> <input id="oldstyle" type="button" value="Old style" name="buttonOldStyle" onClick="styleButtons()"> </form> </body> </html>
10100ckua
tags/0.1/website/yandex-maps.html
HTML
lgpl
6,141
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>10100 maps</title> </head> <body> <a href="google-maps.html" id="google-maps">google-maps.html</a><br/> <a href="google-maps-mobile.html" id="google-maps-mobile">google-maps-mobile.html</a><br/> <a href="visicom-maps.html" id="visicom-maps" >visicom-maps.html</a><br/> <a href="yandex-maps.html" id="yandex-maps" >yandex-maps.html</a><br/> </body> </html>
10100ckua
tags/0.1/website/index.html
HTML
lgpl
639
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript" src="js/moyakarta.js"></script> </head> <body onload="indexPageOnLoad()"> <center> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile" id="google-maps-mobile"> <img border="0" src="images/google-m.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="coords">Ваши координаты:<br /> Широта: <span id="latitude">неизвестно</span><br /> Долгота: <span id="longitude">неизвестно</span><br /> </div> </center> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://moyakarta.com:81/" : "http://moyakarta.com:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <noscript><p><img src="http://moyakarta.com:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/index.jsp
Java Server Pages
lgpl
2,839
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("http://api-maps.yandex.ru/1.1/index.xml?key=AJy6-U0BAAAAJr_5MgIAbUmUfURJX0QfQef4pLZO5vNlHjsAAAAAAAAAAACsZenVuLEihxbcpybjyqyczHDMyA=="); })(); function isMarkerVisible() { return (marker != null); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getCoordPoint().getY(); markerlng = marker.getCoordPoint().getX(); } var maptype = (map.getType().getName() == 'Схема' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().getY(), map.getCenter().getX(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker(isGPS) { if (isGPS) { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } gps_coords = new YMaps.GeoPoint(gps_lng, gps_lat); addMarker(gps_coords); map.setCenter(gps_coords, map.getZoom(), map.getType()); } else { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } else { var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(), map.getCenter().getY()); addMarker(markerCoordinates); } } fillUrls(); markerButtons(isGPS); } function addMarker(markerCoordinates) { marker = new YMaps.Placemark(markerCoordinates, {draggable: true}); map.addOverlay(marker); YMaps.Events.observe(marker, marker.Events.DragEnd, fillUrls); YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () { marker.closeBalloon(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = YMaps.MapType.MAP; else if (mapType == 'sat') mapType = YMaps.MapType.HYBRID; else mapType = YMaps.MapType.MAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new YMaps.GeoPoint(mlng, mlat); } var mapCenter = new YMaps.GeoPoint(lng,lat); map = new YMaps.Map(document.getElementById("map_canvas")); map.setCenter(mapCenter, z, mapType); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.enableScrollZoom(); YMaps.Events.observe(map, map.Events.Update, fillUrls); YMaps.Events.observe(map, map.Events.MoveEnd, fillUrls); YMaps.Events.observe(map, map.Events.DragEnd, fillUrls); YMaps.Events.observe(map, map.Events.MultiTouchEnd, fillUrls); YMaps.Events.observe(map, map.Events.SmoothZoomEnd, fillUrls); YMaps.Events.observe(map, map.Events.TypeChange, fillUrls); // MARKER if (markerCoordinates != null) { addMarker(markerCoordinates); } // init methods fillUrls(); initMarkerButtons(isMarkerVisible()); pageOnLoad(); } function resizeMap() { map.redraw(true, null); fillUrls(); }
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/maps-providers/yandex-maps.js
JavaScript
lgpl
3,433
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("http://maps.visicom.ua/api/2.0.0/map/world_ru.js"); })(); function isMarkerVisible() { return (marker.visible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.coords()[0].lat; markerlng = marker.coords()[0].lng; } var maptype = 'map'; fillUrlsCommon(map.center().lat, map.center().lng, map.zoom(), maptype, markerlat, markerlng); } function processMarker(isGPS) { if (isGPS) { if (marker.visible()) { marker.visible(false); } gps_coords = {lng: gps_lng, lat: gps_lat}; marker.coords(gps_coords); marker.visible(true); map.center(gps_coords); } else { if (marker.visible()) { marker.visible(false); } else { marker.coords(map.center()); marker.visible(true); } } fillUrls(); markerButtons(isGPS); map.repaint(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapCenter = {lng: lng, lat: lat}; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = {lng: mlng, lat: mlat}; } map = new VMap(document.getElementById('map_canvas')); map.center(mapCenter, z); // Create marker marker = new VMarker(markerCoordinates); marker.visible(markerCoordinates != null ? true : false); // Set draggable option marker.draggable(true); // The hint //marker.hint('Hint'); // Set header and description of information window //marker.info('header', 'Description'); // Add a marker on the map map.add(marker); // Repaint the map map.repaint(); marker.enddrag(fillUrls); // init methods fillUrls(); initMarkerButtons(marker.visible()); pageOnLoad(); map.enddrag(fillUrls); map.onzoomchange(fillUrls); } function resizeMap() { map.repaint(); fillUrls(); }
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/maps-providers/visicom-maps.js
JavaScript
lgpl
2,459
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("http://maps.google.com/maps/api/js?sensor=false"); })(); function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { marker.setPosition(map.getCenter()); var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker(isGPS) { if (isGPS) { if (marker.getVisible()) { marker.setVisible(false); } gps_coords = new google.maps.LatLng(gps_lat, gps_lng); marker.setPosition(gps_coords); marker.setVisible(true); map.setCenter(gps_coords); } else { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } } fillUrls(); markerButtons(isGPS); } function UpControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to UP the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = '&nbsp;&nbsp;UP&nbsp;&nbsp;'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, -panOffset); fillUrls(); }); } function DownControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Down the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'DOWN'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, panOffset); fillUrls(); }); } function LeftControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Left the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'LEFT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(-panOffset, 0); fillUrls(); }); } function RightControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Right the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'RIGHT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(panOffset, 0); fillUrls(); }); } function ZoomInControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom In'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() + 1); fillUrls(); }); } function ZoomOutControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom Out'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() - 1); fillUrls(); }); } function RoadmapControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Roadmap In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Roadmap'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); fillUrls(); }); } function HybridControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Hybrid the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Hybrid'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); fillUrls(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { lng = mlng; lat = mlat; markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: false, panControl: false, zoomControl: false, streetViewControl: false, disableDoubleClickZoom: true, draggable: false, scrollwheel: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create the DIV to hold the control and call the UpControl() constructor // passing in this DIV. var upControlDiv = document.createElement('DIV'); var upControl = new UpControl(upControlDiv, map); upControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(upControlDiv); // Create the DIV to hold the control and call the DownControl() constructor // passing in this DIV. var downControlDiv = document.createElement('DIV'); var downControl = new DownControl(downControlDiv, map); downControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(downControlDiv); // Create the DIV to hold the control and call the LeftControl() constructor // passing in this DIV. var leftControlDiv = document.createElement('DIV'); var leftControl = new LeftControl(leftControlDiv, map); leftControlDiv.index = 2; map.controls[google.maps.ControlPosition.LEFT_CENTER].push(leftControlDiv); // Create the DIV to hold the control and call the RightControl() constructor // passing in this DIV. var rightControlDiv = document.createElement('DIV'); var rightControl = new RightControl(rightControlDiv, map); rightControlDiv.index = 3; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(rightControlDiv); // Create the DIV to hold the control and call the ZoomInControl() constructor // passing in this DIV. var zoomInControlDiv = document.createElement('DIV'); var zoomInControl = new ZoomInControl(zoomInControlDiv, map); zoomInControlDiv.index = 4; map.controls[google.maps.ControlPosition.TOP_LEFT].push(zoomInControlDiv); // Create the DIV to hold the control and call the ZoomOutControl() constructor // passing in this DIV. var zoomOutControlDiv = document.createElement('DIV'); var zoomOutControl = new ZoomOutControl(zoomOutControlDiv, map); zoomOutControlDiv.index = 5; map.controls[google.maps.ControlPosition.LEFT_TOP].push(zoomOutControlDiv); // Create the DIV to hold the control and call the RoadmapControl() constructor // passing in this DIV. var roadmapControlDiv = document.createElement('DIV'); var roadmapControl = new RoadmapControl(roadmapControlDiv, map); roadmapControlDiv.index = 5; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(roadmapControlDiv); // Create the DIV to hold the control and call the HybridControl() constructor // passing in this DIV. var hybridControlDiv = document.createElement('DIV'); var hybridControl = new HybridControl(hybridControlDiv, map); hybridControlDiv.index = 5; map.controls[google.maps.ControlPosition.RIGHT_TOP].push(hybridControlDiv); // MARKER marker = new google.maps.Marker({ map: map, draggable: false, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); // init methods fillUrls(); initMarkerButtons(marker.getVisible()); pageOnLoad(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); }
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/maps-providers/google-maps-mobile.js
JavaScript
lgpl
13,262
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("http://maps.google.com/maps/api/js?sensor=false"); })(); function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker(isGPS) { if (isGPS) { if (marker.getVisible()) { marker.setVisible(false); } gps_coords = new google.maps.LatLng(gps_lat, gps_lng); marker.setPosition(gps_coords); marker.setVisible(true); map.setCenter(gps_coords); } else { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } } fillUrls(); markerButtons(isGPS); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: true, panControl: true, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM, style: google.maps.ZoomControlStyle.LARGE }, rotateControl: true, rotateControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, }, streetViewControl: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addDomListener(map, 'zoom_changed', fillUrls); google.maps.event.addDomListener(map, 'center_changed', fillUrls); google.maps.event.addDomListener(map, 'maptypeid_changed', fillUrls); // MARKER marker = new google.maps.Marker({ map: map, draggable: true, animation: google.maps.Animation.DROP, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); google.maps.event.addListener(marker, 'position_changed', fillUrls); // init methods fillUrls(); initMarkerButtons(marker.getVisible()); pageOnLoad(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); }
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/maps-providers/google-maps.js
JavaScript
lgpl
3,554
var _gaq = _gaq || []; _gaq.push( [ '_setAccount', 'UA-1390959-7' ]); _gaq.push( [ '_trackPageview' ]); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); function getMapProvider() { var a_elem = location.href; var mapProvider = null; if (a_elem.indexOf('google-maps-mobile') > 0) { mapProvider = 'google-maps-mobile'; } else if (a_elem.indexOf('google-maps') > 0) { mapProvider = 'google-maps'; } else if (a_elem.indexOf('yandex-maps') > 0) { mapProvider = 'yandex-maps'; } else if (a_elem.indexOf('visicom-maps') > 0) { mapProvider = 'visicom-maps'; } else { mapProvider = 'google-maps'; } return mapProvider; } (function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("js/maps-providers/" + getMapProvider() + ".js"); })(); //map and marker variables var map; var marker; var gps_coords; // init params var def_lat = 48.50; var def_lng = 31.40; var def_zoom = 6; // pan offset for mobile maps var panOffset = 100; // gps params var gps_lat = null; var gps_lng = null; var gps_defzoom = '15'; var gps_defmaptype = 'sat'; // standard map sizes var sizeMicro_w = '320px'; var sizeMicro_h = '200px'; var sizeA_w = '500px'; var sizeA_h = '300px'; var sizeB_w = '640px'; var sizeB_h = '360px'; var sizeC_w = '854px'; var sizeC_h = '480px'; // default maps size var def_w = sizeB_w; var def_h = sizeB_h; // current map position var curr_maplat; var curr_maplng; var curr_mapzoom; var curr_maptype; function getParameter(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) return null; else return results[1]; } function fillUrlsCommon(maplat, maplng, mapzoom, maptype, markerlat, markerlng) { // fill the document variable fields for current map position document.curr_maplat = maplat; document.curr_maplng = maplng; document.curr_mapzoom = mapzoom; document.curr_maptype = maptype; var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; if (isMarkerVisible()) { params += '&mlat=' + markerlat + '&mlng=' + markerlng; } params += '&w=' + document.getElementById("map_canvas").style.width; params += '&h=' + document.getElementById("map_canvas").style.height; fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); fillCurrentMapPositionInText(); } function fillCurrentMapPositionInText() { var a_elem = location.href; var currentLink = null; if (a_elem.indexOf('google-maps-mobile') > 0) { currentLink = document.getElementById('google-maps-mobile').href; } else if (a_elem.indexOf('google-maps') > 0) { currentLink = document.getElementById('google-maps').href; } else if (a_elem.indexOf('yandex-maps') > 0) { currentLink = document.getElementById('yandex-maps').href; } else if (a_elem.indexOf('visicom-maps') > 0) { currentLink = document.getElementById('visicom-maps').href; } else { // default alert('There is no Map Service in the page location.'); return; } document.getElementById('textlink').value = currentLink; document.getElementById('refresh').href = currentLink; } function indexPageOnLoad() { fillIndexPageUrlsWithGPS(); } function fillIndexPageUrlsWithGPS() { if (navigator.geolocation) { navigator.geolocation .getCurrentPosition(function(position) { gps_lat = position.coords.latitude; gps_lng = position.coords.longitude; document.getElementById("latitude").innerHTML = gps_lat; document.getElementById("longitude").innerHTML = gps_lng; var maplat = gps_lat; var maplng = gps_lng; var mapzoom = gps_defzoom; var maptype = gps_defmaptype; var markerlat = gps_lat; var markerlng = gps_lng; var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; params += '&mlat=' + markerlat + '&mlng=' + markerlng; params += '&w=' + def_w; params += '&h=' + def_h; fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); fillTheUrl(params, 'google-maps-mobile'); }); } } /* function fillGPSLink() { if (navigator.geolocation) { navigator.geolocation .getCurrentPosition(function(position) { gps_lat = position.coords.latitude; gps_lng = position.coords.longitude; document.getElementById("gpslink").style.display = "block"; var maplat = gps_lat; var maplng = gps_lng; var mapzoom = document.curr_mapzoom; var maptype = document.curr_maptype; var markerlat = gps_lat; var markerlng = gps_lng; var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; params += '&mlat=' + markerlat + '&mlng=' + markerlng; params += '&w=' + document.getElementById("map_canvas").style.width; params += '&h=' + document.getElementById("map_canvas").style.height; var a_elem = document.getElementById('gpslink'); var elem = location.href; if (elem.indexOf('?') > 0) { a_elem.href = elem.substring(0, elem.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; }); } else { document.getElementById("gpslink").style.display = "none"; } } */ function fillTheUrl(params, urlname) { var a_elem = document.getElementById(urlname); if (a_elem.href.indexOf('?') > 0) { a_elem.href = a_elem.href.substring(0, a_elem.href.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; } function markerButtons(isSetMarker) { if (isSetMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { if (document.getElementById("setmarker").style.display == "none") { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } else { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } } } function pageOnLoad() { initGPS(); // TODO } function initMarkerButtons(visibleMarker) { if (visibleMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } } function resizeMapCanvas(w, h) { document.getElementById("map_canvas").style.width = w; document.getElementById("map_canvas").style.height = h; document.getElementById("div_url").style.width = w; document.getElementById("map_links").style.width = w; document.getElementById("marker_links").style.width = w; } function initMapCanvasSize() { var w = getParameter('w'); var h = getParameter('h'); if (w != null || h != null) { if (w == null) w = def_w; if (h == null) h = def_h; resizeMapCanvas(w, h); } else { resizeMapCanvas(def_w, def_h); } } function viewPort() { var h = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; var w = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; return { width : w, height : h } } function resizeMapMicro() { resizeMapCanvas(sizeMicro_w, sizeMicro_h); resizeMap(); } function resizeMapA() { resizeMapCanvas(sizeA_w, sizeA_h); resizeMap(); } function resizeMapB() { resizeMapCanvas(sizeB_w, sizeB_h); resizeMap(); } function resizeMapC() { resizeMapCanvas(sizeC_w, sizeC_h); resizeMap(); } function resizeMapMacro() { resizeMapCanvas(viewPort().width + 'px', viewPort().height + 'px'); resizeMap(); } function initGPS() { if (navigator.geolocation) { navigator.geolocation .getCurrentPosition(function(position) { gps_lat = position.coords.latitude; gps_lng = position.coords.longitude; }); } }
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/moyakarta-0.3.js
JavaScript
lgpl
9,364
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("js/moyakarta-0.3.js"); })();
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/js/moyakarta.js
JavaScript
lgpl
211
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="js/moyakarta.js"></script> </head> <body onload="initialize()"> <center> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile" id="google-maps-mobile"> <img border="0" src="images/google-m.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <div id="marker_links" style="width: 500px; height: 50px; margin-left:45%;"> <form align="center"> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker(false)"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker(false)"> </form> <!-- a href="" id="gpslink" >GPS: ваши координаты</a --> <input id="gpsbutton" type="button" value="GPS маркер" name="buttongpsmarker" onClick="processMarker(true)"> </div> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="buttonMicro" onClick="resizeMapMicro()"> <input id="resizeSmall" type="button" value="Размер A" name="buttonA" onClick="resizeMapA()"> <input id="resizeNormal" type="button" value="Размер B" name="buttonB" onClick="resizeMapB()"> <input id="resizeLarge" type="button" value="Размер C" name="buttonC" onClick="resizeMapC()"> <input id="resizeMacro" type="button" value="Размер макро" name="buttonMacro" onClick="resizeMapMacro()"> </form> </center> </body> </html>
10100ckua
tags/0.2.1/mk-maps-war/src/main/webapp/jsp/main.jsp
Java Server Pages
lgpl
3,197
package org.moyakarta.server; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import javax.servlet.GenericServlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class KmlServlet extends GenericServlet { private static final int BUFSIZE = 1024; @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { System.out.println(">>> alexey: KmlServlet.service ===================== "); String filename = ""; File f = null; FileInputStream fis = null; String url = req.getParameter("url"); System.out.println(">>> alexey: KmlServlet.service url = " + url); if (url != null) { // new URL(url). req.getRequestDispatcher(url).include(req, res); } else { try { filename = "cta2.kml"; System.out.println(">>> alexey: KmlServlet.service filename = " + filename); System.out.println(">>> alexey: KmlServlet.service getServletContext().getRealPath(filename) = " + getServletContext().getRealPath(filename)); filename = getServletContext().getRealPath(filename); f = new File(filename); fis = new FileInputStream(f); } catch (Exception e) { e.printStackTrace(); } doDownload((HttpServletRequest)req, (HttpServletResponse)res, filename, "cta2.kml"); } } /** * Sends a file to the ServletResponse output stream. Typically * you want the browser to receive a different name than the * name the file has been saved in your local database, since * your local names need to be unique. * * @param req The request * @param res The response * @param filename The name of the file you want to download. * @param original_filename The name the browser should receive. */ private void doDownload(HttpServletRequest req, HttpServletResponse res, String filename, String original_filename) throws IOException { File f = new File(filename); int length = 0; ServletOutputStream op = res.getOutputStream(); ServletContext context = getServletConfig().getServletContext(); String mimetype = context.getMimeType(filename); System.out.println(">>> alexey: KmlServlet.doDownload mimetype = " + mimetype); // // Set the response and go! // res.setContentType((mimetype != null) ? mimetype : "application/octet-stream"); res.setContentLength((int)f.length()); res.setHeader("Content-Disposition", "attachment; filename=\"" + original_filename + "\""); // // Stream to the requester. // byte[] bbuf = new byte[BUFSIZE]; DataInputStream in = new DataInputStream(new FileInputStream(f)); while ((in != null) && ((length = in.read(bbuf)) != -1)) { op.write(bbuf, 0, length); } in.close(); op.flush(); op.close(); } }
10100ckua
tags/0.2.1/mk-maps-war/src/main/java/org/moyakarta/server/KmlServlet.java
Java
lgpl
3,356
package org.moyakarta.server; import java.io.IOException; import javax.servlet.GenericServlet; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; public class MapsServlet extends GenericServlet { /** * */ private static final long serialVersionUID = 4787246679951274988L; @Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest)req; String requestURI = httpRequest.getRequestURI(); String redirectURI = httpRequest.getQueryString() == null ? requestURI.substring(5) : requestURI.substring(5) + "?" + httpRequest.getQueryString(); if (requestURI.equalsIgnoreCase("/maps") || requestURI.contains(".html") || isMapRequest(requestURI)) processMainPage(httpRequest, res); else if (requestURI.endsWith(".js") || requestURI.endsWith(".jpg") || requestURI.endsWith(".css")) httpRequest.getRequestDispatcher(redirectURI).forward(req, res); else httpRequest.getRequestDispatcher(redirectURI).forward(req, res); } private boolean isMapRequest(String requestURI) { if (requestURI.indexOf("google-maps-mobile") > 0 || requestURI.indexOf("google-maps") > 0 || requestURI.indexOf("yandex-maps") > 0 || requestURI.indexOf("visicom-maps") > 0) return true ; return false; } private void processMainPage(ServletRequest req, ServletResponse res) throws IOException, ServletException{ res.setContentType("text/html; charset=utf-8"); HttpServletRequest httpRequest = (HttpServletRequest)req; httpRequest.getRequestDispatcher("/jsp/main.jsp" + "?" + httpRequest.getQueryString()).include(req, res); } }
10100ckua
tags/0.2.1/mk-maps-war/src/main/java/org/moyakarta/server/MapsServlet.java
Java
lgpl
1,975
package org.moyakarta.server; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class MapsFilter implements Filter { @Override public void destroy() { // nothing to do. } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse) response; HttpServletRequest httpRequest = (HttpServletRequest) request; chain.doFilter(httpRequest, httpResponse); } @Override public void init(FilterConfig filterConfig) throws ServletException { // nothing to do. } }
10100ckua
tags/0.2.1/mk-maps-war/src/main/java/org/moyakarta/server/MapsFilter.java
Java
lgpl
952
package org.moyakarta.rest; import java.util.Collection; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; public class PlaceStorage { public synchronized String generateId() { String id = generateEncodedId(); while (getPlace(id) != null) { id = generateEncodedId(); } return id; } private static String generateEncodedId() { Integer intRandom = new Integer(0); while (intRandom.intValue() == 0l) { intRandom = new Random().nextInt(); if (Integer.signum(intRandom) < 0) intRandom = -intRandom; } String result = base48Encode(Long.valueOf(String.valueOf(intRandom))); return result; } private static String base48Encode(Long number) { Double num = Double.valueOf(number); String charSet = "23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ"; Integer length = charSet.length(); String encodeString = new String(); while (num >= length) { int index = Integer.parseInt(String.valueOf(num.longValue() % length)); // Long // value // to // int // value encodeString = charSet.charAt(index) + encodeString; num = Math.ceil(new Double(num / length) - 1); } encodeString = charSet.charAt(num.intValue()) + encodeString; return encodeString; } private Map<String, Place> places = new ConcurrentHashMap<String, Place>(); public PlaceStorage() { init(); } private void init() { Place place = new Place(); place.setTitle("JUnit in Action"); place .setLink("http://moyakarta.com/maps/yandex-maps.html?" + "lat=49.44402965123416&lng=32.058283332735314&z=13&t=map&w=500px&h=300px"); place.setLat(49.44402965123416); place.setLon(32.058283332735314); place.setZ(13); putPlace(place); } public Place getPlace(String id) { return places.get(id); } public String putPlace(Place place) { String id = place.getId(); if (id == null || id.trim().length() == 0) { id = generateId(); place.setId(id); } places.put(id, place); return id; } public Collection<Place> getAll() { return places.values(); } public int numberOfPlaces() { return places.size(); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceStorage.java
Java
lgpl
2,401
package org.moyakarta.rest; public class Place { private String id; private String link; private String title; private double lat; private double lon; private int z; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public double getLat() { return lat; } public void setLat(double lat) { this.lat = lat; } public double getLon() { return lon; } public void setLon(double lon) { this.lon = lon; } public int getZ() { return z; } public void setZ(int z) { this.z = z; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Place:{") .append("title: ").append(title).append(" ") .append("lat: ").append(lat).append(" ") .append("lon: ").append(lon).append(" ") .append("z: ").append(z).append(" ") .append("id: ").append(id).append("} "); return sb.toString(); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/Place.java
Java
lgpl
1,266
package org.moyakarta.rest; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @Provider public class PlaceNotFoundExceptionMapper implements ExceptionMapper<PlaceNotFoundException> { public Response toResponse(PlaceNotFoundException exception) { return Response.status(404).entity(exception.getMessage()).type("text/plain").build(); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceNotFoundExceptionMapper.java
Java
lgpl
412
package org.moyakarta.rest; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; public class PlaceApplication extends Application { @Override public Set<Class<?>> getClasses() { Set<Class<?>> cls = new HashSet<Class<?>>(1); cls.add(PlaceService.class); return cls; } @Override public Set<Object> getSingletons() { Set<Object> objs = new HashSet<Object>(1); objs.add(new PlaceNotFoundExceptionMapper()); return objs; } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceApplication.java
Java
lgpl
518
package org.moyakarta.rest; import java.net.URI; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @Path("places") public class PlaceService { @javax.inject.Inject private PlaceStorage placeStorage; @Path("{id}") @GET @Produces("application/json") public Place get(@PathParam("id") String id) throws PlaceNotFoundException { Place place = placeStorage.getPlace(id); if (place == null) throw new PlaceNotFoundException(id); return place; } @GET @Produces("application/json") public Collection<Place> getAll() { return placeStorage.getAll(); } @PUT @Consumes("application/json") public Response put(Place place, @Context UriInfo uriInfo) { String id = placeStorage.putPlace(place); URI location = uriInfo.getBaseUriBuilder().path(getClass()).path(id).build(); return Response.created(location).entity(location.toString()).type("text/plain").build(); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceService.java
Java
lgpl
1,204
package org.moyakarta.rest; @SuppressWarnings("serial") public class PlaceNotFoundException extends Exception { public PlaceNotFoundException(String id) { super("Place with id " + id + " not found."); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceNotFoundException.java
Java
lgpl
222
package org.moyakarta.rest; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class PlaceServiceBootstrap implements ServletContextListener { static final String PLACE_STORAGE_NAME = PlaceStorage.class.getName(); public void contextDestroyed(ServletContextEvent sce) { ServletContext sctx = sce.getServletContext(); sctx.removeAttribute(PLACE_STORAGE_NAME); } public void contextInitialized(ServletContextEvent sce) { ServletContext sctx = sce.getServletContext(); sctx.setAttribute(PLACE_STORAGE_NAME, new PlaceStorage()); } }
10100ckua
tags/0.2.1/mk-rest-war/src/main/java/org/moyakarta/rest/PlaceServiceBootstrap.java
Java
lgpl
659
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>EverRest Example</title> </head> <body> <h1>EverRest Example</h1> <p>This is sample of using EverRest to launch JAX-RS services.</p> <p>We will create simple places service. It should be able give access to places by id, get list all available places and add new place in storage. Service supports JSON format for transfer data to/from client.</p> </body> <ul> <li>Add required <i>contex-param</i>. <pre> &lt;context-param&gt; &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt; &lt;param-value&gt;org.moyakarta.rest.PlaceApplication&lt;/param-value&gt; &lt;/context-param&gt; </pre> <table border="1"> <tbody> <tr> <th>Parameter</th> <th>Description</th> </tr> <tr> <td>javax.ws.rs.Application</td> <td>This is FQN of Java class that extends <i>javax.ws.rs.core.Application</i> and provides set of classes and(or) instances of JAX-RS components.</td> </tr> </tbody> </table></li> <li>Add bootstrap listeners. <p>Need add two listeners. First one initializes PlaceStorage and adds it to servlet context. The second one initializes common components of EverRest frameworks.</p> <pre> &lt;listener&gt; &lt;listener-class&gt;org.moyakarta.rest.PlaceServiceBootstrap&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.everrest.core.servlet.EverrestInitializedListener&lt;/listener-class&gt; &lt;/listener&gt; </pre></li> <li>Add EverrestServlet. <pre> &lt;servlet&gt; &lt;servlet-name&gt;EverrestServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.everrest.core.servlet.EverrestServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;EverrestServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </pre></li> <li>EverRest components. <p><i>org.moyakarta.rest.PlaceApplication</i> - application deployer.</p> <pre> public class PlaceApplication extends Application { @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; cls = new HashSet&lt;Class&lt;?&gt;&gt;(1); cls.add(PlaceService.class); return cls; } @Override public Set&lt;Object&gt; getSingletons() { Set&lt;Object&gt; objs = new HashSet&lt;Object&gt;(1); objs.add(new PlaceNotFoundExceptionMapper()); return objs; } } </pre> <p><i>org.moyakarta.rest.Place</i> - simple Java Bean that will be used to transfer data via JSON.</p> <p><i>org.moyakarta.rest.PlaceNotFoundException</i> - exception that will be thrown by <i>org.moyakarta.rest.PlaceService</i> if client requested place that does not exist in storage.</p> <p><i>org.moyakarta.rest.PlaceNotFoundExceptionMapper</i> - JAX-RS component that intercepts <i>org.moyakarta.rest.PlaceNotFoundException</i> and send correct response to client.</p> <pre> @Provider public class PlaceNotFoundExceptionMapper implements ExceptionMapper&lt;PlaceNotFoundException&gt; { Response toResponse(PlaceNotFoundException exception) { return Response.status(404).entity(exception.getMessage()).type("text/plain").build(); } } </pre> <p><i>org.moyakarta.rest.PlaceService</i> - JAX-RS service that process client's requests. Instance of <i>PlaceStorage</i> will be injected automatically thanks to <i>org.everrest.core.Inject</i> annotation</p> <pre> @Path("places") public class PlaceService { @Inject private PlaceStorage placeStorage; @Path("{id}") @GET @Produces("application/json") public Place get(@PathParam("id") String id) throws PlaceNotFoundException { Place place = placeStorage.getPlace(id); if (place == null) throw new PlaceNotFoundException(id); return place; } @GET @Produces("application/json") public Collection&lt;Place&gt; getAll() { return placeStorage.getAll(); } @PUT @Consumes("application/json") public Response put(Place place, @Context UriInfo uriInfo) { String id = placeStorage.putPlace(place); URI location = uriInfo.getBaseUriBuilder().path(getClass()).path(id).build(); return Response.created(location).entity(location.toString()).type("text/plain").build(); } } </pre> <p><i>org.moyakarta.rest.PlaceStorage</i> - storage of Places.</p> <pre> public class PlaceStorage { private static int idCounter = 100; public synchronized String generateId() { idCounter++; return Integer.toString(idCounter); } private Map&lt;String, Place&gt; books = new ConcurrentHashMap&lt;String, Place&gt;(); public PlaceStorage() { init(); } private void init() { Place book = new Place(); book.setTitle("JUnit in Action"); book.setAuthor("Vincent Masson"); book.setPages(386); book.setPrice(19.37); putPlace(book); } public Place getPlace(String id) { return books.get(id); } public String putPlace(Place book) { String id = book.getId(); if (id == null || id.trim().length() == 0) { id = generateId(); place.setId(id); } places.put(id, place); return id; } public Collection&lt;Place&gt; getAll() { return places.values(); } public int numberOfPlaces() { return places.size(); } } </pre></li> <li>Request mapping. <table border="1"><tbody> <tr> <th>Relative Path</th> <th>HTTP Method</th> <th>Description</th> </tr> <tr> <td>rest/places/{id}</td> <td>GET</td> <td>Get places with specified id. Just after server start only one place in storage and it can be accessed via id <i>101</i></td> </tr> <tr> <td>rest/places/</td> <td>GET</td> <td>Get all places from storage.</td> </tr> <tr> <td>rest/places/</td> <td>PUT</td> <td>Add new place in storage. The body of request must contains place's description in JSON format. The <i>Content-type</i> header must be set to <i>application/json</i></td> </tr> </tbody></table> </li> <li>How to try. <p>Build project.</p> <pre>mvn clean install</pre> <p>Run it with Jetty server.</p> <pre>mvn jetty:run</pre> <p>Point you web browser to <a href="http://localhost:8080/rest/places/101">http://localhost:8080/rest/places/101</a></p> <p>If you are under linux or other unix like OS the you can use <i>curl</i> utility (often it is already installed). Binary build of this utility available for windows also at <a href="http://curl.haxx.se/download.html">http://curl.haxx.se/download.html</a>. With <i>curl</i> you able to add new place in storage via command</p> <pre> curl -X PUT \ -H "Content-type:application/json" \ -d '{"author":"My Author","title":"My Title","price":1.00,"pages":100}' \ http://localhost:8080/rest/places/ </pre> </li> </ul> </html>
10100ckua
tags/0.2.1/mk-rest-war/README.html
HTML
lgpl
8,222
#!/bin/sh # Build and run the tomcat. mvn clean install -Passembly rm -rf ./target/war-unzipped unzip ./target/lib-mk-standalone-tomcat-resources.dir/mk-maps-war-0.2.1.war -d ./target/war-unzipped #cp ./target/war-unzipped/WEB-INF/lib/slf4j-api-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/slf4j-log4j12-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/log4j-1.2.14.jar ./target/mk-tomcat/lib/ cd ./target/mk-tomcat/bin chmod +x *.sh
10100ckua
tags/0.2.1/mk-server-tomcat/.svn/text-base/mk-build.sh.svn-base
Shell
lgpl
492
#!/bin/sh # Build and run the tomcat. mvn clean install -Passembly rm -rf ./target/war-unzipped unzip ./target/lib-mk-standalone-tomcat-resources.dir/mk-maps-war-0.2.1.war -d ./target/war-unzipped #cp ./target/war-unzipped/WEB-INF/lib/slf4j-api-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/slf4j-log4j12-1.5.8.jar ./target/mk-tomcat/lib/ #cp ./target/war-unzipped/WEB-INF/lib/log4j-1.2.14.jar ./target/mk-tomcat/lib/ cd ./target/mk-tomcat/bin chmod +x *.sh
10100ckua
tags/0.2.1/mk-server-tomcat/mk-build.sh
Shell
lgpl
492
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { marker.setPosition(map.getCenter()); var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function UpControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to UP the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = '&nbsp;&nbsp;UP&nbsp;&nbsp;'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, -panOffset); fillUrls(); }); } function DownControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Down the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'DOWN'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(0, panOffset); fillUrls(); }); } function LeftControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Left the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'LEFT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(-panOffset, 0); fillUrls(); }); } function RightControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Right the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'RIGHT'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.panBy(panOffset, 0); fillUrls(); }); } function ZoomInControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom In'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() + 1); fillUrls(); }); } function ZoomOutControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Zoom In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Zoom Out'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setZoom(map.getZoom() - 1); fillUrls(); }); } function RoadmapControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Roadmap In the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Roadmap'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.ROADMAP); fillUrls(); }); } function HybridControl(controlDiv, map) { controlDiv.style.padding = '5px'; // Set CSS for the control border var controlUI = document.createElement('DIV'); controlUI.style.backgroundColor = 'white'; controlUI.style.borderStyle = 'solid'; controlUI.style.borderWidth = '2px'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; controlUI.title = 'Click to Hybrid the maps'; controlDiv.appendChild(controlUI); // Set CSS for the control interior var controlText = document.createElement('DIV'); controlText.style.fontFamily = 'Arial,sans-serif'; controlText.style.fontSize = '22px'; controlText.style.paddingLeft = '4px'; controlText.style.paddingRight = '4px'; controlText.innerHTML = 'Hybrid'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { map.setMapTypeId(google.maps.MapTypeId.HYBRID); fillUrls(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { lng = mlng; lat = mlat; markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: false, panControl: false, zoomControl: false, streetViewControl: false, disableDoubleClickZoom: true, draggable: false, scrollwheel: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create the DIV to hold the control and call the UpControl() constructor // passing in this DIV. var upControlDiv = document.createElement('DIV'); var upControl = new UpControl(upControlDiv, map); upControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(upControlDiv); // Create the DIV to hold the control and call the DownControl() constructor // passing in this DIV. var downControlDiv = document.createElement('DIV'); var downControl = new DownControl(downControlDiv, map); downControlDiv.index = 1; map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(downControlDiv); // Create the DIV to hold the control and call the LeftControl() constructor // passing in this DIV. var leftControlDiv = document.createElement('DIV'); var leftControl = new LeftControl(leftControlDiv, map); leftControlDiv.index = 2; map.controls[google.maps.ControlPosition.LEFT_CENTER].push(leftControlDiv); // Create the DIV to hold the control and call the RightControl() constructor // passing in this DIV. var rightControlDiv = document.createElement('DIV'); var rightControl = new RightControl(rightControlDiv, map); rightControlDiv.index = 3; map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(rightControlDiv); // Create the DIV to hold the control and call the ZoomInControl() constructor // passing in this DIV. var zoomInControlDiv = document.createElement('DIV'); var zoomInControl = new ZoomInControl(zoomInControlDiv, map); zoomInControlDiv.index = 4; map.controls[google.maps.ControlPosition.TOP_LEFT].push(zoomInControlDiv); // Create the DIV to hold the control and call the ZoomOutControl() constructor // passing in this DIV. var zoomOutControlDiv = document.createElement('DIV'); var zoomOutControl = new ZoomOutControl(zoomOutControlDiv, map); zoomOutControlDiv.index = 5; map.controls[google.maps.ControlPosition.LEFT_TOP].push(zoomOutControlDiv); // Create the DIV to hold the control and call the RoadmapControl() constructor // passing in this DIV. var roadmapControlDiv = document.createElement('DIV'); var roadmapControl = new RoadmapControl(roadmapControlDiv, map); roadmapControlDiv.index = 5; map.controls[google.maps.ControlPosition.TOP_RIGHT].push(roadmapControlDiv); // Create the DIV to hold the control and call the HybridControl() constructor // passing in this DIV. var hybridControlDiv = document.createElement('DIV'); var hybridControl = new HybridControl(hybridControlDiv, map); hybridControlDiv.index = 5; map.controls[google.maps.ControlPosition.RIGHT_TOP].push(hybridControlDiv); // MARKER marker = new google.maps.Marker({ map: map, draggable: false, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); fillUrls(); initMarkerButtons(marker.getVisible()); //initStyleButtons(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
tags/0.2.1/website/google-maps-mobile.html
HTML
lgpl
17,946
var def_lat = 49.44; var def_lng = 32.06; var def_zoom = 13; var panOffset = 100; var def_w = '640px'; var def_h = '360px'; var size0_w = '320px'; var size0_h = '200px'; var sizeA_w = def_w; var sizeA_h = def_h; var sizeB_w = '854px'; var sizeB_h = '480px'; var map; var marker; function getParameter(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return null; else return results[1]; } function fillUrlsCommon(maplat, maplng, mapzoom, maptype, markerlat, markerlng) { var params = 'lat=' + maplat + '&lng=' + maplng + '&z=' + mapzoom + '&t=' + maptype; if (isMarkerVisible()) { params += '&mlat=' + markerlat + '&mlng=' + markerlng; } //if (document.getElementById("map_canvas").style.width != def_w) { params += '&w=' + document.getElementById("map_canvas").style.width; params += '&h=' + document.getElementById("map_canvas").style.height; //} fillTheUrl(params, 'google-maps'); fillTheUrl(params, 'google-maps-mobile'); fillTheUrl(params, 'yandex-maps'); fillTheUrl(params, 'visicom-maps'); fillTextLinkUrl(); } function fillTheUrl(params, urlname) { var a_elem = document.getElementById(urlname); if (a_elem.href.indexOf('?') > 0) { a_elem.href = a_elem.href.substring(0, a_elem.href.indexOf('?')) } a_elem.href = a_elem.href + '?' + params; } function fillTextLinkUrl() { var a_elem = location.href; var currentLink = null; if (a_elem.indexOf('google-maps-mobile') > 0) { currentLink = document.getElementById('google-maps-mobile').href; } else if (a_elem.indexOf('google-maps') > 0) { currentLink = document.getElementById('google-maps').href; } else if (a_elem.indexOf('yandex-maps') > 0) { currentLink = document.getElementById('yandex-maps').href; } else if (a_elem.indexOf('visicom-maps') > 0) { currentLink = document.getElementById('visicom-maps').href; } else { // default alert('There is no Map Service in the page location.'); return; } document.getElementById('textlink').value = currentLink; document.getElementById('refresh').href = currentLink; } function markerButtons() { if (document.getElementById("setmarker").style.display == "none") { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } else { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } } function initStyleButtons() { styleButtons(); } function styleButtons() { if (document.getElementById("newstyle").style.display != "none") { // get new style document.getElementById("newstyle").style.display = "none"; document.getElementById("oldstyle").style.display = "block"; document.getElementById("map_links").style.display = "block"; document.getElementById("map_links_old").style.display = "none"; } else { // get old style document.getElementById("newstyle").style.display = "block"; document.getElementById("oldstyle").style.display = "none"; document.getElementById("map_links").style.display = "none"; document.getElementById("map_links_old").style.display = "block"; } } function initMarkerButtons(visibleMarker) { if (visibleMarker) { document.getElementById("setmarker").style.display = "none"; document.getElementById("removemarker").style.display = "block"; } else { document.getElementById("setmarker").style.display = "block"; document.getElementById("removemarker").style.display = "none"; } } function resizeMapCanvas(w, h) { document.getElementById("map_canvas").style.width = w; document.getElementById("map_canvas").style.height = h; document.getElementById("div_url").style.width = w; document.getElementById("map_links").style.width = w; } function initMapCanvasSize() { var w = getParameter('w'); var h = getParameter('h'); if (w != null || h != null) { if (w == null) w = def_w; if (h == null) h = def_h; resizeMapCanvas(w, h); } } function viewPort() { var h = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; var w = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; return { width : w , height : h } } function resizeMap0() { resizeMapCanvas(size0_w, size0_h); resizeMap(); } function resizeMapA() { resizeMapCanvas(sizeA_w, sizeA_h); resizeMap(); } function resizeMapB() { resizeMapCanvas(sizeB_w, sizeB_h); resizeMap(); } function resizeMapMax() { resizeMapCanvas(viewPort().width + 'px', viewPort().height + 'px'); resizeMap(); }
10100ckua
tags/0.2.1/website/10100ckua-0.3.js
JavaScript
lgpl
5,066
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.visicom.ua/api/2.0.0/map/world_ru.js"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.visible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.coords()[0].lat; markerlng = marker.coords()[0].lng; } var maptype = 'map'; fillUrlsCommon(map.center().lat, map.center().lng, map.zoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.visible()) { marker.visible(false); } else { marker.coords(map.center()); marker.visible(true); } fillUrls(); markerButtons(); map.repaint(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapCenter = {lng: lng, lat: lat}; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = {lng: mlng, lat: mlat}; } map = new VMap(document.getElementById('map_canvas')); map.center(mapCenter, z); // Create marker marker = new VMarker(markerCoordinates); marker.visible(markerCoordinates != null ? true : false); // Set draggable option marker.draggable(true); // The hint //marker.hint('Hint'); // Set header and description of information window //marker.info('header', 'Description'); // Add a marker on the map map.add(marker); // Repaint the map map.repaint(); marker.enddrag(fillUrls); fillUrls(); initMarkerButtons(marker.visible()); //initStyleButtons(); map.enddrag(fillUrls); map.onzoomchange(fillUrls); } function resizeMap() { map.repaint(); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
tags/0.2.1/website/visicom-maps.html
HTML
lgpl
5,631
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker.getVisible()); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getPosition().lat(); markerlng = marker.getPosition().lng(); } var maptype = (map.getMapTypeId() == 'roadmap' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().lat(), map.getCenter().lng(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (marker.getVisible()) { marker.setVisible(false); } else { marker.setPosition(map.getCenter()); marker.setVisible(true); } fillUrls(); markerButtons(); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = google.maps.MapTypeId.ROADMAP; else if (mapType == 'sat') mapType = google.maps.MapTypeId.HYBRID; else mapType = google.maps.MapTypeId.ROADMAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new google.maps.LatLng(mlat, mlng); } var mapCenter = new google.maps.LatLng(lat, lng); var myOptions = { zoom: z, center: mapCenter, mapTypeId: mapType, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeControl: true, panControl: true, panControlOptions: { position: google.maps.ControlPosition.RIGHT_TOP, }, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM, style: google.maps.ZoomControlStyle.LARGE }, rotateControl: true, rotateControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, }, streetViewControl: false, }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addDomListener(map, 'zoom_changed', fillUrls); google.maps.event.addDomListener(map, 'center_changed', fillUrls); google.maps.event.addDomListener(map, 'maptypeid_changed', fillUrls); // MARKER marker = new google.maps.Marker({ map: map, draggable: true, animation: google.maps.Animation.DROP, position: markerCoordinates, visible: (markerCoordinates != null ? true : false) }); google.maps.event.addListener(marker, 'position_changed', fillUrls); fillUrls(); initMarkerButtons(marker.getVisible()); initStyleButtons(); } function resizeMap() { google.maps.event.trigger(map, 'resize'); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
tags/0.2.1/website/google-maps.html
HTML
lgpl
6,810
(function() { function getScript(src) { document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); } getScript("10100ckua-0.3.js"); })();
10100ckua
tags/0.2.1/website/10100ckua.js
JavaScript
lgpl
208
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript" src="http://api-maps.yandex.ru/1.1/index.xml?key=AJy6-U0BAAAAJr_5MgIAbUmUfURJX0QfQef4pLZO5vNlHjsAAAAAAAAAAACsZenVuLEihxbcpybjyqyczHDMyA=="></script> <script type="text/javascript" src="10100ckua.js"></script> <script type="text/javascript"> function isMarkerVisible() { return (marker != null); } function fillUrls() { var markerlat = null; var markerlng = null; if (isMarkerVisible()) { markerlat = marker.getCoordPoint().getY(); markerlng = marker.getCoordPoint().getX(); } var maptype = (map.getType().getName() == 'Схема' ? 'map' : 'sat'); fillUrlsCommon(map.getCenter().getY(), map.getCenter().getX(), map.getZoom(), maptype, markerlat, markerlng); } function processMarker() { if (isMarkerVisible()) { map.removeOverlay(marker); marker = null; } else { var markerCoordinates = new YMaps.GeoPoint(map.getCenter().getX(),map.getCenter().getY()); addMarker(markerCoordinates); } fillUrls(); markerButtons(); } function addMarker(markerCoordinates) { marker = new YMaps.Placemark(markerCoordinates, {draggable: true}); map.addOverlay(marker); YMaps.Events.observe(marker, marker.Events.DragEnd, fillUrls); YMaps.Events.observe(marker, marker.Events.BalloonOpen, function () { marker.closeBalloon(); }); } function initialize() { initMapCanvasSize(); var lat = getParameter('lat'); if (lat == null || isNaN(lat)) lat = def_lat; var lng = getParameter('lng'); if (lng == null || isNaN(lat)) lng = def_lng; var z = parseInt(getParameter('z')); if (z == null || isNaN(z)) z = def_zoom; var mapType = getParameter('t'); if (mapType == null) mapType = YMaps.MapType.MAP; else if (mapType == 'sat') mapType = YMaps.MapType.HYBRID; else mapType = YMaps.MapType.MAP; var mlat = getParameter('mlat'); var mlng = getParameter('mlng'); var markerCoordinates = null; if (mlat != null && !isNaN(mlat) && mlng != null && !isNaN(mlng)) { markerCoordinates = new YMaps.GeoPoint(mlng,mlat); } var mapCenter = new YMaps.GeoPoint(lng,lat); map = new YMaps.Map(document.getElementById("map_canvas")); map.setCenter(mapCenter, z, mapType); map.addControl(new YMaps.TypeControl()); map.addControl(new YMaps.Zoom()); map.addControl(new YMaps.ScaleLine()); map.enableScrollZoom(); YMaps.Events.observe(map, map.Events.Update, fillUrls); YMaps.Events.observe(map, map.Events.MoveEnd, fillUrls); YMaps.Events.observe(map, map.Events.DragEnd, fillUrls); YMaps.Events.observe(map, map.Events.MultiTouchEnd, fillUrls); YMaps.Events.observe(map, map.Events.SmoothZoomEnd, fillUrls); YMaps.Events.observe(map, map.Events.TypeChange, fillUrls); // MARKER if (markerCoordinates != null) { addMarker(markerCoordinates); } fillUrls(); initMarkerButtons(isMarkerVisible()); //initStyleButtons(); } function resizeMap() { map.redraw(true, null); fillUrls(); } </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="div_url" style="width: 500px; height: 65px"> <br/> <a href="" id="refresh" >Обновить</a>&nbsp; <input id="textlink" value="" title="Адрес карты" size="60" type="text" maxlength="2048" spellcheck="false" style="width: 500px;"/><br/> </div> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <form> <input id="setmarker" type="button" value="Поставить маркер" name="button1" onClick="processMarker()"> <input id="removemarker" type="button" value="Убрать маркер" name="button2" onClick="processMarker()"> </form> <br/> <form> <input id="resizeMicro" type="button" value="Размер микро" name="button0" onClick="resizeMap0()"> <input id="resizeNormal" type="button" value="Размер A" name="button1" onClick="resizeMapA()"> <input id="resizeLarge" type="button" value="Размер B" name="button2" onClick="resizeMapB()"> <input id="resizeCurrent" type="button" value="Размер экрана" name="button3" onClick="resizeMapMax()"> </form> </body> </html>
10100ckua
tags/0.2.1/website/yandex-maps.html
HTML
lgpl
6,626
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Моя карта</title> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-7']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="map_links" style="width: 500px; height: 120px"> <table border="0" cellpadding="10" cellspacing="0"> <tr valign="top"> <td><a href="google-maps.html" id="google-maps"> <img border="0" src="images/google.jpg"><br/> google</a><br/></td> <td><a href="yandex-maps.html" id="yandex-maps" > <img border="0" src="images/yandex.jpg"><br/> yandex</a><br/></td> <td><a href="visicom-maps.html" id="visicom-maps" > <img border="0" src="images/visicom.jpg"><br/> visicom</a><br/></td> <td><a href="google-maps-mobile.html" id="google-maps-mobile"> <img border="0" src="images/google.jpg"><br/> google<br/> mobile</a><br/></td> </tr> </table> </div> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://moyakarta.com:81/" : "http://moyakarta.com:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <noscript><p><img src="http://moyakarta.com:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
tags/0.2.1/website/index.html
HTML
lgpl
2,438
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Моя карта</title> <meta http-equiv="REFRESH" content="0;url=http://moyakarta.com/maps/"> <link rel="shortcut icon" href="/favicon.ico" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1390959-6']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <!-- Piwik --> <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://moyakarta.com:81/" : "http://moyakarta.com:81/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 9); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script> <noscript><p><img src="http://moyakarta.com:81/piwik.php?idsite=9" style="border:0" alt="" /></p></noscript> <!-- End Piwik Tracking Code --> </body> </html>
10100ckua
tags/0.2.1/mk-root-war/root/index.html
HTML
lgpl
1,568
#!/bin/sh # Build the ROOT.war cd ./root echo "= Changed ./root dir" zip -r ROOT.war * echo "= Zipped files to the ROOT.war" rm -rf ../ROOT.war echo "= Removed old ../ROOT.war" mv ROOT.war ../ROOT.war echo "= Moved new ROOT.war to the ../ dir" cd .. echo "= Changed ../ dir" echo "= Finished."
10100ckua
tags/0.2.1/mk-root-war/.svn/text-base/root-war-build.sh.svn-base
Shell
lgpl
300
#!/bin/sh # Build the ROOT.war cd ./root echo "= Changed ./root dir" zip -r ROOT.war * echo "= Zipped files to the ROOT.war" rm -rf ../ROOT.war echo "= Removed old ../ROOT.war" mv ROOT.war ../ROOT.war echo "= Moved new ROOT.war to the ../ dir" cd .. echo "= Changed ../ dir" echo "= Finished."
10100ckua
tags/0.2.1/mk-root-war/root-war-build.sh
Shell
lgpl
300
package model.geometry; /** * Created by andreas on 19.04.14. */ public class HorizontalDrawer extends AbstractDrawer { }
101-intro
trunk/src/model/geometry/HorizontalDrawer.java
Java
asf20
126
package model.geometry; /** * Created by andreas on 19.04.14. */ public class AbstractDrawer { public String drawAsterix(int n) { return drawRecursive(n, "*", ""); } public String drawWhitespaces(int n) { if (n < 0) { throw new IllegalArgumentException("can't draw " + n + " whitespaces. n bust be >= 0"); } return drawRecursive(n, " ", ""); } private String drawRecursive(int n, String character, String accumulator) { if (n == 0) { return accumulator; } else { return drawRecursive(n-1, character, accumulator + character); } } }
101-intro
trunk/src/model/geometry/AbstractDrawer.java
Java
asf20
655
package model.geometry; /** * Created by andreas on 19.04.14. */ public class TriangleDrawer extends AbstractDrawer { private HorizontalDrawer horizontalDrawer = new HorizontalDrawer(); public String drawRightTriangle(int size) { return drawTriangleRecursiv(0, size, ""); } private String drawTriangleRecursiv(int i, int size, String accumulator) { if (i==size) { return accumulator; } else { final String newLine = i < size - 1 ? "\n" : ""; return drawTriangleRecursiv(i + 1, size, accumulator + drawAsterix(i + 1) + newLine); } } }
101-intro
trunk/src/model/geometry/TriangleDrawer.java
Java
asf20
628
package model.geometry; /** * Created by andreas on 19.04.14. */ public class VerticalDrawer extends AbstractDrawer { public String drawAsterixVertical(int size) { return drawAsterixVertical(0, size, ""); } private String drawAsterixVertical(int i, int size, String accumulator) { if (i == size) { return accumulator; } else { final String newLine = i < size - 1 ? "\n" : ""; return drawAsterixVertical(i + 1, size, accumulator + "*" + newLine); } } }
101-intro
trunk/src/model/geometry/VerticalDrawer.java
Java
asf20
542
package model.geometry; /** * Created by andreas on 20.04.14. */ public class DiamondDrawer extends AbstractDrawer { public String drawIsoTriangle(int lines) { return drawIsoTriangleRecursive(0, lines, "") + drawMiddleLine(lines, null); } public String drawDiamond(int lines) { return drawDiamond(lines, null); } public String drawDiamond(int lines, String name) { return drawIsoTriangleRecursive(0, lines, "") + drawMiddleLine(lines, name) + (lines == 1 ? "" : "\n") + drawIsoTriangleRecursiveBottom(lines-2, lines, ""); } private String drawIsoTriangleRecursive(int i, int lines, String accumulator) { if (i == lines-1) { return accumulator; } else { final int width = calcWidth(lines); final int numAsterixes = 1 + 2 * i; final int numWhiteSpaces = (width - numAsterixes) / 2; final String whiteSpaces = drawWhitespaces(numWhiteSpaces); final String asterixes = drawAsterix(numAsterixes); final String line = whiteSpaces + asterixes + whiteSpaces + "\n"; return drawIsoTriangleRecursive(i+1, lines, accumulator + line); } } private String drawIsoTriangleRecursiveBottom(int i, int lines, String accumulator) { if (i == -1) { return accumulator; } else { final int width = calcWidth(lines); final int numAsterixes = 1 + 2 * i; final int numWhiteSpaces = (width - numAsterixes) / 2; final String whiteSpaces = drawWhitespaces(numWhiteSpaces); final String asterixes = drawAsterix(numAsterixes); final String newLine = i > 0 ? "\n" : ""; final String line = whiteSpaces + asterixes + whiteSpaces + newLine; return drawIsoTriangleRecursiveBottom(i-1, lines, accumulator + line); } } private String drawMiddleLine(int lines, String name) { int width = calcWidth(lines); return name == null ? drawAsterix(width) : name; } private int calcWidth(int lines) { return 1 + 2 * (lines - 1); } }
101-intro
trunk/src/model/geometry/DiamondDrawer.java
Java
asf20
2,154
package model.fizzbuzz; /** * Created by andreas on 20.04.14. */ public class FizzGenerator { public String generateString(int input) { if (input % 15 == 0) { return "FizzBuzz"; } if (input % 3 == 0) { return "Fizz"; } if (input % 5 == 0) { return "Buzz"; } return input + ""; } }
101-intro
trunk/src/model/fizzbuzz/FizzGenerator.java
Java
asf20
384
package model.primefactor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Created by andreas on 20.04.14. */ public class PrimefactorGenerator { public List<Integer> generatePrimefactors(int i) { if (i == 1) { return new ArrayList<Integer>(); } List<Integer> primeFactors = generatePrimefactorsRecursiv(i); Collections.sort(primeFactors); return primeFactors; } private List<Integer> generatePrimefactorsRecursiv(int i) { final Integer largestDivider = largestDivider(i); if (largestDivider == i) { final List<Integer> list = new ArrayList<Integer>(); list.add(largestDivider); return list; } else { final int factor1 = largestDivider; final int factor2 = i / largestDivider; final List<Integer> primes1 = generatePrimefactors(factor1); final List<Integer> primes2 = generatePrimefactors(factor2); primes1.addAll(primes2); return primes1; } } private int largestDivider(int dividend) { for (int i=dividend-1; i>2; i--) { if (dividend % i == 0) { return i; } } return dividend; } }
101-intro
trunk/src/model/primefactor/PrimefactorGenerator.java
Java
asf20
1,334
<?php /** * Handles Comment Post to WordPress and prevents duplicate comment posting. * * @package WordPress */ if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { header('Allow: POST'); header('HTTP/1.1 405 Method Not Allowed'); header('Content-Type: text/plain'); exit; } /** Sets up the WordPress Environment. */ require( dirname(__FILE__) . '/wp-load.php' ); nocache_headers(); $comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0; $post = get_post($comment_post_ID); if ( empty($post->comment_status) ) { do_action('comment_id_not_found', $comment_post_ID); exit; } // get_post_status() will get the parent status for attachments. $status = get_post_status($post); $status_obj = get_post_status_object($status); if ( !comments_open($comment_post_ID) ) { do_action('comment_closed', $comment_post_ID); wp_die( __('Sorry, comments are closed for this item.') ); } elseif ( 'trash' == $status ) { do_action('comment_on_trash', $comment_post_ID); exit; } elseif ( !$status_obj->public && !$status_obj->private ) { do_action('comment_on_draft', $comment_post_ID); exit; } elseif ( post_password_required($comment_post_ID) ) { do_action('comment_on_password_protected', $comment_post_ID); exit; } else { do_action('pre_comment_on_post', $comment_post_ID); } $comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; $comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null; $comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; // If the user is logged in $user = wp_get_current_user(); if ( $user->exists() ) { if ( empty( $user->display_name ) ) $user->display_name=$user->user_login; $comment_author = $wpdb->escape($user->display_name); $comment_author_email = $wpdb->escape($user->user_email); $comment_author_url = $wpdb->escape($user->user_url); if ( current_user_can('unfiltered_html') ) { if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); // start with a clean slate kses_init_filters(); // set up the filters } } } else { if ( get_option('comment_registration') || 'private' == $status ) wp_die( __('Sorry, you must be logged in to post a comment.') ); } $comment_type = ''; if ( get_option('require_name_email') && !$user->exists() ) { if ( 6 > strlen($comment_author_email) || '' == $comment_author ) wp_die( __('<strong>ERROR</strong>: please fill the required fields (name, email).') ); elseif ( !is_email($comment_author_email)) wp_die( __('<strong>ERROR</strong>: please enter a valid email address.') ); } if ( '' == $comment_content ) wp_die( __('<strong>ERROR</strong>: please type a comment.') ); $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); $comment_id = wp_new_comment( $commentdata ); $comment = get_comment($comment_id); do_action('set_comment_cookies', $comment, $user); $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; $location = apply_filters('comment_post_redirect', $location, $comment); wp_safe_redirect( $location ); exit;
01happy-blog
trunk/myblog/wp-comments-post.php
PHP
oos
3,522
<?php /** * Atom Publishing Protocol support for WordPress * * @version 1.0.5-dc */ /** * WordPress is handling an Atom Publishing Protocol request. * * @var bool */ define('APP_REQUEST', true); /** Set up WordPress environment */ require_once('./wp-load.php'); /** Atom Publishing Protocol Class */ require_once(ABSPATH . WPINC . '/atomlib.php'); /** Atom Server **/ require_once(ABSPATH . WPINC . '/class-wp-atom-server.php'); /** Admin Image API for metadata updating */ require_once(ABSPATH . '/wp-admin/includes/image.php'); $_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] ); // Allow for a plugin to insert a different class to handle requests. $wp_atom_server_class = apply_filters('wp_atom_server_class', 'wp_atom_server'); $wp_atom_server = new $wp_atom_server_class; // Handle the request $wp_atom_server->handle_request(); exit; /** * Writes logging info to a file. * * @since 2.2.0 * @deprecated 3.4.0 * @deprecated Use error_log() * @link http://www.php.net/manual/en/function.error-log.php * * @param string $label Type of logging * @param string $msg Information describing logging reason. */ function log_app( $label, $msg ) { _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); if ( ! empty( $GLOBALS['app_logging'] ) ) error_log( $label . ' - ' . $msg ); }
01happy-blog
trunk/myblog/wp-app.php
PHP
oos
1,354
<?php /** * Outputs the OPML XML format for getting the links defined in the link * administration. This can be used to export links from one blog over to * another. Links aren't exported by the WordPress export, so this file handles * that. * * This file is not added by default to WordPress theme pages when outputting * feed links. It will have to be added manually for browsers and users to pick * up that this file exists. * * @package WordPress */ require_once('./wp-load.php'); header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); $link_cat = ''; if ( !empty($_GET['link_cat']) ) { $link_cat = $_GET['link_cat']; if ( !in_array($link_cat, array('all', '0')) ) $link_cat = absint( (string)urldecode($link_cat) ); } echo '<?xml version="1.0"?'.">\n"; ?> <opml version="1.0"> <head> <title><?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?></title> <dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated> <?php do_action('opml_head'); ?> </head> <body> <?php if ( empty($link_cat) ) $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0)); else $cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat)); foreach ( (array)$cats as $cat ) : $catname = apply_filters('link_category', $cat->name); ?> <outline type="category" title="<?php echo esc_attr($catname); ?>"> <?php $bookmarks = get_bookmarks(array("category" => $cat->term_id)); foreach ( (array)$bookmarks as $bookmark ) : $title = apply_filters('link_title', $bookmark->link_name); ?> <outline text="<?php echo esc_attr($title); ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" /> <?php endforeach; // $bookmarks ?> </outline> <?php endforeach; // $cats ?> </body> </opml>
01happy-blog
trunk/myblog/wp-links-opml.php
PHP
oos
1,997
<?php /** * WordPress Cron Implementation for hosts, which do not offer CRON or for which * the user has not set up a CRON job pointing to this file. * * The HTTP request to this file will not slow down the visitor who happens to * visit when the cron job is needed to run. * * @package WordPress */ ignore_user_abort(true); if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') ) die(); /** * Tell WordPress we are doing the CRON task. * * @var bool */ define('DOING_CRON', true); if ( !defined('ABSPATH') ) { /** Set up WordPress environment */ require_once('./wp-load.php'); } // Uncached doing_cron transient fetch function _get_cron_lock() { global $_wp_using_ext_object_cache, $wpdb; $value = 0; if ( $_wp_using_ext_object_cache ) { // Skip local cache and force refetch of doing_cron transient in case // another processs updated the cache $value = wp_cache_get( 'doing_cron', 'transient', true ); } else { $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); if ( is_object( $row ) ) $value = $row->option_value; } return $value; } if ( false === $crons = _get_cron_array() ) die(); $keys = array_keys( $crons ); $local_time = microtime( true ); if ( isset($keys[0]) && $keys[0] > $local_time ) die(); $doing_cron_transient = get_transient( 'doing_cron'); // Use global $doing_wp_cron lock otherwise use the GET lock. If no lock, trying grabbing a new lock. if ( empty( $doing_wp_cron ) ) { if ( empty( $_GET[ 'doing_wp_cron' ] ) ) { // Called from external script/job. Try setting a lock. if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $local_time ) ) return; $doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); set_transient( 'doing_cron', $doing_wp_cron ); } else { $doing_wp_cron = $_GET[ 'doing_wp_cron' ]; } } // Check lock if ( $doing_cron_transient != $doing_wp_cron ) return; foreach ( $crons as $timestamp => $cronhooks ) { if ( $timestamp > $local_time ) break; foreach ( $cronhooks as $hook => $keys ) { foreach ( $keys as $k => $v ) { $schedule = $v['schedule']; if ( $schedule != false ) { $new_args = array($timestamp, $schedule, $hook, $v['args']); call_user_func_array('wp_reschedule_event', $new_args); } wp_unschedule_event( $timestamp, $hook, $v['args'] ); do_action_ref_array( $hook, $v['args'] ); // If the hook ran too long and another cron process stole the lock, quit. if ( _get_cron_lock() != $doing_wp_cron ) return; } } } if ( _get_cron_lock() == $doing_wp_cron ) delete_transient( 'doing_cron' ); die();
01happy-blog
trunk/myblog/wp-cron.php
PHP
oos
2,726
<?php /** * Used to set up and fix common variables and include * the WordPress procedural and class library. * * Allows for some configuration in wp-config.php (see default-constants.php) * * @internal This file must be parsable by PHP4. * * @package WordPress */ /** * Stores the location of the WordPress directory of functions, classes, and core content. * * @since 1.0.0 */ define( 'WPINC', 'wp-includes' ); // Include files required for initialization. require( ABSPATH . WPINC . '/load.php' ); require( ABSPATH . WPINC . '/default-constants.php' ); require( ABSPATH . WPINC . '/version.php' ); // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. wp_initial_constants( ); // Check for the required PHP version and for the MySQL extension or a database drop-in. wp_check_php_mysql_versions(); // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php. @ini_set( 'magic_quotes_runtime', 0 ); @ini_set( 'magic_quotes_sybase', 0 ); // Set default timezone in PHP 5. if ( function_exists( 'date_default_timezone_set' ) ) date_default_timezone_set( 'UTC' ); // Turn register_globals off. wp_unregister_GLOBALS(); // Ensure these global variables do not exist so they do not interfere with WordPress. unset( $wp_filter, $cache_lastcommentmodified ); // Standardize $_SERVER variables across setups. wp_fix_server_vars(); // Check if we have received a request due to missing favicon.ico wp_favicon_request(); // Check if we're in maintenance mode. wp_maintenance(); // Start loading timer. timer_start(); // Check if we're in WP_DEBUG mode. wp_debug_mode(); // For an advanced caching plugin to use. Uses a static drop-in because you would only want one. if ( WP_CACHE ) WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' ); // Define WP_LANG_DIR if not set. wp_set_lang_dir(); // Load early WordPress files. require( ABSPATH . WPINC . '/compat.php' ); require( ABSPATH . WPINC . '/functions.php' ); require( ABSPATH . WPINC . '/class-wp.php' ); require( ABSPATH . WPINC . '/class-wp-error.php' ); require( ABSPATH . WPINC . '/plugin.php' ); require( ABSPATH . WPINC . '/pomo/mo.php' ); // Include the wpdb class and, if present, a db.php database drop-in. require_wp_db(); // Set the database table prefix and the format specifiers for database table columns. $GLOBALS['table_prefix'] = $table_prefix; wp_set_wpdb_vars(); // Start the WordPress object cache, or an external object cache if the drop-in is present. wp_start_object_cache(); // Attach the default filters. require( ABSPATH . WPINC . '/default-filters.php' ); // Initialize multisite if enabled. if ( is_multisite() ) { require( ABSPATH . WPINC . '/ms-blogs.php' ); require( ABSPATH . WPINC . '/ms-settings.php' ); } elseif ( ! defined( 'MULTISITE' ) ) { define( 'MULTISITE', false ); } register_shutdown_function( 'shutdown_action_hook' ); // Stop most of WordPress from being loaded if we just want the basics. if ( SHORTINIT ) return false; // Load the L10n library. require_once( ABSPATH . WPINC . '/l10n.php' ); // Run the installer if WordPress is not installed. wp_not_installed(); // Load most of WordPress. require( ABSPATH . WPINC . '/class-wp-walker.php' ); require( ABSPATH . WPINC . '/class-wp-ajax-response.php' ); require( ABSPATH . WPINC . '/formatting.php' ); require( ABSPATH . WPINC . '/capabilities.php' ); require( ABSPATH . WPINC . '/query.php' ); require( ABSPATH . WPINC . '/theme.php' ); require( ABSPATH . WPINC . '/class-wp-theme.php' ); require( ABSPATH . WPINC . '/template.php' ); require( ABSPATH . WPINC . '/user.php' ); require( ABSPATH . WPINC . '/meta.php' ); require( ABSPATH . WPINC . '/general-template.php' ); require( ABSPATH . WPINC . '/link-template.php' ); require( ABSPATH . WPINC . '/author-template.php' ); require( ABSPATH . WPINC . '/post.php' ); require( ABSPATH . WPINC . '/post-template.php' ); require( ABSPATH . WPINC . '/post-thumbnail-template.php' ); require( ABSPATH . WPINC . '/category.php' ); require( ABSPATH . WPINC . '/category-template.php' ); require( ABSPATH . WPINC . '/comment.php' ); require( ABSPATH . WPINC . '/comment-template.php' ); require( ABSPATH . WPINC . '/rewrite.php' ); require( ABSPATH . WPINC . '/feed.php' ); require( ABSPATH . WPINC . '/bookmark.php' ); require( ABSPATH . WPINC . '/bookmark-template.php' ); require( ABSPATH . WPINC . '/kses.php' ); require( ABSPATH . WPINC . '/cron.php' ); require( ABSPATH . WPINC . '/deprecated.php' ); require( ABSPATH . WPINC . '/script-loader.php' ); require( ABSPATH . WPINC . '/taxonomy.php' ); require( ABSPATH . WPINC . '/update.php' ); require( ABSPATH . WPINC . '/canonical.php' ); require( ABSPATH . WPINC . '/shortcodes.php' ); require( ABSPATH . WPINC . '/media.php' ); require( ABSPATH . WPINC . '/http.php' ); require( ABSPATH . WPINC . '/class-http.php' ); require( ABSPATH . WPINC . '/widgets.php' ); require( ABSPATH . WPINC . '/nav-menu.php' ); require( ABSPATH . WPINC . '/nav-menu-template.php' ); require( ABSPATH . WPINC . '/admin-bar.php' ); // Load multisite-specific files. if ( is_multisite() ) { require( ABSPATH . WPINC . '/ms-functions.php' ); require( ABSPATH . WPINC . '/ms-default-filters.php' ); require( ABSPATH . WPINC . '/ms-deprecated.php' ); } // Define constants that rely on the API to obtain the default value. // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. wp_plugin_directory_constants( ); // Load must-use plugins. foreach ( wp_get_mu_plugins() as $mu_plugin ) { include_once( $mu_plugin ); } unset( $mu_plugin ); // Load network activated plugins. if ( is_multisite() ) { foreach( wp_get_active_network_plugins() as $network_plugin ) { include_once( $network_plugin ); } unset( $network_plugin ); } do_action( 'muplugins_loaded' ); if ( is_multisite() ) ms_cookie_constants( ); // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). wp_cookie_constants( ); // Define and enforce our SSL constants wp_ssl_constants( ); // Create common globals. require( ABSPATH . WPINC . '/vars.php' ); // Make taxonomies and posts available to plugins and themes. // @plugin authors: warning: these get registered again on the init hook. create_initial_taxonomies(); create_initial_post_types(); // Register the default theme directory root register_theme_directory( get_theme_root() ); // Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) include_once( $plugin ); unset( $plugin ); // Load pluggable functions. require( ABSPATH . WPINC . '/pluggable.php' ); require( ABSPATH . WPINC . '/pluggable-deprecated.php' ); // Set internal encoding. wp_set_internal_encoding(); // Run wp_cache_postload() if object cache is enabled and the function exists. if ( WP_CACHE && function_exists( 'wp_cache_postload' ) ) wp_cache_postload(); do_action( 'plugins_loaded' ); // Define constants which affect functionality if not already defined. wp_functionality_constants( ); // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) wp_magic_quotes(); do_action( 'sanitize_comment_cookies' ); /** * WordPress Query object * @global object $wp_the_query * @since 2.0.0 */ $wp_the_query = new WP_Query(); /** * Holds the reference to @see $wp_the_query * Use this global for WordPress queries * @global object $wp_query * @since 1.5.0 */ $wp_query =& $wp_the_query; /** * Holds the WordPress Rewrite object for creating pretty URLs * @global object $wp_rewrite * @since 1.5.0 */ $GLOBALS['wp_rewrite'] = new WP_Rewrite(); /** * WordPress Object * @global object $wp * @since 2.0.0 */ $wp = new WP(); /** * WordPress Widget Factory Object * @global object $wp_widget_factory * @since 2.8.0 */ $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory(); do_action( 'setup_theme' ); // Define the template related constants. wp_templating_constants( ); // Load the default text localization domain. load_default_textdomain(); $locale = get_locale(); $locale_file = WP_LANG_DIR . "/$locale.php"; if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) require( $locale_file ); unset( $locale_file ); // Pull in locale data after loading text domain. require_once( ABSPATH . WPINC . '/locale.php' ); /** * WordPress Locale object for loading locale domain date and various strings. * @global object $wp_locale * @since 2.1.0 */ $GLOBALS['wp_locale'] = new WP_Locale(); // Load the functions for the active theme, for both parent and child theme if applicable. if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) { if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) include( STYLESHEETPATH . '/functions.php' ); if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) include( TEMPLATEPATH . '/functions.php' ); } do_action( 'after_setup_theme' ); // Set up current user. $wp->init(); /** * Most of WP is loaded at this stage, and the user is authenticated. WP continues * to load on the init hook that follows (e.g. widgets), and many plugins instantiate * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.). * * If you wish to plug an action once WP is loaded, use the wp_loaded hook below. */ do_action( 'init' ); // Check site status if ( is_multisite() ) { if ( true !== ( $file = ms_site_check() ) ) { require( $file ); die(); } unset($file); } /** * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. * * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for * users not logged in. * * @link http://codex.wordpress.org/AJAX_in_Plugins * * @since 3.0.0 */ do_action('wp_loaded');
01happy-blog
trunk/myblog/wp-settings.php
PHP
oos
9,916
<?php /** * Bootstrap file for setting the ABSPATH constant * and loading the wp-config.php file. The wp-config.php * file will then load the wp-settings.php file, which * will then set up the WordPress environment. * * If the wp-config.php file is not found then an error * will be displayed asking the visitor to set up the * wp-config.php file. * * Will also search for wp-config.php in WordPress' parent * directory to allow the WordPress directory to remain * untouched. * * @internal This file must be parsable by PHP4. * * @package WordPress */ /** Define ABSPATH as this file's directory */ define( 'ABSPATH', dirname(__FILE__) . '/' ); error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); if ( file_exists( ABSPATH . 'wp-config.php') ) { /** The config file resides in ABSPATH */ require_once( ABSPATH . 'wp-config.php' ); } elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) { /** The config file resides one level above ABSPATH but is not part of another install */ require_once( dirname(ABSPATH) . '/wp-config.php' ); } else { // A config file doesn't exist // Set a path for the link to the installer if ( strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false ) $path = 'setup-config.php'; else $path = 'wp-admin/setup-config.php'; define( 'WPINC', 'wp-includes' ); define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); require_once( ABSPATH . WPINC . '/load.php' ); require_once( ABSPATH . WPINC . '/version.php' ); wp_load_translations_early(); wp_check_php_mysql_versions(); // Die with an error message $die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>'; $die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>'; $die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>'; $die .= '<p><a href="' . $path . '" class="button">' . __( "Create a Configuration File" ) . '</a>'; wp_die( $die, __( 'WordPress &rsaquo; Error' ) ); }
01happy-blog
trunk/myblog/wp-load.php
PHP
oos
2,341
<?php /** * Disable error reporting * * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging */ error_reporting(0); /** Set ABSPATH for execution */ define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' ); define( 'WPINC', 'wp-includes' ); /** * @ignore */ function __() {} /** * @ignore */ function _x() {} /** * @ignore */ function add_filter() {} /** * @ignore */ function esc_attr() {} /** * @ignore */ function apply_filters() {} /** * @ignore */ function get_option() {} /** * @ignore */ function is_lighttpd_before_150() {} /** * @ignore */ function add_action() {} /** * @ignore */ function do_action_ref_array() {} /** * @ignore */ function get_bloginfo() {} /** * @ignore */ function is_admin() {return true;} /** * @ignore */ function site_url() {} /** * @ignore */ function admin_url() {} /** * @ignore */ function wp_guess_url() {} function get_file($path) { if ( function_exists('realpath') ) $path = realpath($path); if ( ! $path || ! @is_file($path) ) return ''; return @file_get_contents($path); } require(ABSPATH . '/wp-includes/script-loader.php'); require(ABSPATH . '/wp-includes/version.php'); $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] ); $load = explode(',', $load); if ( empty($load) ) exit; $compress = ( isset($_GET['c']) && $_GET['c'] ); $force_gzip = ( $compress && 'gzip' == $_GET['c'] ); $rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] ); $expires_offset = 31536000; $out = ''; $wp_styles = new WP_Styles(); wp_default_styles($wp_styles); foreach( $load as $handle ) { if ( !array_key_exists($handle, $wp_styles->registered) ) continue; $style = $wp_styles->registered[$handle]; $path = ABSPATH . $style->src; $content = get_file($path) . "\n"; if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) { $rtl_path = is_bool($style->extra['rtl']) ? str_replace( '.css', '-rtl.css', $path ) : ABSPATH . $style->extra['rtl']; $content .= get_file($rtl_path) . "\n"; } if ( strpos( $style->src, '/wp-includes/css/' ) === 0 ) { $content = str_replace( '../images/', '../wp-includes/images/', $content ); $out .= str_replace( '../js/tinymce/', '../wp-includes/js/tinymce/', $content ); } else { $out .= str_replace( '../images/', 'images/', $content ); } } header('Content-Type: text/css'); header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); header("Cache-Control: public, max-age=$expires_offset"); if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { header('Vary: Accept-Encoding'); // Handle proxies if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) { header('Content-Encoding: deflate'); $out = gzdeflate( $out, 3 ); } elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) { header('Content-Encoding: gzip'); $out = gzencode( $out, 3 ); } } echo $out; exit;
01happy-blog
trunk/myblog/wp-admin/load-styles.php
PHP
oos
3,108
<?php /** * Multisite themes administration panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( './admin.php' ); wp_redirect( network_admin_url('themes.php') ); exit;
01happy-blog
trunk/myblog/wp-admin/ms-themes.php
PHP
oos
209
<?php /** * My Sites dashboard. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( './admin.php' ); if ( !is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); if ( ! current_user_can('read') ) wp_die( __( 'You do not have sufficient permissions to view this page.' ) ); $action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash'; $blogs = get_blogs_of_user( $current_user->ID ); $updated = false; if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) { check_admin_referer( 'update-my-sites' ); $blog = get_blog_details( (int) $_POST['primary_blog'] ); if ( $blog && isset( $blog->domain ) ) { update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true ); $updated = true; } else { wp_die( __( 'The primary site you chose does not exist.' ) ); } } $title = __( 'My Sites' ); $parent_file = 'index.php'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' . '<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); require_once( './admin-header.php' ); if ( $updated ) { ?> <div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div> <?php } ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php echo esc_html( $title ); ?></h2> <?php if ( empty( $blogs ) ) : echo '<p>'; _e( 'You must be a member of at least one site to use this page.' ); echo '</p>'; else : ?> <form id="myblogs" action="" method="post"> <?php choose_primary_blog(); do_action( 'myblogs_allblogs_options' ); ?> <br clear="all" /> <table class="widefat fixed"> <?php $settings_html = apply_filters( 'myblogs_options', '', 'global' ); if ( $settings_html != '' ) { echo '<tr><td valign="top"><h3>' . __( 'Global Settings' ) . '</h3></td><td>'; echo $settings_html; echo '</td></tr>'; } reset( $blogs ); $num = count( $blogs ); $cols = 1; if ( $num >= 20 ) $cols = 4; elseif ( $num >= 10 ) $cols = 2; $num_rows = ceil( $num / $cols ); $split = 0; for ( $i = 1; $i <= $num_rows; $i++ ) { $rows[] = array_slice( $blogs, $split, $cols ); $split = $split + $cols; } $c = ''; foreach ( $rows as $row ) { $c = $c == 'alternate' ? '' : 'alternate'; echo "<tr class='$c'>"; $i = 0; foreach ( $row as $user_blog ) { $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;'; echo "<td valign='top' style='$s'>"; echo "<h3>{$user_blog->blogname}</h3>"; echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>"; echo apply_filters( 'myblogs_options', '', $user_blog ); echo "</td>"; $i++; } echo "</tr>"; }?> </table> <input type="hidden" name="action" value="updateblogsettings" /> <?php wp_nonce_field( 'update-my-sites' ); ?> <?php submit_button(); ?> </form> <?php endif; ?> </div> <?php include( './admin-footer.php' );
01happy-blog
trunk/myblog/wp-admin/my-sites.php
PHP
oos
3,805
<?php /** * Retrieves and creates the wp-config.php file. * * The permissions for the base directory must allow for writing files in order * for the wp-config.php to be created using this page. * * @internal This file must be parsable by PHP4. * * @package WordPress * @subpackage Administration */ /** * We are installing. * * @package WordPress */ define('WP_INSTALLING', true); /** * We are blissfully unaware of anything. */ define('WP_SETUP_CONFIG', true); /** * Disable error reporting * * Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging */ error_reporting(0); /**#@+ * These three defines are required to allow us to use require_wp_db() to load * the database class while being wp-content/db.php aware. * @ignore */ define('ABSPATH', dirname(dirname(__FILE__)).'/'); define('WPINC', 'wp-includes'); define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); define('WP_DEBUG', false); /**#@-*/ require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/version.php'); // Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php) wp_load_translations_early(); // Check for the required PHP version and for the MySQL extension or a database drop-in. wp_check_php_mysql_versions(); // Turn register_globals off. wp_unregister_GLOBALS(); require_once(ABSPATH . WPINC . '/compat.php'); require_once(ABSPATH . WPINC . '/class-wp-error.php'); require_once(ABSPATH . WPINC . '/formatting.php'); // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) wp_magic_quotes(); if ( ! file_exists( ABSPATH . 'wp-config-sample.php' ) ) wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) ); $config_file = file(ABSPATH . 'wp-config-sample.php'); // Check if wp-config.php has been created if ( file_exists( ABSPATH . 'wp-config.php' ) ) wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' ); // Check if wp-config.php exists above the root directory but is not part of another install if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) ) wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' ); $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; /** * Display setup wp-config.php file header. * * @ignore * @since 2.3.0 * @package WordPress * @subpackage Installer_WP_Config */ function display_header() { global $wp_version; header( 'Content-Type: text/html; charset=utf-8' ); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title> <link rel="stylesheet" href="css/install.css?ver=<?php echo preg_replace( '/[^0-9a-z\.-]/i', '', $wp_version ); ?>" type="text/css" /> </head> <body<?php if ( is_rtl() ) echo ' class="rtl"'; ?>> <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png?ver=20120216" /></h1> <?php }//end function display_header(); switch($step) { case 0: display_header(); ?> <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p> <ol> <li><?php _e( 'Database name' ); ?></li> <li><?php _e( 'Database username' ); ?></li> <li><?php _e( 'Database password' ); ?></li> <li><?php _e( 'Database host' ); ?></li> <li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li> </ol> <p><strong><?php _e( "If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong></p> <p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p> <p class="step"><a href="setup-config.php?step=1<?php if ( isset( $_GET['noapi'] ) ) echo '&amp;noapi'; ?>" class="button"><?php _e( 'Let&#8217;s go!' ); ?></a></p> <?php break; case 1: display_header(); ?> <form method="post" action="setup-config.php?step=2"> <p><?php _e( "Below you should enter your database connection details. If you're not sure about these, contact your host." ); ?></p> <table class="form-table"> <tr> <th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th> <td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td> <td><?php _e( 'The name of the database you want to run WP in.' ); ?></td> </tr> <tr> <th scope="row"><label for="uname"><?php _e( 'User Name' ); ?></label></th> <td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td> <td><?php _e( 'Your MySQL username' ); ?></td> </tr> <tr> <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th> <td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" /></td> <td><?php _e( '&hellip;and your MySQL password.' ); ?></td> </tr> <tr> <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th> <td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td> <td><?php _e( 'You should be able to get this info from your web host, if <code>localhost</code> does not work.' ); ?></td> </tr> <tr> <th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th> <td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td> <td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td> </tr> </table> <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?> <p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button" /></p> </form> <?php break; case 2: foreach ( array( 'dbname', 'uname', 'pwd', 'dbhost', 'prefix' ) as $key ) $$key = trim( stripslashes( $_POST[ $key ] ) ); $tryagain_link = '</p><p class="step"><a href="setup-config.php?step=1" onclick="javascript:history.go(-1);return false;" class="button">' . __( 'Try Again' ) . '</a>'; if ( empty( $prefix ) ) wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) ); // Validate $prefix: it can only contain letters, numbers and underscores. if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) ); // Test the db connection. /**#@+ * @ignore */ define('DB_NAME', $dbname); define('DB_USER', $uname); define('DB_PASSWORD', $pwd); define('DB_HOST', $dbhost); /**#@-*/ // We'll fail here if the values are no good. require_wp_db(); if ( ! empty( $wpdb->error ) ) wp_die( $wpdb->error->get_error_message() . $tryagain_link ); // Fetch or generate keys and salts. $no_api = isset( $_POST['noapi'] ); if ( ! $no_api ) { require_once( ABSPATH . WPINC . '/class-http.php' ); require_once( ABSPATH . WPINC . '/http.php' ); wp_fix_server_vars(); /**#@+ * @ignore */ function get_bloginfo() { return ( ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . str_replace( $_SERVER['PHP_SELF'], '/wp-admin/setup-config.php', '' ) ); } /**#@-*/ $secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); } if ( $no_api || is_wp_error( $secret_keys ) ) { $secret_keys = array(); require_once( ABSPATH . WPINC . '/pluggable.php' ); for ( $i = 0; $i < 8; $i++ ) { $secret_keys[] = wp_generate_password( 64, true, true ); } } else { $secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) ); foreach ( $secret_keys as $k => $v ) { $secret_keys[$k] = substr( $v, 28, 64 ); } } $key = 0; foreach ( $config_file as &$line ) { if ( '$table_prefix =' == substr( $line, 0, 16 ) ) { $line = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n"; continue; } if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) continue; $constant = $match[1]; $padding = $match[2]; switch ( $constant ) { case 'DB_NAME' : case 'DB_USER' : case 'DB_PASSWORD' : case 'DB_HOST' : $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n"; break; case 'AUTH_KEY' : case 'SECURE_AUTH_KEY' : case 'LOGGED_IN_KEY' : case 'NONCE_KEY' : case 'AUTH_SALT' : case 'SECURE_AUTH_SALT' : case 'LOGGED_IN_SALT' : case 'NONCE_SALT' : $line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n"; break; } } unset( $line ); if ( ! is_writable(ABSPATH) ) : display_header(); ?> <p><?php _e( "Sorry, but I can't write the <code>wp-config.php</code> file." ); ?></p> <p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p> <textarea cols="98" rows="15" class="code"><?php foreach( $config_file as $line ) { echo htmlentities($line, ENT_COMPAT, 'UTF-8'); } ?></textarea> <p><?php _e( 'After you\'ve done that, click "Run the install."' ); ?></p> <p class="step"><a href="install.php" class="button"><?php _e( 'Run the install' ); ?></a></p> <?php else : $handle = fopen(ABSPATH . 'wp-config.php', 'w'); foreach( $config_file as $line ) { fwrite($handle, $line); } fclose($handle); chmod(ABSPATH . 'wp-config.php', 0666); display_header(); ?> <p><?php _e( "All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p> <p class="step"><a href="install.php" class="button"><?php _e( 'Run the install' ); ?></a></p> <?php endif; break; } ?> </body> </html>
01happy-blog
trunk/myblog/wp-admin/setup-config.php
PHP
oos
10,852
<?php /** * Multisite delete site panel. * * @package WordPress * @subpackage Multisite * @since 3.0.0 */ require_once( './admin.php' ); if ( !is_multisite() ) wp_die( __( 'Multisite support is not enabled.' ) ); // @todo Create a delete blog cap. if ( ! current_user_can( 'manage_options' ) ) wp_die(__( 'You do not have sufficient permissions to delete this site.')); if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { wpmu_delete_blog( $wpdb->blogid ); wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) ); } else { wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); } } $title = __( 'Delete Site' ); $parent_file = 'tools.php'; require_once( './admin-header.php' ); echo '<div class="wrap">'; screen_icon(); echo '<h2>' . esc_html( $title ) . '</h2>'; if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { check_admin_referer( 'delete-blog' ); $hash = wp_generate_password( 20, false ); update_option( 'delete_blog_hash', $hash ); $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); $content = apply_filters( 'delete_site_email_content', __( "Dear User, You recently clicked the 'Delete Site' link on your site and filled in a form on that page. If you really want to delete your site, click the link below. You will not be asked to confirm again so only click this link if you are absolutely certain: ###URL_DELETE### If you delete your site, please consider opening a new site here some time in the future! (But remember your current site and username are gone forever.) Thanks for using the site, Webmaster ###SITE_NAME###" ) ); $content = str_replace( '###URL_DELETE###', $url_delete, $content ); $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content ); wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Delete My Site' ), $content ); ?> <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p> <?php } else { ?> <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p> <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> <form method="post" name="deletedirect"> <?php wp_nonce_field( 'delete-blog' ) ?> <input type="hidden" name="action" value="deleteblog" /> <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_blog->domain . $current_blog->path ); ?></strong></label></p> <?php submit_button( __( 'Delete My Site Permanently' ) ); ?> </form> <?php } echo '</div>'; include( './admin-footer.php' );
01happy-blog
trunk/myblog/wp-admin/ms-delete-site.php
PHP
oos
3,368
<?php /** * The custom header image script. * * @package WordPress * @subpackage Administration */ /** * The custom header image class. * * @since 2.1.0 * @package WordPress * @subpackage Administration */ class Custom_Image_Header { /** * Callback for administration header. * * @var callback * @since 2.1.0 * @access private */ var $admin_header_callback; /** * Callback for header div. * * @var callback * @since 3.0.0 * @access private */ var $admin_image_div_callback; /** * Holds default headers. * * @var array * @since 3.0.0 * @access private */ var $default_headers = array(); /** * Holds custom headers uploaded by the user * * @var array * @since 3.2.0 * @access private */ var $uploaded_headers = array(); /** * Holds the page menu hook. * * @var string * @since 3.0.0 * @access private */ var $page = ''; /** * Constructor - Register administration header callback. * * @since 2.1.0 * @param callback $admin_header_callback * @param callback $admin_image_div_callback Optional custom image div output callback. * @return Custom_Image_Header */ function __construct($admin_header_callback, $admin_image_div_callback = '') { $this->admin_header_callback = $admin_header_callback; $this->admin_image_div_callback = $admin_image_div_callback; add_action( 'admin_menu', array( $this, 'init' ) ); } /** * Set up the hooks for the Custom Header admin page. * * @since 2.1.0 */ function init() { if ( ! current_user_can('edit_theme_options') ) return; $this->page = $page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array(&$this, 'admin_page')); add_action("admin_print_scripts-$page", array(&$this, 'js_includes')); add_action("admin_print_styles-$page", array(&$this, 'css_includes')); add_action("admin_head-$page", array(&$this, 'help') ); add_action("admin_head-$page", array(&$this, 'take_action'), 50); add_action("admin_head-$page", array(&$this, 'js'), 50); if ( $this->admin_header_callback ) add_action("admin_head-$page", $this->admin_header_callback, 51); if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-header' ) { add_filter( 'attachment_fields_to_edit', array( $this, 'attachment_fields_to_edit' ), 10, 2 ); add_filter( 'media_upload_tabs', array( $this, 'filter_upload_tabs' ) ); add_filter( 'media_upload_mime_type_links', '__return_empty_array' ); } } /** * Adds contextual help. * * @since 3.0.0 */ function help() { get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __( 'This screen is used to customize the header section of your theme.') . '</p>' . '<p>' . __( 'You can choose from the theme&#8217;s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.') . '<p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-image', 'title' => __('Header Image'), 'content' => '<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button.' ) . '</p>' . '<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the &#8220;Save Changes&#8221; button.' ) . '</p>' . '<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the &#8220;Random&#8221; radio button next to the Uploaded Images or Default Images section to enable this feature.') . '</p>' . '<p>' . __( 'If you don&#8217;t want a header image to be displayed on your site at all, click the &#8220;Remove Header Image&#8221; button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click &#8220;Save Changes&#8221;.') . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'set-header-text', 'title' => __('Header Text'), 'content' => '<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' . '<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by typing in a legitimate HTML hex value (eg: &#8220;#ff0000&#8221; for red) or by clicking &#8220;Select a Color&#8221; and dialing in a color using the color picker.') . '</p>' . '<p>' . __( 'Don&#8217;t forget to Save Changes when you&#8217;re done!') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Header_Screen" target="_blank">Documentation on Custom Header</a>' ) . '</p>' . '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' ); } /** * Get the current step. * * @since 2.6.0 * * @return int Current step */ function step() { if ( ! isset( $_GET['step'] ) ) return 1; $step = (int) $_GET['step']; if ( $step < 1 || 3 < $step || ( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) || ( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) ) ) return 1; return $step; } /** * Set up the enqueue for the JavaScript files. * * @since 2.1.0 */ function js_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) ) { add_thickbox(); wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'custom-header' ); if ( current_theme_supports( 'custom-header', 'header-text' ) ) wp_enqueue_script('farbtastic'); } elseif ( 2 == $step ) { wp_enqueue_script('imgareaselect'); } } /** * Set up the enqueue for the CSS files * * @since 2.7 */ function css_includes() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) wp_enqueue_style('farbtastic'); elseif ( 2 == $step ) wp_enqueue_style('imgareaselect'); } /** * Execute custom header modification. * * @since 2.6.0 */ function take_action() { if ( ! current_user_can('edit_theme_options') ) return; if ( empty( $_POST ) ) return; $this->updated = true; if ( isset( $_POST['resetheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->reset_header_image(); return; } if ( isset( $_POST['resettext'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); remove_theme_mod('header_textcolor'); return; } if ( isset( $_POST['removeheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->remove_header_image(); return; } if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); set_theme_mod( 'header_textcolor', 'blank' ); } elseif ( isset( $_POST['text-color'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] ); $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']); if ( strlen($color) == 6 || strlen($color) == 3 ) set_theme_mod('header_textcolor', $color); elseif ( ! $color ) set_theme_mod( 'header_textcolor', 'blank' ); } if ( isset( $_POST['default-header'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); $this->set_header_image( $_POST['default-header'] ); return; } } /** * Process the default headers * * @since 3.0.0 */ function process_default_headers() { global $_wp_default_headers; if ( !empty($this->headers) ) return; if ( !isset($_wp_default_headers) ) return; $this->default_headers = $_wp_default_headers; $template_directory_uri = get_template_directory_uri(); $stylesheet_directory_uri = get_stylesheet_directory_uri(); foreach ( array_keys($this->default_headers) as $header ) { $this->default_headers[$header]['url'] = sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri ); $this->default_headers[$header]['thumbnail_url'] = sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri ); } } /** * Display UI for selecting one of several default headers. * * Show the random image option if this theme has multiple header images. * Random image option is on by default if no header has been set. * * @since 3.0.0 */ function show_header_selector( $type = 'default' ) { if ( 'default' == $type ) { $headers = $this->default_headers; } else { $headers = get_uploaded_header_images(); $type = 'uploaded'; } if ( 1 < count( $headers ) ) { echo '<div class="random-header">'; echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />'; echo __( '<strong>Random:</strong> Show a different image on each page.' ); echo '</label>'; echo '</div>'; } echo '<div class="available-headers">'; foreach ( $headers as $header_key => $header ) { $header_thumbnail = $header['thumbnail_url']; $header_url = $header['url']; $header_desc = empty( $header['description'] ) ? '' : $header['description']; echo '<div class="default-header">'; echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />'; $width = ''; if ( !empty( $header['attachment_id'] ) ) $width = ' width="230"'; echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_desc ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>'; echo '</div>'; } echo '<div class="clear"></div></div>'; } /** * Execute Javascript depending on step. * * @since 2.1.0 */ function js() { $step = $this->step(); if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) $this->js_1(); elseif ( 2 == $step ) $this->js_2(); } /** * Display Javascript based on Step 1 and 3. * * @since 2.6.0 */ function js_1() { ?> <script type="text/javascript"> /* <![CDATA[ */ var farbtastic; (function($){ var default_color = '#<?php echo get_theme_support( 'custom-header', 'default-text-color' ); ?>', header_text_fields; function pickColor(color) { $('#name').css('color', color); $('#desc').css('color', color); $('#text-color').val(color); farbtastic.setColor(color); } function toggle_text() { var checked = $('#display-header-text').prop('checked'), text_color; header_text_fields.toggle( checked ); if ( ! checked ) return; text_color = $('#text-color'); if ( '' == text_color.val().replace('#', '') ) { text_color.val( default_color ); pickColor( default_color ); } else { pickColor( text_color.val() ); } } $(document).ready(function() { header_text_fields = $('.displaying-header-text'); $('#pickcolor').click(function(e) { e.preventDefault(); $('#color-picker').show(); }); $('#display-header-text').click( toggle_text ); $('#defaultcolor').click(function() { pickColor(default_color); $('#text-color').val(default_color); }); $('#text-color').keyup(function() { var _hex = $('#text-color').val(); var hex = _hex; if ( hex[0] != '#' ) hex = '#' + hex; hex = hex.replace(/[^#a-fA-F0-9]+/, ''); if ( hex != _hex ) $('#text-color').val(hex); if ( hex.length == 4 || hex.length == 7 ) pickColor( hex ); }); $(document).mousedown(function(){ $('#color-picker').each( function() { var display = $(this).css('display'); if (display == 'block') $(this).fadeOut(2); }); }); farbtastic = $.farbtastic('#color-picker', function(color) { pickColor(color); }); <?php if ( display_header_text() ) { ?> pickColor('#<?php echo get_header_textcolor(); ?>'); <?php } else { ?> toggle_text(); <?php } ?> }); })(jQuery); /* ]]> */ </script> <?php } /** * Display Javascript based on Step 2. * * @since 2.6.0 */ function js_2() { ?> <script type="text/javascript"> /* <![CDATA[ */ function onEndCrop( coords ) { jQuery( '#x1' ).val(coords.x); jQuery( '#y1' ).val(coords.y); jQuery( '#width' ).val(coords.w); jQuery( '#height' ).val(coords.h); } jQuery(document).ready(function() { var xinit = <?php echo absint( get_theme_support( 'custom-header', 'width' ) ); ?>; var yinit = <?php echo absint( get_theme_support( 'custom-header', 'height' ) ); ?>; var ratio = xinit / yinit; var ximg = jQuery('img#upload').width(); var yimg = jQuery('img#upload').height(); if ( yimg < yinit || ximg < xinit ) { if ( ximg / yimg > ratio ) { yinit = yimg; xinit = yinit * ratio; } else { xinit = ximg; yinit = xinit / ratio; } } jQuery('img#upload').imgAreaSelect({ handles: true, keys: true, show: true, x1: 0, y1: 0, x2: xinit, y2: yinit, <?php if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { ?> aspectRatio: xinit + ':' + yinit, <?php } if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) { ?> maxHeight: <?php echo get_theme_support( 'custom-header', 'height' ); ?>, <?php } if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) { ?> maxWidth: <?php echo get_theme_support( 'custom-header', 'width' ); ?>, <?php } ?> onInit: function () { jQuery('#width').val(xinit); jQuery('#height').val(yinit); }, onSelectChange: function(img, c) { jQuery('#x1').val(c.x1); jQuery('#y1').val(c.y1); jQuery('#width').val(c.width); jQuery('#height').val(c.height); } }); }); /* ]]> */ </script> <?php } /** * Display first step of custom header image page. * * @since 2.1.0 */ function step_1() { $this->process_default_headers(); ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php _e('Custom Header'); ?></h2> <?php if ( ! empty( $this->updated ) ) { ?> <div id="message" class="updated"> <p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p> </div> <?php } ?> <h3><?php _e( 'Header Image' ); ?></h3> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e( 'Preview' ); ?></th> <td> <?php if ( $this->admin_image_div_callback ) { call_user_func( $this->admin_image_div_callback ); } else { ?> <div id="headimg" style="background-image:url(<?php esc_url ( header_image() ) ?>);max-width:<?php echo get_custom_header()->width; ?>px;height:<?php echo get_custom_header()->height; ?>px;"> <?php if ( display_header_text() ) $style = ' style="color:#' . get_header_textcolor() . ';"'; else $style = ' style="display:none;"'; ?> <h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>"><?php bloginfo( 'name' ); ?></a></h1> <div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div> </div> <?php } ?> </td> </tr> <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?> <tr valign="top"> <th scope="row"><?php _e( 'Select Image' ); ?></th> <td> <p><?php _e( 'You can upload a custom header image to be shown at the top of your site instead of the default one. On the next screen you will be able to crop the image.' ); ?><br /> <?php if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) { printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) ); } elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) { if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) printf( __( 'Images should be at least <strong>%1$d pixels</strong> wide.' ) . ' ', get_theme_support( 'custom-header', 'width' ) ); } elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) { if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) printf( __( 'Images should be at least <strong>%1$d pixels</strong> tall.' ) . ' ', get_theme_support( 'custom-header', 'height' ) ); } if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) { if ( current_theme_supports( 'custom-header', 'width' ) ) printf( __( 'Suggested width is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'width' ) ); if ( current_theme_supports( 'custom-header', 'height' ) ) printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) ); } ?></p> <form enctype="multipart/form-data" id="upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>"> <p> <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br /> <input type="file" id="upload" name="import" /> <input type="hidden" name="action" value="save" /> <?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?> <?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?> </p> <?php $image_library_url = get_upload_iframe_src( 'image', null, 'library' ); $image_library_url = remove_query_arg( 'TB_iframe', $image_library_url ); $image_library_url = add_query_arg( array( 'context' => 'custom-header', 'TB_iframe' => 1 ), $image_library_url ); ?> <p> <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br /> <a id="choose-from-library-link" class="button thickbox" href="<?php echo esc_url( $image_library_url ); ?>"><?php _e( 'Choose Image' ); ?></a> </p> </form> </td> </tr> <?php endif; ?> </tbody> </table> <form method="post" action="<?php echo esc_attr( add_query_arg( 'step', 1 ) ) ?>"> <table class="form-table"> <tbody> <?php if ( get_uploaded_header_images() ) : ?> <tr valign="top"> <th scope="row"><?php _e( 'Uploaded Images' ); ?></th> <td> <p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p> <?php $this->show_header_selector( 'uploaded' ); ?> </td> </tr> <?php endif; if ( ! empty( $this->default_headers ) ) : ?> <tr valign="top"> <th scope="row"><?php _e( 'Default Images' ); ?></th> <td> <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?> <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p> <?php else: ?> <p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p> <?php endif; ?> <?php $this->show_header_selector( 'default' ); ?> </td> </tr> <?php endif; if ( get_header_image() ) : ?> <tr valign="top"> <th scope="row"><?php _e( 'Remove Image' ); ?></th> <td> <p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p> <?php submit_button( __( 'Remove Header Image' ), 'button', 'removeheader', false ); ?> </td> </tr> <?php endif; $default_image = get_theme_support( 'custom-header', 'default-image' ); if ( $default_image && get_header_image() != $default_image ) : ?> <tr valign="top"> <th scope="row"><?php _e( 'Reset Image' ); ?></th> <td> <p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p> <?php submit_button( __( 'Restore Original Header Image' ), 'button', 'resetheader', false ); ?> </td> </tr> <?php endif; ?> </tbody> </table> <?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?> <h3><?php _e( 'Header Text' ); ?></h3> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e( 'Header Text' ); ?></th> <td> <p> <label><input type="checkbox" name="display-header-text" id="display-header-text"<?php checked( display_header_text() ); ?> /> <?php _e( 'Show header text with your image.' ); ?></label> </p> </td> </tr> <tr valign="top" class="displaying-header-text"> <th scope="row"><?php _e( 'Text Color' ); ?></th> <td> <p> <?php if ( display_header_text() ) : ?> <input type="text" name="text-color" id="text-color" value="#<?php echo esc_attr( get_header_textcolor() ); ?>" /> <?php else : ?> <input type="text" name="text-color" id="text-color" value="#<?php echo esc_attr( get_theme_support( 'custom-header', 'default-text-color' ) ); ?>" /> <?php endif; ?> <a href="#" class="hide-if-no-js" id="pickcolor"><?php _e( 'Select a Color' ); ?></a> </p> <div id="color-picker" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> </td> </tr> <?php if ( current_theme_supports( 'custom-header', 'default-text-color' ) && get_theme_mod( 'header_textcolor' ) ) { ?> <tr valign="top"> <th scope="row"><?php _e('Reset Text Color'); ?></th> <td> <p><?php _e( 'This will restore the original header text. You will not be able to restore any customizations.' ) ?></p> <?php submit_button( __( 'Restore Original Header Text' ), 'button', 'resettext', false ); ?> </td> </tr> <?php } ?> </tbody> </table> <?php endif; do_action( 'custom_header_options' ); wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> <?php submit_button( null, 'primary', 'save-header-options' ); ?> </form> </div> <?php } /** * Display second step of custom header image page. * * @since 2.1.0 */ function step_2() { check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload'); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( empty( $_POST ) && isset( $_GET['file'] ) ) { $attachment_id = absint( $_GET['file'] ); $file = get_attached_file( $attachment_id, true ); $url = wp_get_attachment_image_src( $attachment_id, 'full'); $url = $url[0]; } elseif ( isset( $_POST ) ) { extract($this->step_2_manage_upload()); } if ( file_exists( $file ) ) { list( $width, $height, $type, $attr ) = getimagesize( $file ); } else { $data = wp_get_attachment_metadata( $attachment_id ); $height = $data[ 'height' ]; $width = $data[ 'width' ]; unset( $data ); } $max_width = 0; // For flex, limit size of image displayed to 1500px unless theme says otherwise if ( current_theme_supports( 'custom-header', 'flex-width' ) ) $max_width = 1500; if ( current_theme_supports( 'custom-header', 'max-width' ) ) $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); // If flexible height isn't supported and the image is the exact right size if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) && $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) ) { // Add the meta-data if ( file_exists( $file ) ) wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication return $this->finished(); } elseif ( $width > $max_width ) { $oitar = $width / $max_width; $image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file)); if ( ! $image || is_wp_error( $image ) ) wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); $image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication $url = str_replace(basename($url), basename($image), $url); $width = $width / $oitar; $height = $height / $oitar; } else { $oitar = 1; } ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php _e( 'Crop Header Image' ); ?></h2> <form method="post" action="<?php echo esc_attr(add_query_arg('step', 3)); ?>"> <p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p> <p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p> <div id="crop_image" style="position: relative"> <img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" /> </div> <input type="hidden" name="x1" id="x1" value="0"/> <input type="hidden" name="y1" id="y1" value="0"/> <input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/> <input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/> <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" /> <input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" /> <?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?> <input type="hidden" name="create-new-attachment" value="true" /> <?php } ?> <?php wp_nonce_field( 'custom-header-crop-image' ) ?> <p class="submit"> <?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?> <?php if ( isset( $oitar ) && 1 == $oitar ) submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false ); ?> </p> </form> </div> <?php } /** * Upload the file to be cropped in the second step. * * @since 3.4.0 */ function step_2_manage_upload() { $overrides = array('test_form' => false); $file = wp_handle_upload($_FILES['import'], $overrides); if ( isset($file['error']) ) wp_die( $file['error'], __( 'Image Upload Error' ) ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = basename($file); // Construct the object array $object = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url, 'context' => 'custom-header' ); // Save the data $attachment_id = wp_insert_attachment( $object, $file ); return compact( 'attachment_id', 'file', 'filename', 'url', 'type' ); } /** * Display third step of custom header image page. * * @since 2.1.0 */ function step_3() { check_admin_referer( 'custom-header-crop-image' ); if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) wp_die( __( 'Cheatin&#8217; uh?' ) ); if ( $_POST['oitar'] > 1 ) { $_POST['x1'] = $_POST['x1'] * $_POST['oitar']; $_POST['y1'] = $_POST['y1'] * $_POST['oitar']; $_POST['width'] = $_POST['width'] * $_POST['oitar']; $_POST['height'] = $_POST['height'] * $_POST['oitar']; } $attachment_id = absint( $_POST['attachment_id'] ); $original = get_attached_file($attachment_id); $max_width = 0; // For flex, limit size of image displayed to 1500px unless theme says otherwise if ( current_theme_supports( 'custom-header', 'flex-width' ) ) $max_width = 1500; if ( current_theme_supports( 'custom-header', 'max-width' ) ) $max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) ); $max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) ); if ( ( current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) || $_POST['width'] > $max_width ) $dst_height = absint( $_POST['height'] * ( $max_width / $_POST['width'] ) ); elseif ( current_theme_supports( 'custom-header', 'flex-height' ) && current_theme_supports( 'custom-header', 'flex-width' ) ) $dst_height = absint( $_POST['height'] ); else $dst_height = get_theme_support( 'custom-header', 'height' ); if ( ( current_theme_supports( 'custom-header', 'flex-width' ) && ! current_theme_supports( 'custom-header', 'flex-height' ) ) || $_POST['width'] > $max_width ) $dst_width = absint( $_POST['width'] * ( $max_width / $_POST['width'] ) ); elseif ( current_theme_supports( 'custom-header', 'flex-width' ) && current_theme_supports( 'custom-header', 'flex-height' ) ) $dst_width = absint( $_POST['width'] ); else $dst_width = get_theme_support( 'custom-header', 'width' ); if ( empty( $_POST['skip-cropping'] ) ) $cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $dst_width, $dst_height ); elseif ( ! empty( $_POST['create-new-attachment'] ) ) $cropped = _copy_image_file( $attachment_id ); else $cropped = get_attached_file( $attachment_id ); if ( ! $cropped || is_wp_error( $cropped ) ) wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication $parent = get_post($attachment_id); $parent_url = $parent->guid; $url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url ); $size = @getimagesize( $cropped ); $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; // Construct the object array $object = array( 'ID' => $attachment_id, 'post_title' => basename($cropped), 'post_content' => $url, 'post_mime_type' => $image_type, 'guid' => $url, 'context' => 'custom-header' ); if ( ! empty( $_POST['create-new-attachment'] ) ) unset( $object['ID'] ); // Update the attachment $attachment_id = wp_insert_attachment( $object, $cropped ); wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $cropped ) ); $width = $dst_width; $height = $dst_height; $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); // cleanup $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original ); if ( file_exists( $medium ) ) @unlink( apply_filters( 'wp_delete_file', $medium ) ); if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) @unlink( apply_filters( 'wp_delete_file', $original ) ); return $this->finished(); } /** * Display last step of custom header image page. * * @since 2.1.0 */ function finished() { $this->updated = true; $this->step_1(); } /** * Display the page based on the current step. * * @since 2.1.0 */ function admin_page() { if ( ! current_user_can('edit_theme_options') ) wp_die(__('You do not have permission to customize headers.')); $step = $this->step(); if ( 2 == $step ) $this->step_2(); elseif ( 3 == $step ) $this->step_3(); else $this->step_1(); } /** * Replace default attachment actions with "Set as header" link. * * @since 3.4.0 */ function attachment_fields_to_edit( $form_fields, $post ) { $form_fields = array(); $href = esc_url(add_query_arg(array( 'page' => 'custom-header', 'step' => 2, '_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'), 'file' => $post->ID ), admin_url('themes.php'))); $form_fields['buttons'] = array( 'tr' => '<tr class="submit"><td></td><td><a data-location="' . $href . '" class="wp-set-header">' . __( 'Set as header' ) . '</a></td></tr>' ); $form_fields['context'] = array( 'input' => 'hidden', 'value' => 'custom-header' ); return $form_fields; } /** * Leave only "Media Library" tab in the uploader window. * * @since 3.4.0 */ function filter_upload_tabs() { return array( 'library' => __('Media Library') ); } /** * Choose a header image, selected from existing uploaded and default headers, * or provide an array of uploaded header data (either new, or from media library). * * @param mixed $choice Which header image to select. Allows for values of 'random-default-image', * for randomly cycling among the default images; 'random-uploaded-image', for randomly cycling * among the uploaded images; the key of a default image registered for that theme; and * the key of an image uploaded for that theme (the basename of the URL). * Or an array of arguments: attachment_id, url, width, height. All are required. * * @since 3.4.0 */ final public function set_header_image( $choice ) { if ( is_array( $choice ) || is_object( $choice ) ) { $choice = (array) $choice; if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) return; $choice['url'] = esc_url_raw( $choice['url'] ); $header_image_data = (object) array( 'attachment_id' => $choice['attachment_id'], 'url' => $choice['url'], 'thumbnail_url' => $choice['url'], 'height' => $choice['height'], 'width' => $choice['width'], ); update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() ); set_theme_mod( 'header_image', $choice['url'] ); set_theme_mod( 'header_image_data', $header_image_data ); return; } if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) { set_theme_mod( 'header_image', $choice ); remove_theme_mod( 'header_image_data' ); return; } $uploaded = get_uploaded_header_images(); if ( $uploaded && isset( $uploaded[ $choice ] ) ) { $header_image_data = $uploaded[ $choice ]; } else { $this->process_default_headers(); if ( isset( $this->default_headers[ $choice ] ) ) $header_image_data = $this->default_headers[ $choice ]; else return; } set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) ); set_theme_mod( 'header_image_data', $header_image_data ); } /** * Remove a header image. * * @since 3.4.0 */ final public function remove_header_image() { return $this->set_header_image( 'remove-header' ); } /** * Reset a header image to the default image for the theme. * * This method does not do anything if the theme does not have a default header image. * * @since 3.4.0 */ final public function reset_header_image() { $this->process_default_headers(); $default = get_theme_support( 'custom-header', 'default-image' ); if ( ! $default ) return $this->remove_header_image(); $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() ); foreach ( $this->default_headers as $header => $details ) { if ( $details['url'] == $default ) { $default_data = $details; break; } } set_theme_mod( 'header_image', $default ); set_theme_mod( 'header_image_data', (object) $default_data ); } }
01happy-blog
trunk/myblog/wp-admin/custom-header.php
PHP
oos
35,880
<?php /** * Manage link administration actions. * * This page is accessed by the link management pages and handles the forms and * AJAX processes for link actions. * * @package WordPress * @subpackage Administration */ /** Load WordPress Administration Bootstrap */ require_once ('admin.php'); wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); if ( ! current_user_can('manage_links') ) wp_die( __('You do not have sufficient permissions to edit the links for this site.') ); if ( !empty($_POST['deletebookmarks']) ) $action = 'deletebookmarks'; if ( !empty($_POST['move']) ) $action = 'move'; if ( !empty($_POST['linkcheck']) ) $linkcheck = $_POST['linkcheck']; $this_file = admin_url('link-manager.php'); switch ($action) { case 'deletebookmarks' : check_admin_referer('bulk-bookmarks'); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { wp_redirect($this_file); exit; } $deleted = 0; foreach ($linkcheck as $link_id) { $link_id = (int) $link_id; if ( wp_delete_link($link_id) ) $deleted++; } wp_redirect("$this_file?deleted=$deleted"); exit; break; case 'move' : check_admin_referer('bulk-bookmarks'); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { wp_redirect($this_file); exit; } $all_links = join(',', $linkcheck); // should now have an array of links we can change //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); wp_redirect($this_file); exit; break; case 'add' : check_admin_referer('add-bookmark'); $redir = wp_get_referer(); if ( add_link() ) $redir = add_query_arg( 'added', 'true', $redir ); wp_redirect( $redir ); exit; break; case 'save' : $link_id = (int) $_POST['link_id']; check_admin_referer('update-bookmark_' . $link_id); edit_link($link_id); wp_redirect($this_file); exit; break; case 'delete' : $link_id = (int) $_GET['link_id']; check_admin_referer('delete-bookmark_' . $link_id); wp_delete_link($link_id); wp_redirect($this_file); exit; break; case 'edit' : wp_enqueue_script('link'); wp_enqueue_script('xfn'); if ( wp_is_mobile() ) wp_enqueue_script( 'jquery-touch-punch' ); $parent_file = 'link-manager.php'; $submenu_file = 'link-manager.php'; $title = __('Edit Link'); $link_id = (int) $_GET['link_id']; if (!$link = get_link_to_edit($link_id)) wp_die(__('Link not found.')); include ('edit-link-form.php'); include ('admin-footer.php'); break; default : break; }
01happy-blog
trunk/myblog/wp-admin/link.php
PHP
oos
2,794
<?php /** * Network installation administration panel. * * A multi-step process allowing the user to enable a network of WordPress sites. * * @since 3.0.0 * * @package WordPress * @subpackage Administration */ define( 'WP_INSTALLING_NETWORK', true ); /** WordPress Administration Bootstrap */ require_once( './admin.php' ); if ( ! is_super_admin() ) wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); if ( is_multisite() ) { if ( ! is_network_admin() ) { wp_redirect( network_admin_url( 'setup.php' ) ); exit; } if ( ! defined( 'MULTISITE' ) ) wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) ); } // We need to create references to ms global tables to enable Network. foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) $wpdb->$table = $prefixed_table; /** * Check for an existing network. * * @since 3.0.0 * @return Whether a network exists. */ function network_domain_check() { global $wpdb; if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); return false; } /** * Allow subdomain install * * @since 3.0.0 * @return bool Whether subdomain install is allowed */ function allow_subdomain_install() { $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'siteurl' ) ); if( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) ) return false; return true; } /** * Allow subdirectory install * * @since 3.0.0 * @return bool Whether subdirectory install is allowed */ function allow_subdirectory_install() { global $wpdb; if ( apply_filters( 'allow_subdirectory_install', false ) ) return true; if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) return true; $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); if ( empty( $post ) ) return true; return false; } /** * Get base domain of network. * * @since 3.0.0 * @return string Base domain. */ function get_clean_basedomain() { if ( $existing_domain = network_domain_check() ) return $existing_domain; $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); if ( $slash = strpos( $domain, '/' ) ) $domain = substr( $domain, 0, $slash ); return $domain; } if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) ); if ( is_network_admin() ) { $title = __( 'Network Setup' ); $parent_file = 'settings.php'; } else { $title = __( 'Create a Network of WordPress Sites' ); $parent_file = 'tools.php'; } $network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' . '<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' . '<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' . '<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' . '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' . '<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' . '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' . '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'network', 'title' => __('Network'), 'content' => $network_help, ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' . '<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); include( ABSPATH . 'wp-admin/admin-header.php' ); ?> <div class="wrap"> <?php screen_icon('tools'); ?> <h2><?php echo esc_html( $title ); ?></h2> <?php /** * Prints step 1 for Network installation process. * * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network * should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo. * * @since 3.0.0 */ function network_step1( $errors = false ) { global $is_apache; if ( get_option( 'siteurl' ) != get_option( 'home' ) ) { echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . sprintf( __( 'Your <strong>WordPress address</strong> must match your <strong>Site address</strong> before creating a Network. See <a href="%s">General Settings</a>.' ), esc_url( admin_url( 'options-general.php' ) ) ) . '</p></div>'; echo '</div>'; include ( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; echo '</div>'; include ( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } $active_plugins = get_option( 'active_plugins' ); if ( ! empty( $active_plugins ) ) { echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; echo '</div>'; include( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } $hostname = get_clean_basedomain(); $has_ports = strstr( $hostname, ':' ); if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>'; echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; echo '</div>'; include( ABSPATH . 'wp-admin/admin-footer.php' ); die(); } echo '<form method="post" action="">'; wp_nonce_field( 'install-network-1' ); $error_codes = array(); if ( is_wp_error( $errors ) ) { echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; foreach ( $errors->get_error_messages() as $error ) echo "<p>$error</p>"; echo '</div>'; $error_codes = $errors->get_error_codes(); } if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) ); $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' ); ?> <p><?php _e( 'Welcome to the Network installation process!' ); ?></p> <p><?php _e( 'Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p> <?php if ( isset( $_POST['subdomain_install'] ) ) { $subdomain_install = (bool) $_POST['subdomain_install']; } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing $subdomain_install = true; } elseif ( !allow_subdirectory_install() ) { $subdomain_install = true; } else { $subdomain_install = false; if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>'; elseif ( $is_apache ) echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>'; if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache) echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>'; } if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p> <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> <?php // @todo: Link to an MS readme? ?> <table class="form-table"> <tr> <th><label><input type='radio' name='subdomain_install' value='1'<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th> <td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td> </tr> <tr> <th><label><input type='radio' name='subdomain_install' value='0'<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th> <td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td> </tr> </table> <?php endif; $is_www = ( 0 === strpos( $hostname, 'www.' ) ); if ( $is_www ) : ?> <h3><?php esc_html_e( 'Server Address' ); ?></h3> <p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></p> <table class="form-table"> <tr> <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> <td> <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> </td> </tr> </table> <?php endif; ?> <h3><?php esc_html_e( 'Network Details' ); ?></h3> <table class="form-table"> <?php if ( 'localhost' == $hostname ) : ?> <tr> <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> <td><?php _e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' ); // Uh oh: if ( !allow_subdirectory_install() ) echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; ?></td> </tr> <?php elseif ( !allow_subdomain_install() ) : ?> <tr> <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> <td><?php _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' ); // Uh oh: if ( !allow_subdirectory_install() ) echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; ?></td> </tr> <?php elseif ( !allow_subdirectory_install() ) : ?> <tr> <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th> <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' ); echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; ?></td> </tr> <?php endif; ?> <?php if ( ! $is_www ) : ?> <tr> <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> <td> <?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?> </td> </tr> <?php endif; ?> <tr> <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th> <td> <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' /> <br /><?php _e( 'What would you like to call your network?' ); ?> </td> </tr> <tr> <th scope='row'><?php esc_html_e( 'Admin E-mail Address' ); ?></th> <td> <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' /> <br /><?php _e( 'Your email address.' ); ?> </td> </tr> </table> <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?> </form> <?php } /** * Prints step 2 for Network installation process. * * @since 3.0.0 */ function network_step2( $errors = false ) { global $base, $wpdb; $hostname = get_clean_basedomain(); if ( ! isset( $base ) ) $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); // Wildcard DNS message. if ( is_wp_error( $errors ) ) echo '<div class="error">' . $errors->get_error_message() . '</div>'; if ( $_POST ) { if ( allow_subdomain_install() ) $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; else $subdomain_install = false; } else { if ( is_multisite() ) { $subdomain_install = is_subdomain_install(); ?> <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> <?php } else { $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); ?> <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> <?php } } if ( $_POST || ! is_multisite() ) { ?> <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> <div class="updated inline"><p><?php if ( file_exists( ABSPATH . '.htaccess' ) ) printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' ); elseif ( file_exists( ABSPATH . 'web.config' ) ) printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' ); else _e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' ); ?></p></div> <?php } ?> <ol> <li><p><?php printf( __( 'Create a <code>blogs.dir</code> directory at <code>%s/blogs.dir</code>. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR ); if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' ) echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>'; ?></p></li> <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p> <textarea class="code" readonly="readonly" cols="100" rows="7"> define('MULTISITE', true); define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>); $base = '<?php echo $base; ?>'; define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>'); define('PATH_CURRENT_SITE', '<?php echo $base; ?>'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);</textarea> <?php $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); foreach ( $keys_salts as $c => $v ) { if ( defined( $c ) ) unset( $keys_salts[ $c ] ); } if ( ! empty( $keys_salts ) ) { $keys_salts_str = ''; $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); if ( is_wp_error( $from_api ) ) { foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; } } else { $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); foreach ( $keys_salts as $c => $v ) { $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; } } $num_keys_salts = count( $keys_salts ); ?> <p><?php echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p> <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> <?php } ?> </li> <?php if ( iis7_supports_permalinks() ) : if ( $subdomain_install ) { $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>'; } else { $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:1}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule> <rule name="WordPress Rule 7" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>'; } ?> <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> <textarea class="code" readonly="readonly" cols="100" rows="20"> <?php echo esc_textarea( $web_config_file ); ?> </textarea></li> </ol> <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: $htaccess_file = 'RewriteEngine On RewriteBase ' . $base . ' RewriteRule ^index\.php$ - [L] # uploaded files RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; if ( ! $subdomain_install ) $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L]'; // @todo custom content dir. if ( ! $subdomain_install ) $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]"; $htaccess_file .= "\nRewriteRule . index.php [L]"; ?> <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> </ol> <?php endif; // end IIS/Apache code branches. if ( !is_multisite() ) { ?> <p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p> <?php } } if ( $_POST ) { $base = trailingslashit( stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) ) ); check_admin_referer( 'install-network-1' ); require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); // create network tables install_network(); $hostname = get_clean_basedomain(); $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; if ( ! network_domain_check() ) { $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), stripslashes( $_POST['sitename'] ), $base, $subdomain_install ); if ( is_wp_error( $result ) ) { if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) network_step2( $result ); else network_step1( $result ); } else { network_step2(); } } else { network_step2(); } } elseif ( is_multisite() || network_domain_check() ) { network_step2(); } else { network_step1(); } ?> </div> <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
01happy-blog
trunk/myblog/wp-admin/network.php
PHP
oos
26,208
<?php /** * Install plugin administration panel. * * @package WordPress * @subpackage Administration */ // TODO route this pages via a specific iframe handler instead of the do_action below if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) define( 'IFRAME_REQUEST', true ); /** WordPress Administration Bootstrap */ require_once('./admin.php'); if ( ! current_user_can('install_plugins') ) wp_die(__('You do not have sufficient permissions to install plugins on this site.')); if ( is_multisite() && ! is_network_admin() ) { wp_redirect( network_admin_url( 'plugin-install.php' ) ); exit(); } $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $wp_list_table->prepare_items(); $title = __('Install Plugins'); $parent_file = 'plugins.php'; wp_enqueue_script( 'plugin-install' ); if ( 'plugin-information' != $tab ) add_thickbox(); $body_id = $tab; do_action('install_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information. get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'http://wordpress.org/extend/plugins/') . '</p>' ) ); get_current_screen()->add_help_tab( array( 'id' => 'adding-plugins', 'title' => __('Adding Plugins'), 'content' => '<p>' . __('If you know what you&#8217;re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting a popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' . '<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured, Popular, and Newest plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' . '<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>' ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); include(ABSPATH . 'wp-admin/admin-header.php'); ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php echo esc_html( $title ); ?></h2> <?php $wp_list_table->views(); ?> <br class="clear" /> <?php do_action('install_plugins_' . $tab, $paged); ?> </div> <?php include(ABSPATH . 'wp-admin/admin-footer.php');
01happy-blog
trunk/myblog/wp-admin/plugin-install.php
PHP
oos
3,313
// send html to the post editor var wpActiveEditor; function send_to_editor(h) { var ed, mce = typeof(tinymce) != 'undefined', qt = typeof(QTags) != 'undefined'; if ( !wpActiveEditor ) { if ( mce && tinymce.activeEditor ) { ed = tinymce.activeEditor; wpActiveEditor = ed.id; } else if ( !qt ) { return false; } } else if ( mce ) { if ( tinymce.activeEditor && (tinymce.activeEditor.id == 'mce_fullscreen' || tinymce.activeEditor.id == 'wp_mce_fullscreen') ) ed = tinymce.activeEditor; else ed = tinymce.get(wpActiveEditor); } if ( ed && !ed.isHidden() ) { // restore caret position on IE if ( tinymce.isIE && ed.windowManager.insertimagebookmark ) ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark); if ( h.indexOf('[caption') === 0 ) { if ( ed.wpSetImgCaption ) h = ed.wpSetImgCaption(h); } else if ( h.indexOf('[gallery') === 0 ) { if ( ed.plugins.wpgallery ) h = ed.plugins.wpgallery._do_gallery(h); } else if ( h.indexOf('[embed') === 0 ) { if ( ed.plugins.wordpress ) h = ed.plugins.wordpress._setEmbed(h); } ed.execCommand('mceInsertContent', false, h); } else if ( qt ) { QTags.insertContent(h); } else { document.getElementById(wpActiveEditor).value += h; } try{tb_remove();}catch(e){}; } // thickbox settings var tb_position; (function($) { tb_position = function() { var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width, adminbar_height = 0; if ( $('body.admin-bar').length ) adminbar_height = 28; if ( tbWindow.size() ) { tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); if ( typeof document.body.style.maxWidth != 'undefined' ) tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); }; return $('a.thickbox').each( function() { var href = $(this).attr('href'); if ( ! href ) return; href = href.replace(/&width=[0-9]+/g, ''); href = href.replace(/&height=[0-9]+/g, ''); $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 - adminbar_height ) ); }); }; $(window).resize(function(){ tb_position(); }); // store caret position in IE $(document).ready(function($){ $('a.thickbox').click(function(){ var ed; if ( typeof(tinymce) != 'undefined' && tinymce.isIE && ( ed = tinymce.get(wpActiveEditor) ) && !ed.isHidden() ) { ed.focus(); ed.windowManager.insertimagebookmark = ed.selection.getBookmark(); } }); }); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/media-upload.dev.js
JavaScript
oos
2,673
(function($,undefined) { wpWordCount = { settings : { strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc. w : /\S\s+/g, // word-counting regexp c : /\S/g // char-counting regexp for asian languages }, block : 0, wc : function(tx, type) { var t = this, w = $('.word-count'), tc = 0; if ( type === undefined ) type = wordCountL10n.type; if ( type !== 'w' && type !== 'c' ) type = 'w'; if ( t.block ) return; t.block = 1; setTimeout( function() { if ( tx ) { tx = tx.replace( t.settings.strip, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' ); tx = tx.replace( t.settings.clean, '' ); tx.replace( t.settings[type], function(){tc++;} ); } w.html(tc.toString()); setTimeout( function() { t.block = 0; }, 2000 ); }, 1 ); } } $(document).bind( 'wpcountwords', function(e, txt) { wpWordCount.wc(txt); }); }(jQuery));
01happy-blog
trunk/myblog/wp-admin/js/word-count.dev.js
JavaScript
oos
978
jQuery(function($){ $( 'body' ).bind( 'click.wp-gallery', function(e){ var target = $( e.target ), id, img_size; if ( target.hasClass( 'wp-set-header' ) ) { ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); e.preventDefault(); } else if ( target.hasClass( 'wp-set-background' ) ) { id = target.data( 'attachment-id' ); img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); jQuery.post(ajaxurl, { action: 'set-background-image', attachment_id: id, size: img_size }, function(){ var win = window.dialogArguments || opener || parent || top; win.tb_remove(); win.location.reload(); }); e.preventDefault(); } }); });
01happy-blog
trunk/myblog/wp-admin/js/media-gallery.dev.js
JavaScript
oos
748
(function($) { inlineEditPost = { init : function(){ var t = this, qeRow = $('#inline-edit'), bulkRow = $('#bulk-edit'); t.type = $('table.widefat').hasClass('pages') ? 'page' : 'post'; t.what = '#post-'; // prepare the edit rows qeRow.keyup(function(e){ if (e.which == 27) return inlineEditPost.revert(); }); bulkRow.keyup(function(e){ if (e.which == 27) return inlineEditPost.revert(); }); $('a.cancel', qeRow).click(function(){ return inlineEditPost.revert(); }); $('a.save', qeRow).click(function(){ return inlineEditPost.save(this); }); $('td', qeRow).keydown(function(e){ if ( e.which == 13 ) return inlineEditPost.save(this); }); $('a.cancel', bulkRow).click(function(){ return inlineEditPost.revert(); }); $('#inline-edit .inline-edit-private input[value="private"]').click( function(){ var pw = $('input.inline-edit-password-input'); if ( $(this).prop('checked') ) { pw.val('').prop('disabled', true); } else { pw.prop('disabled', false); } }); // add events $('a.editinline').live('click', function(){ inlineEditPost.edit(this); return false; }); $('#bulk-title-div').parents('fieldset').after( $('#inline-edit fieldset.inline-edit-categories').clone() ).siblings( 'fieldset:last' ).prepend( $('#inline-edit label.inline-edit-tags').clone() ); // hiearchical taxonomies expandable? $('span.catshow').click(function(){ $(this).hide().next().show().parent().next().addClass("cat-hover"); }); $('span.cathide').click(function(){ $(this).hide().prev().show().parent().next().removeClass("cat-hover"); }); $('select[name="_status"] option[value="future"]', bulkRow).remove(); $('#doaction, #doaction2').click(function(e){ var n = $(this).attr('id').substr(2); if ( $('select[name="'+n+'"]').val() == 'edit' ) { e.preventDefault(); t.setBulk(); } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) { t.revert(); } }); $('#post-query-submit').mousedown(function(e){ t.revert(); $('select[name^="action"]').val('-1'); }); }, toggle : function(el){ var t = this; $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); }, setBulk : function(){ var te = '', type = this.type, tax, c = true; this.revert(); $('#bulk-edit td').attr('colspan', $('.widefat:first thead th:visible').length); $('table.widefat tbody').prepend( $('#bulk-edit') ); $('#bulk-edit').addClass('inline-editor').show(); $('tbody th.check-column input[type="checkbox"]').each(function(i){ if ( $(this).prop('checked') ) { c = false; var id = $(this).val(), theTitle; theTitle = $('#inline_'+id+' .post_title').text() || inlineEditL10n.notitle; te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>'; } }); if ( c ) return this.revert(); $('#bulk-titles').html(te); $('#bulk-titles a').click(function(){ var id = $(this).attr('id').substr(1); $('table.widefat input[value="' + id + '"]').prop('checked', false); $('#ttle'+id).remove(); }); // enable autocomplete for tags if ( 'post' == type ) { // support multi taxonomies? tax = 'post_tag'; $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); } $('html, body').animate( { scrollTop: 0 }, 'fast' ); }, edit : function(id) { var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f; t.revert(); if ( typeof(id) == 'object' ) id = t.getId(id); fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order']; if ( t.type == 'page' ) fields.push('post_parent', 'page_template'); // add the new blank row editRow = $('#inline-edit').clone(true); $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); if ( $(t.what+id).hasClass('alternate') ) $(editRow).addClass('alternate'); $(t.what+id).hide().after(editRow); // populate the data rowData = $('#inline_'+id); if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) { // author no longer has edit caps, so we need to add them to the list of authors $(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>'); } if ( $(':input[name="post_author"] option', editRow).length == 1 ) { $('label.inline-edit-author', editRow).hide(); } // hide unsupported formats, but leave the current format alone cur_format = $('.post_format', rowData).text(); $('option.unsupported', editRow).each(function() { var $this = $(this); if ( $this.val() != cur_format ) $this.remove(); }); for ( f = 0; f < fields.length; f++ ) { $(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() ); } if ( $('.comment_status', rowData).text() == 'open' ) $('input[name="comment_status"]', editRow).prop("checked", true); if ( $('.ping_status', rowData).text() == 'open' ) $('input[name="ping_status"]', editRow).prop("checked", true); if ( $('.sticky', rowData).text() == 'sticky' ) $('input[name="sticky"]', editRow).prop("checked", true); // hierarchical taxonomies $('.post_category', rowData).each(function(){ var term_ids = $(this).text(); if ( term_ids ) { taxname = $(this).attr('id').replace('_'+id, ''); $('ul.'+taxname+'-checklist :checkbox', editRow).val(term_ids.split(',')); } }); //flat taxonomies $('.tags_input', rowData).each(function(){ var terms = $(this).text(), taxname = $(this).attr('id').replace('_' + id, ''), textarea = $('textarea.tax_input_' + taxname, editRow), comma = inlineEditL10n.comma; if ( terms ) { if ( ',' !== comma ) terms = terms.replace(/,/g, comma); textarea.val(terms); } textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } ); }); // handle the post status status = $('._status', rowData).text(); if ( 'future' != status ) $('select[name="_status"] option[value="future"]', editRow).remove(); if ( 'private' == status ) { $('input[name="keep_private"]', editRow).prop("checked", true); $('input.inline-edit-password-input').val('').prop('disabled', true); } // remove the current page and children from the parent dropdown pageOpt = $('select[name="post_parent"] option[value="' + id + '"]', editRow); if ( pageOpt.length > 0 ) { pageLevel = pageOpt[0].className.split('-')[1]; nextPage = pageOpt; while ( pageLoop ) { nextPage = nextPage.next('option'); if (nextPage.length == 0) break; nextLevel = nextPage[0].className.split('-')[1]; if ( nextLevel <= pageLevel ) { pageLoop = false; } else { nextPage.remove(); nextPage = pageOpt; } } pageOpt.remove(); } $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); $('.ptitle', editRow).focus(); return false; }, save : function(id) { var params, fields, page = $('.post_status_page').val() || ''; if ( typeof(id) == 'object' ) id = this.getId(id); $('table.widefat .inline-edit-save .waiting').show(); params = { action: 'inline-save', post_type: typenow, post_ID: id, edit_date: 'true', post_status: page }; fields = $('#edit-'+id+' :input').serialize(); params = fields + '&' + $.param(params); // make ajax request $.post( ajaxurl, params, function(r) { $('table.widefat .inline-edit-save .waiting').hide(); if (r) { if ( -1 != r.indexOf('<tr') ) { $(inlineEditPost.what+id).remove(); $('#edit-'+id).before(r).remove(); $(inlineEditPost.what+id).hide().fadeIn(); } else { r = r.replace( /<.[^<>]*?>/g, '' ); $('#edit-'+id+' .inline-edit-save .error').html(r).show(); } } else { $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); } } , 'html'); return false; }, revert : function(){ var id = $('table.widefat tr.inline-editor').attr('id'); if ( id ) { $('table.widefat .inline-edit-save .waiting').hide(); if ( 'bulk-edit' == id ) { $('table.widefat #bulk-edit').removeClass('inline-editor').hide(); $('#bulk-titles').html(''); $('#inlineedit').append( $('#bulk-edit') ); } else { $('#'+id).remove(); id = id.substr( id.lastIndexOf('-') + 1 ); $(this.what+id).show(); } } return false; }, getId : function(o) { var id = $(o).closest('tr').attr('id'), parts = id.split('-'); return parts[parts.length - 1]; } }; $(document).ready(function(){inlineEditPost.init();}); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/inline-edit-post.dev.js
JavaScript
oos
9,088
(function($) { inlineEditTax = { init : function() { var t = this, row = $('#inline-edit'); t.type = $('#the-list').attr('class').substr(5); t.what = '#'+t.type+'-'; $('.editinline').live('click', function(){ inlineEditTax.edit(this); return false; }); // prepare the edit row row.keyup(function(e) { if(e.which == 27) return inlineEditTax.revert(); }); $('a.cancel', row).click(function() { return inlineEditTax.revert(); }); $('a.save', row).click(function() { return inlineEditTax.save(this); }); $('input, select', row).keydown(function(e) { if(e.which == 13) return inlineEditTax.save(this); }); $('#posts-filter input[type="submit"]').mousedown(function(e){ t.revert(); }); }, toggle : function(el) { var t = this; $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el); }, edit : function(id) { var t = this, editRow; t.revert(); if ( typeof(id) == 'object' ) id = t.getId(id); editRow = $('#inline-edit').clone(true), rowData = $('#inline_'+id); $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); if ( $(t.what+id).hasClass('alternate') ) $(editRow).addClass('alternate'); $(t.what+id).hide().after(editRow); $(':input[name="name"]', editRow).val( $('.name', rowData).text() ); $(':input[name="slug"]', editRow).val( $('.slug', rowData).text() ); $(editRow).attr('id', 'edit-'+id).addClass('inline-editor').show(); $('.ptitle', editRow).eq(0).focus(); return false; }, save : function(id) { var params, fields, tax = $('input[name="taxonomy"]').val() || ''; if( typeof(id) == 'object' ) id = this.getId(id); $('table.widefat .inline-edit-save .waiting').show(); params = { action: 'inline-save-tax', tax_type: this.type, tax_ID: id, taxonomy: tax }; fields = $('#edit-'+id+' :input').serialize(); params = fields + '&' + $.param(params); // make ajax request $.post( ajaxurl, params, function(r) { var row, new_id; $('table.widefat .inline-edit-save .waiting').hide(); if (r) { if ( -1 != r.indexOf('<tr') ) { $(inlineEditTax.what+id).remove(); new_id = $(r).attr('id'); $('#edit-'+id).before(r).remove(); row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id); row.hide().fadeIn(); } else $('#edit-'+id+' .inline-edit-save .error').html(r).show(); } else $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); } ); return false; }, revert : function() { var id = $('table.widefat tr.inline-editor').attr('id'); if ( id ) { $('table.widefat .inline-edit-save .waiting').hide(); $('#'+id).remove(); id = id.substr( id.lastIndexOf('-') + 1 ); $(this.what+id).show(); } return false; }, getId : function(o) { var id = o.tagName == 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-'); return parts[parts.length - 1]; } }; $(document).ready(function(){inlineEditTax.init();}); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/inline-edit-tax.dev.js
JavaScript
oos
3,019
jQuery(document).ready( function($) { var newCat, noSyncChecks = false, syncChecks, catAddAfter; $('#link_name').focus(); // postboxes postboxes.add_postbox_toggles('link'); // category tabs $('#category-tabs a').click(function(){ var t = $(this).attr('href'); $(this).parent().addClass('tabs').siblings('li').removeClass('tabs'); $('.tabs-panel').hide(); $(t).show(); if ( '#categories-all' == t ) deleteUserSetting('cats'); else setUserSetting('cats','pop'); return false; }); if ( getUserSetting('cats') ) $('#category-tabs a[href="#categories-pop"]').click(); // Ajax Cat newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); $('#category-add-submit').click( function() { newCat.focus(); } ); syncChecks = function() { if ( noSyncChecks ) return; noSyncChecks = true; var th = $(this), c = th.is(':checked'), id = th.val().toString(); $('#in-link-category-' + id + ', #in-popular-category-' + id).prop( 'checked', c ); noSyncChecks = false; }; catAddAfter = function( r, s ) { $(s.what + ' response_data', r).each( function() { var t = $($(this).text()); t.find( 'label' ).each( function() { var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o; $('#' + id).change( syncChecks ); o = $( '<option value="' + parseInt( val, 10 ) + '"></option>' ).text( name ); } ); } ); }; $('#categorychecklist').wpList( { alt: '', what: 'link-category', response: 'category-ajax-response', addAfter: catAddAfter } ); $('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');}); $('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');}); if ( 'pop' == getUserSetting('cats') ) $('a[href="#categories-pop"]').click(); $('#category-add-toggle').click( function() { $(this).parents('div:first').toggleClass( 'wp-hidden-children' ); $('#category-tabs a[href="#categories-all"]').click(); $('#newcategory').focus(); return false; } ); $('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); });
01happy-blog
trunk/myblog/wp-admin/js/link.dev.js
JavaScript
oos
2,161
jQuery(document).ready( function($) { var stamp = $('#timestamp').html(); $('.edit-timestamp').click(function () { if ($('#timestampdiv').is(":hidden")) { $('#timestampdiv').slideDown("normal"); $('.edit-timestamp').hide(); } return false; }); $('.cancel-timestamp').click(function() { $('#timestampdiv').slideUp("normal"); $('#mm').val($('#hidden_mm').val()); $('#jj').val($('#hidden_jj').val()); $('#aa').val($('#hidden_aa').val()); $('#hh').val($('#hidden_hh').val()); $('#mn').val($('#hidden_mn').val()); $('#timestamp').html(stamp); $('.edit-timestamp').show(); return false; }); $('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(), newD = new Date( aa, mm - 1, jj, hh, mn ); if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) { $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid'); return false; } else { $('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid'); } $('#timestampdiv').slideUp("normal"); $('.edit-timestamp').show(); $('#timestamp').html( commentL10n.submittedOn + ' <b>' + $( '#mm option[value="' + mm + '"]' ).text() + ' ' + jj + ', ' + aa + ' @ ' + hh + ':' + mn + '</b> ' ); return false; }); });
01happy-blog
trunk/myblog/wp-admin/js/comment.dev.js
JavaScript
oos
1,427
jQuery(document).ready( function($) { $('#link_rel').prop('readonly', true); $('#linkxfndiv input').bind('click keyup', function() { var isMe = $('#me').is(':checked'), inputs = ''; $('input.valinp').each( function() { if (isMe) { $(this).prop('disabled', true).parent().addClass('disabled'); } else { $(this).removeAttr('disabled').parent().removeClass('disabled'); if ( $(this).is(':checked') && $(this).val() != '') inputs += $(this).val() + ' '; } }); $('#link_rel').val( (isMe) ? 'me' : inputs.substr(0,inputs.length - 1) ); }); });
01happy-blog
trunk/myblog/wp-admin/js/xfn.dev.js
JavaScript
oos
575
var farbtastic, pickColor; (function($) { var defaultColor = ''; pickColor = function(color) { farbtastic.setColor(color); $('#background-color').val(color); $('#custom-background-image').css('background-color', color); // If we have a default color, and they match, then we need to hide the 'Default' link. // Otherwise, we hide the 'Clear' link when it is empty. if ( ( defaultColor && color === defaultColor ) || ( ! defaultColor && ( '' === color || '#' === color ) ) ) $('#clearcolor').hide(); else $('#clearcolor').show(); } $(document).ready(function() { defaultColor = $('#defaultcolor').val(); $('#pickcolor').click(function() { $('#colorPickerDiv').show(); return false; }); $('#clearcolor a').click( function(e) { pickColor( defaultColor ); e.preventDefault(); }); $('#background-color').keyup(function() { var _hex = $('#background-color').val(), hex = _hex; if ( hex.charAt(0) != '#' ) hex = '#' + hex; hex = hex.replace(/[^#a-fA-F0-9]+/, ''); if ( hex != _hex ) $('#background-color').val(hex); if ( hex.length == 4 || hex.length == 7 ) pickColor( hex ); }); $('input[name="background-position-x"]').change(function() { $('#custom-background-image').css('background-position', $(this).val() + ' top'); }); $('input[name="background-repeat"]').change(function() { $('#custom-background-image').css('background-repeat', $(this).val()); }); farbtastic = $.farbtastic('#colorPickerDiv', function(color) { pickColor(color); }); pickColor($('#background-color').val()); $(document).mousedown(function(){ $('#colorPickerDiv').each(function(){ var display = $(this).css('display'); if ( display == 'block' ) $(this).fadeOut(2); }); }); }); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/custom-background.dev.js
JavaScript
oos
1,794
(function($) { var id = 'undefined' !== typeof current_site_id ? '&site_id=' + current_site_id : ''; $(document).ready( function() { $( '.wp-suggest-user' ).autocomplete({ source: ajaxurl + '?action=autocomplete-user&autocomplete_type=add' + id, delay: 500, minLength: 2, position: ( 'undefined' !== typeof isRtl && isRtl ) ? { my: 'right top', at: 'right bottom', offset: '0, -1' } : { offset: '0, -1' }, open: function() { $(this).addClass('open'); }, close: function() { $(this).removeClass('open'); } }); }); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/user-suggest.dev.js
JavaScript
oos
566
var showNotice, adminMenu, columns, validateForm, screenMeta; (function($){ // Removed in 3.3. // (perhaps) needed for back-compat adminMenu = { init : function() {}, fold : function() {}, restoreMenuState : function() {}, toggle : function() {}, favorites : function() {} }; // show/hide/save table columns columns = { init : function() { var that = this; $('.hide-column-tog', '#adv-settings').click( function() { var $t = $(this), column = $t.val(); if ( $t.prop('checked') ) that.checked(column); else that.unchecked(column); columns.saveManageColumnsState(); }); }, saveManageColumnsState : function() { var hidden = this.hidden(); $.post(ajaxurl, { action: 'hidden-columns', hidden: hidden, screenoptionnonce: $('#screenoptionnonce').val(), page: pagenow }); }, checked : function(column) { $('.column-' + column).show(); this.colSpanChange(+1); }, unchecked : function(column) { $('.column-' + column).hide(); this.colSpanChange(-1); }, hidden : function() { return $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(','); }, useCheckboxesForHidden : function() { this.hidden = function(){ return $('.hide-column-tog').not(':checked').map(function() { var id = this.id; return id.substring( id, id.length - 5 ); }).get().join(','); }; }, colSpanChange : function(diff) { var $t = $('table').find('.colspanchange'), n; if ( !$t.length ) return; n = parseInt( $t.attr('colspan'), 10 ) + diff; $t.attr('colspan', n.toString()); } } $(document).ready(function(){columns.init();}); validateForm = function( form ) { return !$( form ).find('.form-required').filter( function() { return $('input:visible', this).val() == ''; } ).addClass( 'form-invalid' ).find('input:visible').change( function() { $(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ).size(); } // stub for doing better warnings showNotice = { warn : function() { var msg = commonL10n.warnDelete || ''; if ( confirm(msg) ) { return true; } return false; }, note : function(text) { alert(text); } }; screenMeta = { element: null, // #screen-meta toggles: null, // .screen-meta-toggle page: null, // #wpcontent init: function() { this.element = $('#screen-meta'); this.toggles = $('.screen-meta-toggle a'); this.page = $('#wpcontent'); this.toggles.click( this.toggleEvent ); }, toggleEvent: function( e ) { var panel = $( this.href.replace(/.+#/, '#') ); e.preventDefault(); if ( !panel.length ) return; if ( panel.is(':visible') ) screenMeta.close( panel, $(this) ); else screenMeta.open( panel, $(this) ); }, open: function( panel, link ) { $('.screen-meta-toggle').not( link.parent() ).css('visibility', 'hidden'); panel.parent().show(); panel.slideDown( 'fast', function() { link.addClass('screen-meta-active'); }); }, close: function( panel, link ) { panel.slideUp( 'fast', function() { link.removeClass('screen-meta-active'); $('.screen-meta-toggle').css('visibility', ''); panel.parent().hide(); }); } }; /** * Help tabs. */ $('.contextual-help-tabs').delegate('a', 'click focus', function(e) { var link = $(this), panel; e.preventDefault(); // Don't do anything if the click is for the tab already showing. if ( link.is('.active a') ) return false; // Links $('.contextual-help-tabs .active').removeClass('active'); link.parent('li').addClass('active'); panel = $( link.attr('href') ); // Panels $('.help-tab-content').not( panel ).removeClass('active').hide(); panel.addClass('active').show(); }); $(document).ready( function() { var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'), pageInput = $('input.current-page'), currentPage = pageInput.val(), refresh; // admin menu refresh = function(i, el){ // force the browser to refresh the tabbing index var node = $(el), tab = node.attr('tabindex'); if ( tab ) node.attr('tabindex', '0').attr('tabindex', tab); }; $('#collapse-menu', menu).click(function(){ var body = $(document.body); // reset any compensation for submenus near the bottom of the screen $('#adminmenu div.wp-submenu').css('margin-top', ''); if ( body.hasClass('folded') ) { body.removeClass('folded'); setUserSetting('mfold', 'o'); } else { body.addClass('folded'); setUserSetting('mfold', 'f'); } return false; }); $('li.wp-has-submenu', menu).hoverIntent({ over: function(e){ var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop; if ( m.is(':visible') ) return; menutop = $(this).offset().top; wintop = $(window).scrollTop(); maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar b = menutop + m.height() + 1; // Bottom offset of the menu h = $('#wpwrap').height(); // Height of the entire page o = 60 + b - h; f = $(window).height() + wintop - 15; // The fold if ( f < (b - o) ) o = b - f; if ( o > maxtop ) o = maxtop; if ( o > 1 ) m.css('margin-top', '-'+o+'px'); else m.css('margin-top', ''); menu.find('.wp-submenu').removeClass('sub-open'); m.addClass('sub-open'); }, out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css('margin-top', ''); }, timeout: 200, sensitivity: 7, interval: 90 }); // Tab to select, Enter to open sub, Esc to close sub and focus the top menu $('li.wp-has-submenu > a.wp-not-current-submenu', menu).bind('keydown.adminmenu', function(e){ if ( e.which != 13 ) return; var target = $(e.target); e.stopPropagation(); e.preventDefault(); menu.find('.wp-submenu').removeClass('sub-open'); target.siblings('.wp-submenu').toggleClass('sub-open').find('a[role="menuitem"]').each(refresh); }).each(refresh); $('a[role="menuitem"]', menu).bind('keydown.adminmenu', function(e){ if ( e.which != 27 ) return; var target = $(e.target); e.stopPropagation(); e.preventDefault(); target.add( target.siblings() ).closest('.sub-open').removeClass('sub-open').siblings('a.wp-not-current-submenu').focus(); }); // Move .updated and .error alert boxes. Don't move boxes designed to be inline. $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') ); // Init screen meta screenMeta.init(); // check all checkboxes $('tbody').children().children('.check-column').find(':checkbox').click( function(e) { if ( 'undefined' == e.shiftKey ) { return true; } if ( e.shiftKey ) { if ( !lastClicked ) { return true; } checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ); first = checks.index( lastClicked ); last = checks.index( this ); checked = $(this).prop('checked'); if ( 0 < first && 0 < last && first != last ) { checks.slice( first, last ).prop( 'checked', function(){ if ( $(this).closest('tr').is(':visible') ) return checked; return false; }); } } lastClicked = this; return true; }); $('thead, tfoot').find('.check-column :checkbox').click( function(e) { var c = $(this).prop('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle; $(this).closest( 'table' ).children( 'tbody' ).filter(':visible') .children().children('.check-column').find(':checkbox') .prop('checked', function() { if ( $(this).closest('tr').is(':hidden') ) return false; if ( toggle ) return $(this).prop( 'checked' ); else if (c) return true; return false; }); $(this).closest('table').children('thead, tfoot').filter(':visible') .children().children('.check-column').find(':checkbox') .prop('checked', function() { if ( toggle ) return false; else if (c) return true; return false; }); }); $('#default-password-nag-no').click( function() { setUserSetting('default_password_nag', 'hide'); $('div.default-password-nag').hide(); return false; }); // tab in textareas $('#newcontent').bind('keydown.wpevent_InsertTab', function(e) { if ( e.keyCode != 9 ) return true; var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel; try { this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below. } catch(err) {} if ( document.selection ) { el.focus(); sel = document.selection.createRange(); sel.text = '\t'; } else if ( selStart >= 0 ) { scroll = this.scrollTop; el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) ); el.selectionStart = el.selectionEnd = selStart + 1; this.scrollTop = scroll; } if ( e.stopPropagation ) e.stopPropagation(); if ( e.preventDefault ) e.preventDefault(); }); $('#newcontent').bind('blur.wpevent_InsertTab', function(e) { if ( this.lastKey && 9 == this.lastKey ) this.focus(); }); if ( pageInput.length ) { pageInput.closest('form').submit( function(e){ // Reset paging var for new filters/searches but not for bulk actions. See #17685. if ( $('select[name="action"]').val() == -1 && $('select[name="action2"]').val() == -1 && pageInput.val() == currentPage ) pageInput.val('1'); }); } }); // internal use $(document).bind( 'wp_CloseOnEscape', function( e, data ) { if ( typeof(data.cb) != 'function' ) return; if ( typeof(data.condition) != 'function' || data.condition() ) data.cb(); return true; }); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/common.dev.js
JavaScript
oos
9,641
/** * Theme Browsing * * Controls visibility of theme details on manage and install themes pages. */ jQuery( function($) { $('#availablethemes').on( 'click', '.theme-detail', function (event) { var theme = $(this).closest('.available-theme'), details = theme.find('.themedetaildiv'); if ( ! details.length ) { details = theme.find('.install-theme-info .theme-details'); details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide(); } details.toggle(); event.preventDefault(); }); }); /** * Theme Install * * Displays theme previews on theme install pages. */ jQuery( function($) { if( ! window.postMessage ) return; var preview = $('#theme-installer'), info = preview.find('.install-theme-info'), panel = preview.find('.wp-full-overlay-main'), body = $( document.body ); preview.on( 'click', '.close-full-overlay', function( event ) { preview.fadeOut( 200, function() { panel.empty(); body.removeClass('theme-installer-active full-overlay-active'); }); event.preventDefault(); }); preview.on( 'click', '.collapse-sidebar', function( event ) { preview.toggleClass( 'collapsed' ).toggleClass( 'expanded' ); event.preventDefault(); }); $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) { var src; info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() ); src = info.find( '.theme-preview-url' ).val(); panel.html( '<iframe src="' + src + '" />'); preview.fadeIn( 200, function() { body.addClass('theme-installer-active full-overlay-active'); }); event.preventDefault(); }); }); var ThemeViewer; (function($){ ThemeViewer = function( args ) { function init() { $( '#filter-click, #mini-filter-click' ).unbind( 'click' ).click( function() { $( '#filter-click' ).toggleClass( 'current' ); $( '#filter-box' ).slideToggle(); $( '#current-theme' ).slideToggle( 300 ); return false; }); $( '#filter-box :checkbox' ).unbind( 'click' ).click( function() { var count = $( '#filter-box :checked' ).length, text = $( '#filter-click' ).text(); if ( text.indexOf( '(' ) != -1 ) text = text.substr( 0, text.indexOf( '(' ) ); if ( count == 0 ) $( '#filter-click' ).text( text ); else $( '#filter-click' ).text( text + ' (' + count + ')' ); }); /* $('#filter-box :submit').unbind( 'click' ).click(function() { var features = []; $('#filter-box :checked').each(function() { features.push($(this).val()); }); listTable.update_rows({'features': features}, true, function() { $( '#filter-click' ).toggleClass( 'current' ); $( '#filter-box' ).slideToggle(); $( '#current-theme' ).slideToggle( 300 ); }); return false; }); */ } // These are the functions we expose var api = { init: init }; return api; } })(jQuery); jQuery( document ).ready( function($) { theme_viewer = new ThemeViewer(); theme_viewer.init(); }); /** * Class that provides infinite scroll for Themes admin screens * * @since 3.4 * * @uses ajaxurl * @uses list_args * @uses theme_list_args * @uses $('#_ajax_fetch_list_nonce').val() * */ var ThemeScroller; (function($){ ThemeScroller = { querying: false, scrollPollingDelay: 500, failedRetryDelay: 4000, outListBottomThreshold: 300, /** * Initializer * * @since 3.4 * @access private */ init: function() { var self = this; // Get out early if we don't have the required arguments. if ( typeof ajaxurl === 'undefined' || typeof list_args === 'undefined' || typeof theme_list_args === 'undefined' ) { $('.pagination-links').show(); return; } // Handle inputs this.nonce = $('#_ajax_fetch_list_nonce').val(); this.nextPage = ( theme_list_args.paged + 1 ); // Cache jQuery selectors this.$outList = $('#availablethemes'); this.$spinner = $('div.tablenav.bottom').children( 'img.ajax-loading' ); this.$window = $(window); this.$document = $(document); /** * If there are more pages to query, then start polling to track * when user hits the bottom of the current page */ if ( theme_list_args.total_pages >= this.nextPage ) this.pollInterval = setInterval( function() { return self.poll(); }, this.scrollPollingDelay ); }, /** * Checks to see if user has scrolled to bottom of page. * If so, requests another page of content from self.ajax(). * * @since 3.4 * @access private */ poll: function() { var bottom = this.$document.scrollTop() + this.$window.innerHeight(); if ( this.querying || ( bottom < this.$outList.height() - this.outListBottomThreshold ) ) return; this.ajax(); }, /** * Applies results passed from this.ajax() to $outList * * @since 3.4 * @access private * * @param results Array with results from this.ajax() query. */ process: function( results ) { if ( results === undefined ) { clearInterval( this.pollInterval ); return; } if ( this.nextPage > theme_list_args.total_pages ) clearInterval( this.pollInterval ); if ( this.nextPage <= ( theme_list_args.total_pages + 1 ) ) this.$outList.append( results.rows ); }, /** * Queries next page of themes * * @since 3.4 * @access private */ ajax: function() { var self = this; this.querying = true; var query = { action: 'fetch-list', paged: this.nextPage, s: theme_list_args.search, tab: theme_list_args.tab, type: theme_list_args.type, _ajax_fetch_list_nonce: this.nonce, 'features[]': theme_list_args.features, 'list_args': list_args }; this.$spinner.css( 'visibility', 'visible' ); $.getJSON( ajaxurl, query ) .done( function( response ) { self.nextPage++; self.process( response ); self.$spinner.css( 'visibility', 'hidden' ); self.querying = false; }) .fail( function() { self.$spinner.css( 'visibility', 'hidden' ); self.querying = false; setTimeout( function() { self.ajax(); }, self.failedRetryDelay ); }); } } $(document).ready( function($) { ThemeScroller.init(); }); })(jQuery);
01happy-blog
trunk/myblog/wp-admin/js/theme.dev.js
JavaScript
oos
6,231
jQuery(document).ready(function($) { $('.delete-tag').live('click', function(e){ var t = $(this), tr = t.parents('tr'), r = true, data; if ( 'undefined' != showNotice ) r = showNotice.warn(); if ( r ) { data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag'); $.post(ajaxurl, data, function(r){ if ( '1' == r ) { $('#ajax-response').empty(); tr.fadeOut('normal', function(){ tr.remove(); }); // Remove the term from the parent box and tag cloud $('select#parent option[value="' + data.match(/tag_ID=(\d+)/)[1] + '"]').remove(); $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove(); } else if ( '-1' == r ) { $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>'); tr.children().css('backgroundColor', ''); } else { $('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.broken + '</p></div>'); tr.children().css('backgroundColor', ''); } }); tr.children().css('backgroundColor', '#f33'); } return false; }); $('#submit').click(function(){ var form = $(this).parents('form'); if ( !validateForm( form ) ) return false; $.post(ajaxurl, $('#addtag').serialize(), function(r){ $('#ajax-response').empty(); var res = wpAjax.parseAjaxResponse(r, 'ajax-response'); if ( ! res || res.errors ) return; var parent = form.find('select#parent').val(); if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list. $('.tags #tag-' + parent).after( res.responses[0].supplemental['noparents'] ); // As the parent exists, Insert the version with - - - prefixed else $('.tags').prepend( res.responses[0].supplemental['parents'] ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm $('.tags .no-items').remove(); if ( form.find('select#parent') ) { // Parents field exists, Add new term to the list. var term = res.responses[1].supplemental; // Create an indent for the Parent field var indent = ''; for ( var i = 0; i < res.responses[1].position; i++ ) indent += '&nbsp;&nbsp;&nbsp;'; form.find('select#parent option:selected').after('<option value="' + term['term_id'] + '">' + indent + term['name'] + '</option>'); } $('input[type="text"]:visible, textarea:visible', form).val(''); }); return false; }); });
01happy-blog
trunk/myblog/wp-admin/js/tags.dev.js
JavaScript
oos
2,493
var switchEditors = { switchto: function(el) { var aid = el.id, l = aid.length, id = aid.substr(0, l - 5), mode = aid.substr(l - 4); this.go(id, mode); }, go: function(id, mode) { // mode can be 'html', 'tmce', or 'toggle' id = id || 'content'; mode = mode || 'toggle'; var t = this, ed = tinyMCE.get(id), wrap_id, txtarea_el, dom = tinymce.DOM; wrap_id = 'wp-'+id+'-wrap'; txtarea_el = dom.get(id); if ( 'toggle' == mode ) { if ( ed && !ed.isHidden() ) mode = 'html'; else mode = 'tmce'; } if ( 'tmce' == mode || 'tinymce' == mode ) { if ( ed && ! ed.isHidden() ) return false; if ( typeof(QTags) != 'undefined' ) QTags.closeAllTags(id); if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop ) txtarea_el.value = t.wpautop( txtarea_el.value ); if ( ed ) { ed.show(); } else { ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]); ed.render(); } dom.removeClass(wrap_id, 'html-active'); dom.addClass(wrap_id, 'tmce-active'); setUserSetting('editor', 'tinymce'); } else if ( 'html' == mode ) { if ( ed && ed.isHidden() ) return false; if ( ed ) { txtarea_el.style.height = ed.getContentAreaContainer().offsetHeight + 20 + 'px'; ed.hide(); } dom.removeClass(wrap_id, 'tmce-active'); dom.addClass(wrap_id, 'html-active'); setUserSetting('editor', 'html'); } return false; }, _wp_Nop : function(content) { var blocklist1, blocklist2, preserve_linebreaks = false, preserve_br = false; // Protect pre|script tags if ( content.indexOf('<pre') != -1 || content.indexOf('<script') != -1 ) { preserve_linebreaks = true; content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-temp-lb>'); return a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-temp-lb>'); }); } // keep <br> tags inside captions and remove line breaks if ( content.indexOf('[caption') != -1 ) { preserve_br = true; content = content.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) { return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, ''); }); } // Pretty it up for the source editor blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset'; content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'g'), '</$1>\n'); content = content.replace(new RegExp('\\s*<((?:'+blocklist1+')(?: [^>]*)?)>', 'g'), '\n<$1>'); // Mark </p> if it has any attributes. content = content.replace(/(<p [^>]+>.*?)<\/p>/g, '$1</p#>'); // Sepatate <div> containing <p> content = content.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n'); // Remove <p> and <br /> content = content.replace(/\s*<p>/gi, ''); content = content.replace(/\s*<\/p>\s*/gi, '\n\n'); content = content.replace(/\n[\s\u00a0]+\n/g, '\n\n'); content = content.replace(/\s*<br ?\/?>\s*/gi, '\n'); // Fix some block element newline issues content = content.replace(/\s*<div/g, '\n<div'); content = content.replace(/<\/div>\s*/g, '</div>\n'); content = content.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n'); content = content.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption'); blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset'; content = content.replace(new RegExp('\\s*<((?:'+blocklist2+')(?: [^>]*)?)\\s*>', 'g'), '\n<$1>'); content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'g'), '</$1>\n'); content = content.replace(/<li([^>]*)>/g, '\t<li$1>'); if ( content.indexOf('<hr') != -1 ) { content = content.replace(/\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n'); } if ( content.indexOf('<object') != -1 ) { content = content.replace(/<object[\s\S]+?<\/object>/g, function(a){ return a.replace(/[\r\n]+/g, ''); }); } // Unmark special paragraph closing tags content = content.replace(/<\/p#>/g, '</p>\n'); content = content.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1'); // Trim whitespace content = content.replace(/^\s+/, ''); content = content.replace(/[\s\u00a0]+$/, ''); // put back the line breaks in pre|script if ( preserve_linebreaks ) content = content.replace(/<wp-temp-lb>/g, '\n'); // and the <br> tags in captions if ( preserve_br ) content = content.replace(/<wp-temp-br([^>]*)>/g, '<br$1>'); return content; }, _wp_Autop : function(pee) { var preserve_linebreaks = false, preserve_br = false, blocklist = 'table|thead|tfoot|tbody|tr|td|th|caption|col|colgroup|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|fieldset|legend|hr|noscript|menu|samp|header|footer|article|section|hgroup|nav|aside|details|summary'; if ( pee.indexOf('<object') != -1 ) { pee = pee.replace(/<object[\s\S]+?<\/object>/g, function(a){ return a.replace(/[\r\n]+/g, ''); }); } pee = pee.replace(/<[^<>]+>/g, function(a){ return a.replace(/[\r\n]+/g, ' '); }); // Protect pre|script tags if ( pee.indexOf('<pre') != -1 || pee.indexOf('<script') != -1 ) { preserve_linebreaks = true; pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) { return a.replace(/(\r\n|\n)/g, '<wp-temp-lb>'); }); } // keep <br> tags inside captions and convert line breaks if ( pee.indexOf('[caption') != -1 ) { preserve_br = true; pee = pee.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) { // keep existing <br> a = a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>'); // no line breaks inside HTML tags a = a.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(b){ return b.replace(/[\r\n\t]+/, ' '); }); // convert remaining line breaks to <br> return a.replace(/\s*\n\s*/g, '<wp-temp-br />'); }); } pee = pee + '\n\n'; pee = pee.replace(/<br \/>\s*<br \/>/gi, '\n\n'); pee = pee.replace(new RegExp('(<(?:'+blocklist+')(?: [^>]*)?>)', 'gi'), '\n$1'); pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), '$1\n\n'); pee = pee.replace(/<hr( [^>]*)?>/gi, '<hr$1>\n\n'); // hr is self closing block element pee = pee.replace(/\r\n|\r/g, '\n'); pee = pee.replace(/\n\s*\n+/g, '\n\n'); pee = pee.replace(/([\s\S]+?)\n\n/g, '<p>$1</p>\n'); pee = pee.replace(/<p>\s*?<\/p>/gi, ''); pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')(?: [^>]*)?>)\\s*</p>', 'gi'), "$1"); pee = pee.replace(/<p>(<li.+?)<\/p>/gi, '$1'); pee = pee.replace(/<p>\s*<blockquote([^>]*)>/gi, '<blockquote$1><p>'); pee = pee.replace(/<\/blockquote>\s*<\/p>/gi, '</p></blockquote>'); pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')(?: [^>]*)?>)', 'gi'), "$1"); pee = pee.replace(new RegExp('(</?(?:'+blocklist+')(?: [^>]*)?>)\\s*</p>', 'gi'), "$1"); pee = pee.replace(/\s*\n/gi, '<br />\n'); pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); pee = pee.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1'); pee = pee.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, '[caption$1[/caption]'); pee = pee.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(a, b, c) { if ( c.match(/<p( [^>]*)?>/) ) return a; return b + '<p>' + c + '</p>'; }); // put back the line breaks in pre|script if ( preserve_linebreaks ) pee = pee.replace(/<wp-temp-lb>/g, '\n'); if ( preserve_br ) pee = pee.replace(/<wp-temp-br([^>]*)>/g, '<br$1>'); return pee; }, pre_wpautop : function(content) { var t = this, o = { o: t, data: content, unfiltered: content }, q = typeof(jQuery) != 'undefined'; if ( q ) jQuery('body').trigger('beforePreWpautop', [o]); o.data = t._wp_Nop(o.data); if ( q ) jQuery('body').trigger('afterPreWpautop', [o]); return o.data; }, wpautop : function(pee) { var t = this, o = { o: t, data: pee, unfiltered: pee }, q = typeof(jQuery) != 'undefined'; if ( q ) jQuery('body').trigger('beforeWpautop', [o]); o.data = t._wp_Autop(o.data); if ( q ) jQuery('body').trigger('afterWpautop', [o]); return o.data; } }
01happy-blog
trunk/myblog/wp-admin/js/editor.dev.js
JavaScript
oos
8,177
jQuery(document).ready(function($) { var gallerySortable, gallerySortableInit, w, desc = false; gallerySortableInit = function() { gallerySortable = $('#media-items').sortable( { items: 'div.media-item', placeholder: 'sorthelper', axis: 'y', distance: 2, handle: 'div.filename', stop: function(e, ui) { // When an update has occurred, adjust the order for each item var all = $('#media-items').sortable('toArray'), len = all.length; $.each(all, function(i, id) { var order = desc ? (len - i) : (1 + i); $('#' + id + ' .menu_order input').val(order); }); } } ); } sortIt = function() { var all = $('.menu_order_input'), len = all.length; all.each(function(i){ var order = desc ? (len - i) : (1 + i); $(this).val(order); }); } clearAll = function(c) { c = c || 0; $('.menu_order_input').each(function(){ if ( this.value == '0' || c ) this.value = ''; }); } $('#asc').click(function(){desc = false; sortIt(); return false;}); $('#desc').click(function(){desc = true; sortIt(); return false;}); $('#clear').click(function(){clearAll(1); return false;}); $('#showall').click(function(){ $('#sort-buttons span a').toggle(); $('a.describe-toggle-on').hide(); $('a.describe-toggle-off, table.slidetoggle').show(); $('img.pinkynail').toggle(false); return false; }); $('#hideall').click(function(){ $('#sort-buttons span a').toggle(); $('a.describe-toggle-on').show(); $('a.describe-toggle-off, table.slidetoggle').hide(); $('img.pinkynail').toggle(true); return false; }); // initialize sortable gallerySortableInit(); clearAll(); if ( $('#media-items>*').length > 1 ) { w = wpgallery.getWin(); $('#save-all, #gallery-settings').show(); if ( typeof w.tinyMCE != 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) { wpgallery.mcemode = true; wpgallery.init(); } else { $('#insert-gallery').show(); } } }); jQuery(window).unload( function () { tinymce = tinyMCE = wpgallery = null; } ); // Cleanup /* gallery settings */ var tinymce = null, tinyMCE, wpgallery; wpgallery = { mcemode : false, editor : {}, dom : {}, is_update : false, el : {}, I : function(e) { return document.getElementById(e); }, init: function() { var t = this, li, q, i, it, w = t.getWin(); if ( ! t.mcemode ) return; li = ('' + document.location.search).replace(/^\?/, '').split('&'); q = {}; for (i=0; i<li.length; i++) { it = li[i].split('='); q[unescape(it[0])] = unescape(it[1]); } if (q.mce_rdomain) document.domain = q.mce_rdomain; // Find window & API tinymce = w.tinymce; tinyMCE = w.tinyMCE; t.editor = tinymce.EditorManager.activeEditor; t.setup(); }, getWin : function() { return window.dialogArguments || opener || parent || top; }, setup : function() { var t = this, a, ed = t.editor, g, columns, link, order, orderby; if ( ! t.mcemode ) return; t.el = ed.selection.getNode(); if ( t.el.nodeName != 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) { if ( (g = ed.dom.select('img.wpGallery')) && g[0] ) { t.el = g[0]; } else { if ( getUserSetting('galfile') == '1' ) t.I('linkto-file').checked = "checked"; if ( getUserSetting('galdesc') == '1' ) t.I('order-desc').checked = "checked"; if ( getUserSetting('galcols') ) t.I('columns').value = getUserSetting('galcols'); if ( getUserSetting('galord') ) t.I('orderby').value = getUserSetting('galord'); jQuery('#insert-gallery').show(); return; } } a = ed.dom.getAttrib(t.el, 'title'); a = ed.dom.decode(a); if ( a ) { jQuery('#update-gallery').show(); t.is_update = true; columns = a.match(/columns=['"]([0-9]+)['"]/); link = a.match(/link=['"]([^'"]+)['"]/i); order = a.match(/order=['"]([^'"]+)['"]/i); orderby = a.match(/orderby=['"]([^'"]+)['"]/i); if ( link && link[1] ) t.I('linkto-file').checked = "checked"; if ( order && order[1] ) t.I('order-desc').checked = "checked"; if ( columns && columns[1] ) t.I('columns').value = ''+columns[1]; if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1]; } else { jQuery('#insert-gallery').show(); } }, update : function() { var t = this, ed = t.editor, all = '', s; if ( ! t.mcemode || ! t.is_update ) { s = '[gallery'+t.getSettings()+']'; t.getWin().send_to_editor(s); return; } if (t.el.nodeName != 'IMG') return; all = ed.dom.decode(ed.dom.getAttrib(t.el, 'title')); all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, ''); all += t.getSettings(); ed.dom.setAttrib(t.el, 'title', all); t.getWin().tb_remove(); }, getSettings : function() { var I = this.I, s = ''; if ( I('linkto-file').checked ) { s += ' link="file"'; setUserSetting('galfile', '1'); } if ( I('order-desc').checked ) { s += ' order="DESC"'; setUserSetting('galdesc', '1'); } if ( I('columns').value != 3 ) { s += ' columns="'+I('columns').value+'"'; setUserSetting('galcols', I('columns').value); } if ( I('orderby').value != 'menu_order' ) { s += ' orderby="'+I('orderby').value+'"'; setUserSetting('galord', I('orderby').value); } return s; } };
01happy-blog
trunk/myblog/wp-admin/js/gallery.dev.js
JavaScript
oos
5,225
<?php // The JS here is purposefully obfuscated to preserve mystery and romance. // If you want to see behind the curtain, visit http://core.trac.wordpress.org/ticket/15262 if ( !defined( 'ABSPATH' ) ) exit; /** @ignore */ function dvortr( $str ) { return strtr( $str, '\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]', 'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-=' ); } $j = esc_url( site_url( '/wp-includes/js/jquery/jquery.js' ) ); $n = esc_html( $GLOBALS['current_user']->data->display_name ); $d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) ); wp_die( <<<EOEE <style type="text/css"> html body { font-family: courier, monospace; } #hal { text-decoration: blink; } </style> <script type="text/javascript" src="$j"></script> <script type="text/javascript"> /* <![CDATA[ */ var n = '$n'; eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('6(4(){2 e=6(\\'#Q\\').v();2 i=\\'\\\\\\',.R/=\\\\\\\\S-;T"<>U?+|V:W[]X{}\\'.u(\\'\\');2 o=\\'Y[]\\\\\\\\Z;\\\\\\'10,./11{}|12:"13<>?-=14+\\'.u(\\'\\');2 5=4(s){r=\\'\\';6.15(s.u(\\'\\'),4(){2 t=16.D();2 c=6.17(t,i);r+=\\'\$\\'==t?n:(-1==c?t:o[c])});j r};2 a=[\\'O.E[18 e.y.19.1a\\',\\'1b 1c. 1d .1e.,1f 1g\\',\\'O.E e.1h 1i 8\\',\\'9\\',\\'0\\'];2 b=[\\'<1j. 1k \$1l\\',\\'1m. 1n 1o 1p\\',\\'1q, 1r. ,1s. 1t\\'];2 w=[];2 h=6(5(\\'#1u\\'));6(5(\\'1v\\')).1w(4(e){7(1x!==e.1y){j}7(x&&x.F){x.F();j G}1z.1A=6(5(\\'#1B\\')).1C(\\'1D\\');j G});2 k=4(){2 l=a.H();7(\\'I\\'==J l){7(m){2 c={};c[5(\\'1E\\')]=5(\\'1F\\');c[5(\\'1G\\')]=5(\\'1H..b\\');6(5(\\'1I 1J\\')).1K(c);p();h.v().1L({1M:1},z,\\'1N\\',4(){h.K()});d(m,L)}j}w=5(l).u(\\'\\');A()};2 A=4(){B=w.H();7(\\'I\\'==J B){7(m){h.M(5(\\'1O 1P\\'));d(k,C)}N{7(a.P){d(p,C);d(k,z)}N{d(4(){p();h.v()},C);d(4(){e.K()},L)}}j}h.M(B.D());d(A,1Q)};2 m=4(){a=b;m=1R;k()};p=4(){2 f=6(\\'p\\').1S(0);2 g=6.1T(f.q).1U();1V(2 g=f.q.P;g>0;g--){7(3==f.q[g-1].1W||\\'1X\\'==f.q[g-1].1Y.1Z()){f.20(f.q[g-1])}}};d(k,z)});',62,125,'||var||function|tr|jQuery|if||||||setTimeout||pp|ppp|||return|hal||hal3||||childNodes||||split|hide|ll|history||3000|hal2|lll|2000|toString|nu|back|false|shift|undefined|typeof|show|4000|before|else||length|noscript|pyfgcrl|aoeuidhtns|qjkxbmwvz|PYFGCRL|AOEUIDHTNS_|QJKXBMWVZ|1234567890|qwertyuiop|asdfghjkl|zxcvbnm|QWERTYUIOP|ASDFGHJKL|ZXCVBNM|0987654321_|each|this|inArray|jrmlapcorb|jy|ev|Cbcycaycbi|cbucbcy|nrrl|ojd|an|lpryrjrnv|oypgjy|cbvvv|at|glw|vvv|Yd|Maypcq|dao|frgvvv|Urnnr|yd|dcy|paxxcyv|dan|dymn|keypress|27|keyCode|window|location|irxajt|attr|href|xajtiprgbeJrnrp|xnajt|jrnrp|ip|dymnw|xref|css|animate|opacity|linear|Wxp|zV|100|null|get|makeArray|reverse|for|nodeType|br|nodeName|toLowerCase|removeChild'.split('|'),0,{})) /* ]]> */ </script> <span id="noscript">$d</span> <blink id="hal">&#x258c;</blink> EOEE , dvortr( 'Eabi.p!' ) );
01happy-blog
trunk/myblog/wp-admin/js/revisions-js.php
PHP
oos
3,162
jQuery(document).ready(function($) { var options = false, addAfter, delBefore, delAfter; if ( document.forms['addcat'].category_parent ) options = document.forms['addcat'].category_parent.options; addAfter = function( r, settings ) { var name, id; name = $("<span>" + $('name', r).text() + "</span>").text(); id = $('cat', r).attr('id'); options[options.length] = new Option(name, id); } delAfter = function( r, settings ) { var id = $('cat', r).attr('id'), o; for ( o = 0; o < options.length; o++ ) if ( id == options[o].value ) options[o] = null; } delBefore = function(s) { if ( 'undefined' != showNotice ) return showNotice.warn() ? s : false; return s; } if ( options ) $('#the-list').wpList( { addAfter: addAfter, delBefore: delBefore, delAfter: delAfter } ); else $('#the-list').wpList({ delBefore: delBefore }); $('.delete a[class^="delete"]').live('click', function(){return false;}); });
01happy-blog
trunk/myblog/wp-admin/js/categories.dev.js
JavaScript
oos
948